private Branch GetObject() { Branch branch = new Branch(); branch.BranchId = (this.IsUpdate) ? this.BranchId : 0; branch.BranchName = BranchNameTextBox.Text; branch.Email = EmailTextBox.Text; branch.Mobile = MobileTextBox.Text; branch.Website = WebAddressTextBox.Text; branch.AddressLine = AddressLineTextBox.Text; branch.CityId = Convert.ToInt32(CityComboBox1.SelectedValue); branch.DistrictId = Convert.ToInt32(DistrictComboBox2.SelectedValue); branch.PostCode = PostCodeTextBox.Text; branch.BranchImage = (LogoPictureBox.Image == null) ? null : ImageManipulations.GetPhoto(LogoPictureBox); branch.CreatedBy = LoggedInUser.UserName; return(branch); }
private Employee GetObject() { Employee emp = new Employee(); emp.EmployeeId = Convert.ToInt32(EmployeeIDTextBox.Text); emp.FullName = FullNameTextBox.Text; emp.DateOfBirth = dateTimePicker1.Value.Date; emp.NICNumber = NICTextBox.Text.Trim(); emp.EmailAddress = EmailTextBox.Text.Trim(); emp.Mobile = MobileETextBox.Text.Trim(); emp.Telephone = TelephoneTextBox.Text.Trim(); emp.GenderId = (GenderComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(GenderComboBox.SelectedValue); emp.BranchId = (BranchComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(BranchComboBox.SelectedValue); emp.EmploymentDate = dateTimePicker2.Value.Date; emp.Photo = (pictureBox1.Image == null) ? null : ImageManipulations.GetPhoto(pictureBox1); emp.AddressLine = AddressLineTextBox.Text.Trim(); emp.CityId = (CityComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(CityComboBox.SelectedValue); emp.DistrictId = (DistrictComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(DistrictComboBox.SelectedValue); emp.PostCode = PostCodeBox.Text.Trim(); emp.JobTitleId = (JobTitleComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(JobTitleComboBox.SelectedValue); emp.CurrentSalary = Convert.ToDecimal(CurrentSalaryTextBox.Text.Trim()); emp.StartingSalary = Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()); emp.HasLeft = (HasLeftComboBox.Text.Trim() == "Yes") ? true : false; emp.DateLeft = DateLeftDateTimePicker.Value.Date; emp.ReasonLeftId = (ReasonLeftComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(ReasonLeftComboBox.SelectedValue); emp.Comments = CommentsTextBox.Text.Trim(); emp.CreatedBy = LoggedInUser.UserName; return(emp); }