Example #1
0
 public void AddEmployee(Shared.Entities.Employee emp)
 {
     using (var db = new EmployeesEntities())
     {
         db.Employees.Add(emp);
         db.SaveChanges();
     }
 }
Example #2
0
 public void UpdateEmployee(Shared.Entities.Employee emp)
 {
     using (var db = new EmployeesEntities())
     {
         db.Employees.Attach(emp);
         var entry = db.Entry(emp);
         entry.State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Example #3
0
 private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     foreach (ListViewItem itemSeleccionado in listView1.SelectedItems)
     {
         Shared.Entities.Employee emp = IEmp.GetEmployee(int.Parse(itemSeleccionado.Text));
         textId.Text     = emp.Id.ToString();
         textNombre.Text = emp.Name;
         if (emp.GetType() == typeof(Shared.Entities.FullTimeEmployee))
         {
             Shared.Entities.FullTimeEmployee empFull = (Shared.Entities.FullTimeEmployee)emp;
             textSalario.Text = empFull.Salary.ToString();
             comboTipo.Text   = "Mensual";
         }
         else
         {
             Shared.Entities.PartTimeEmployee empPart = (Shared.Entities.PartTimeEmployee)emp;
             textSalario.Text = empPart.HourlyRate.ToString();
             comboTipo.Text   = "Jornalero";
         }
     }
     buttonAgregar.Visible   = false;
     buttonCancelar.Visible  = true;
     buttonModificar.Visible = true;
 }
 public void UpdateEmployee(Shared.Entities.Employee e)
 {
     _bl.UpdateEmployee(e);
 }
 public void SaveEmployee(Shared.Entities.Employee e)
 {
     _bl.AddEmployee(e);
 }