Example #1
0
 private void dtgFichadoras_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         fichadoraSeleccionada = (Trabajador)this.dtgFichadoras.SelectedItem;
         if (fichadoraSeleccionada != null && fichadoraSeleccionada.Id != 0)
             this.txtFichadora.Text = fichadoraSeleccionada.Nombres;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void NuevaFichadora()
        {
            try
            {
                this.conexion.BeginTransaction();
                Trabajador fichadora = new Trabajador(this.conexion)
                {
                    ApellidoMaterno = this.txtFichadora.Text,
                    ApellidoPaterno = this.txtFichadora.Text,
                    Cargo = new Cargo { Id = 3 },
                    FechaIngreso = DateTime.Now,
                    FechaNacimiento = DateTime.Now,
                    Nombres = this.txtFichadora.Text,
                    NombreCompleto = this.txtFichadora.Text,
                    TipoDocumento = new Core.Persona.TipoDocumento
                    {
                        Codigo = "DNI"
                    },
                    NumeroDocumento = "00000001",
                    Sexo = 'F'
                };

                fichadora.Nuevo();

                this.txtFichadora.IsReadOnly = true;
                this.conexion.Commit();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                this.conexion.RoolBack();
            }
        }