private void btnSave_Click(object sender, EventArgs e) { try { if (ClsTools.CheckValidation(pnlNewEdit) == false) { FarsiMessagbox.Show(ClsMessage.ErrNotRegEmptyValue, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); return; } if (txtPassWord_.Text != txtRePassWord_.Text) { FarsiMessagbox.Show("تکرار کلمه عبور با کلمه عبور یکسان نمی باشد", "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); return; } if (SaveType == 1) { InsertRow(); } else { UpdateRow(); } } catch (Exception ex) { FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (ClsTools.CheckValidation(pnlNewEdit) == false || frmPaziresh.tblPaziresh.PazireshID == 0) { FarsiMessagbox.Show(ClsMessage.ErrNotRegEmptyValue, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); return; } if (SaveType == 1) { InsertRow(); } else { UpdateRow(); } } catch (Exception ex) { FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); } }
void New() { tblOtagh = new tblOtagh(); SaveType = 1; BindGrid(); ClsTools.ClearContent(pnlNewEdit); btnDelete.Enabled = false; }
void New() { tblUser.UserID = 0; SaveType = 1; BindGrid(); ClsTools.ClearContent(pnlNewEdit); btnDelete.Enabled = false; btnChangeStatus.Enabled = false; }
void New() { SaveType = 1; BindGrid(); frmPaziresh.tblPaziresh = new tblPaziresh(); ClsTools.ClearContent(pnlNewEdit); btnDelete.Enabled = false; txtTarikhTasviyeHeasb_.Text = ClsTools.ShamsiDate(); }
protected void BtnSearch_Click(object sender, EventArgs e) { try { string search_value = ClsTools.Text_Validator(txtSearch.Text); Strsearch = " WHERE UserFullName LIKE '%" + search_value + "%' ORDER BY UserFullName"; bindgrid(); } catch (Exception ex) { } }
void InsertRow() { try { HospitalEntities db = new HospitalEntities(); tblPaziresh tblPaziresh = new tblPaziresh(); tblPaziresh.NameBimar = txtName_.Text; tblPaziresh.LastNameBimar = txtLastName_.Text; tblPaziresh.CodeMelliBimar = txtCodeMelli_.Text; tblPaziresh.CodeBimeBimar = txtCodeBime.Text; tblPaziresh.PezeshkID = (int)cmbPezeshk_.SelectedValue; tblPaziresh.OtaghID = (int)cmbOtagh_.SelectedValue; tblPaziresh.TarikhPaziresh = ClsTools.ShamsiDate(); db.tblPazireshes.Add(tblPaziresh); db.SaveChanges(); New(); } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage); var fullErrorMessage = string.Join("\n", errorMessages); var exceptionMessage = string.Concat(ClsMessage.Error, ex.Message, " The validation errors are: ", fullErrorMessage); FarsiMessagbox.Show(exceptionMessage, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); } catch (DbUpdateException ex) { FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); } catch (Exception ex) { FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error); } }