private void StudentForm_Load(object sender, EventArgs e) { LoadDataIntoComboBoxes(); if (this.IsUpdate) { DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString()); DataTable dtBranch = db.GetDataList("usp_StudentsGetAllStudentByStudentId", new DbParameter() { Parameter = "@StudentId", Value = this.StudentId }); DataRow row = dtBranch.Rows[0]; StudentIdTextBox.Text = row["StudentId"].ToString(); FullNameTextBox.Text = row["FullName"].ToString(); FatherNameTextBox.Text = row["FatherName"].ToString(); MotherNameTextBox.Text = row["MotherName"].ToString(); DOBDateTimePicker.Text = row["DOB"].ToString(); AddressTextBox.Text = row["Address"].ToString(); EmailTextBox.Text = row["Email"].ToString(); AdmissionDateDateTimePicker.Text = row["AdmissionDate"].ToString(); MobileTextBox.Text = row["Mobile"].ToString(); BloodGroupTextBox.Text = row["BloodGroup"].ToString(); GenderComboBox.SelectedValue = row["GenderId"]; BranchComboBox.SelectedValue = row["BranchId"]; ImagepictureBox.Image = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]); } else { GenerateStudentId(); } }
private void EmployeeInfoForm_Load(object sender, EventArgs e) { LoadDataIntoComboBoxes(); if (this.IsUpdate) { DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString()); DataTable dtBranch = db.GetDataList("usp_EmployeesGetAllEmployeesByEmployeeId", new DbParameter() { Parameter = "@EmployeeId", Value = this.EmployeeId }); DataRow row = dtBranch.Rows[0]; EmployeeIdTextBox.Text = row["EmployeeId"].ToString(); FullNameTextBox.Text = row["FullName"].ToString(); DOBdateTimePicker.Text = row["DateOfBirth"].ToString(); NICTextBox.Text = row["NICNumber"].ToString(); EmailAddressTextBox.Text = row["EmailAddress"].ToString(); MobileTextBox.Text = row["Mobile"].ToString(); TelephoneTextBox.Text = row["Telephone"].ToString(); GenderComboBox.SelectedValue = row["GenderId"]; EmploymentDatedateTimePicker.Text = row["EmploymentDate"].ToString(); BranchComboBox.SelectedValue = row["BranchId"]; EmployeePictureBox.Image = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]); AddressLineTextBox.Text = row["AddressLine"].ToString(); CityComboBox.SelectedValue = row["CityId"]; DistrictComboBox.SelectedValue = row["DistrictId"]; PostCodeTextBox.Text = row["PostCode"].ToString(); JobTitleComboBox.SelectedValue = row["JObTitleId"]; CurrentSalaryTextBox1.Text = row["CurrentSalary"].ToString(); StartingSalaryTextBox.Text = row["StartingSalary"].ToString(); HasLeftComboBox.SelectedValue = row["HasLeft"]; DateLeftDateTimePicker.Text = row["DateLeft"].ToString(); ReasonLeftComboBox.SelectedValue = row["ReasonLeftId"]; CommentsTextBox.Text = row["Comments"].ToString(); } else { GenerateEmployeeId(); } }
private void LoadDataAndBindIntoControls() { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); DataTable dtEmployee = db.GetDataList("usp_EmployeesGetEmployeeDetailsId", new DBParameter { Parameter = "@EmployeeId", Value = this.EmployeeId }); DataRow row = dtEmployee.Rows[0]; EmployeeIdTextBox.Text = row["EmployeeId"].ToString(); FullNameTextBox.Text = row["FullName"].ToString(); DateOfBirthDateTimePicker.Value = Convert.ToDateTime(row["DateOfBirth"]); CNICTextBox.Text = row["CNICNumber"].ToString(); EmailAddressTextBox.Text = row["EmailAddress"].ToString(); MobileTextBox.Text = row["Mobile"].ToString(); TelephoneTextBox.Text = row["Telephone"].ToString(); GenderComboBox.SelectedValue = row["GenderId"]; EmploymentDateDateTimePicker.Value = Convert.ToDateTime(row["EmploymentDate"]); BranchComboBox.SelectedValue = row["BranchId"]; PhotoPictureBox.Image = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]); AddressLineTextBox.Text = row["AddressLine"].ToString(); CityComboBox.SelectedValue = row["CityId"]; DistrictComboBox.SelectedValue = row["DistrictId"]; PostralCodeTextBox.Text = row["PostralCode"].ToString(); JobTitleComboBox.SelectedValue = row["JobTitleId"]; CurrentSalaryTextBox.Text = row["CurrentSalary"].ToString(); StartingSalaryTextBox.Text = row["StartingSalary"].ToString(); HasLeftComboBox.Text = (Convert.ToBoolean(row["HasLeft"]) == true) ? "Yes" : "No"; if (row["DateLeft"] is DBNull) { DateLeftDateTimePicker.CustomFormat = " "; } else { DateLeftDateTimePicker.Value = Convert.ToDateTime(row["DateLeft"]); } ReasonLeftComboBox.SelectedValue = row["ReasonLeftId"]; CommentsTextBox.Text = row["Comments"].ToString(); }
private void LoadDataAndBindToControlIfUpdate() { if (this.IsUpdate) { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); DBParameter para = new DBParameter(); para.Parameter = "@BranchId"; para.Value = this.BranchId; DataTable dtBranch = db.GetDataList("usp_BranchesGetBranchDetailByBranchId", para); DataRow row = dtBranch.Rows[0]; BranchNameTextBox.Text = row["BranchName"].ToString(); EmailAddressTextBox.Text = row["Email"].ToString(); TelephoneTextBox.Text = row["Telephone"].ToString(); WebSiteAddressTextBox.Text = row["WebSite"].ToString(); AddressLineTextBox.Text = row["AddressLine"].ToString(); CityNameComboBox.SelectedValue = row["CityId"]; DistrictNameComboBox.SelectedValue = row["DistrictId"]; PostralCodeTextBox.Text = row["PostralCode"].ToString(); LogoPictureBox.Image = (row["branchImage"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["branchImage"]); } }