private void PopulateInterfaceFromModel(int id) { using (var facade = new EmployeeCore()) { var employee = facade.Get <IEmployeeModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault(); if (employee == null || !facade.IsSuccess) { MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee not found" : facade.Message); return; } address.Text = employee.Address; bankAccount.Text = employee.BankAccount; bankName.Text = employee.BankName; birthDate.Value = employee.BirthDate; cityName.Text = employee.City; createdBy.Text = employee.CreatedBy; createdDate.Value = employee.CreatedDate; firstName.Text = employee.FirstName; gender.Text = employee.Gender; hireDate.Value = employee.HiredDate; recordId.Text = employee.Id.ToString(CultureInfo.InvariantCulture); lastName.Text = employee.LastName; maritalStatus.Text = employee.MaritalStatus; middleName.Text = employee.MiddleName; nationalIdNumber.Text = employee.NationalIDNumber; payrollGroupCode.Text = employee.PayrollGroupCode; positionName.Text = employee.PositionName; postalCode.Text = employee.PostalCode; stateName.Text = employee.State; titleName.Text = employee.Title; createdBy.Text = employee.CreatedBy; createdDate.Value = employee.CreatedDate; modifiedBy.Text = employee.ModifiedBy; modifiedDate.Value = employee.ModifiedDate.HasValue ? employee.ModifiedDate.Value : DateTime.Now; employeeId.Text = employee.EmployeeID; isTerminate.Text = employee.IsTerminate.ToString(); terminateDate.Value = employee.TerminateDate.HasValue ? employee.TerminateDate.Value : DateTime.Now; terminateDate.Checked = employee.TerminateDate.HasValue; terminateDescription.Text = employee.TerminateDescription; } }
private void PopulateInterfaceFromModel(int id) { using(var facade = new EmployeeCore()) { var employee = facade.Get<IEmployeeModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault(); if (employee == null || !facade.IsSuccess) { MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee not found" : facade.Message); return; } address.Text = employee.Address; bankAccount.Text = employee.BankAccount ; bankName.Text = employee.BankName; birthDate.Value = employee.BirthDate; cityName.Text = employee.City; createdBy.Text = employee.CreatedBy; createdDate.Value = employee.CreatedDate; firstName.Text = employee.FirstName; gender.Text = employee.Gender; hireDate.Value = employee.HiredDate; recordId.Text = employee.Id.ToString(CultureInfo.InvariantCulture); lastName.Text = employee.LastName; maritalStatus.Text = employee.MaritalStatus; middleName.Text = employee.MiddleName; nationalIdNumber.Text = employee.NationalIDNumber; payrollGroupCode.Text = employee.PayrollGroupCode; positionName.Text = employee.PositionName; postalCode.Text = employee.PostalCode; stateName.Text = employee.State; titleName.Text = employee.Title; createdBy.Text = employee.CreatedBy; createdDate.Value = employee.CreatedDate; modifiedBy.Text = employee.ModifiedBy; modifiedDate.Value = employee.ModifiedDate.HasValue ? employee.ModifiedDate.Value : DateTime.Now; employeeId.Text = employee.EmployeeID; isTerminate.Text = employee.IsTerminate.ToString(); terminateDate.Value = employee.TerminateDate.HasValue ? employee.TerminateDate.Value : DateTime.Now; terminateDate.Checked = employee.TerminateDate.HasValue; terminateDescription.Text = employee.TerminateDescription; } }