public Consulta_Empleado(Class_.Empleado Nempleado, Class_.Connection CConnection) { InitializeComponent(); this.CConnection = CConnection; this.Nempleado = Nempleado; }
public Menu_Venta(Class_.Connection Connection, Class_.Empleado Empleado) { InitializeComponent(); this.Connection = Connection; this.Empleado = Empleado; }
public Menu_Principal_Administrador(Class_.Empleado Empleado, Class_.Connection CConnection) { InitializeComponent(); this.Empleado = Empleado; this.CConnection = CConnection; }
private void buttonAdd_Click(object sender, EventArgs e) { if (textBoxApellidosE.Text == "" || comboBoxPuesto.Text == "" || textBoxCPassword.Text == "" || textBoxPassword.Text == "" || textBoxNombreE.Text == "") { MessageBox.Show("Favor de llenar\nlos campor requeridos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (textBoxPassword.Text == textBoxCPassword.Text) { CConnection.OpenConnection(); Class_.Empleado Nempleado = new Class_.Empleado(); Nempleado.Nombre = textBoxNombreE.Text; Nempleado.Apellido = textBoxApellidosE.Text; Nempleado.Puesto = comboBoxPuesto.Text; Nempleado.Contrasena = textBoxPassword.Text; int OK = Class_.Empleado.AgregarEmpleado(CConnection.myConnection, Nempleado); if (OK == 1) { MessageBox.Show("Empleado Capturado\nCon Éxito", "Exito", MessageBoxButtons.OK); CConnection.CloseConnection(); this.Close(); } else { MessageBox.Show("No se Pudo Capturar", "Error", MessageBoxButtons.OK); } CConnection.CloseConnection(); } else { MessageBox.Show("La contraseña no coincide", "Error Password", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void buttonAccept_Click(object sender, EventArgs e) { CConnection.OpenConnection(); Class_.Empleado Nuempleado = new Class_.Empleado(Nempleado.ID, textBoxNombre.Text, textBoxApellido.Text, comboBoxPuesto.Text, textBoxContrasena.Text, true); int retorno = Class_.Empleado.ModificarEmpleado(CConnection.myConnection, Nuempleado); CConnection.CloseConnection(); MessageBox.Show("Datos Modificados"); this.Close(); }
private void LoadEmployee(string idEmployee) { Connection.OpenConnection(); MySqlDataReader reader = Class_.Empleado.BuscarEmpleado(Connection.myConnection, idEmployee); Class_.Empleado employee = new Class_.Empleado(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(5)); labelNombreEmpleado.Text = employee.Nombre; Connection.CloseConnection(); }
private void buttonSearch_Click(object sender, EventArgs e) { CConnection.OpenConnection(); MySqlDataReader reader = Class_.Empleado.BuscarEmpleado(CConnection.myConnection, dataGridView1.CurrentRow.Cells[0].Value.ToString()); if (reader.Read()) { Class_.Empleado Nempleado = new Class_.Empleado(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(5)); Consulta_Empleado consulta_empleado = new Consulta_Empleado(Nempleado, CConnection); CConnection.CloseConnection(); consulta_empleado.ShowDialog(); LoadData(); } }
private void buttonEntrar_Click(object sender, EventArgs e) { CConnection.OpenConnection(); MySqlCommand command = new MySqlCommand("SELECT * FROM empleado WHERE idEmpleado = '" + textBoxNombre.Text + "' AND eContrasena = '" + textBoxContraseña.Text + "'", CConnection.myConnection); MySqlDataReader Reader = command.ExecuteReader(); if (Reader.Read()) { Class_.Empleado nEmpleado = new Class_.Empleado(Reader.GetInt32(0), Reader.GetString(1), Reader.GetString(2), Reader.GetString(3), Reader.GetString(4), Reader.GetBoolean(5)); if (nEmpleado.Status) { if (nEmpleado.Puesto == "Gerente") { Menu_Principal_Administrador menu_principal_adm = new Menu_Principal_Administrador(nEmpleado, CConnection); CConnection.CloseConnection(); this.Hide(); menu_principal_adm.ShowDialog(); this.Show(); } else if (nEmpleado.Puesto == "Cajero") { Menu_Principal_Empleado menu_principal_emp = new Menu_Principal_Empleado(CConnection, nEmpleado); CConnection.CloseConnection(); menu_principal_emp.ShowDialog(); } } else { MessageBox.Show("ID ó Contraseña incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("ID ó Contraseña incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } CConnection.CloseConnection(); textBoxNombre.Clear(); textBoxContraseña.Clear(); }
public Menu_Principal_Empleado(Class_.Connection Connection, Class_.Empleado empleado) { InitializeComponent(); this.Connection = Connection; this.empleado = empleado; }