public static void LoadDataIntoDataGridView(DataGridView dgv, string storedProceName) { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); dgv.DataSource = db.GetDataList(storedProceName); dgv.MultiSelect = false; dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public static void LoadDataIntoComboBox(ComboBox cb, string storedProceName, DBParameter[] parameters) { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); cb.DataSource = db.GetDataList(storedProceName, parameters); cb.DisplayMember = "Description"; cb.ValueMember = "Id"; cb.SelectedIndex = -1; cb.DropDownStyle = ComboBoxStyle.DropDownList; }
public static void LoadDataIntoComboBox(ComboBox cb, DBParameter parameter) { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); cb.DataSource = db.GetDataList("usp_ListTypesDataGetDataByListTypeId", parameter); cb.DisplayMember = "Description"; cb.ValueMember = "Id"; cb.SelectedIndex = -1; cb.DropDownStyle = ComboBoxStyle.DropDownList; }
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 LoadDataAndBindIntoControls() { DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString()); DataTable dtEmployee = db.GetDataList("usp_StudentGetStudentDetailsById", new DBParameter { Parameter = "@StudentId", Value = this.StudentId }); DataRow row = dtEmployee.Rows[0]; StudentIdTextBox.Text = row["StudentId"].ToString(); StudentNameTextBox.Text = row["StudentName"].ToString(); FatherNameTextBox.Text = row["FatherName"].ToString(); PhoneNumberTextBox.Text = row["PhoneNumber"].ToString(); CityComboBox.SelectedValue = row["CityId"]; EmailAddressTextBox.Text = row["EmailAddress"].ToString(); DepartmentComboBox.SelectedValue = row["DepartmentId"]; AddressLineTextBox.Text = row["AddressLine"].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"]); } }