示例#1
0
        private void btn_Agregar_AgregarEmpleados_Click(object sender, EventArgs e)
        {
            form_Empleados fe   = new form_Empleados();
            Home           home = new Home();

            if (verifivarVacio() == true)
            {
                if (txt_Cedula_AgregarEmpleados.Text != logica.comprobarSiYaExiste("cedula", "Empleado", txt_Cedula_AgregarEmpleados.Text))
                {
                    try
                    {
                        string opcion;
                        opcion = cb_Alturas_AgregarEmpleados.SelectedItem.ToString();
                        if (dia_fcs_empleados.Text == "" && mes_fcs_empleados.Text == "" && ano_fcs_empleados.Text == "")
                        {
                            datos.insertarDatos("INSERT INTO Empleado (`cedula`, `nombre`, `apellido`, `cursoAltura`,`fechaInicio`,`fechaSalida`) VALUES('" + txt_Cedula_AgregarEmpleados.Text + "','" + txt_Nombres_AgregarEmpleados.Text + "',' " + txt_Apellido_AgregarEmpleados.Text + "','" + opcion + "','" + ano_fci_empleados.Text + "/" + mes_fci_empleados.Text + "/" + dia_fci_empleados.Text + "', NULL)");
                        }
                        else
                        {
                            datos.insertarDatos("INSERT INTO Empleado (`cedula`, `nombre`, `apellido`, `cursoAltura`,`fechaInicio`,`fechaSalida`) VALUES('" + txt_Cedula_AgregarEmpleados.Text + "','" + txt_Nombres_AgregarEmpleados.Text + "',' " + txt_Apellido_AgregarEmpleados.Text + "','" + opcion + "','" + ano_fci_empleados.Text + "/" + mes_fci_empleados.Text + "/" + dia_fci_empleados.Text + "','" + ano_fcs_empleados.Text + "/" + mes_fcs_empleados.Text + "/" + dia_fcs_empleados.Text + "')");
                        }
                        constructor();
                        home.limpiarPanel();
                        fe.empleado();
                        home.AbrirFormEnPanel(fe);
                        MessageBox.Show("Correcto");
                        this.Close();
                    }
                    catch
                    {
                        MessageBox.Show("Error al insertar");
                    }
                }
                else
                {
                    MessageBox.Show("El cliente " + txt_Nombres_AgregarEmpleados.Text + " " + txt_Apellido_AgregarEmpleados.Text + " ya esta registrado con cedula  " + txt_Cedula_AgregarEmpleados.Text);
                    constructor();
                }
            }
            else
            {
                constructor();
                lbl_ErrorApellido.Visible     = false;
                lbl_ErrorCedula.Visible       = false;
                lbl_ErrorNombre.Visible       = false;
                lbl_ErrorAlturas.Visible      = false;
                lbl_ErrorFechaIngreso.Visible = false;
            }
        }