protected void Page_Load(object sender, EventArgs e) { //default 0=No : 1=Yes //(Master.FindControl("lblRoot") as Label).Text = "Scheduler"; //(Master.FindControl("lblMark") as Label).Text = ""; //(Master.FindControl("lblMark") as Label).Visible = false; (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Scheduler"; (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = ""; if (Request.QueryString["sts"] != null) { //(Master.FindControl("lblpntStatus") as Label).Text = Request.QueryString["sts"].ToString(); } if (!IsPostBack) { ViewState["a"] = "1"; //---pr_Admin_GetSubTestDetails_Constella , lnk_LabValue rupesh ILabMst LabManager; LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); DataSet theDS = LabManager.GetSubTestDetails(Convert.ToInt32(Request.QueryString["LabId"])); ViewState["MstDS"] = theDS; fillDropDownList(); ddUnit.SelectedIndex = 0; if (((DataSet)ViewState["MstDS"]).Tables[1].Rows.Count > 0) { lblSubTest.Text = ((DataSet)ViewState["MstDS"]).Tables[1].Rows[0][1].ToString(); if (ViewState["grdDataSource"] == null) { ViewState["grdDataSource"] = ((DataSet)ViewState["MstDS"]).Tables[1]; } ViewState["SortDirection"] = "Desc"; grdSearchResult.DataSource = ((DataSet)ViewState["MstDS"]).Tables[1]; BindGrid(); } { //give msg and go to prv page } //RegisterClientScriptBlock("setVisibility('divUnit','divBoundary','divDefault','divButtons', 'none');", ""); //RegisterClientScriptBlock("HideShow();", ""); } else { ViewState["a"] = "2"; } lblSubTest.Text = ((DataSet)ViewState["MstDS"]).Tables[2].Rows[0][0].ToString(); txtUpper.Attributes.Add("onkeyup", "chkNumeric('" + txtUpper.ClientID + "')"); txtLower.Attributes.Add("onkeyup", "chkNumeric('" + txtLower.ClientID + "')"); Page.EnableViewState = true; }
protected void btnSave_Click(object sender, EventArgs e) { //pr_Admin_SaveLabUnitLinks_Constella if (Validation() == true) { int defUnit = 0; string OldID; ILabMst LabManager; LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); DataSet theDS = (DataSet)ViewState["MstDS"]; //---find ID old Default unitl---- DataView theDV = new DataView(theDS.Tables[1]); theDV.RowFilter = "DefaultUnit='Yes'"; if (theDV.Count > 0) { OldID = theDV[0]["ID"].ToString();//ID of Old Default Unit if ((ddDefault.SelectedIndex == 1) && (txtOperation.Value == "")) { DataTable theDT2 = LabManager.ChangeDefaultUnit(Convert.ToInt32(OldID)); } if (ViewState["SelID"] != null) { if (ViewState["SelID"].ToString() != "") { if ((ddDefault.SelectedIndex == 1) && (ViewState["SelID"].ToString() != OldID)) { DataTable theDT2 = LabManager.ChangeDefaultUnit(Convert.ToInt32(OldID)); } } } } if (ViewState["SelID"] != null) // for add { if (ViewState["SelID"].ToString() != "") { //---edit old unit foreach (DataRow theDR in theDS.Tables[1].Rows) { if (theDR["ID"].ToString() == ViewState["SelID"].ToString()) { theDR["UnitID"] = ddUnit.SelectedValue.ToString(); theDR["UnitName"] = ddUnit.SelectedItem.ToString(); theDR["MinBoundaryValue"] = Convert.ToDecimal(txtLower.Text); theDR["MaxBoundaryValue"] = Convert.ToDecimal(txtUpper.Text); //if (ddDefault.SelectedIndex == 0) // theDR["DefaultUnit"] = "No"; //else // theDR["DefaultUnit"] = "Yes"; // ------- convert previous default unit to "No"---- if ((ddDefault.SelectedIndex == 0) & (theDS.Tables[1].Rows.Count >= 0)) { theDR["DefaultUnit"] = "No"; defUnit = 0; } else { theDR["DefaultUnit"] = "Yes"; defUnit = 1; } DataTable theDT2 = LabManager.SaveLabUnitLinks(Convert.ToInt32(ViewState["SelID"]), Convert.ToInt32(theDS.Tables[1].Rows[0][0]), Convert.ToDecimal(txtLower.Text), Convert.ToDecimal(txtUpper.Text), Convert.ToInt32(ddUnit.SelectedValue), defUnit); break; } } } } if ((ViewState["SelID"] == null))//for edit { //---add new unit DataRow theDR = theDS.Tables[1].NewRow(); //theDR["SubTestID"] = theDS.Tables[1].Rows[0][0];//Request.QueryString["LabId"] theDR["SubTestID"] = Request.QueryString["LabId"]; theDR["SubTestName"] = lblSubTest.Text.ToString(); theDR["UnitID"] = ddUnit.SelectedValue.ToString(); theDR["UnitName"] = ddUnit.SelectedItem.ToString(); theDR["MinBoundaryValue"] = Convert.ToDecimal(txtLower.Text); theDR["MaxBoundaryValue"] = Convert.ToDecimal(txtUpper.Text); //---first unit should be "Yes" by default----- if ((ddDefault.SelectedIndex == 0) & (theDS.Tables[1].Rows.Count >= 0)) { theDR["DefaultUnit"] = "No"; defUnit = 0; } else { theDR["DefaultUnit"] = "Yes"; defUnit = 1; } theDS.Tables[1].Rows.Add(theDR); DataTable theDT2 = LabManager.SaveLabUnitLinks(99999, Convert.ToInt32(theDS.Tables[1].Rows[0][0]), Convert.ToDecimal(txtLower.Text), Convert.ToDecimal(txtUpper.Text), Convert.ToInt32(ddUnit.SelectedValue), defUnit); } //--again get saved values from database) LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); theDS = LabManager.GetSubTestDetails(Convert.ToInt32(Request.QueryString["LabId"])); ViewState["MstDS"] = theDS; grdSearchResult.Columns.Clear(); grdSearchResult.DataSource = ((DataSet)ViewState["MstDS"]).Tables[1]; BindGrid(); ViewState["SelID"] = null; ViewState["a"] = 1; txtLower.Text = ""; txtUpper.Text = ""; ddDefault.SelectedIndex = 0; ddUnit.Enabled = true; ddUnit.SelectedIndex = 0; ViewState["grdDataSource"] = ((DataSet)ViewState["MstDS"]).Tables[1]; ViewState["SortDirection"] = "Desc"; txtOperation.Value = "";// 11Jan08 -- it was creating duplicate default unit string theUrl; if (Request.QueryString["name"] == "Add") { theUrl = "frmAdmin_LabTestBoundary.aspx?name=Add"; } else { theUrl = string.Format("{0}LabId={1}", "frmAdmin_LabTestBoundary.aspx?name=" + "Edit" + "&", Request.QueryString["LabId"].ToString()); } Response.Redirect(theUrl); } int a = 2; }
//protected void Page_Init(object sender, EventArgs e) //{ // /***************** Check For User Rights ****************/ // AuthenticationManager Authentiaction = new AuthenticationManager(); // if (Authentiaction.HasFunctionRight(ApplicationAccess.Schedular, FunctionAccess.Update, (DataTable)Session["UserRight"]) == false) // { // //btnSubmit.Enabled = false; // //btnNewAppointment.Enabled = false; // } // if (Authentiaction.HasFunctionRight(ApplicationAccess.Schedular, FunctionAccess.Add, (DataTable)Session["UserRight"]) == false) // { // // btnSubmit.Enabled = false; // //btnNewAppointment.Enabled = false; // } //} 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); } if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "") { IQCareMsgBox.Show("SessionExpired", this); Response.Redirect("~/frmlogin.aspx", true); } (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Scheduler"; (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = ""; if (Request.QueryString["Fid"] != null) { ViewState["FID"] = Request.QueryString["Fid"].ToString(); } if (Request.QueryString["sts"] != null) { //(Master.FindControl("lblpntStatus") as Label).Text = Request.QueryString["sts"].ToString(); } if (!IsPostBack) { ViewState["a"] = "1"; //---pr_Admin_GetSubTestDetails_Constella , lnk_LabValue rupesh ILabMst LabManager; LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); DataSet theDS = LabManager.GetSubTestDetails(Convert.ToInt32(Request.QueryString["LabId"])); ViewState["MstDS"] = theDS; fillDropDownList(); ddUnit.SelectedIndex = 0; if (((DataSet)ViewState["MstDS"]).Tables[1].Rows.Count > 0) { lblSubTest.Text = ((DataSet)ViewState["MstDS"]).Tables[1].Rows[0][1].ToString(); if (ViewState["grdDataSource"] == null) { ViewState["grdDataSource"] = ((DataSet)ViewState["MstDS"]).Tables[1]; } ViewState["SortDirection"] = "Desc"; grdSearchResult.DataSource = ((DataSet)ViewState["MstDS"]).Tables[1]; BindGrid(); } { //give msg and go to prv page } //RegisterClientScriptBlock("setVisibility('divUnit','divBoundary','divDefault','divButtons', 'none');", ""); //RegisterClientScriptBlock("HideShow();", ""); } else { ViewState["a"] = "2"; } lblSubTest.Text = ((DataSet)ViewState["MstDS"]).Tables[2].Rows[0][0].ToString(); txtUpper.Attributes.Add("onkeyup", "chkNumeric('" + txtUpper.ClientID + "')"); txtLower.Attributes.Add("onkeyup", "chkNumeric('" + txtLower.ClientID + "')"); Page.EnableViewState = true; AuthenticationManager Authentication = new AuthenticationManager(); if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.Update, (DataTable)Session["UserRight"]) == false) { btnSave.Enabled = false; } }