private void LoadDataIfUpdate() { DataRow dataRow = db.GetList("Employees_GetEmployeeByEmployeeId", new DbParameter() { Name = "@EmployeeId", Value = EmployeeId }).Rows[0]; EmployeeIDTextBox.Text = EmployeeId.ToString(); EmployeeNameTextBox.Text = dataRow["Name"].ToString(); DateOfBirthDateTimePicker.Value = Convert.ToDateTime(dataRow["DateOfBirth"]); CNICTextBox.Text = dataRow["CNIC"].ToString(); EmailTextBox.Text = dataRow["Email"].ToString(); MobileTextBox.Text = dataRow["Mobile"].ToString(); TelephoneTextBox.Text = dataRow["Telephone"].ToString(); GenderComboBox.SelectedValue = dataRow["GenderId"]; EmploymentDateDateTimePicker.Value = Convert.ToDateTime(dataRow["EmploymentDate"]); //if (Convert.ToInt32(dataRow["BranchId"]) != 0) //{ BranchComboBox.SelectedValue = dataRow["BranchId"]; //} AddressLineTextBox.Text = dataRow["AddressLine"].ToString(); CityComboBox.SelectedValue = dataRow["CityId"]; DistrictComboBox.SelectedValue = dataRow["DistrictId"]; PostalCodeTextBox.Text = dataRow["PostalCode"].ToString(); JobTitleComboBox.SelectedValue = dataRow["JobTitleId"]; StartingSalaryTextBox.Text = dataRow["StartingSalary"].ToString(); CurrentSalaryTextBox.Text = dataRow["CurrentSalary"].ToString(); PicturePictureBox.Image = dataRow["Picture"] is DBNull ? Resources.noimage : ImageManipulation.ConvertBytesIntoImage((byte[])dataRow["Picture"]); HasLeftComboBox.Text = ((bool)dataRow["HasLeft"]) ? "Yes" : "No"; DateLeftDateTimePicker.Value = Convert.ToDateTime(dataRow["DateLeft"]); LeftReasonComboBox.SelectedValue = dataRow["ReasonLeftId"]; LeavingCommentsTextBox.Text = dataRow["Comments"].ToString(); }
private void LoadDataIfUpdate() { DataRow dataRow = db.GetList("Branches_GetBranchByID", new DbParameter() { Name = "@BranchId", Value = BranchId }).Rows[0]; NameTextBox.Text = dataRow["BranchName"].ToString(); EmailTextBox.Text = dataRow["Email"].ToString(); TelephoneTextBox.Text = dataRow["Telephone"].ToString(); WebsiteTextBox.Text = dataRow["Website"].ToString(); AddressLineTextBox.Text = dataRow["AddressLine"].ToString(); CityComboBox.SelectedValue = dataRow["CityId"]; DistrictComboBox.SelectedValue = dataRow["DistrictId"]; PostalCodeTextBox.Text = dataRow["PostalCode"].ToString(); LogoPictureBox.Image = dataRow["BranchImage"] is DBNull ? Resources.noimage : ImageManipulation.ConvertBytesIntoImage((byte[])dataRow["BranchImage"]); }