private void BindList()
        {
            IQCareUtils theUtils = new IQCareUtils();
            DataView    theDV;

            #region "Filter Drug"

            //if(Request.QueryString["DrugType"].ToString()=="37" && Request.QueryString["btnreg"].ToString()=="btnRegimen")
            //{
            //}
            //else{
            theDV = new DataView((DataTable)Session["DrugData"]);//}

            DataTable DTSelected = (DataTable)Session["SelectedData"];

            if (Convert.ToInt32(Session["DrugType"]) > 0)
            {
                theDV.RowFilter = "DrugTypeId = " + Session["DrugType"].ToString();
                //theDV.RowFilter = "DrugTypeId = " + Session["DrugType"].ToString() + " and DrugId <> 1 " ;
            }
            else
            {
                theDV.RowFilter = "DrugTypeId <> 37 ";
                //theDV.RowFilter = "DrugTypeId <> 37  and DrugId <> 1 ";
            }
            DataTable theDT = theUtils.CreateTableFromDataView(theDV);

            #endregion "Filter Drug"

            if (theDT != null)
            {
                DataView theDV1 = new DataView(theDT);
                theDV1.RowFilter = "DrugId <> 203";
                theDV1.Sort      = "DrugName Asc";
                theDT            = theUtils.CreateTableFromDataView(theDV1);
            }

            if (DTSelected != null && DTSelected.Rows.Count > 0)
            {
                foreach (DataRow dr1 in DTSelected.Rows)
                {
                    foreach (DataRow dr in theDT.Rows)
                    {
                        //string drugName = dr["DrugName"].ToString();
                        if ((Convert.ToInt32(dr1["Generic"]) == Convert.ToInt32(dr["Generic"])) && (Convert.ToInt32(dr1["DrugId"]) == Convert.ToInt32(dr["DrugId"])))
                        {
                            theDT.Rows.Remove(dr);
                            break;
                        }
                    }
                }
            }

            //----rupesh for seperating generic and drugid
            if (theDT != null)
            {
                foreach (DataRow theDR in theDT.Rows)
                {
                    if (Convert.ToInt32(theDR["Generic"]) == 0) // its drug
                    {
                        if (theDR["DrugId"].ToString().LastIndexOf("8888") == -1)
                        {
                            theDR["DrugId"] = theDR["DrugId"].ToString() + "8888";
                            if (theDR["Abbr"].ToString() != "")
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString() + "-[" + theDR["Abbr"].ToString() + "]";
                            }
                            else
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString();
                            }
                        }
                    }
                    else if (Convert.ToInt32(theDR["Generic"]) > 0)  // if generic
                    {
                        if (theDR["DrugId"].ToString().LastIndexOf("9999") == -1)
                        {
                            theDR["DrugId"] = theDR["DrugId"].ToString() + "9999";
                            if (theDR["Abbr"].ToString() != "")
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString() + "-[" + theDR["Abbr"].ToString() + "]";
                            }
                            else
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString();
                            }
                        }
                    }
                }

                Session["DrugTable"] = theDT;

                foreach (DataRow theDR in DTSelected.Rows)
                {
                    if (Convert.ToInt32(theDR["Generic"]) == 0) // its drug
                    {
                        if (theDR["DrugId"].ToString().LastIndexOf("8888") == -1)
                        {
                            theDR["DrugId"] = theDR["DrugId"].ToString() + "8888";
                        }
                    }
                    else if (Convert.ToInt32(theDR["Generic"]) > 0) // if generic
                    {
                        if (theDR["DrugId"].ToString().LastIndexOf("9999") == -1)
                        {
                            theDR["DrugId"] = theDR["DrugId"].ToString() + "9999";
                            if (theDR["Abbr"].ToString() != "")
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString() + "-[" + theDR["Abbr"].ToString() + "]";
                            }
                            else
                            {
                                theDR["DrugName"] = theDR["DrugName"].ToString();
                            }
                        }
                    }
                }

                //--------------------------------------------
                BindFunctions theBind = new BindFunctions();

                theBind.BindList(lstDrugList, theDT, "DrugName", "DrugId");
                theBind.BindList(lstSelectedDrug, DTSelected, "DrugName", "DrugId");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Page_Load", "fnClose('lstSelectedDrug');", true);
            }
        }
Example #2
0
        /// <summary>
        /// Binds the list.
        /// </summary>
        private void BindList()
        {
            DataTable theDT    = new DataTable();
            DataTable theTmpDT = new DataTable();

            DataTable DTSelected = new DataTable();

            if (ViewState["SelectedLab"] == null)
            {
                DTSelected.Columns.Add("LabTestID", System.Type.GetType("System.Int32"));
                DTSelected.Columns.Add("LabName", System.Type.GetType("System.String"));
                DTSelected.Columns.Add("SubTestID", System.Type.GetType("System.Int32"));
                DTSelected.Columns.Add("SubTestName", System.Type.GetType("System.String"));
                DTSelected.Columns.Add("LabTypeId", System.Type.GetType("System.Int32"));
                DTSelected.Columns.Add("Flag", System.Type.GetType("System.Int32"));
                DTSelected.Constraints.Add("Con1", DTSelected.Columns["SubTestID"], true);
                ViewState["SelectedLab"] = DTSelected;
            }
            DTSelected = (DataTable)ViewState["SelectedLab"];
            IQCareUtils theUtils = new IQCareUtils();

            if (ViewState["LabData"] != null)
            {
                DataView theDV = new DataView((DataTable)ViewState["LabData"]);
                #region "14-jun-07 - 1"
                // theDV.RowFilter = "LabTypeId=1";
                if (Request.QueryString["Mode"] == "Add")
                {
                    theDV.RowFilter = "LabTypeId=1 and DeleteFlag = 0";
                }
                else if (Request.QueryString["Mode"] == "All")
                {
                    theDV.RowFilter = "DeleteFlag = 0";
                }
                else
                {
                    theDV.RowFilter = "LabTypeId=1";
                }
                #endregion

                theTmpDT = theUtils.CreateTableFromDataView(theDV);
                theDT    = theTmpDT;
            }
            DataView theDV1 = new DataView(theDT);
            theDV1.Sort = "SubTestName Asc";
            theDT       = theUtils.CreateTableFromDataView(theDV1);

            BindFunctions theBind = new BindFunctions();
            theBind.BindList(lstSelectedLab, DTSelected, "SubTestName", "SubTestID");
            //ajay changes begin
            for (int j = 0; j < lstSelectedLab.Items.Count; j++)
            {
                DataRow[] theDR = theDT.Select("SubTestID=" + lstSelectedLab.Items[j].Value);
                if (theDR.Length != 0)
                {
                    theDT.Rows.Remove(theDR[0]);
                }
            }
            //ajay changes end
            ViewState["LabData"] = theDT;
            theBind.BindList(lstLabList, theDT, "SubTestName", "SubTestId");
        }
    private void BindList()
    {
        IDrugMst      DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration");
        BindFunctions theBind     = new BindFunctions();
        IQCareUtils   theUtils    = new IQCareUtils();

        txtAbbv.Visible = false;
        lblAbbv.Visible = false;

        if (ViewState["SelectedData"] == null)
        {
            DataTable Select = MakeSelectedTable();
            ViewState["SelectedData"] = Select;
        }
        string strID = GetGenericID((DataTable)ViewState["SelectedData"]);

        theBind.BindList(lstSelected, (DataTable)ViewState["SelectedData"], "Name", "Id");
        if (Request.QueryString["Type"] == "Generic")
        {
            lblAdd.Text = "Add Generic :";
            if (ViewState["DrugData"] != null)
            {
                DataView theDV = new DataView((DataTable)ViewState["DrugData"]);
                if (strID != "")
                {
                    theDV.RowFilter = "DrugTypeId=" + ViewState["DrugType"].ToString() + " and GenericId not in(" + strID + ")";
                }
                else
                {
                    theDV.RowFilter = "DrugTypeId=" + ViewState["DrugType"].ToString();
                }
                DataTable theDT = theUtils.CreateTableFromDataView(theDV);
                //---- filtered data
                DataTable theDT1 = CreateGenericTable(theDT);
                ViewState["MasterTable"] = theDT1;

                theBind.BindList(lstAvailable, theDT1, "GenericName", "GenericId");
                if (Convert.ToInt32(ViewState["DrugType"]) == 37)
                {
                    txtAbbv.Visible = true;
                    lblAbbv.Visible = true;
                }
            }
        }
        else if (Request.QueryString["Type"] == "Strength")
        {
            lblAdd.Text = "Add Strength :";
            DataView theDV = new DataView(((DataTable)ViewState["DrugData"]));
            theDV.Sort = "StrengthName asc";
            DataTable theDT = theDV.ToTable();
            theBind.BindList(lstAvailable, theDT, "StrengthName", "StrengthId");
            ViewState["MasterTable"] = theDT;
        }
        else if (Request.QueryString["Type"] == "Frequency")
        {
            lblAdd.Text = "Add Frequency :";
            DataTable theDT = (DataTable)ViewState["DrugData"];
            theBind.BindList(lstAvailable, theDT, "Name", "Id");
            ViewState["MasterTable"] = theDT;
        }
        else if (Request.QueryString["Type"] == "Schedule")
        {
            lblAdd.Text = "Add Schedule :";
            DataTable theDT = (DataTable)ViewState["DrugData"];
            theBind.BindList(lstAvailable, theDT, "Name", "Id");
            ViewState["MasterTable"] = theDT;
        }
    }
    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);
        }
        //(Master.FindControl("lblRoot") as Label).Text = " ยป Customize Lists";
        //(Master.FindControl("lblMark") as Label).Visible = false;
        //(Master.FindControl("lblheader") as Label).Text = "Regimen";
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Customize Lists";
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = " >> Regimen";
        if (!IsPostBack)
        {
            GetMasters();
            if (theMasterDS.Tables.Count == 0) // 10Mar08
            {
                RefreshCache();
                return;
            }
            if (Request.QueryString["name"] == "Add")
            {
                lblH2.Text             = "Add Regimen";
                ddStatus.SelectedValue = "0";
            }
            if (Request.QueryString["name"] != null)
            {
                if (Request.QueryString["name"].ToString() == "Edit")
                {
                    lblH2.Text = "Edit Regimen";
                    int intRegimenID = Convert.ToInt32(Request.QueryString["RegimenId"]);
                    Session["rid"] = intRegimenID;
                    BindControl(intRegimenID);
                }
            }

            ViewState["DrugType"]        = theMasterDS.Tables[0];
            ViewState["GenericMaster"]   = theMasterDS.Tables[1];
            ViewState["StrengthMaster"]  = theMasterDS.Tables[2];
            ViewState["FrequencyMaster"] = theMasterDS.Tables[3];
            ViewState["GenericMasterFD"] = theMasterDS.Tables[1];
        }
        if ((Session["SelectedData"] != null) && (Session["SelectedData"].ToString() != ""))
        {
            string theDrugType = "";
            if (Session["Type"] != null)
            {
                theDrugType = Session["Type"].ToString();
            }
            //ViewState["MasterData"] = Session["MasterData"];
            DataTable theDT = (DataTable)Session["SelectedData"];


            if (theDrugType == "Generic")
            {
                BindFunctions BindManager = new BindFunctions();
                ViewState["SelGeneric"]    = theDT;
                ViewState["GenericMaster"] = (DataTable)Session["MasterData"];
                BindManager.BindList(lstGeneric, (DataTable)ViewState["SelGeneric"], "Name", "Id");
            }
            Session.Remove("Type");
            Session.Remove("MasterData");
            Session.Remove("SelectedData");
        }
    }
Example #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DataTable thedt = new DataTable();

            thedt.Columns.Add("Id", System.Type.GetType("System.Int32"));
            thedt.Columns.Add("Name", System.Type.GetType("System.String"));
            string values = hdStrGenID.Value;

            if (hdStrGenID.Value != null || hdStrGenID.Value != string.Empty || hdStrGenID.Value != "")
            {
                if (values.Length > 0)
                {
                    values = values.Remove(values.Length - 1);
                    string[] result = values.Split(new string[] { "," }, StringSplitOptions.None);
                    foreach (string s in result)
                    {
                        string[] newresult = s.Split(new string[] { "-" }, StringSplitOptions.None);
                        DataRow  theDR     = thedt.NewRow();
                        theDR["Id"]   = newresult[1];
                        theDR["Name"] = newresult[0];
                        thedt.Rows.Add(theDR);
                    }

                    //if (lstSelected.Items.Count > 0)
                    //{
                    //    foreach (ListItem lstItem in lstSelected.Items)
                    //    {
                    //        DataRow theDR = thedt.NewRow();
                    //        theDR["Id"] = lstItem.Value;
                    //        theDR["Name"] = lstItem.Value;
                    //        thedt.Rows.Add(theDR);
                    //    }
                    //}
                    BindFunctions theBind = new BindFunctions();
                    if (hdFlag.Value == "Generic")
                    {
                        ViewState["SelGeneric"] = (DataTable)thedt;
                        theBind.BindList(lstGeneric, (DataTable)ViewState["SelGeneric"], "Name", "Id");
                        //--remove selected Generic from from ViewState["StrengthMaster"]
                        if (ViewState["SelGeneric"] != null)
                        {
                            DataTable dtt           = new DataTable();
                            DataTable dtGenMaster   = (DataTable)ViewState["GenericMaster"];
                            DataTable dtGenSelected = (DataTable)ViewState["SelGeneric"];

                            var dtUpdate = new HashSet <int>(dtGenSelected.AsEnumerable()
                                                             .Select(row => row.Field <int>("Id")));

                            var varUnmatched = from all in dtGenMaster.AsEnumerable()
                                               let id = all.Field <int>("GenericId")
                                                        where !dtUpdate.Contains(id)
                                                        select all;
                            DataTable dtInsert = varUnmatched.CopyToDataTable();


                            ViewState["GenericMaster"] = dtInsert;
                        }
                    }
                    else if (hdFlag.Value == "Strength")
                    {
                        ViewState["SelStrength"] = (DataTable)thedt;
                        theBind.BindList(lstStrength, (DataTable)ViewState["SelStrength"], "Name", "Id");
                        //--remove selected strength from from ViewState["StrengthMaster"]
                        if (ViewState["SelStrength"] != null)
                        {
                            DataTable dtStrenthMaster = (DataTable)ViewState["StrengthMaster"];
                            DataTable dtStrnSelected  = (DataTable)ViewState["SelStrength"];

                            var dtUpdate = new HashSet <int>(dtStrnSelected.AsEnumerable()
                                                             .Select(row => row.Field <int>("Id")));

                            var varUnmatched = from all in dtStrenthMaster.AsEnumerable()
                                               let id = all.Field <int>("StrengthId")
                                                        where !dtUpdate.Contains(id)
                                                        select all;
                            DataTable dtStrenInsert = varUnmatched.CopyToDataTable();

                            ViewState["StrengthMaster"] = dtStrenInsert;
                        }
                    }
                }
            }
            string scriptString = "<script language='javascript'> " +
                                  "window.opener.__doPostBack('Submit_OnClick',''); </script>";

            if (!Page.ClientScript.IsClientScriptBlockRegistered(scriptString))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                                                            "script", scriptString);
            }
            mp1.Hide();
        }
Example #6
0
        private void Bind_Controls(int ItemId)
        {
            BindFunctions BindManager   = new BindFunctions();
            IMasterList   theMasterList = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList, BusinessProcess.SCM");
            DataSet       theDS         = theMasterList.GetItemDetails(ItemId);


            if (theDS.Tables[0].Rows.Count > 0)
            {
                if (theDS.Tables[0].Rows[0].IsNull("FDACode") == true)
                {
                    txtItemCode.Text = "";
                }
                else
                {
                    txtItemCode.Text = theDS.Tables[0].Rows[0]["FDACode"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("ItemTypeID") == true)
                {
                    ddlItemType.SelectedValue = "0";
                }
                else
                {
                    ddlItemType.SelectedValue = theDS.Tables[0].Rows[0]["ItemTypeID"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DrugSubTypeId") != true)
                {
                    hdsubtype.Value = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                }

                DataTable theSubDT = PopulateItemSubTypeDT(Convert.ToInt32(ddlItemType.SelectedValue));
                BindManager.BindCombo(ddlItemSubType, theSubDT, "SubTypeName", "SubItemTypeID");
                ddlItemSubType.Attributes.Add("onchange", "ItemSubTypeChange('" + ddlItemSubType.ClientID + "');");
                //ScriptManager.RegisterStartupScript(this, GetType(), "PopulateItemType", "PopulateContinents('" + theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString() + "');", true);
                if (theDS.Tables[0].Rows[0].IsNull("DrugSubTypeId") == true)
                {
                    ddlItemSubType.SelectedValue = "0";
                }
                else
                {
                    ddlItemSubType.SelectedValue = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                    hdsubtype.Value = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                }



                //$('#mycontrolId').val(myvalue).attr("selected", "selected");
                if (theDS.Tables[0].Rows[0].IsNull("RxNorm") == true)
                {
                    txtRxNorm.Text = "";
                }
                else
                {
                    txtRxNorm.Text = theDS.Tables[0].Rows[0]["RxNorm"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("MorDose") == true || theDS.Tables[0].Rows[0]["MorDose"].ToString() == "0")
                {
                    txtMornDose.Text = "";
                }
                else
                {
                    txtMornDose.Text = theDS.Tables[0].Rows[0]["MorDose"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("MidDose") == true || theDS.Tables[0].Rows[0]["MidDose"].ToString() == "0")
                {
                    txtMidDayDose.Text = "";
                }
                else
                {
                    txtMidDayDose.Text = theDS.Tables[0].Rows[0]["MidDose"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("EvenDose") == true || theDS.Tables[0].Rows[0]["EvenDose"].ToString() == "0")
                {
                    txtEvenDose.Text = "";
                }
                else
                {
                    txtEvenDose.Text = theDS.Tables[0].Rows[0]["EvenDose"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("NightDose") == true || theDS.Tables[0].Rows[0]["NightDose"].ToString() == "0")
                {
                    txtNightDose.Text = "";
                }
                else
                {
                    txtNightDose.Text = theDS.Tables[0].Rows[0]["NightDose"].ToString();
                }


                txtTradeName.Text    = theDS.Tables[0].Rows[0]["ItemName"].ToString();
                txtTradeName.Enabled = false;

                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnit") == true)
                {
                    ddlpurchaseunit.SelectedValue = "0";
                }
                else
                {
                    ddlpurchaseunit.SelectedValue = theDS.Tables[0].Rows[0]["PurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("QtyPerPurchaseUnit") == true)
                {
                    txtpurchaseqty.Text = "";
                }
                else
                {
                    txtpurchaseqty.Text = theDS.Tables[0].Rows[0]["QtyPerPurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnitPrice") == true)
                {
                    txtPurUnitPrice.Text = "";
                }
                else
                {
                    txtPurUnitPrice.Text = theDS.Tables[0].Rows[0]["PurchaseUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("Manufacturer") == true)
                {
                    ddlmanufaturer.SelectedValue = "0";
                }
                else
                {
                    ddlmanufaturer.SelectedValue = theDS.Tables[0].Rows[0]["Manufacturer"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnit") == true)
                {
                    ddldispensingunit.SelectedValue = "0";
                }
                else
                {
                    ddldispensingunit.SelectedValue = theDS.Tables[0].Rows[0]["DispensingUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnitPrice") == true)
                {
                    txtDispUnitPrice.Text = "";
                }
                else
                {
                    txtDispUnitPrice.Text = theDS.Tables[0].Rows[0]["DispensingUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingMargin") == true)
                {
                    txtDispMargin.Text = "0";
                }
                else
                {
                    txtDispMargin.Text = theDS.Tables[0].Rows[0]["DispensingMargin"].ToString();
                }
                if ((theDS.Tables[0].Rows[0].IsNull("EffectiveDate") == true) || (Convert.ToDateTime(theDS.Tables[0].Rows[0]["EffectiveDate"]).ToString("dd-MMM-yyyy") == "01-Jan-1900"))
                {
                }
                else
                {
                    txtEffectiveDate.Text = Convert.ToDateTime(theDS.Tables[0].Rows[0]["EffectiveDate"]).ToString("dd-MMM-yyyy");
                }
                if (theDS.Tables[0].Rows[0].IsNull("SellingUnitPrice") == true)
                {
                    txtsellingprice.Text = "";
                }
                else
                {
                    txtsellingprice.Text = theDS.Tables[0].Rows[0]["SellingUnitPrice"].ToString();
                }


                if (theDS.Tables[0].Rows[0].IsNull("ItemInstructions") == true)
                {
                    txtinstructions.Text = "";
                }
                else
                {
                    txtinstructions.Text = theDS.Tables[0].Rows[0]["ItemInstructions"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("syrup") == true)
                {
                    chksyrup.Checked = false;
                }
                else if (theDS.Tables[0].Rows[0]["syrup"].ToString() == "1")
                {
                    chksyrup.Checked      = true;
                    ddlVolumeUnit.Enabled = true;
                }

                if (theDS.Tables[0].Rows[0].IsNull("VolUnit") == true)
                {
                    ddlVolumeUnit.SelectedValue = "0";
                }
                else
                {
                    ddlVolumeUnit.SelectedValue = theDS.Tables[0].Rows[0]["VolUnit"].ToString();
                }

                CalculateSellingPrice();
                collapsepanels();
            }
            if (theDS.Tables[7].Rows.Count > 0)
            {
                string GenericAbbv = "";
                foreach (DataRow DRow in theDS.Tables[7].Rows)
                {
                    if (DRow["Abbrevation"].ToString() != "")
                    {
                        if (GenericAbbv == "")
                        {
                            GenericAbbv = DRow["Abbrevation"].ToString();
                        }
                        else
                        {
                            GenericAbbv = GenericAbbv + '/' + DRow["Abbrevation"].ToString();
                        }
                    }
                    DataTable theSelectedGeneric = MakeSelectedGenericTable();
                    DataRow   theDR1             = theSelectedGeneric.NewRow();
                    theDR1["Drug_pk"]     = ItemId.ToString();
                    theDR1["Id"]          = DRow["ID"];
                    theDR1["Name"]        = DRow["Name"];
                    theDR1["Abbrevation"] = DRow["Abbrevation"];
                    theSelectedGeneric.Rows.Add(theDR1);
                    ViewState["SelGeneric"] = theSelectedGeneric;

                    DataTable DT1 = (DataTable)ViewState["SelGeneric"];
                    theGenericTable = DT1;
                    foreach (DataRow theDR2 in DT1.Rows)
                    {
                        DataTable theDT2 = (DataTable)ViewState["GenericMaster"];
                        DataRow[] DR2    = theDT2.Select("GenericID = " + theDR1["Id"].ToString());
                        if (DR2.Length > 0)
                        {
                            theDT2.Rows.Remove(DR2[0]);
                        }
                        ViewState["GenericMaster"] = theDT2;
                    }
                    txtDrugAbbre.Text = GenericAbbv.ToString();
                }
                BindManager.BindList(lstGeneric, theDS.Tables[7], "Name", "Id");
            }
            if (theDS.Tables[8].Rows.Count > 0)
            {
                BindManager.BindList(lstStrength, theDS.Tables[8], "Name", "Id");
                DataTable SelStrength = theDS.Tables[8];
                //SelStrength.Columns.Add("Abbrevation", System.Type.GetType("System.String"));
                ViewState["SelStrength"] = SelStrength;
                //////// StrengthMaster /////////
                DataTable DT = (DataTable)ViewState["SelStrength"];
                foreach (DataRow theDR in DT.Rows)
                {
                    DataTable theDT = (DataTable)ViewState["StrengthMaster"];
                    DataRow[] DR    = theDT.Select("StrengthId = '" + theDR["Id"].ToString() + "'");
                    if (DR.Length > 0)
                    {
                        theDT.Rows.Remove(DR[0]);
                    }
                    ViewState["StrengthMaster"] = theDT;
                }
            }
            if (theDS.Tables[0].Rows[0]["ItemTypeID"].ToString() == "300")
            {
                lstGeneric.Enabled    = false;
                btnAddGeneric.Enabled = false;
                lstStrength.Enabled   = false;
                btnAddDose.Enabled    = false;
            }
            if (theDS.Tables[9] != null)
            {
                if (theDS.Tables[9].Rows.Count > 0)
                {
                    if (theDS.Tables[9].Rows[0]["BatchId"].ToString() != "0")
                    {
                        gridItemBatchList.DataSource = theDS.Tables[9];
                        gridItemBatchList.DataBind();
                        btnbatchsummary.Visible = true;
                    }
                }
                else
                {
                    btnbatchsummary.Visible = false;
                }
            }
            //ScriptManager.RegisterStartupScript(this, GetType(), "PopulateItmSubT", "PopulateItmSubT('" + theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString() + "');", true);
        }