예제 #1
0
 private void updateEmployeeButton_Click(object sender, EventArgs e)
 {
     ServiceLayer.ServiceEmployeeProxy proxy = new ServiceLayer.ServiceEmployeeProxy();
     if (indexForm.typeEmployeeGlobal == "FullTime")
     {
         Shared.Entities.FullTimeEmployee emp = new Shared.Entities.FullTimeEmployee()
         {
             Id        = indexForm.idEmployeeGlobal,
             Name      = nameTextBox.Text,
             StartDate = datePicker.Value,
             Salary    = (int)salaryBox.Value
         };
         proxy.UpdateEmployee(emp);
     }
     else
     {
         Shared.Entities.PartTimeEmployee emp = new Shared.Entities.PartTimeEmployee()
         {
             Id         = indexForm.idEmployeeGlobal,
             Name       = nameTextBox.Text,
             StartDate  = datePicker.Value,
             HourlyRate = (int)hourlyRateBox.Value
         };
         proxy.UpdateEmployee(emp);
     }
     this.Close();
 }
예제 #2
0
        private void refreshList()
        {
            ServiceLayer.ServiceEmployeeProxy             proxy          = new ServiceLayer.ServiceEmployeeProxy();
            List <Shared.Entities.Employee>               empleados      = proxy.GetAllEmployees();
            List <Shared.Entities.EmployeeMuestraWinform> empleadosTabla = new List <Shared.Entities.EmployeeMuestraWinform>();

            empleados.ForEach(x =>
            {
                if (x.GetType().Name == "FullTimeEmployee")
                {
                    Shared.Entities.FullTimeEmployee emp = (Shared.Entities.FullTimeEmployee)x;
                    empleadosTabla.Add(new Shared.Entities.EmployeeMuestraWinform()
                    {
                        Id        = emp.Id,
                        Name      = emp.Name,
                        StartDate = emp.StartDate,
                        TypeEmp   = "FullTime"
                    });
                }
                else
                {
                    Shared.Entities.PartTimeEmployee emp = (Shared.Entities.PartTimeEmployee)x;
                    empleadosTabla.Add(new Shared.Entities.EmployeeMuestraWinform()
                    {
                        Id        = emp.Id,
                        Name      = emp.Name,
                        StartDate = emp.StartDate,
                        TypeEmp   = "PartTime"
                    });
                }
            });

            dataGridView1.DataSource = empleadosTabla;
        }
예제 #3
0
 private void loadDataEmployee()
 {
     ServiceLayer.ServiceEmployeeProxy proxy = new ServiceLayer.ServiceEmployeeProxy();
     Shared.Entities.Employee          emp   = proxy.GetEmployee(indexForm.idEmployeeGlobal);
     if (emp.GetType().Name == "FullTimeEmployee")
     {
         Shared.Entities.FullTimeEmployee employee = (Shared.Entities.FullTimeEmployee)emp;
         nameTextBox.Text     = employee.Name;
         datePicker.Value     = employee.StartDate;
         typeEmployeeBox.Text = "FullTime";
         salaryBox.Value      = employee.Salary;
     }
     else
     {
         Shared.Entities.PartTimeEmployee employee = (Shared.Entities.PartTimeEmployee)emp;
         nameTextBox.Text     = employee.Name;
         datePicker.Value     = employee.StartDate;
         typeEmployeeBox.Text = "PartTime";
         hourlyRateBox.Value  = (int)employee.HourlyRate;
     }
 }
예제 #4
0
 private void deleteButton_Click(object sender, EventArgs e)
 {
     ServiceLayer.ServiceEmployeeProxy proxy = new ServiceLayer.ServiceEmployeeProxy();
     proxy.DeleteEmployee(indexForm.idEmployeeGlobal);
     this.Close();
 }