private InsertEmployeeProperties PopulateProperties() { var viewModel = new InsertEmployeeProperties { FirstName = this.FirstName.Text, LastName = this.LastName.Text, Gender = this.GenderSelection.Text, BirthDate = this.DateOfBirth.Text, HireDate = this.HireDate.Text, }; return viewModel; }
public bool SendCreateEmployeeRequest(InsertEmployeeProperties porperties) { var request = new InsertEmployeeRequest { InsertEmployeePorperties = porperties }; var response = this.employeeService.InsertEmployee(request); if (response != null && response.Exception == null) { MessageBox.Show(string.Format("Response: {0}" + Environment.NewLine + "Employee Id: {1}" + Environment.NewLine + "Error Messages: {2}", response.ResponceCode, response.EmployeeId, response.InvalidDataMessage)); if (!string.IsNullOrWhiteSpace(response.EmployeeId)) { return true; } } return false; }
private Employee AssignAvailablePropertiesToDomain(InsertEmployeeProperties insertEmployeePorperties) { DateTime? nullableBirthDate = DateTimeHelper.ParseNullableDateTime(insertEmployeePorperties.BirthDate); DateTime? nullableHireDate = DateTimeHelper.ParseNullableDateTime(insertEmployeePorperties.HireDate); Gender gender; if (!Gender.TryParse(insertEmployeePorperties.Gender, out gender)) { gender = Gender.Unknown; } Employee newEmployee = Employee.CreateEmployee(insertEmployeePorperties.FirstName, insertEmployeePorperties.LastName, nullableBirthDate, nullableHireDate, gender); return newEmployee; }