You are on page 1of 12

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.OleDb;
using System.Data.SqlClient;

namespace WindowsFormsApp4
{
public partial class Form_login : Form
{
SqlConnection con = new SqlConnection();
public Form_login()
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=DESKTOP-NAOEH82;Initial
Catalog=Nomina; Integrated Security=SSPI";

InitializeComponent();
}

private void Form_login_Load(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-
NAOEH82;Initial Catalog=Nomina; Integrated Security=SSPI");
con.Open();
}
private void btlogin_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=DESKTOP-NAOEH82;Initial
Catalog=Nomina; Integrated Security=SSPI";
con.Open();
string user_Name = tbusuario.Text;
string user_Password = tbpassword.Text;
SqlCommand cmd = new SqlCommand("select
user_Name,user_Password from logins where user_Name='" + tbusuario.Text +
"'and user_Password='" + tbpassword.Text + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

this.Hide();
Form_menu fr = new Form_menu();
fr.Show();
}
else
{
MessageBox.Show("Invalid Login please check username and
password");
}
con.Close();
}

private void btexit_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void tbpassword_TextChanged(object sender, EventArgs e)


{

private void tbusuario_TextChanged(object sender, EventArgs e)


{

}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp4
{
public partial class Form_menu : Form
{
public Form_menu()
{
InitializeComponent();
}

private void ingresarEmpleadosToolStripMenuItem_Click(object sender,


EventArgs e)
{
this.Hide();
Form_empleado form_emp= new Form_empleado();
form_emp.Show();
}

private void calcularSueldoToolStripMenuItem_Click(object sender,


EventArgs e)
{
this.Hide();
Form_sueldo form_sue = new Form_sueldo();
form_sue.Show();
}

private void liquidacionToolStripMenuItem_Click(object sender, EventArgs


e)
{
this.Hide();
Form_Registro form_Reg = new Form_Registro();
form_Reg.Show();
}

private void salirToolStripMenuItem_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void Form_menu_Load(object sender, EventArgs e)


{

}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp4
{
public partial class Form_empleado : Form
{
public Form_empleado()
{
InitializeComponent();
}

private void btguardar_Click(object sender, EventArgs e)


{

this.Validate();
this.empleadoBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.nominaDataSet);

private void agempleado_Load(object sender, EventArgs e)


{
// TODO: esta línea de código carga datos en la tabla
'nominaDataSet11.Departamento' Puede moverla o quitarla según sea
necesario.
this.departamentoTableAdapter.Fill(this.nominaDataSet.Departamento);
// TODO: esta línea de código carga datos en la tabla
'nominaDataSet.Empleado' Puede moverla o quitarla según sea necesario.
this.empleadoTableAdapter.Fill(this.nominaDataSet.Empleado);
// TODO: esta línea de código carga datos en la tabla
'nominaDataSet.Cargo' Puede moverla o quitarla según sea necesario.
this.cargoTableAdapter.Fill(this.nominaDataSet.Cargo);
// TODO: esta línea de código carga datos en la tabla
'nominaDataSet.Departamento' Puede moverla o quitarla según sea necesario.
this.departamentoTableAdapter.Fill(this.nominaDataSet.Departamento);

private void btsalir_Click(object sender, EventArgs e)


{
this.Hide();
Form_menu fr = new Form_menu();
fr.Show();
}

private void dtgempleado_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

private void groupBox2_Enter(object sender, EventArgs e)


{

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

private void btnuevo_Click(object sender, EventArgs e)


{
this.empleadoBindingSource.AddNew();
}

private void btremover_Click(object sender, EventArgs e)


{
this.empleadoBindingSource.RemoveCurrent();
}

private void cbdepartamento_SelectedIndexChanged(object sender,


EventArgs e)
{

private void empleadoDataGridView_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

private void dtpfnacimiento_ValueChanged(object sender, EventArgs e)


{

}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp4
{
public partial class Form_sueldo : Form
{
double sueldo = 0;

public Form_sueldo()
{
InitializeComponent();
}

private void button3_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{

private void Empleados_Load(object sender, EventArgs e)


{
// TODO: esta línea de código carga datos en la tabla
'nominaDataSet.Empleado' Puede moverla o quitarla según sea necesario.
this.empleadoTableAdapter.Fill(this.nominaDataSet.Empleado);
lblFecha.Text = DateTime.Today.Date.ToString("d");
}

private void btnRegistrar_Click(object sender, EventArgs e)


{
string empleado = txtEmpleado.Text;
string categoria = cbCategoria.Text;

double descuento = 0;
if (sueldo > 2000) descuento = sueldo * (12.5 / 100);

double neto = sueldo - descuento;

ListViewItem fila = new ListViewItem(empleado);


fila.SubItems.Add(categoria);
fila.SubItems.Add(sueldo.ToString("C"));
fila.SubItems.Add(descuento.ToString("C"));
fila.SubItems.Add(neto.ToString("C"));
lvPagos.Items.Add(fila);

private void btnCancelar_Click(object sender, EventArgs e)


{
cbCategoria.Text = "(Seleccione)";
txtEmpleado.Clear();
txtEmpleado.Focus();

private void cbCategoria_SelectedIndexChanged(object sender,


EventArgs e)
{
//Capturando la Categoria seleccionada
string categoria = cbCategoria.Text;
if (categoria == "Jefe") sueldo = 3500;
if (categoria == "Administrador") sueldo = 2500;
if (categoria == "Tecnico") sueldo = 1700;
if (categoria == "Operario") sueldo = 1000;

lblSueldo.Text = sueldo.ToString("C");
}

private void btnSalir_Click(object sender, EventArgs e)


{
DialogResult r = MessageBox.Show("Esta Seguro de Salir?", "Pago",
MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (r == DialogResult.Yes)

this.Hide();
Form_menu fr = new Form_menu();
fr.Show();
}

private void txtEmpleado_TextChanged(object sender, EventArgs e)


{

}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApp4
{
public partial class Form_Registro : Form
{
public Form_Registro()
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=DESKTOP-NAOEH82;Initial
Catalog=Nomina; Integrated Security=SSPI";
InitializeComponent();
}

private void Form_Registro_Load(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=DESKTOP-NAOEH82;Initial
Catalog=Nomina; Integrated Security=SSPI";
con.Open();
SqlCommand cmd = new SqlCommand("select
e.Id_Empleado,Nombre,e.Apellido,e.Cedula,e.Fecha_Ing,e.Fecha_Nac,e.Domi
cilio,e.Telefono,c.Cargo,d.Departamento from Empleado as e inner join Cargo
as c on e.Id_Cargo=c.Id_Cargo inner join Departamento as d on
e.Id_Departamento=d.Id_Departamento", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dgvRegistro.DataSource = dt;
con.Close();
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

private void button1_Click(object sender, EventArgs e)


{
this.Hide();
Form_menu fr = new Form_menu();
fr.Show();
}

private void dataGridView1_CellContentClick_1(object sender,


DataGridViewCellEventArgs e)
{

}
}
}

You might also like