예제 #1
0
        private void InsertarDatosBD()
        {
            Empleado myEmpleado = new Empleado();

            myEmpleado.Codigo   = InCodigo.Text;
            myEmpleado.Nombre   = InNombre.Text;
            myEmpleado.Apellido = InApellido.Text;
            myEmpleado.Cargo    = InCargo.Text;
            myEmpleado.Salario  = InSalario.Text;
            myEmpleado.Area     = InArea.Text;
            myEmpleado.Ciudad   = InCiudad.Text;

            if (!datos.ExisteEmpleado(InCodigo.Text))
            {
                if (datos.InsertaEmpleadoBD(myEmpleado))
                {
                    LabelRta.Text = " El registro fue insertado correctamente ";
                }
                else
                {
                    LabelRta.Text = " Se produjo un error " + datos.error;
                }
            }
            else
            {
                ErrorCodigo.Text = " El codigo " + InCodigo.Text + " Ya existe";
            }
        }