///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ClearUI() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = 'Visitors' AND EmpID='" + txtVisIdentityNo.Text + "'"); txtVisCardID.Text = ""; txtVisIdentityNo.Text = ""; txtVisNameAr.Text = ""; txtVisNameEn.Text = ""; txtVisMobileNo.Text = ""; calStartDate.ClearDate(); calExpiryDate.ClearDate(); for (int i = 1; i < 10; i++) { chkbRegion.Items.FindByValue("Region" + i.ToString()).Selected = false; } txtDescription.Text = ""; ddlTmpID.SelectedIndex = -1; VisImage.ClearImage(); divCardCount.Visible = false; txtVisIdentityNo.Enabled = false; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void PopulateUI(string pID) { try { string Action = ViewState["Action"].ToString(); if (string.IsNullOrEmpty(pID)) { lblMsg.Text = General.Msg("Visitor number does not exist", "رقم الزائر غير موجود سابقا"); divCardCount.Visible = true; if (Action == "A") { if (ddlSearchBy.SelectedValue == "VisIdentityNo") { txtVisIdentityNo.Text = txtSearchBy.Text; txtVisIdentityNo.Enabled = false; } else if (ddlSearchBy.SelectedValue == "VisNameAr") { txtVisNameAr.Text = txtSearchBy.Text; txtVisIdentityNo.Enabled = true; } else if (ddlSearchBy.SelectedValue == "VisNameEn") { txtVisNameEn.Text = txtSearchBy.Text; txtVisIdentityNo.Enabled = true; } else if (ddlSearchBy.SelectedValue == "VisMobileNo") { txtVisMobileNo.Text = txtSearchBy.Text; txtVisIdentityNo.Enabled = true; } ddlTmpID.SelectedIndex = 1; ButtonAction("11", false); } return; } else { DataTable CDT = DBFun.FetchData("SELECT TOP 1 * FROM VisitorsCard WHERE VisIdentityNo = '" + pID + "' ORDER BY VisCardID DESC"); if (!DBFun.IsNullOrEmpty(CDT)) { if (Action == "A" || Action == "U") { txtVisIdentityNo.Text = CDT.Rows[0]["VisIdentityNo"].ToString(); txtVisNameAr.Text = CDT.Rows[0]["VisNameAr"].ToString(); txtVisNameEn.Text = CDT.Rows[0]["VisNameEn"].ToString(); txtVisMobileNo.Text = CDT.Rows[0]["VisMobileNo"].ToString(); if ((CDT.Rows[0]["VisImage"] == DBNull.Value) || (CDT.Rows[0]["VisImageLength"].ToString() == "0")) { VisImage.ClearImage(); } else { VisImage.setImage(CDT.Rows[0]["VisIdentityNo"].ToString()); } } if (Action == "U") { txtVisCardID.Text = CDT.Rows[0]["VisCardID"].ToString(); txtDescription.Text = CDT.Rows[0]["Description"].ToString(); if (CDT.Rows[0]["StartDate"] != DBNull.Value) { calStartDate.setDBDate(CDT.Rows[0]["StartDate"], "S"); } if (CDT.Rows[0]["ExpiryDate"] != DBNull.Value) { calExpiryDate.setDBDate(CDT.Rows[0]["ExpiryDate"], "S"); } chkbRegion.Items.FindByValue("Region1").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion1"]); chkbRegion.Items.FindByValue("Region2").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion2"]); chkbRegion.Items.FindByValue("Region3").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion3"]); chkbRegion.Items.FindByValue("Region4").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion4"]); chkbRegion.Items.FindByValue("Region5").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion5"]); chkbRegion.Items.FindByValue("Region6").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion6"]); chkbRegion.Items.FindByValue("Region7").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion7"]); chkbRegion.Items.FindByValue("Region8").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion8"]); chkbRegion.Items.FindByValue("Region9").Selected = Convert.ToBoolean(CDT.Rows[0]["VisRegion9"]); } ddlTmpID.SelectedIndex = 1; //FindCount(pID); if (Action == "A") { bool active = FindActiveCard(txtVisIdentityNo.Text); if (active) { lblMsg.Text = General.Msg("This visitor has a valid card", "هذا الزائر لديه بطاقة سارية المفعول"); divCardCount.Visible = true; } ButtonAction("11", false); } else if (Action == "U" && CDT.Rows[0]["isPrinted"].ToString() == "False") { bool active = FindActiveCard(txtVisIdentityNo.Text); if (active) { lblMsg.Text = General.Msg("This visitor has a valid card", "هذا الزائر لديه بطاقة سارية المفعول"); divCardCount.Visible = true; } ButtonAction("11", false); } else if (Action == "U" && CDT.Rows[0]["isPrinted"].ToString() == "True") { lblMsg.Text = General.Msg("This card has printed, can not be modified", "هذه البطاقة تمت طباعتها, لا يمكن تعديلها"); divCardCount.Visible = true; ButtonAction("00", true); } } } } catch (Exception ex) { DBFun.InsertError(FormSession.PageName, "PopulateUI"); } }