Ejemplo n.º 1
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            int LabId = 0;

            if (Request.QueryString["LabId"] != "")
            {
                LabId = int.Parse(Request.QueryString["LabId"]);
            }
            //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Customize Lists >> ";
            //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Laboratory Group Items";
            ILabMst  LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
            DataSet  theMainDt  = LabManager.GetLabGroupTests(LabId);
            DataView theDV      = new DataView(theMainDt.Tables[0]);

            theDV.RowFilter = "DataType <>'Group' OR DataType IS NULL ";
            DataTable theDt = theDV.ToTable();

            grdLabs.DataSource = theDt;
            grdLabs.DataBind();
            if (LabId > 0 && theMainDt.Tables[1].Rows.Count > 0)
            {
                txtLabName.Text            = theMainDt.Tables[1].Rows[0]["LabName"].ToString();
                ddDepartment.SelectedValue = theMainDt.Tables[1].Rows[0]["LabDepartmentID"].ToString();
                ddStatus.SelectedValue     = theMainDt.Tables[1].Rows[0]["DeleteFlag"].ToString();
                txtLabName.Enabled         = false;
                ddDepartment.Enabled       = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (FieldValidation() == false)
            {
                return;
            }

            try
            {
                saveLabConfig();

                redirect();
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                LabManager = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (FieldValidation())
            {
                using (DataTable theDT = new DataTable())
                {
                    theDT.Columns.AddRange(new DataColumn[2] {
                        new DataColumn("LabgroupID", typeof(int)), new DataColumn("LabTestID", typeof(int))
                    });
                    foreach (GridViewRow row in grdLabs.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkRow = (row.Cells[1].FindControl("chkLabTest") as CheckBox);
                            if (chkRow.Checked)
                            {
                                string LabID      = (row.Cells[0].FindControl("lblLabTestID") as Label).Text;
                                string LabGroupID = Request.QueryString["LabId"];
                                theDT.Rows.Add(LabGroupID, LabID);
                            }
                        }
                    }
                    ILabMst LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
                    LabManager.SaveLabGroupItems(Convert.ToInt32(Session["AppUserId"]), theDT, int.Parse(Request.QueryString["LabId"]), txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue));

                    string theUrl = "window.location.href='frmAdmin_LaboratoryGroups.aspx?Fid=" + Request.QueryString["Fid"] + "'";
                    IQCareMsgBox.NotifyAction("Saved successfully.", "Lab Groups", false, this, theUrl);
                }
            }
        }
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            using (DataTable theDT = new DataTable())
            {
                theDT.Columns.AddRange(new DataColumn[2] {
                    new DataColumn("LabgroupID", typeof(int)), new DataColumn("LabTestID", typeof(int))
                });
                foreach (GridViewRow row in grdLabs.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        CheckBox chkRow = (row.Cells[1].FindControl("chkLabTest") as CheckBox);
                        if (chkRow.Checked)
                        {
                            string LabID      = (row.Cells[0].FindControl("lblLabTestID") as Label).Text;
                            string LabGroupID = Request.QueryString["LabId"];
                            theDT.Rows.Add(LabGroupID, LabID);
                        }
                    }
                }
                ILabMst LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
                LabManager.SaveLabGroupItems(Convert.ToInt32(Session["AppUserId"]), theDT, int.Parse(Request.QueryString["LabId"]));

                string theUrl = "frmAdmin_LaboratoryGroups.aspx?Fid=" + Request.QueryString["Fid"];

                string script = "<script language = 'javascript' defer ='defer' id = 'confirm'>\n";
                script += "window.alert('Saved successfully.');\n";
                script += "window.location.href='" + theUrl + "';\n";
                script += "</script>\n";
                ClientScript.RegisterStartupScript(this.GetType(), "success", script);
            }
        }
    protected void FillDropDowns()
    {
        LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
        DataSet       theDS       = LabManager.GetDropDowns();
        BindFunctions BindManager = new BindFunctions();

        BindManager.BindCombo(ddDepartment, theDS.Tables[0], "LabDepartmentName", "LabDepartmentID");
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Fills the values drop downs.
        /// </summary>
        protected void FillValuesDropDowns()
        {
            LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
            DataSet       theDDDS     = LabManager.GetDropDowns();
            BindFunctions BindManager = new BindFunctions();

            BindManager.BindCombo(ddDepartment, theDDDS.Tables[0], "LabDepartmentName", "LabDepartmentID");

            if (Request.QueryString["name"] == "Edit")
            {
                int     LabId = Convert.ToInt32(Request.QueryString["LabId"]);
                DataSet theDS = LabManager.GetLabByID(LabId);
                txtLabName.Text = theDS.Tables[0].Rows[0]["LabName"].ToString();
                this.ddDepartment.SelectedValue = theDS.Tables[0].Rows[0]["LabDepartmentID"].ToString();
                this.ddStatus.SelectedValue     = theDS.Tables[0].Rows[0]["DeleteFlag"].ToString();
                //ddlDataType.Items.FindByText(theDS.Tables[0].Rows[0]["dataType"].ToString()).Selected = true;
                if (theDS.Tables[0].Rows[0]["dataType"] != DBNull.Value)
                {
                    //ddlDataType.Items.FindByText(theDS.Tables[0].Rows[0]["dataType"].ToString()).Selected = true;
                    ddlDataType.ClearSelection();
                    ListItem item = ddlDataType.Items.FindByText(theDS.Tables[0].Rows[0]["dataType"].ToString());
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }

                if (ddlDataType.SelectedItem.Text == "Select List")
                {
                    getselectlist(theDS.Tables[2]);
                }
                else if (ddlDataType.SelectedItem.Text == "Numeric")
                {
                    DataSet ds = LabManager.GetSubTestDetails(Convert.ToInt32(Request.QueryString["LabId"]));
                    ViewState["MstDS"] = ds;
                    DataTable  theDT  = ds.Tables[1];
                    DataColumn newCol = new DataColumn("Visible", typeof(bool));
                    newCol.DefaultValue = true;
                    theDT.Columns.Add(newCol);
                    this.BindGrid(ref theDT);
                }
            }
            else
            {
                ViewState["MstDS"] = LabManager.GetSubTestDetails(Convert.ToInt32(Request.QueryString["LabId"]));

                theLabNumerics = ((DataSet)ViewState["MstDS"]).Tables[1];
                DataRow theDR = theLabNumerics.NewRow();
                theDR.SetField(0, 0);
                theLabNumerics.Rows.Add(theDR);

                grdLabUnits.DataSource = theLabNumerics;
                grdLabUnits.DataBind();
                grdLabUnits.Rows[0].Visible = false;
            }
        }
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text   = "Customize Lists >> ";
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Laboratory Group Items";
            ILabMst   LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
            DataTable theMainDt  = LabManager.GetLabGroupTests(int.Parse(Request.QueryString["LabId"]));
            DataView  theDV      = new DataView(theMainDt);

            theDV.RowFilter = "DataType <>'Group' OR DataType IS NULL ";
            DataTable theDt = theDV.ToTable();

            grdLabs.DataSource = theDt;
            grdLabs.DataBind();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Saves the lab configuration.
        /// </summary>
        private void saveLabConfig()
        {
            String saveOption = Request.QueryString["name"];
            int    labID;

            if (saveOption == "Add")
            {
                labID = Convert.ToInt32(ViewState["MainLabId"]);
            }
            else
            {
                labID = Convert.ToInt32(Request.QueryString["LabId"]);
            }

            DataTable theDt = null;

            if (ddlDataType.SelectedItem.Text == "Numeric")
            {
                updateNumericGridData(false);
                theDt = theLabNumerics;
            }
            else if (ddlDataType.SelectedItem.Text == "Select List")
            {
                if (Session["LaboratorySelectList"] != null)
                {
                    theDt = (DataTable)Session["LaboratorySelectList"];
                }
                else
                {
                    IQCareMsgBox.Show("LabSelectList", this);
                    return;
                }
            }

            LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
            DataTable theDTr = LabManager.SaveLabTestConfig(labID, txtLabName.Text.Trim(), Convert.ToInt32(ddDepartment.SelectedValue), Convert.ToInt32(ViewState["UserID"]),
                                                            ddlDataType.SelectedItem.Text, theDt, Convert.ToInt32(ddStatus.SelectedValue), Convert.ToInt32(ViewState["MainLabId"]), saveOption);

            if (theDTr.Rows[0].ToString() == "0")
            {
                IQCareMsgBox.Show("LabExists", this);
                return;
            }
            Session.Remove("LaboratorySelectList");
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (FieldValidation() == false)
        {
            return;
        }

        try
        {
            if (Request.QueryString["name"] == "Add")
            {
                LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
                if ((ddlDataType.SelectedItem.Text == "Text") || (ddlDataType.SelectedItem.Text == "Select List"))
                {
                    theResultDT = LabManager.SaveNewLab(txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), ddlDataType.SelectedItem.Text.ToString(), 0, 0, Convert.ToInt32(this.txtSeq.Text));
                }
                else
                {
                    theResultDT = LabManager.SaveNewLab(txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), ddlDataType.SelectedItem.Text.ToString(), Convert.ToDecimal(txtUpperBoundary.Text), Convert.ToDecimal(txtLowerBoundary.Text), Convert.ToInt32(this.txtSeq.Text));
                }

                if (theResultDT.Rows[0][0].ToString() == "0")
                {
                    IQCareMsgBox.Show("LabExists", this);
                    return;
                }

                if (ddlDataType.SelectedItem.Text == "Select List")
                {
                    if (Session["LaboratorySelectList"] != null)
                    {
                        DataTable dt          = (DataTable)Session["LaboratorySelectList"];
                        int       rowaffected = LabManager.SaveNewLabselectList(Convert.ToInt32(theResultDT.Rows[0][1].ToString()), dt, Convert.ToInt32(ViewState["UserID"]));
                        Session.Remove("LaboratorySelectList");
                    }
                    else
                    {
                        IQCareMsgBox.Show("LabSelectList", this);
                        return;
                    }
                }
            }
            else if (Request.QueryString["name"] == "Edit")
            {
                LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
                if (ViewState["LabValueID"].ToString() == "")
                {
                    if ((ddlDataType.SelectedItem.Text == "Text") || (ddlDataType.SelectedItem.Text == "Select List"))
                    {
                        theResultDT = LabManager.UpdateLab(Convert.ToInt32(Request.QueryString["labid"]), txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), Convert.ToInt32(this.ddStatus.SelectedValue), ddlDataType.SelectedItem.Text.ToString(), 0, 0, 0, Convert.ToInt32(this.txtSeq.Text));
                    }
                    else
                    {
                        theResultDT = LabManager.UpdateLab(Convert.ToInt32(Request.QueryString["labid"]), txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), Convert.ToInt32(this.ddStatus.SelectedValue), ddlDataType.SelectedItem.Text.ToString(), Convert.ToDecimal(txtUpperBoundary.Text), Convert.ToDecimal(txtLowerBoundary.Text), 0, Convert.ToInt32(this.txtSeq.Text));
                    }
                }
                else
                {
                    if ((ddlDataType.SelectedItem.Text == "Text") || (ddlDataType.SelectedItem.Text == "Select List"))
                    {
                        theResultDT = LabManager.UpdateLab(Convert.ToInt32(Request.QueryString["labid"]), txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), Convert.ToInt32(this.ddStatus.SelectedValue), ddlDataType.SelectedItem.Text.ToString(), 0, 0, Convert.ToInt32(ViewState["LabValueID"]), Convert.ToInt32(this.txtSeq.Text));
                    }
                    else
                    {
                        theResultDT = LabManager.UpdateLab(Convert.ToInt32(Request.QueryString["labid"]), txtLabName.Text, Convert.ToInt32(ddDepartment.SelectedValue), 1, Convert.ToInt32(ViewState["UserID"]), Convert.ToInt32(this.ddStatus.SelectedValue), ddlDataType.SelectedItem.Text.ToString(), Convert.ToDecimal(txtUpperBoundary.Text), Convert.ToDecimal(txtLowerBoundary.Text), Convert.ToInt32(ViewState["LabValueID"]), Convert.ToInt32(this.txtSeq.Text));
                    }
                }

                if (theResultDT.Rows[0][0].ToString() == "0")
                {
                    IQCareMsgBox.Show("UpdateLab", this);
                    return;
                }
                if (ddlDataType.SelectedItem.Text == "Select List")
                {
                    if (Session["LaboratorySelectList"] != null)
                    {
                        DataTable dt          = (DataTable)Session["LaboratorySelectList"];
                        int       rowaffected = LabManager.SaveNewLabselectList(Convert.ToInt32(theResultDT.Rows[0][1].ToString()), dt, Convert.ToInt32(ViewState["UserID"]));
                        Session.Remove("LaboratorySelectList");
                    }
                    else
                    {
                        IQCareMsgBox.Show("LabSelectList", this);
                        return;
                    }
                }
            }
            //theURL = "frmAdmin_LabTestlist.aspx";
            string theUrl = string.Format("{0}?Fid={1}", "frmAdmin_LabTestlist.aspx", ViewState["FID"].ToString());
            Response.Redirect(theUrl);
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            return;
        }
        finally
        {
            LabManager = null;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //  (Master.FindControl("lblheader") as Label).Text = "Customise List";
        LabIdforselectList = 0;

        lblH2.Text = Request.QueryString["name"];
        //(Master.FindControl("lblRoot") as Label).Text = " » Customize Lists";
        //(Master.FindControl("lblMark") as Label).Visible = false;
        //(Master.FindControl("lblheader") as Label).Text = "Laboratory";
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text   = "Customize Lists >> ";
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Laboratory";
        ViewState["FID"] = Request.QueryString["Fid"].ToString();
        if (lblH2.Text == "Add")
        {
            ddStatus.Visible   = false;
            lblStatus1.Visible = false;
            lblH2.Text         = "Add Laboratory Test";
            tdDataType.ColSpan = 2;
        }
        else if (lblH2.Text == "Edit")
        {
            lblH2.Text   = "Edit Laboratory Test";
            btnSave.Text = "Update";
            //txtLabName.Enabled = false;
        }
        try
        {
            if (!IsPostBack)
            {
                Session.Remove("LaboratorySelectList");
                ViewState["LabValueID"] = "";
                ddlDataType.Attributes.Add("OnChange", "JavaScript:ShowHideBoundary();");
                txtLowerBoundary.Attributes.Add("onkeyup", "chkDecimal('" + txtLowerBoundary.ClientID + "');");;
                txtUpperBoundary.Attributes.Add("onkeyup", "chkDecimal('" + txtUpperBoundary.ClientID + "');");;
                //txtCD4.Attributes.Add("onkeyup", "chkDecimal('" + txtCD4.ClientID + "');");
                FillDropDowns();
                ViewState["UserID"] = Session["AppUserId"].ToString();
                AuthenticationManager Authentication = new AuthenticationManager();
                if (Convert.ToInt32(ViewState["FID"]) != 0)
                {
                    if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.Add, (DataTable)Session["UserRight"]) == false)
                    {
                        btnSave.Enabled = false;
                    }
                }
                if (Request.QueryString["name"] == "Edit")
                {
                    int LabId;
                    LabId = Convert.ToInt32(Request.QueryString["LabId"]);



                    LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration");
                    DataSet theDS = LabManager.GetLabByID(LabId);
                    this.txtLabName.Text            = theDS.Tables[0].Rows[0]["LabName"].ToString();
                    this.ddDepartment.SelectedValue = theDS.Tables[0].Rows[0]["LabDepartmentID"].ToString();
                    if (theDS.Tables[0].Rows[0]["LabTypeId"].ToString() == "1")
                    {
                        this.txtLabName.Enabled = true;
                        ddDepartment.Enabled    = true;
                        ddlDataType.Enabled     = true;
                    }
                    else
                    {
                        this.txtLabName.Enabled = false;
                        ddDepartment.Enabled    = false;
                        ddlDataType.Enabled     = false;
                    }

                    if (theDS.Tables[0].Rows[0]["DeleteFlag"].ToString() == "1")
                    {
                        this.ddStatus.SelectedValue = "1";
                    }
                    else
                    {
                        this.ddStatus.SelectedValue = "0";
                    }
                    this.txtSeq.Text = (theDS.Tables[0].Rows[0]["Sequence"].ToString() == "") ? "1" : theDS.Tables[0].Rows[0]["Sequence"].ToString();
                    if (theDS.Tables[1].Rows.Count > 0)
                    {
                        if (theDS.Tables[1].Rows[0]["SubTestId"].ToString() != "")
                        {
                            ddlDataType.SelectedIndex = 1; //Numeric
                            //pnlBoundary.Visible = true;
                            //pnlBoundary2.Visible = true;
                            RegisterClientScriptBlock("ShowHideBoundary", "");
                            txtLowerBoundary.Text   = theDS.Tables[1].Rows[0]["MinBoundaryValue"].ToString();
                            txtUpperBoundary.Text   = theDS.Tables[1].Rows[0]["MaxBoundaryValue"].ToString();
                            ViewState["LabValueID"] = theDS.Tables[1].Rows[0]["Id"].ToString(); //id from lnk_labValue
                        }
                        else
                        {
                            //  ddlDataType.SelectedIndex = 0; //Text

                            if (theDS.Tables[2].Rows.Count > 0)
                            {
                                ddlDataType.SelectedIndex = 2; //select list
                                getselectlist(theDS.Tables[2]);

                                LabIdforselectList = Convert.ToInt32(Request.QueryString["LabId"]);
                            }
                            else
                            {
                                ddlDataType.SelectedIndex = 0; //Text
                            }
                            RegisterClientScriptBlock("ShowHideBoundary", "");
                            //pnlBoundary.Visible = false;
                            //pnlBoundary2.Visible = false;
                            txtLowerBoundary.Text = "";
                            txtUpperBoundary.Text = "";
                        }
                    }
                    else
                    {
                        if (theDS.Tables[2].Rows.Count > 0)
                        {
                            ddlDataType.SelectedIndex = 2; //select list
                            getselectlist(theDS.Tables[2]);
                            LabIdforselectList = Convert.ToInt32(Request.QueryString["LabId"]);
                        }
                        else
                        {
                            ddlDataType.SelectedIndex = 0; //Text
                        }
                        RegisterClientScriptBlock("ShowHideBoundary", "");
                        //pnlBoundary.Visible = false;
                        //pnlBoundary2.Visible = false;
                        txtLowerBoundary.Text = "";
                        txtUpperBoundary.Text = "";
                    }
                }
                if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.Update, (DataTable)Session["UserRight"]) == false)
                {
                    btnSave.Enabled = false;
                }
            }
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            return;
        }
        finally
        {
            LabManager = null;
        }
    }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            LabIdforselectList = 0;

            lblH2.Text = Request.QueryString["name"];
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text   = "Customize Lists >> ";
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Laboratory";

            ViewState["FID"] = Request.QueryString["Fid"].ToString();
            if (Request.QueryString["mainLabID"] != null)
            {
                ViewState["MainLabId"] = Convert.ToInt32(Request.QueryString["mainLabID"]);
            }
            else if (Request.QueryString["LabId"] != null)
            {
                ViewState["MainLabId"] = Convert.ToInt32(Request.QueryString["LabId"]);
            }
            else
            {
                ViewState["MainLabId"] = 0;
            }
            if (lblH2.Text == "Add")
            {
                ddStatus.Visible   = false;
                lblStatus1.Visible = false;
                lblH2.Text         = "Add Laboratory Test";
                tdDataType.ColSpan = 2;
            }
            else if (lblH2.Text == "Edit")
            {
                lblH2.Text   = "Edit Laboratory Test";
                btnSave.Text = "Update";
                //txtLabName.Enabled = false;
            }
            try
            {
                if (!IsPostBack)
                {
                    Session.Remove("LaboratorySelectList");
                    ViewState["LabValueID"] = "";
                    ddlDataType.Attributes.Add("OnChange", "JavaScript:ShowHideBoundary();");

                    FillValuesDropDowns();

                    ViewState["UserID"] = Session["AppUserId"].ToString();
                    AuthenticationManager Authentication = new AuthenticationManager();
                    if (Convert.ToInt32(ViewState["FID"]) != 0)
                    {
                        if (Authentication.HasFunctionRight(Convert.ToInt32(ViewState["FID"]), FunctionAccess.View, (DataTable)Session["UserRight"]) == false)
                        {
                            btnSave.Enabled = false;
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                LabManager = null;
            }
        }