protected void Page_Load(object sender, EventArgs e) { if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "") { IQCareMsgBox.Show("SessionExpired", this); Response.Redirect("~/frmlogin.aspx", true); } //txtSeqNo.Attributes.Add("onkeypress", "chkNumeric('"+ txtSeqNo.ClientID + "')"); if (Page.IsPostBack != true) { try { txtSeqNo.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtSeqNo.ClientID + "')"); txtmultiplier.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtmultiplier.ClientID + "')"); ViewState["Id"] = Convert.ToInt32(Request.QueryString["SelectedId"]); Session["UpdateID"] = Convert.ToInt32(Request.QueryString["SelectedId"]); ViewState["TableName"] = Request.QueryString["TableName"].ToString(); ViewState["CategoryId"] = Request.QueryString["CategoryId"].ToString(); ViewState["ListName"] = Request.QueryString["LstName"].ToString(); ViewState["FID"] = Request.QueryString["Fid"].ToString(); ViewState["Update"] = Request.QueryString["Upd"].ToString(); if (Request.QueryString["CCID"] != null) { ViewState["CCID"] = Request.QueryString["CCID"].ToString(); } if (Request.QueryString["ModId"].ToString() != "") { ViewState["ModuleId"] = Convert.ToInt32(Request.QueryString["ModId"]); } //(Master.FindControl("lblMark") as Label).Visible = false; //(Master.FindControl("lblRoot") as Label).Text = " » Customize Lists"; //(Master.FindControl("lblheader") as Label).Text = ViewState["ListName"].ToString(); //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Customize Lists >> "; //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = ViewState["ListName"].ToString(); if (ViewState["ListName"].ToString() == "Emergency Contact Relationship") { //(Master.FindControl("lblheader") as Label).Text = "Emerg. Cont. Relationship"; //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Emerg. Cont. Relationship"; } if (ViewState["ListName"].ToString() == "Scheduler - Appointment purpose") { //(Master.FindControl("lblheader") as Label).Text = "Sched. Appoi. Purpose"; //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Sched. Appoi. Purpose"; } if (ViewState["TableName"].ToString() == "Frequency") { divmultiplier.Visible = true; } else { divmultiplier.Visible = false; } txtSeqNo.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtSeqNo.ClientID + "')"); Clear_Fields(); AuthenticationManager Authentication = new AuthenticationManager(); if (Convert.ToInt32(ViewState["Id"]) == 0) { if (Convert.ToInt32(ViewState["FID"]) != 0) { //if(Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]),FunctionAccess.View,(DataTable)Session["UserRight"]) == false ) //{ // btnSave.Enabled = false; //} if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.Add, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } } MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); } IQCareMsgBox.ShowConfirm("CustomSaveRecord", theBuilder, btnSave); if (ViewState["TableName"].ToString() != "HivDisease") { lblHeader.Text = "Add " + ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { lblHeader.Text = "Add " + ViewState["ListName"].ToString(); } } else { lblHeader.Text = "Add OIs or AIDS Defining Illnesses"; } tdStatus.Visible = false; } else { if (Convert.ToInt32(ViewState["FID"]) != 0) { if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.Update, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } } else { if (Authentication.HasFunctionRight(Convert.ToString(ViewState["ListName"]), FunctionAccess.Update, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } } /////////////Imposing Business Rule of Limiting Custom List to Add Only ///////// if (Convert.ToInt32(ViewState["Update"]) != 1) { DataTable DTupdateflag = new DataTable(); ICustomList CustomManager = (ICustomList)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomList, BusinessProcess.Administration"); DTupdateflag = CustomManager.GetCustomListUpdateFlag(Convert.ToString(ViewState["TableName"]), Convert.ToInt32(ViewState["Id"]), Convert.ToInt32(Session["SystemId"].ToString())); if (DTupdateflag.Rows.Count > 0) { if (DTupdateflag.Rows[0]["UpdateFlag"] != System.DBNull.Value) { if (DTupdateflag.Rows[0].IsNull("UpdateFlag") == true) { ViewState["UpdateFlag"] = 0; } else { ViewState["UpdateFlag"] = DTupdateflag.Rows[0]["UpdateFlag"]; } // int UpdateFlag = Convert.ToInt32(DTupdateflag.Rows[0]["UpdateFlag"]); if (Convert.ToInt32(ViewState["UpdateFlag"]) == 0) { btnSave.Enabled = false; } } } } ///////////////////////////////////////////////////////////////////////////////// MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); } IQCareMsgBox.ShowConfirm("CustomUpdateRecord", theBuilder, btnSave); if (ViewState["TableName"].ToString() != "HivDisease") { lblHeader.Text = "Edit " + ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { lblHeader.Text = "Edit " + ViewState["ListName"].ToString(); } } else { lblHeader.Text = "Edit OIs or AIDS Defining Illnesses"; } tdStatus.Visible = false; btnSave.Text = "Update"; tdStatus.Visible = true; } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { ViewState["Id"] = Convert.ToInt32(Request.QueryString["SelectedId"]); if (Request.QueryString["TableName"].ToString() == "PreDefinedFields") { ViewState["TableName"] = "ModDeCode"; } else { ViewState["TableName"] = Request.QueryString["TableName"].ToString(); } ViewState["CategoryId"] = Request.QueryString["CategoryId"].ToString(); ViewState["ListName"] = Request.QueryString["LstName"].ToString(); ViewState["FID"] = Request.QueryString["Fid"].ToString(); ViewState["Update"] = Request.QueryString["Upd"].ToString(); if (Request.QueryString["CCID"] != null) { ViewState["CCID"] = Request.QueryString["CCID"].ToString(); } if (Request.QueryString["ModId"].ToString() != "") { ViewState["ModuleId"] = Convert.ToInt32(Request.QueryString["ModId"]); } (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Customize Lists >> "; (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = ViewState["ListName"].ToString(); txtSeqNo.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtSeqNo.ClientID + "')"); Clear_Fields(); AuthenticationManager Authentication = new AuthenticationManager(); if (Convert.ToInt32(ViewState["Id"]) == 0) { if (Convert.ToInt32(ViewState["FID"]) != 0) { if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.View, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } } MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); } IQCareMsgBox.ShowConfirm("CustomSaveRecord", theBuilder, btnSave); if (ViewState["TableName"].ToString() != "HivDisease") { lblHeader.Text = "Add " + ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { lblHeader.Text = "Add " + ViewState["ListName"].ToString(); } } tdStatus.Visible = false; tdPriority.ColSpan = 2; } else { if (Convert.ToInt32(ViewState["FID"]) != 0) { if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.View, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } } if (Convert.ToInt32(ViewState["Update"]) != 1) { DataTable DTupdateflag = new DataTable(); ICustomList CustomManager = (ICustomList)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomList, BusinessProcess.Administration"); DTupdateflag = CustomManager.GetCustomListUpdateFlag(Convert.ToString(ViewState["TableName"]), Convert.ToInt32(ViewState["Id"]), Convert.ToInt32(Session["SystemId"].ToString())); if (DTupdateflag.Rows[0]["UpdateFlag"] != System.DBNull.Value) { if (DTupdateflag.Rows[0].IsNull("UpdateFlag") == true) { ViewState["UpdateFlag"] = 0; } else { ViewState["UpdateFlag"] = DTupdateflag.Rows[0]["UpdateFlag"]; } if (Convert.ToInt32(ViewState["UpdateFlag"]) == 0) { btnSave.Enabled = false; } } } MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { theBuilder.DataElements["Name"] = ViewState["ListName"].ToString(); } IQCareMsgBox.ShowConfirm("CustomUpdateRecord", theBuilder, btnSave); if (ViewState["TableName"].ToString() != "HivDisease") { lblHeader.Text = "Edit " + ViewState["ListName"].ToString(); if (Convert.ToInt32(ViewState["CategoryId"]) > 0) { lblHeader.Text = "Edit " + ViewState["ListName"].ToString(); } } tdStatus.Visible = false; btnSave.Text = "Update"; tdStatus.Visible = true; } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } }