private void btnSearch_Click(object sender, EventArgs e) { query.OpenConection(); try { var dr = query.DataReader("select * from tblMosafer where ID=" + txtCode.Text); if (dr.Read()) { txtCode.Text = dr["ID"].ToString(); txtFName.Text = dr["FName"].ToString(); txtLName.Text = dr["LName"].ToString(); cmbGender.Text = dr["Gender"].ToString(); txtSen.Text = dr["Sen"].ToString(); txtTel.Text = dr["Tel"].ToString(); } else { MessageBox.Show("اطلاعاتی برای این کد پیدا نشد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearControls.ClearTextBoxes(this); txtCode.Focus(); } } catch (Exception) { MessageBox.Show("در هنگام اتصال به بانک اطلاعاتی خطایی رخ داده است ، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btnSearch_Click(object sender, EventArgs e) { query.OpenConection(); try { var dr = query.DataReader("select * from tblHesab where ID=" + txtCode.Text); if (dr.Read()) { txtCode.Text = dr["ID"].ToString(); txtNameHesab.Text = dr["NameHesab"].ToString(); txtShomareHesab.Text = dr["ShomareHesab"].ToString(); txtMojodi.Text = dr["Mojodi"].ToString(); txtTozihat.Text = dr["Tozihat"].ToString(); } else { MessageBox.Show("اطلاعاتی برای این کد پیدا نشد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearControls.ClearTextBoxes(this); txtCode.Focus(); } } catch (Exception) { MessageBox.Show("در هنگام اتصال به بانک اطلاعاتی خطایی رخ داده است ، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btnSave_Click(object sender, EventArgs e) { query.OpenConection(); try { int tedad_sandali; int tedad_blit; var q = query.ExecuteScaler("select Tedad from tblHavapeyma where ID=" + txtCodeHavapeyma.Text); tedad_sandali = (int)q.ExecuteScalar(); tedad_blit = Convert.ToInt32(txtTedadBlit.Text); if (tedad_blit > tedad_sandali) { MessageBox.Show("مقدار تعداد بلیط های وارد شده از حد مجاز ظرفیت صندلی های این هواپیما بیشتر است", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int reserve = tedad_sandali - tedad_blit; query.ExecuteQueries("update tblHavapeyma set Tedad='" + reserve + "' where ID=" + txtCodeHavapeyma.Text); query.ExecuteQueries(string.Format("insert into tblBlit values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')", mskTarikh.Text, lblTime.Text, txtCodeHavapeyma.Text, txtNameHavapeyma.Text, txtTedadSandali.Text, txtNooBlit.Text, txtNameCity.Text, txtGheymat.Text, txtFName.Text, txtLName.Text, txtTedadBlit.Text, txtNumSandali.Text, txtGheymatKol.Text, txtTozihat.Text)); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
protected virtual void OnClearControls() { if (ClearControls != null) { ClearControls.Invoke(this, EventArgs.Empty); } IsWaiting = false; }
private void btnNew_Click(object sender, EventArgs e) { ClearControls ctr = new ClearControls(); ctr.Clearcontrol(txtStaffName, cboGender, txtPosition, txtAddress, txtPhone, dcHiredDate, dcStaffBirthday, txtSalary); txtStaffID.Text = "AutoNumber"; status = "New"; txtStaffID.Enabled = false; txtStaffName.Focus(); }
private void btnSave_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries(string.Format("insert into tblGroups values('{0}')", txtName.Text)); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btn_Edit_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries("update tblBlit set Tarikh='" + mskTarikh.Text + "',Saat='" + lblTime.Text + "',ID_Havapeyma='" + txtCodeHavapeyma.Text + "',NameHavapeyma='" + txtNameHavapeyma.Text + "',Tedadsandali='" + txtTedadSandali.Text + "',NooBlit='" + txtNooBlit.Text + "',NameCity='" + txtNameCity.Text + "',Gheymat='" + txtGheymat.Text + "',FName='" + txtFName.Text + "',LName='" + txtLName.Text + "',TedadBlit='" + txtTedadBlit.Text + "',NumSandali='" + txtNumSandali.Text + "',GheymatKol='" + txtGheymatKol.Text + "',Tozihat='" + txtTozihat.Text + "' where ID=" + txtCode.Text); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btn_Edit_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries("update tblHavapeyma set NameHavapeyma='" + txtName.Text + "',NameGroup='" + cmbGroup.Text + "',Tedad='" + txtTedad.Text + "',Tozihat='" + txtTozihat.Text + "' where id=" + txtCode.Text); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btn_Edit_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries("Update tblMosafer set FName='" + txtFName.Text + "',LName='" + txtLName.Text + "',Gender='" + cmbGender.Text + "',Sen='" + txtSen.Text + "',Tel='" + txtTel.Text + "' where ID=" + txtCode.Text); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btnDelete_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries("delete from tblGroups where ID=" + txtCode.Text); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btnSave_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries(string.Format("insert into tblHarekat values('{0}','{1}','{2}','{3}','{4}','{5}')", txtCodeHavapeyma.Text, txtNameHavapeyma.Text, mskTarikh.Text, txtTime.Text, cmbNameCity.Text, txtTedad.Text)); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btn_Edit_Click(object sender, EventArgs e) { query.OpenConection(); try { query.ExecuteQueries("update tblHesab set NameHesab='" + txtNameHesab.Text + "', ShomareHesab='" + txtShomareHesab.Text + "', Mojodi='" + txtMojodi.Text + "', Tozihat='" + txtTozihat.Text + "' where ID=" + txtCode.Text); Display(); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { File.WriteAllText(saveFileDialog1.FileName, txtNote.Text, Encoding.UTF8); MessageBox.Show("یادداشت با موفقیت ذخیره شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { query.OpenConection(); try { int x = Convert.ToInt32(dgvHesab.SelectedCells[0].Value); query.ExecuteQueries("delete from tblHesab where ID=" + x); Display(); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
protected void btnSave_Click(object sender, EventArgs e) { if (_adminUserBll.CheckUserNameExists(txtUserName.Text)) { DisplayMessage.ShowMessage("Username already registered, please choose a another username !", Page); return; } else if (_adminUserBll.CheckEmailExists(txtEmail.Text)) { DisplayMessage.ShowMessage("Email already registered, please choose a another email !", Page); return; } else { AddNewAdminUser(); ClearControls.ClearControl(this); DisplayMessage.ShowMessage("Inserted successfully !", Page); } }
private void btnPardakht_Click(object sender, EventArgs e) { query.OpenConection(); try { int mojodi_hesab; int mablagh_kol; var q = query.ExecuteScaler("select Mojodi from tblHesab where ShomareHesab=" + cmbShomareHesab.SelectedValue.ToString()); mojodi_hesab = ((int)q.ExecuteScalar()); mablagh_kol = Convert.ToInt32(txtGheymatKol.Text); int variz = mojodi_hesab + mablagh_kol; query.ExecuteQueries("update tblHesab set Mojodi=" + variz + " where ShomareHesab=" + cmbShomareHesab.SelectedValue.ToString()); MessageBox.Show("عملیات با موفقیت انجام شد", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearControls.ClearTextBoxes(this); } catch (Exception) { MessageBox.Show("خطایی رخ داده است، مجددا تلاش کنید", "Blit", MessageBoxButtons.OK, MessageBoxIcon.Error); } query.CloseConnection(); }
private void ChangePassword() { var id = BitcoinSession.AdminUser; if (id != 0) { var adminUser = _adminUserBll.GetAdminUserById(id); if (adminUser == null) { throw new ArgumentNullException("adminUser"); } if (adminUser.Password != MD5Password.MD5Hash(txtCurrentPassword.Text)) { DisplayMessage.ShowMessage("Your current password is not valid !", Page); } else { adminUser.Password = MD5Password.MD5Hash(txtNewPassword.Text); _adminUserBll.UpdateAdminUser(adminUser); ClearControls.ClearControl(this); DisplayMessage.ShowMessage("You have been changed password successfully !", Page); } } }
private void btnClear_Click(object sender, EventArgs e) { ClearControls.ResetAllControls(this); }