Exemplo n.º 1
0
 protected void ButtonSave_Click(object sender, EventArgs e)
 {
     try
     {
         var service = new EmployeesServiceClient();
         var employee = new Employees();
         employee.ID = int.Parse(TextBoxEmployeeID.Text);
         employee.FirstName = TextBoxFirstName.Text;
         employee.LastName = TextBoxLastName.Text;
         employee.Title = TextBoxTitle.Text;
         employee.TitleOfCourtesy = TextBoxTitleOfCourtesy.Text;
         employee.BirthDate = DateTime.Parse(TextBoxBirthDate.Text);
         employee.HireDate = DateTime.Parse(TextBoxHireDate.Text);
         employee.Address = TextBoxAddress.Text;
         employee.City = TextBoxCity.Text;
         service.EditEmployee(employee);
     }
     catch (FaultException<SqlException> ex)
     {
         throw new FaultException<SqlException>(ex.Detail, "Something went wrong");
     }
     catch (Exception ex)
     {
         throw new Exception("Client error: " + ex.Message);
     }
 }
Exemplo n.º 2
0
 public void EditEmployee(Employees employee)
 {
     try
     {
         repo.EditEmployee(employee);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }