///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Page_Load(object sender, EventArgs e) { try { //---Common Code ----------------------------------------------------------------- // FormSession.FillSession("Visitors", pageDiv); //---Common Code ----------------------------------------------------------------- // if (!IsPostBack) { pnlMain.Attributes.Add("onkeypress", "javascript:return DefaultButton(event,'" + btnIDSearch.ClientID + "');"); if (Request.QueryString["ID"] == null) { Response.Redirect(@"~/Login.aspx"); } ViewState["VisIdentityNo"] = ""; ViewState["Action"] = ""; ButtonAction("00", true); //ddlTmpID.Enabled = false; //VisImage.EnabledImage(false); if (Request.QueryString["ID"].ToString() == "i") { MainMasterPage.ShowTitel(General.Msg("Add " + MainNameEn + " Card", "إضافة بطاقة " + MainName1Ar)); if (!FormSession.PermUsr.Contains("IVis")) { Response.Redirect(@"~/Login.aspx"); } ViewState["Action"] = "A"; btnSave.Enabled = btnCancel.Enabled = false; Fillddl(); } if (Request.QueryString["ID"].ToString() == "u") { MainMasterPage.ShowTitel(General.Msg("Update " + MainNameEn + " Card", "تعديل بطاقة " + MainName1Ar)); if (!FormSession.PermUsr.Contains("UVis")) { Response.Redirect(@"~/Login.aspx"); } ViewState["Action"] = "U"; btnSave.Enabled = btnCancel.Enabled = false; Fillddl(); } ddlTmpID.Enabled = false; } if (IsPostBack) { VisImage.PopulateImage(txtVisIdentityNo.Text); } } catch (Exception ex) { DBFun.InsertError(FormSession.PageName, "PageLoad"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } FillPropeties(); if (ViewState["Action"].ToString() == "A") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data added successfully", "تمت إضافة بيانات " + MainName2Ar + " بنجاح")); } if (ViewState["Action"].ToString() == "U") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data updated successfully", "تم تعديل بيانات " + MainName2Ar + " بنجاح")); } ClearUI(); ButtonAction("00", true); //VisImage.EnabledImage(false); } catch (Exception ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); VisImage.PopulateImage(txtVisIdentityNo.Text); MessageFun.ShowAdminMsg(this, ex.Message); } }