private void LoadDataAndBindIntoControls() { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); DataTable dataTabe = dbSQLServer.GetDataList("usp_EmployeesGetEmployeesDetailsById", new DbParameter { Parameter = "@EmployeeId", Value = this.EmployeeId }); DataRow dtRow = dataTabe.Rows[0]; EmployeeIDTextBox.Text = dtRow["EmployeeId"].ToString(); FullNameTextBox.Text = dtRow["FullName"].ToString(); dateTimePicker1.Value = Convert.ToDateTime(dtRow["DateOfBirth"]); NICTextBox.Text = dtRow["NICNumber"].ToString(); EmailTextBox.Text = dtRow["EmailAddress"].ToString(); TelephoneTextBox.Text = dtRow["Telephone"].ToString(); MobileETextBox.Text = dtRow["Mobile"].ToString(); dateTimePicker2.Value = Convert.ToDateTime(dtRow["EmploymentDate"]); AddressLineTextBox.Text = dtRow["AddressLine"].ToString(); PostCodeBox.Text = dtRow["PostCode"].ToString(); CurrentSalaryTextBox.Text = dtRow["CurrentSalary"].ToString(); StartingSalaryTextBox.Text = dtRow["StartingSalary"].ToString(); CommentsTextBox.Text = dtRow["Comments"].ToString(); pictureBox1.Image = (dtRow["Photo"] is DBNull) ? null : ImageManipulations.PutPhoto((byte[])dtRow["Photo"]); CityComboBox.SelectedValue = dtRow["CityId"]; DistrictComboBox.SelectedValue = dtRow["DistrictId"]; GenderComboBox.SelectedValue = dtRow["GenderId"]; BranchComboBox.SelectedValue = dtRow["BranchId"]; JobTitleComboBox.SelectedValue = dtRow["JobTitleId"]; HasLeftComboBox.Text = (Convert.ToBoolean(dtRow["HasLeft"]) == true) ? "Yes" : "No"; ReasonLeftComboBox.SelectedValue = dtRow["ReasonLeftId"]; DateLeftDateTimePicker.Value = Convert.ToDateTime(dtRow["DateLeft"]); CommentsTextBox.Text = dtRow["Comments"].ToString(); }
public static void LoadDataIntoDataGridView(DataGridView dataGridView, string storedProcedureName) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); dataGridView.DataSource = dbSQLServer.GetDataList(storedProcedureName); dataGridView.MultiSelect = false; dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public static void LoadDataIntoComboBox(ComboBox comboBox, string storedProcedureName, DbParameter[] dbParameters) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); comboBox.DataSource = dbSQLServer.GetDataList(storedProcedureName, dbParameters); comboBox.DisplayMember = "Description"; comboBox.ValueMember = "Id"; comboBox.SelectedIndex = -1; comboBox.DropDownStyle = ComboBoxStyle.DropDownList; }
public static void LoadDataIntoComboBox(ComboBox comboBox, DbParameter dbParameter) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); comboBox.DataSource = dbSQLServer.GetDataList("usp_GetListTypesDataById", dbParameter); comboBox.DisplayMember = "Description"; comboBox.ValueMember = "Id"; comboBox.SelectedIndex = -1; comboBox.DropDownStyle = ComboBoxStyle.DropDownList; }
private void btnLogin_Click(object sender, EventArgs e) { if (IsFormValid()) { DbSQLServer db = new DbSQLServer(AppSetting.ConnectionString()); bool isLoginDetailsCorrect = Convert.ToBoolean(db.GetScalarValue("sp_CheckLoginDetails", GetPrameters())); if (isLoginDetailsCorrect) { this.Hide(); frmDashboard frm = new frmDashboard(); frm.Show(); } else { MessageBox.Show("Netačno korisničko ime ili šifra.\nPokušajte opet.", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void LoadDataAndBindToControlIfUpdate() { if (this.IsUpdate) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); //DbParameter dbPara = new DbParameter(); //dbPara.Parameter = "@BranchId"; //dbPara.Value = this.BranchId; DataTable dtBranchTable = dbSQLServer.GetDataList("usp_BranchesGetBrancheDetailByBranchId", new DbParameter { Parameter = "@BranchId", Value = this.BranchId }); DataRow row = dtBranchTable.Rows[0]; BranchNameTextBox.Text = row["BranchName"].ToString(); EmailTextBox.Text = row["Email"].ToString(); MobileTextBox.Text = row["Mobile"].ToString(); WebAddressTextBox.Text = row["Website"].ToString(); LogoPictureBox.Image = (row["branchImage"] is DBNull)? null : ImageManipulations.PutPhoto((byte[])row["branchImage"]); AddressLineTextBox.Text = row["AddressLine"].ToString(); CityComboBox1.SelectedValue = row["CityId"]; DistrictComboBox2.SelectedValue = row["DistrictId"]; PostCodeTextBox.Text = row["PostCode"].ToString(); } }
private void btnSignIn_Click(object sender, EventArgs e) { if (IsFormValid()) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); bool isLoginDetailsCorrect = Convert.ToBoolean(dbSQLServer.GetScalarValue("usp_UsersCheckLoginDetails", GetParameters())); if (isLoginDetailsCorrect) { GetLoggedInUserSettings(); this.Hide(); DashboardForm dashboardForm = new DashboardForm(); dashboardForm.Show(); } else { JIMessageBox.ShowErrorMessage("User Name/Password is incorrect"); //MessageBox.Show("User Name/Password is incorrect", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void SaveOrUpdateRecord(string storedProcedureName) { DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString()); dbSQLServer.SaveOrUpdateRecord(storedProcedureName, GetObject()); }
private void GenerateEmployeeId() { DbSQLServer dBSQLSerevr = new DbSQLServer(AppSetting.ConnectionString()); EmployeeIDTextBox.Text = dBSQLSerevr.GetScalarValue("usp_EmployeesGenerateNewEmployeeId").ToString(); }