Exemple #1
0
 private void btnModificar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         EmpleadosNEG empleadosNEG = new EmpleadosNEG();
         string       nombre       = txtNombre.Text.ToUpper();
         string       apellido     = txtApellido.Text.ToUpper();
         string       rut          = txtRut.Text.ToUpper();
         DateTime     fecha_nac    = default(DateTime);
         if (dpkFechaNac.SelectedDate != null)
         {
             fecha_nac = DateTime.Parse(dpkFechaNac.SelectedDate.ToString());
         }
         string direccion       = txtDireccion.Text.ToUpper();
         string email           = txtEmail.Text;
         int    comuna          = int.Parse(cbxComuna.SelectedValue.ToString());
         string telefono_fijo   = txtTelFijo.Text;
         string celular         = txtTelCelular.Text;
         int    tipo_persona    = int.Parse(cbxTipoPersona.SelectedValue.ToString());
         int    estado_persona  = int.Parse(cbxEstadoPersona.SelectedValue.ToString());
         int    tipo_empleado   = int.Parse(cbxTipoEmpleado.SelectedValue.ToString());
         int    estado_empleado = int.Parse(cbxEstadoEmpleado.SelectedValue.ToString());
         int    sucursal        = int.Parse(cbxSucursal.SelectedValue.ToString());
         string respuesta       = empleadosNEG.ActualizarEmpleado(nombre, apellido, rut, fecha_nac, direccion, email, comuna, telefono_fijo, celular, tipo_persona, estado_persona, tipo_empleado, estado_empleado, sucursal);
         if (respuesta == "actualizado")
         {
             LimpiarFormulario();
             MessageBox.Show("El empleado ha sido actualizado satisfactoriamente");
         }
         else
         {
             MessageBox.Show(respuesta);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
     }
 }