Esempio n. 1
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();
        }
Esempio n. 2
0
        //void txtItem_KeyUp(object sender, KeyEventArgs e)
        //{
        //    if (txtItem.Text != "")
        //    {
        //        lstSearch.Visible = true;
        //        lstSearch.Width = txtItem.Width;
        //        lstSearch.Left = txtItem.Left;
        //        lstSearch.Top = txtItem.Top + txtItem.Height;
        //        lstSearch.Height = 300;
        //        DataView theDV = new DataView(dsPOItems.Tables[0]);
        //        theDV.RowFilter = "ItemName like '%" + txtItem.Text + "%'";
        //        if (theDV.Count > 0)
        //        {
        //            DataTable theDT = theDV.ToTable();
        //            BindFunctions theBindManager = new BindFunctions();
        //            theBindManager.Win_BindListBox(lstSearch, theDT, "ItemName", "ItemId");
        //        }
        //        else
        //        {
        //            lstSearch.DataSource = null;
        //        }

        //    }
        //    else
        //    {
        //        lstSearch.Visible = false;
        //    }
        //    if (e.KeyCode == Keys.Down)
        //        lstSearch.Select();

        //}
        void txtQuantity_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBind = new BindFunctions();

            theBind.Win_decimal(e);
        }
Esempio n. 3
0
        private void txtFDACode_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_String(e);
        }
Esempio n. 4
0
        private void txtOpeningQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBind = new BindFunctions();

            theBind.Win_Numeric(e);
        }
    //int VisitID;
    #region "User Functions"
    //int currentDate;
    #region "Modified13June07(1)"
    private void fillDropDownList(int idPurpose, int idEmployee)


    {
        ////*******Get the patient details on the basis of Patient Enrollment Id and show the details.*******//
        //FormManager = (IAppointment)ObjectFactory.CreateInstance("BusinessProcess.Scheduler.BAppointment, BusinessProcess.Scheduler");
        ////DataSet theDtSet = FormManager.GetEmployees(idEmployee);

        //appBind = new BindFunctions();
        //appBind.BindCombo(ddAppProvider, theDtSet.Tables[0],"EmployeeName", "EmployeeId" );

        ////DataSet theDtSetPurpose = FormManager.GetAppointmentReasons(idPurpose);
        //appBind = new BindFunctions();
        //appBind.BindCombo(ddAppPurpose, theDtSetPurpose.Tables[0], "Name", "Id");

        //{
        IAppointment FormManager;

        FormManager = (IAppointment)ObjectFactory.CreateInstance("BusinessProcess.Scheduler.BAppointment, BusinessProcess.Scheduler");
        DataSet       theDtSet        = FormManager.GetEmployees(idEmployee);
        DataSet       theDtSetPurpose = FormManager.GetAppointmentReasons(idPurpose);
        BindFunctions appBind         = new BindFunctions();
        IQCareUtils   theUtils        = new IQCareUtils();

        if (Request.QueryString["Name"] == "Add")
        {
            //if (Convert.ToInt32(Session["PatientVisitId"]) == 0)
            //{
            DataView theDV = new DataView(theDtSet.Tables[0]);
            DataView TheDV = new DataView(theDtSetPurpose.Tables[0]);
            theDV.RowFilter = "DeleteFlag=0";
            TheDV.RowFilter = "DeleteFlag=0";
            DataTable DT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            if (Convert.ToInt32(Session["AppUserEmployeeId"]) > 0)
            {
                theDV           = new DataView(DT);
                theDV.RowFilter = "EmployeeId =" + Session["AppUserEmployeeId"].ToString();
                if (theDV.Count > 0)
                {
                    DT = theUtils.CreateTableFromDataView(theDV);
                }
            }
            DataTable TheDT = (DataTable)theUtils.CreateTableFromDataView(TheDV);
            appBind.BindCombo(ddAppProvider, DT, "EmployeeName", "EmployeeId");
            appBind.BindCombo(ddAppPurpose, TheDT, "Name", "Id");
            theDV.Dispose();
            TheDV.Dispose();
            DT.Clear();
            TheDT.Clear();
        }



        //}


        else if (Request.QueryString["name"] == "Edit" || Request.QueryString["name"] == "Delete")

        {
            BindDropdownOrderBy(theDtSet.Tables[0].Rows[0]["EmployeeName"].ToString());
            this.ddAppProvider.SelectedValue = theDtSet.Tables[0].Rows[0]["EmployeeName"].ToString();

            //appBind.BindCombo(ddAppProvider, theDtSet.Tables[0], "EmployeeName", "EmployeeId");
            appBind.BindCombo(ddAppPurpose, theDtSetPurpose.Tables[0], "Name", "Id");
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text  = "User Group Administration";

            if (Request.QueryString["name"] != null)
            {
                lblh3.Text = Request.QueryString["name"];
            }
            try
            {
                if (Page.IsPostBack != true)
                {
                    if (Request.QueryString["name"] != null)
                    {
                        AunthenticationFunction();
                    }
                    if (lblh3.Text == "Add")
                    {
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Name"] = "User Group Roles";
                        IQCareMsgBox.ShowConfirm("UserGroupDetailSaveRecord", theBuilder, btnsave);
                        lblh3.Text = "Add User Group";
                    }
                    else
                    {
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Name"] = "User Group Roles";
                        IQCareMsgBox.ShowConfirm("UserGroupDetailUpdateRecord", theBuilder, btnsave);
                        lblh3.Text = "Edit User Group";
                    }

                    if (Request.QueryString["name"] != null && Request.QueryString["name"] == "Edit")
                    {
                        GroupId = Convert.ToInt32(Request.QueryString["GroupID"]);
                        IUserRole UserGroupManager;
                        UserGroupManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration");
                        DataSet       theDS       = UserGroupManager.GetUserGroupFeatureList(1, 0);
                        BindFunctions BindManager = new BindFunctions();
                        DataView      DVDD        = new DataView(theDS.Tables[4]);
                        DVDD.RowFilter = "GroupID <> " + GroupId + "";
                        BindManager.BindCombo(ddGroupName, DVDD.ToTable(), "GroupName", "GroupID");
                        ViewState["DataPopulate"] = theDS;
                        //GetGeneralDataforTreeView(theDS.Tables[1]);
                        //GetModuleCustomListTreeView(theDS.Tables[3]);
                        //GetCommonItemsinTreeView(theDS.Tables[0]);
                        //GetSPlPriviledgesinTreeView(theDS.Tables[5]);
                        DataSet theOtherDS = UserGroupManager.GetUserGroupFeatureListByID(GroupId);
                        GetFacilityServiceUserGroupData(theOtherDS);
                        txtusergroupname.Text = Request.QueryString["Grpnm"].ToString();
                    }
                    else if (Request.QueryString["name"] != null && Request.QueryString["name"] == "Add")
                    {
                        IUserRole UserGroupManager;
                        UserGroupManager = (IUserRole)ObjectFactory.CreateInstance("BusinessProcess.Administration.BUserRole, BusinessProcess.Administration");
                        DataSet       theDS       = UserGroupManager.GetUserGroupFeatureList(1, 0);
                        BindFunctions BindManager = new BindFunctions();
                        DataView      DVDD        = new DataView(theDS.Tables[4]);
                        DVDD.RowFilter = "GroupID <> " + GroupId + "";
                        BindManager.BindCombo(ddGroupName, DVDD.ToTable(), "GroupName", "GroupID");
                        ViewState["DataPopulate"] = theDS;
                        //GetGeneralDataforTreeView(theDS.Tables[1]);
                        //GetModuleCustomListTreeView(theDS.Tables[3]);
                        //GetCommonItemsinTreeView(theDS.Tables[0]);
                        //GetSPlPriviledgesinTreeView(theDS.Tables[5]);
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theMsgBuilder = new MsgBuilder();
                theMsgBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theMsgBuilder, this);
                return;
            }
            finally
            {
            }
        }
    private void BindGrid()
    {
        if (ViewState["Sorted"] != null)
        {
            IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");
            DataSet          theDS = PatientTransferMgr.GetSatelliteLocation(PatientId, TransferId, 0, Session["SystemId"].ToString());
            txtLocationName.Text = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
            BindFunctions BindManager = new BindFunctions();
            IQCareUtils   theUtils    = new IQCareUtils();
            DataView      theDV       = new DataView(theDS.Tables[1]);
            DataTable     theDT       = new DataTable();
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddSatellite, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            GrdTransfer.DataSource = theDS.Tables[2];
            if (ViewState["grdDataSource"] == null)
            {
                ViewState["grdDataSource"] = theDS.Tables[2];
            }
        }

        ViewState["Sorted"] = "";
        BoundField theCol0 = new BoundField();

        theCol0.HeaderText           = "ID";
        theCol0.DataField            = "ID";
        theCol0.HeaderStyle.CssClass = "textstylehidden";
        theCol0.ItemStyle.CssClass   = "textstylehidden";
        theCol0.ReadOnly             = true;

        BoundField theCol1 = new BoundField();

        theCol1.HeaderText         = "From Location";
        theCol1.DataField          = "TransferfromSatellite";
        theCol1.ItemStyle.CssClass = "textstyle";
        theCol1.SortExpression     = "TransferfromSatellite";
        theCol1.ReadOnly           = true;

        BoundField theCol2 = new BoundField();

        theCol2.HeaderText         = "To Location";
        theCol2.DataField          = "TransfertoSatellite";
        theCol2.ItemStyle.CssClass = "textstyle";
        theCol2.SortExpression     = "TransfertoSatellite";
        theCol2.ReadOnly           = true;

        BoundField theCol3 = new BoundField();

        theCol3.HeaderText         = "Transferred Date";
        theCol3.DataField          = "TransferredDate";
        theCol3.ItemStyle.CssClass = "textstyle";
        theCol3.SortExpression     = "TransferredDate";
        theCol3.ReadOnly           = true;

        ButtonField theBtn = new ButtonField();

        theBtn.ButtonType           = ButtonType.Link;
        theBtn.CommandName          = "Select";
        theBtn.HeaderStyle.CssClass = "textstylehidden";
        theBtn.ItemStyle.CssClass   = "textstylehidden";

        GrdTransfer.Columns.Add(theCol0);
        GrdTransfer.Columns.Add(theCol1);
        GrdTransfer.Columns.Add(theCol2);
        GrdTransfer.Columns.Add(theCol3);
        GrdTransfer.Columns.Add(theBtn);
        GrdTransfer.DataBind();
    }
        private void BindControls()
        {
            BindFunctions theBindManager = new BindFunctions();
            IQCareUtils   theUtils       = new IQCareUtils();

            theDV = new DataView((DataTable)Session["DrugTable"]);
            DataTable DTSelected = (DataTable)Session["SelectedData"];

            if (Convert.ToInt32(Session["DrugType"]) > 0)
            {
                if (Convert.ToInt32(Session["DrugType"]) == 100)
                {
                    theDV.RowFilter = "DrugTypeId NOT IN (37,36,31) and Generic=0";
                }
                else
                {
                    //theDV.RowFilter = "DrugTypeId = " + Session["DrugType"].ToString();
                    theDV.RowFilter = "DrugTypeId = " + Session["DrugType"].ToString() + " and Generic=0 ";
                }
                theDV.Sort = "DrugName Asc";
            }
            else
            {
                //theDV.RowFilter = "DrugTypeId <> 37 ";
                theDV.RowFilter = "DrugTypeId <> 37  and DrugId <> 1  and Generic=0 ";
            }
            DataTable theDT = theUtils.CreateTableFromDataView(theDV);

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


            if (theDT.Rows.Count > 0)
            {
                theBindManager.BindCheckedList(chkPharmacyselect, theDT, "DrugName", "DrugId");
                theDV.Dispose();
                theDT.Clear();
            }


            if (DTSelected != null && DTSelected.Rows.Count > 0)
            {
                foreach (DataRow dr1 in DTSelected.Rows)
                {
                    foreach (ListItem item in this.chkPharmacyselect.Items)
                    //foreach (DataRow dr in theDT.Rows)
                    {
                        //string drugName = dr["DrugName"].ToString();
                        if (Convert.ToInt32(dr1["DrugId"]) == Convert.ToInt32(item.Value))
                        {
                            //theDT.Rows.Remove(dr);
                            item.Selected = true;
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 9
0
    private void Init_Form()
    {
        txtcountryno.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtcountryno.ClientID + "')");
        txtcountryno.Attributes.Add("onblur", "chkPostiveInteger('" + txtcountryno.ClientID + "')");

        txtLPTF.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtLPTF.ClientID + "')");
        txtLPTF.Attributes.Add("onblur", "chkPostiveInteger('" + txtLPTF.ClientID + "')");

        txtSatelliteID.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtSatelliteID.ClientID + "')");
        txtSatelliteID.Attributes.Add("onblur", "chkPostiveInteger('" + txtSatelliteID.ClientID + "')");
        txtNationalId.Attributes.Add("onKeyup", "chkNumeric('" + txtNationalId.ClientID + "')");

        txtfacilityname.Text      = "";
        txtcountryno.Text         = "";
        txtLPTF.Text              = "";
        txtSatelliteID.Text       = "";
        txtGrace.Text             = "";
        txtPEPFAR_Fund.Text       = "";
        cmbCurrency.SelectedValue = "0";
        if (Session["SystemId"].ToString() == "2")
        {
            paperless.Visible = false;
        }
        //BindCombo();
        //ddBackupTime.SelectedValue = "0";


        BindFunctions BindManager = new BindFunctions();
        IQCareUtils   theUtils    = new IQCareUtils();
        DataSet       theDSXML    = new DataSet();

        theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));

        DataView  theDV = new DataView();
        DataTable theDT = new DataTable();

        /*******/
        theDV           = new DataView(theDSXML.Tables["Mst_District"]);
        theDV.RowFilter = "DeleteFlag=0 and SystemID= " + Session["SystemId"] + "";
        if (theDV.Table != null)
        {
            theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            BindManager.BindCombo(ddldistrict, theDT, "Name", "ID");
            theDV.Dispose();
            theDT.Clear();
        }

        theDV           = new DataView(theDSXML.Tables["Mst_Province"]);
        theDV.RowFilter = "Deleteflag=0 and SystemID=" + Session["SystemId"] + "";
        if (theDV.Table != null)
        {
            theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            BindManager.BindCombo(ddlprovince, theDT, "Name", "ID");
            theDV.Dispose();
            theDT.Clear();
        }
        /////////////////////////////////////////////////
        IFacilitySetup FacilityManager = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration");
        DataSet        theDSFacility   = FacilityManager.GetModuleName();
        DataTable      DT = theDSFacility.Tables[0];

        BindManager.BindCheckedList(cblPMTCT, DT, "modulename", "moduleid");
    }
        public void BindControl(Control cntrl, string fieldname)
        {
            DataTable     thedeCodeDT = new DataTable();
            IQCareUtils   iQCareUtils = new IQCareUtils();
            BindFunctions BindManager = new BindFunctions();
            DataSet       theDSXML    = new DataSet();

            theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));


            DataView theCodeDV = new DataView(theDSXML.Tables["MST_CODE"]);

            theCodeDV.RowFilter = "DeleteFlag=0 and Name='" + fieldname + "'";
            DataTable theCodeDT = (DataTable)iQCareUtils.CreateTableFromDataView(theCodeDV);
            DataView  theDV     = new DataView(theDSXML.Tables["MST_DECODE"]);

            if (fieldname.ToString() != "")
            {
                if (theCodeDT.Rows.Count > 0)
                {
                    theDV.RowFilter = "DeleteFlag=0 and SystemID IN(0," + Convert.ToString(Session["SystemId"]) + ") and CodeID=" + theCodeDT.Rows[0]["CodeId"];
                    theDV.Sort      = "SRNo ASC";
                    thedeCodeDT     = (DataTable)iQCareUtils.CreateTableFromDataView(theDV);
                }
                if (cntrl is CheckBoxList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.BindCheckedList((CheckBoxList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
                else if (cntrl is DropDownList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.BindCombo((DropDownList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
                else if (cntrl is RadioButtonList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.RadioButtonList((RadioButtonList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
            }
            else
            {
                theDV = new DataView(theDSXML.Tables["MST_DECODE"]);
                if (theDV.Table.Rows.Count > 0)
                {
                    theDV.RowFilter = "DeleteFlag=0 and SystemID IN(0," + Convert.ToString(Session["SystemId"]) + ") and CodeID=17 and ModuleId=209";
                    theDV.Sort      = "SRNo ASC";
                    thedeCodeDT     = new DataTable();
                    thedeCodeDT     = (DataTable)iQCareUtils.CreateTableFromDataView(theDV);
                }
                if (cntrl is CheckBoxList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.BindCheckedList((CheckBoxList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
                else if (cntrl is DropDownList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.BindCombo((DropDownList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
                else if (cntrl is RadioButtonList)
                {
                    if (thedeCodeDT.Rows.Count > 0)
                    {
                        BindManager.RadioButtonList((RadioButtonList)cntrl, thedeCodeDT, "Name", "ID");
                    }
                }
            }
        }
    protected void BindDropdown()
    {
        BindFunctions BindManager = new BindFunctions();
        IQCareUtils   theUtils    = new IQCareUtils();
        DataSet       theDSXML    = new DataSet();

        theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));

        DataView  theDV = new DataView();
        DataTable theDT = new DataTable();

        //if (Request.QueryString["Name"] == "Add")
        if (Convert.ToInt32(Session["PatientId"]) == 0)
        {
            //Marital Status
            theDV           = new DataView(theDSXML.Tables["Mst_Decode"]);
            theDV.RowFilter = "DeleteFlag=0 and CodeID=12 and SystemID IN(" + Session["SystemId"].ToString() + ",0)";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(DDMaritalStatus, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            //Referred From
            theDV           = new DataView(theDSXML.Tables["mst_pmtctdecode"]);
            theDV.RowFilter = "CodeID=28 and SystemID IN(" + Session["SystemId"].ToString() + ", 0) and DeleteFlag=0";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddReferredFrom, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }

            // Village/Town/City
            theDV           = new DataView(theDSXML.Tables["mst_Village"]);
            theDV.RowFilter = "SystemID IN(" + Session["SystemId"].ToString() + ", 0) and DeleteFlag=0";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddVillageName, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }

            //District
            theDV           = new DataView(theDSXML.Tables["Mst_District"]);
            theDV.RowFilter = "SystemID IN (" + Session["SystemId"].ToString() + ",0) and DeleteFlag=0";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddDistrict, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            //Transferring Information from FindAdd /ART Enrolment Form
        }
        else
        {
            //Marital Status
            theDV           = new DataView(theDSXML.Tables["Mst_Decode"]);
            theDV.RowFilter = "CodeID=12 and SystemID IN(" + Session["SystemId"].ToString() + ",0)";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(DDMaritalStatus, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            //Referred From
            theDV           = new DataView(theDSXML.Tables["mst_pmtctdecode"]);
            theDV.RowFilter = "CodeID=28 and SystemID IN(" + Session["SystemId"].ToString() + ",0)";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddReferredFrom, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }

            // Village/Town/City
            theDV           = new DataView(theDSXML.Tables["mst_Village"]);
            theDV.RowFilter = "SystemID IN(" + Session["SystemId"].ToString() + ",0)";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddVillageName, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }

            //District
            theDV           = new DataView(theDSXML.Tables["Mst_District"]);
            theDV.RowFilter = "SystemID IN(" + Session["SystemId"].ToString() + ",0)";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddDistrict, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
        }

        if (!IsPostBack)
        {
            //if (Session["PatientId"] == null || Convert.ToString(Session["PatientId"]) == "0")
            //{
            //    Session["PatientId"] = Request.QueryString["PatientId"];
            //}


            //if (Request.QueryString["PatientID"] == null)
            if (Session["PatientId"] == null || System.Convert.ToInt32(Session["PatientId"]) == 0)
            {
                Hashtable theHT = (Hashtable)Session["EnrollParams"];
                TxtFirstName.Text = theHT["FirstName"].ToString();
                TxtLastName.Text  = theHT["LastName"].ToString();
                //txthospitalID.Text = theHT["ClinicNo"].ToString();
                TxtDOB.Text   = theHT["Date of Birth"].ToString();
                DDGender.Text = theHT["Sex"].ToString();
                Session.Remove("EnrollParams");
            }
            else
            {
                IPatientRegistration MgrPMTCT = (IPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter);
                int patientID = System.Convert.ToInt32(Session["PatientId"]); //Convert.ToInt32(Request.QueryString["PatientID"]);
                ViewState["ptnid"] = patientID;
                DataTable RecordDT = MgrPMTCT.GetPatientRecord(patientID);
                this.TxtLastName.Text       = RecordDT.Rows[0]["LastName"].ToString();
                this.TxtFirstName.Text      = RecordDT.Rows[0]["FirstName"].ToString();
                this.DDGender.SelectedValue = RecordDT.Rows[0]["Sex"].ToString();
                this.TxtDOB.Text            = ((DateTime)RecordDT.Rows[0]["DOB"]).ToString(Session["AppDateFormat"].ToString());
            }

            /////////////////////////////////////////////////////////////////////////////////////////////////
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            Boolean blnCD4 = false; // blnCD4hasValue,blnCD4%hasValue,blnTLChasValue,blnTLC%hasValue

            Boolean blnTLC    = false;
            Boolean blnTLCPer = false;

            if (!IsPostBack == true)
            {
                htCD4TLC = (Hashtable)Session["htCD4TLC"];

                if (htCD4TLC["CD4"] != null)
                {
                    if (htCD4TLC["CD4"].ToString() != "")
                    {
                        txtCD4.Text = htCD4TLC["CD4"].ToString();
                        blnCD4      = true;
                    }
                }

                if (htCD4TLC["CD4Percent"] != null)
                {
                    if (htCD4TLC["CD4Percent"].ToString() != "")
                    {
                        txtCD4Percent.Text = htCD4TLC["CD4Percent"].ToString();
                    }
                }

                if (htCD4TLC["TLC"] != null)
                {
                    if (htCD4TLC["TLC"].ToString() != "")
                    {
                        txtTLC.Text = htCD4TLC["TLC"].ToString();
                        blnTLC      = true;
                    }
                }

                if (htCD4TLC["TLCPercent"] != null)
                {
                    if (htCD4TLC["TLCPercent"].ToString() != "")
                    {
                        txtTLCPercent.Text = htCD4TLC["TLCPercent"].ToString();
                        blnTLCPer          = true;
                    }
                }

                if (htCD4TLC["OrderedBy"] != null)
                {
                    if (htCD4TLC["OrderedBy"].ToString() != "")
                    {
                        ddlOrderedbyName.SelectedValue = htCD4TLC["OrderedBy"].ToString();
                    }
                }

                if (htCD4TLC["OrderedDate"] != null)
                {
                    if (htCD4TLC["OrderedDate"].ToString() != "")
                    {
                        txtOrderedDate.Value = Convert.ToDateTime(htCD4TLC["OrderedDate"].ToString()).ToString(Session["AppDateFormat"].ToString());
                    }
                }

                if (htCD4TLC["ReportedBy"] != null)
                {
                    if (htCD4TLC["ReportedBy"].ToString() != "")
                    {
                        ddlReportedBy.SelectedValue = htCD4TLC["ReportedBy"].ToString();
                    }
                }

                if (htCD4TLC["ReportedDate"] != null)
                {
                    if (htCD4TLC["ReportedDate"].ToString() != "")
                    {
                        txtReportedDate.Value = Convert.ToDateTime(htCD4TLC["ReportedDate"].ToString()).ToString(Session["AppDateFormat"].ToString());
                    }
                }

                BindFunctions theBindMgr = new BindFunctions();
                theBindMgr.BindCombo(ddlOrderedbyName, ((DataTable)Session["Employee"]), "EmployeeName", "EmployeeId");
                theBindMgr.BindCombo(ddlReportedBy, ((DataTable)Session["Employee"]), "EmployeeName", "EmployeeId");

                if (Session["WhyEligible"].ToString() == "CD4 count/%")
                {
                    if (blnCD4 == false && blnCD4 == false)
                    {
                        ddlOrderedbyName.SelectedValue = "0";
                        ddlReportedBy.SelectedValue    = "0";
                        txtOrderedDate.Value           = "";
                        txtReportedDate.Value          = "";
                    }
                }
                else
                {
                    if (blnTLC == false && blnTLCPer == false)
                    {
                        ddlOrderedbyName.SelectedValue = "0";
                        ddlReportedBy.SelectedValue    = "0";
                        txtOrderedDate.Value           = "";
                        txtReportedDate.Value          = "";
                    }
                }

                if (Session["WhyEligible"].ToString() == "CD4 count/%")
                {
                    divTLC.Visible        = false;
                    divTLCPercent.Visible = false;

                    if (htCD4TLC["LABID"] != null)
                    {
                        if (htCD4TLC["LABID"].ToString() == "0")
                        {
                            txtCD4.ReadOnly          = false;
                            txtCD4Percent.ReadOnly   = false;
                            btnSubmit.Enabled        = true;
                            ddlOrderedbyName.Enabled = true;
                            ddlReportedBy.Enabled    = true;
                            txtOrderedDate.Disabled  = false;
                            txtReportedDate.Disabled = false;
                        }
                        else
                        {
                            txtCD4.ReadOnly          = true;
                            txtCD4Percent.ReadOnly   = true;
                            btnSubmit.Enabled        = false;
                            ddlOrderedbyName.Enabled = false;
                            ddlReportedBy.Enabled    = false;
                            txtOrderedDate.Disabled  = true;
                            txtReportedDate.Disabled = true;
                        }
                    }
                }
                else
                {
                    divCD4.Visible        = false;
                    divCD4Percent.Visible = 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);
        }
        //(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");
        }
    }
        private void CreateMultiSelectwithDate(int reqflg, System.Web.UI.WebControls.Panel DIVCustomItem, string fieldlabel, string fieldlabel2, string fieldlabel3, string fieldname)
        {
            //DIVCustomItem.CssClass = "center formbg";
            //DIVCustomItem.Controls.Add(new LiteralControl("</br>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<table cellspacing='6' cellpadding='0' width='100%' border='0'>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<td class='border center pad5 whitebg' colspan='2' style='width: 50%'>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<div class='customdivborder leftallign' runat='server' nowrap='nowrap'>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<table width=100%>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<td width='30%' align='left'>"));

            if (reqflg == 1)
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<label class='required' align='left' id='lbl-" + fieldlabel + "'>" + fieldlabel + " </label>"));
            }
            else
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<label align='left' id='lbl-" + fieldlabel + "'>" + fieldlabel + " </label>"));
            }
            DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<td width='20%' align='left'>"));
            if (reqflg == 1)
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<label class='required' align='left' id='lbl-" + fieldlabel2 + "'>" + fieldlabel2 + " </label>"));
            }
            else
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<label align='left' id='lbl-" + fieldlabel2 + "'>" + fieldlabel2 + " </label>"));
            }
            DIVCustomItem.Controls.Add(new LiteralControl("</td>"));

            if (hiddateshow.Value == "SHOW")
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<td width='25%'>"));
                DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
                //start
                DIVCustomItem.Controls.Add(new LiteralControl("<td width='20%' align='left'>"));
                if (reqflg == 1)
                {
                    DIVCustomItem.Controls.Add(new LiteralControl("<label class='required' align='left' id='lbl-" + fieldlabel3 + "'>" + fieldlabel3 + " </label>"));
                }
                else
                {
                    DIVCustomItem.Controls.Add(new LiteralControl("<label align='center' id='lbl-" + fieldlabel3 + "'>" + fieldlabel3 + " </label>"));
                }
                DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            }
            //end
            if (hiddateshow.Value == "HIDE")
            {
                DIVCustomItem.Controls.Add(new LiteralControl("<td width='25%'>"));
                DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            }
            DIVCustomItem.Controls.Add(new LiteralControl("<td width='25%'>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("<td colspan='4' class='border'>"));

            //WithPanel
            System.Web.UI.WebControls.Panel PnlMulti = new System.Web.UI.WebControls.Panel();
            PnlMulti.ID      = "Pnl_-" + fieldname;
            PnlMulti.ToolTip = fieldlabel;
            PnlMulti.Controls.Add(new LiteralControl("<div class='customdivborder1 leftallign' runat='server' nowrap='nowrap'>"));
            IQCareUtils theUtils = new IQCareUtils();
            DataSet     theDSXML = new DataSet();

            theDSXML.ReadXml(MapPath("..\\..\\XMLFiles\\AllMasters.con"));
            DataView theCodeDV = new DataView(theDSXML.Tables["MST_CODE"]);

            theCodeDV.RowFilter = "DeleteFlag=0 and Name='" + fieldname + "'";
            DataTable theCodeDT = (DataTable)theUtils.CreateTableFromDataView(theCodeDV);
            DataTable theDT     = new DataTable();

            if (theCodeDT.Rows.Count > 0)
            {
                DataView theDV = new DataView(theDSXML.Tables["MST_DECODE"]);
                theDV.RowFilter = "DeleteFlag=0 and SystemID IN(0," + Convert.ToString(Session["SystemId"]) + ") and CodeID=" + theCodeDT.Rows[0]["CodeId"];

                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            }
            BindFunctions BindManager = new BindFunctions();

            if (theDT != null)
            {
                for (int i = 0; i < theDT.Rows.Count; i++)
                {
                    // Dates Control creation for multi Select list
                    //Date 1 Control
                    TextBox theDate1 = new TextBox();
                    theDate1.ID = "TXTDT1-" + theDT.Rows[i][0] + "-" + fieldname;
                    Control ctl = (TextBox)theDate1;
                    theDate1.Width     = 83;
                    theDate1.MaxLength = 11;
                    theDate1.Attributes.Add("onkeyup", "DateFormat(this,this.value,event,false,'3')");


                    //string thDTVar = "ctl00_IQCareContentPlaceHolder_" + DIVCustomItem.ID + "_" + theDate1.ClientID;
                    string thDTVar = theDate1.ClientID;
                    theDate1.Attributes.Add("onblur", "DateFormat(this, this.value,event,true,'3'); isCheckValidDate('" + Application["AppCurrentDate"] + "', '" + thDTVar + "', '" + thDTVar + "')");

                    Image theDateImage1 = new Image();
                    theDateImage1.ID     = "img" + theDate1.ID;
                    theDateImage1.Height = 22;
                    theDateImage1.Width  = 22;
                    //theDateImage1.Visible = theEnable;
                    theDateImage1.ToolTip  = "Date Helper";
                    theDateImage1.ImageUrl = "~/images/cal_icon.gif";
                    theDateImage1.Attributes.Add("onClick", "w_displayDatePicker('" + ((TextBox)ctl).ClientID + "');");
                    theDate1.Visible      = false;
                    theDateImage1.Visible = false;

                    //date 2 start

                    TextBox theDate2 = new TextBox();
                    theDate2.ID = "TXTDT2-" + theDT.Rows[i][0] + "-" + fieldname;
                    Control ctl1 = (TextBox)theDate2;
                    theDate2.Width     = 83;
                    theDate2.MaxLength = 11;
                    theDate2.Attributes.Add("onkeyup", "DateFormat(this,this.value,event,false,'3')");


                    //string thDTVar = "ctl00_IQCareContentPlaceHolder_" + DIVCustomItem.ID + "_" + theDate1.ClientID;
                    string thDTVar1 = theDate2.ClientID;
                    theDate2.Attributes.Add("onblur", "DateFormat(this, this.value,event,true,'3'); isCheckValidDate('" + Application["AppCurrentDate"] + "', '" + thDTVar1 + "', '" + thDTVar1 + "')");

                    Image theDateImage2 = new Image();
                    theDateImage2.ID     = "img" + theDate2.ID;
                    theDateImage2.Height = 22;
                    theDateImage2.Width  = 22;
                    //theDateImage1.Visible = theEnable;
                    theDateImage2.ToolTip  = "Date Helper";
                    theDateImage2.ImageUrl = "~/images/cal_icon.gif";
                    theDateImage2.Attributes.Add("onClick", "w_displayDatePicker('" + ((TextBox)ctl1).ClientID + "');");
                    theDate2.Visible      = false;
                    theDateImage2.Visible = false;


                    //
                    CheckBox chkbox = new CheckBox();
                    chkbox.ID   = Convert.ToString("CHKMULTI-" + theDT.Rows[i][0] + "-" + fieldname);
                    chkbox.Text = Convert.ToString(theDT.Rows[i]["Name"]);

                    PnlMulti.Controls.Add(chkbox);
                    PnlMulti.Controls.Add(theDate1);
                    PnlMulti.Controls.Add(new LiteralControl("&nbsp;"));
                    PnlMulti.Controls.Add(theDateImage1);
                    PnlMulti.Controls.Add(new LiteralControl("<span class='smallerlabel'>(DD-MMM-YYYY)</span>"));
                    chkbox.Width = 210;
                    if (hiddateshow.Value == "HIDE")
                    {
                        PnlMulti.Controls.Add(new LiteralControl("<br/>"));
                    }
                    theDate1.Visible      = true;
                    theDateImage1.Visible = true;
                    //
                    if (hiddateshow.Value == "SHOW")
                    {
                        PnlMulti.Controls.Add(new LiteralControl("&nbsp;"));
                        PnlMulti.Controls.Add(new LiteralControl("&nbsp;"));
                        PnlMulti.Controls.Add(theDate2);
                        PnlMulti.Controls.Add(new LiteralControl("&nbsp;"));
                        PnlMulti.Controls.Add(theDateImage2);
                        PnlMulti.Controls.Add(new LiteralControl("<span class='smallerlabel'>(DD-MMM-YYYY)</span>"));
                        PnlMulti.Controls.Add(new LiteralControl("<br/>"));
                        theDate2.Visible      = true;
                        theDateImage2.Visible = true;
                    }
                }
            }
            PnlMulti.Controls.Add(new LiteralControl("</div>"));

            DIVCustomItem.Controls.Add(PnlMulti);
            //ApplyBusinessRules(PnlMulti, ControlID, theEnable);
            //PnlMulti.Enabled = theEnable;
            DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</table>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</div>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</td>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</tr>"));
            DIVCustomItem.Controls.Add(new LiteralControl("</table>"));
        }
Esempio n. 15
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");
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            if (lstAvailable.SelectedIndex >= 0)
            {
                BindFunctions BindManager = new BindFunctions();
                IQCareUtils   theUtils    = new IQCareUtils();

                if (Request.QueryString["Type"] == "Strength")
                {
                    DataRow   theDR;
                    DataTable theDTAvail = (DataTable)ViewState["MasterTable"];

                    DataTable theDTSel = (DataTable)ViewState["SelectedData"];

                    DataView theDV = new DataView(theDTAvail);
                    theDV.RowFilter = "StrengthId =" + lstAvailable.SelectedValue;
                    theDR           = theDTSel.NewRow();
                    theDR[0]        = Convert.ToInt32(theDV[0][0]);
                    theDR[1]        = theDV[0][1].ToString();
                    theDTSel.Rows.Add(theDR);
                    lstSelected.DataSource = theDTSel;
                    lstSelected.DataBind();
                    ViewState["SelectedData"] = theDTSel;

                    DataRow[] theDR1 = theDTAvail.Select("StrengthId='" + lstAvailable.SelectedValue + "'");
                    theDTAvail.Rows.Remove(theDR1[0]);
                    lstAvailable.DataSource = theDTAvail;
                    lstAvailable.DataBind();
                    ViewState["MasterTable"] = theDTAvail;
                }
                else if (Request.QueryString["Type"] == "Frequency")
                {
                    DataRow   theDR;
                    DataTable theDTAvail = (DataTable)ViewState["MasterTable"];

                    DataTable theDTSel = (DataTable)ViewState["SelectedData"];

                    DataView theDV = new DataView(theDTAvail);
                    theDV.RowFilter = "Id =" + lstAvailable.SelectedValue;
                    theDR           = theDTSel.NewRow();
                    theDR[0]        = Convert.ToInt32(theDV[0][0]);             ////(lstAvailable.SelectedValue);
                    theDR[1]        = theDV[0][1].ToString();
                    theDTSel.Rows.Add(theDR);
                    lstSelected.DataSource = theDTSel;
                    lstSelected.DataBind();
                    ViewState["SelectedData"] = theDTSel;

                    theDR = null;
                    theDV.Dispose();
                    // theDR[2] = "";
                    /////lstAvailable.SelectedItem.Text;

                    DataRow[] theDR1;
                    theDR1 = theDTAvail.Select("Id='" + lstAvailable.SelectedValue + "'");
                    theDTAvail.Rows.Remove(theDR1[0]);
                    lstAvailable.DataSource = theDTAvail;
                    lstAvailable.DataBind();
                    ViewState["MasterTable"] = theDTAvail;
                }
                else if (Request.QueryString["Type"] == "Schedule")
                {
                    DataRow   theDR;
                    DataTable theDTAvail = (DataTable)ViewState["MasterTable"];

                    DataTable theDTSel = (DataTable)ViewState["SelectedData"];

                    DataView theDV = new DataView(theDTAvail);
                    theDV.RowFilter = "Id =" + lstAvailable.SelectedValue;
                    theDR           = theDTSel.NewRow();
                    theDR[0]        = Convert.ToInt32(theDV[0][0]);             ////(lstAvailable.SelectedValue);
                    theDR[1]        = theDV[0][1].ToString();
                    theDTSel.Rows.Add(theDR);
                    lstSelected.DataSource = theDTSel;
                    lstSelected.DataBind();
                    ViewState["SelectedData"] = theDTSel;

                    theDR = null;
                    theDV.Dispose();
                    // theDR[2] = "";
                    /////lstAvailable.SelectedItem.Text;

                    DataRow[] theDR1;
                    theDR1 = theDTAvail.Select("Id='" + lstAvailable.SelectedValue + "'");
                    theDTAvail.Rows.Remove(theDR1[0]);
                    lstAvailable.DataSource = theDTAvail;
                    lstAvailable.DataBind();
                    ViewState["MasterTable"] = theDTAvail;
                }
                else
                {
                    DataRow   theDR;
                    DataTable theDTAvail = (DataTable)ViewState["MasterTable"];

                    //if (ViewState["DrugStrengthSel"] != null)
                    //{
                    DataTable theDTSel = (DataTable)ViewState["SelectedData"];

                    DataView theDV = new DataView(theDTAvail);
                    theDV.RowFilter = "GenericId =" + lstAvailable.SelectedValue;
                    theDR           = theDTSel.NewRow();
                    theDR[0]        = Convert.ToInt32(theDV[0][0]);             ////(lstAvailable.SelectedValue);
                    theDR[1]        = theDV[0][1].ToString();
                    theDR[2]        = theDV[0]["GenericAbbrevation"];
                    /////lstAvailable.SelectedItem.Text;
                    theDTSel.Rows.Add(theDR);
                    lstSelected.DataSource = theDTSel;
                    lstSelected.DataBind();
                    ViewState["SelectedData"] = theDTSel;

                    DataRow[] theDR1 = theDTAvail.Select("GenericId=" + lstAvailable.SelectedValue);
                    theDTAvail.Rows.Remove(theDR1[0]);
                    lstAvailable.DataSource = theDTAvail;
                    lstAvailable.DataBind();
                    ViewState["MasterTable"] = theDTAvail;
                }
            }
            else
            {
                IQCareMsgBox.Show("NoItemToAdd", this);
            }
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
        }
    }
    /*  private void BindTextBox()
     * {
     *    DataSet theDS = new DataSet();
     *    IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");
     *    theDS = PatientTransferMgr.GetSatelliteLocation(PatientId, LocationId, SatelliteId, TransferId, 0);
     *    txtLocationName.Text = theDS.Tables[2].Rows[0]["CurrentSatellite"].ToString();
     *    txtTransferDate.Text = theDS.Tables[2].Rows[0]["TransferredDate"].ToString();
     *    //ddSatellite.SelectedValue = theDS.Tables[2].Rows[0]["TransfertoSatellite"].ToString();
     *    ddSatellite.SelectedValue = "0";
     * }*/
    private void BindTransferDetail()
    {
        txtLocationName.Text     = Session["AppLocation"].ToString();
        txtLocationName.ReadOnly = true;

        /*Binding Satellite ID*/
        BindFunctions BindManager = new BindFunctions();
        IQCareUtils   theUtils    = new IQCareUtils();
        DataTable     theDT       = new DataTable();

        DataSet          theDS = new DataSet();
        IPatientTransfer PatientTransferMgr = (IPatientTransfer)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientTransfer, BusinessProcess.Clinical");

        if (btnSave.Text == "Save")
        {
            tredit.Visible       = false;
            theDS                = PatientTransferMgr.GetSatelliteLocation(PatientId, TransferId, 0, Session["SystemId"].ToString());
            txtLocationName.Text = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
            //this.lblpatientname.Text = theDS.Tables[0].Rows[0]["PatientName"].ToString();
            //this.lblpatientenrolment.Text = theDS.Tables[0].Rows[0]["PatientID"].ToString();
            //this.lblexisclinicid.Text = theDS.Tables[0].Rows[0]["PatientClinicID"].ToString();
            DataView theDV = new DataView(theDS.Tables[1]);
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddSatellite, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
        }
        /*Current Location*/
        //ViewState["FromID"] = theDS.Tables[0].Rows[0]["ID"].ToString();
        //txtLocationName.Text = theDS.Tables[0].Rows[0]["Name"].ToString();

        if (btnSave.Text == "Update")
        {
            tredit.Visible = true;
            theDS          = PatientTransferMgr.GetSatelliteLocation(PatientId, TransferId, 1, Session["SystemId"].ToString());
            // this.lblpatientname.Text = theDS.Tables[0].Rows[0]["PatientName"].ToString();
            // this.lblpatientenrolment.Text = theDS.Tables[0].Rows[0]["PatientID"].ToString();
            // this.lblexisclinicid.Text = theDS.Tables[0].Rows[0]["PatientClinicID"].ToString();
            txtLocationNameEdit.Text    = theDS.Tables[0].Rows[0]["CurrentSatName"].ToString();
            txtLocationNameEdit.Enabled = false;
            txtFromSatellite.Text       = theDS.Tables[2].Rows[0]["TransferfromSatellite"].ToString();
            txtFromSatellite.Enabled    = false;
            ViewState["FromID"]         = theDS.Tables[2].Rows[0]["TransferredfromID"].ToString();
            //ddSatelliteEdit.Enabled = false;
            TxtTransDateEdit.Text     = string.Format("{0:dd-MMM-yyyy}", Convert.ToDateTime(theDS.Tables[2].Rows[0]["TransferredDate"]));
            ViewState["TransferDate"] = TxtTransDateEdit.Text;
            DataView theDV = new DataView(theDS.Tables[1]);
            //theDV.RowFilter = "DeleteFlag=0";
            if (theDV.Table != null)
            {
                theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                BindManager.BindCombo(ddSatelliteEdit, theDT, "Name", "ID");
                theDV.Dispose();
                theDT.Clear();
            }
            ddSatelliteEdit.SelectedValue = theDS.Tables[2].Rows[0][3].ToString();
        }


        /* else
         * {
         *   theDV = new DataView(theDS.Tables[1]);
         *   theDV.RowFilter = "DeleteFlag=0";
         *   if (theDV.Table != null)
         *   {
         *       theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
         *       BindManager.BindCombo(ddSatellite, theDT, "Name", "ID");
         *       theDV.Dispose();
         *       theDT.Clear();
         *   }
         * }
         */
    }
    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;
        }
    }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            Session["dtWaitingList"]       = null;
            Session["WLTechnicalArea"]     = null;
            Session["WLTechnicalAreaName"] = null;
            Session["WLPatientID"]         = 0;
            btnSubmit.Enabled = false;


            DataTable dtPatientInfo = (DataTable)Session["PatientInformation"];

            if (dtPatientInfo != null)
            {
                lblname.Text = String.Format("{0}, {1}", dtPatientInfo.Rows[0]["LastName"], dtPatientInfo.Rows[0]["FirstName"]);

                lblIQnumber.Text = dtPatientInfo.Rows[0]["IQNumber"].ToString();
                if (Request.QueryString["srvNm"] != null)
                {
                    lblTechnicalArea.Text          = Request.QueryString["srvNm"];
                    Session["WLTechnicalArea"]     = Request.QueryString["mod"];
                    Session["WLTechnicalAreaName"] = Request.QueryString["srvNm"];
                    Session["WLPatientID"]         = Request.QueryString["PID"];
                }
                else
                {
                    lblTechnicalArea.Text          = Session["TechnicalAreaName"].ToString();
                    Session["WLTechnicalArea"]     = Session["TechnicalAreaId"];
                    Session["WLTechnicalAreaName"] = Session["TechnicalAreaName"];
                    Session["WLPatientID"]         = HttpContext.Current.Session["PatientId"];
                }

                using (DataSet theDSXML = new DataSet())
                {
                    theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));
                    IQCareUtils   theUtils    = new IQCareUtils();
                    BindFunctions BindManager = new BindFunctions();
                    DataView      theDV       = new DataView(theDSXML.Tables["Mst_Decode"]);
                    theDV.RowFilter = "DeleteFlag=0 and CodeID=214";
                    if (theDV.Table != null)
                    {
                        DataTable theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                        DataRow   dr    = theDT.NewRow();
                        dr["Name"] = "Consultation";
                        dr["ID"]   = 1;
                        theDT.Rows.Add(dr);

                        dr         = theDT.NewRow();
                        dr["Name"] = "Laboratory";
                        dr["ID"]   = 3;
                        theDT.Rows.Add(dr);

                        dr         = theDT.NewRow();
                        dr["Name"] = "Pharmacy";
                        dr["ID"]   = 4;
                        theDT.Rows.Add(dr);

                        dr         = theDT.NewRow();
                        dr["Name"] = "Triage";
                        dr["ID"]   = 5;
                        theDT.Rows.Add(dr);

                        BindManager.BindCombo(ddWList, theDT, "Name", "ID");
                        //BindUserDropdown(ddWList, string.Empty);
                        //BindUserDropdown(ddWList, Session["AppUserId"].ToString());
                        theDT.Clear();
                    }
                    theDV.Dispose();
                }

                loadPatientsWaitList(Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]));
                PopulateUsersList();
            }
        }
Esempio n. 20
0
    private void Init_Form()
    {
        //txtcountryno.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtcountryno.ClientID + "')");
        //txtcountryno.Attributes.Add("onblur", "chkPostiveInteger('" + txtcountryno.ClientID + "')");

        txtLPTF.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtLPTF.ClientID + "')");
        txtLPTF.Attributes.Add("onblur", "chkPostiveInteger('" + txtLPTF.ClientID + "')");

        txtSatelliteID.Attributes.Add("onkeyup", "chkPostiveInteger('" + txtSatelliteID.ClientID + "')");
        txtSatelliteID.Attributes.Add("onblur", "chkPostiveInteger('" + txtSatelliteID.ClientID + "')");
        txtNationalId.Attributes.Add("onKeyup", "chkNumeric('" + txtNationalId.ClientID + "')");



        txtfacilityname.Text = "";
        //txtcountryno.Text = "";
        txtLPTF.Text              = "";
        txtSatelliteID.Text       = "";
        txtGrace.Text             = "";
        txtPEPFAR_Fund.Value      = "";
        cmbCurrency.SelectedValue = "0";
        if (Session["SystemId"].ToString() == "2")
        {
            paperless.Visible = false;
        }
        //BindCombo();
        //ddBackupTime.SelectedValue = "0";


        BindFunctions BindManager = new BindFunctions();
        IQCareUtils   theUtils    = new IQCareUtils();
        DataSet       theDSXML    = new DataSet();

        theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con"));

        DataView  theDV;
        DataTable theDT = new DataTable();

        //theDV = new DataView(theDSXML.Tables["Mst_District"]);
        ICommonData oCommonData = (ICommonData)ObjectFactory.CreateInstance("BusinessProcess.Service.BCommonData,BusinessProcess.Service");

        theDT = (DataTable)oCommonData.getAllCountries();
        //theDV.RowFilter = "SystemID=" + Session["SystemId"] + "";
        if (theDT != null && theDT.Rows.Count > 0)
        {
            //theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            BindManager.BindCombo(ddCountry, theDT, "CountryName", "CountryID");
            //theDV.Dispose();
            theDT.Clear();
        }

        theDT = (DataTable)oCommonData.getAllProvince();
        DataView dv = new DataView(theDT);

        dv.RowFilter = "CountryID= " + Session["AppCountryId"] + "";
        DataTable theDTSpecific = (DataTable)theUtils.CreateTableFromDataView(dv);

        if (theDTSpecific.Rows.Count > 0)
        {
            BindManager.BindCombo(ddlprovince, theDTSpecific, "Name", "ID");
        }
        else if (theDT != null && theDT.Rows.Count > 0)
        {
            //theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            BindManager.BindCombo(ddlprovince, theDT, "Name", "ID");
            //theDV.Dispose();
            theDT.Clear();
        }

        theDT = (DataTable)oCommonData.getAllDistrict();
        // theDV.RowFilter = "SystemID= " + Session["SystemId"] + "";
        if (theDT != null && theDT.Rows.Count > 0)
        {
            //theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
            BindManager.BindCombo(ddldistrict, theDT, "Name", "ID");
            //theDV.Dispose();
            theDT.Clear();
        }



        /////////////////////////////////////////////////
        IFacilitySetup FacilityManager = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration");
        DataSet        theDSFacility   = FacilityManager.GetModuleName();
        DataTable      DT = theDSFacility.Tables[0];

        BindManager.BindCheckedList(cblPMTCT, DT, "modulename", "moduleid");

        // Binding Drug Stores
        DataSet theDSDrugStores = FacilityManager.GetDrugStores();

        BindManager.BindCheckedList(CBL_DrugStore, theDSDrugStores.Tables[0], "Name", "StoreId");
    }
Esempio n. 21
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Validation_Form() == true)
            {
                try
                {
                    theDTStock = (DataTable)dgwOpeningStock.DataSource;

                    DataTable dtb = theDTStock.Copy();

                    DataTable dtCheck = (DataTable)dgwOpeningStock.DataSource;
                    DataView  dt11    = dtCheck.DefaultView;

                    theDTStock.PrimaryKey = new DataColumn[] { theDTStock.Columns["ItemId"], theDTStock.Columns["BatchId"], theDTStock.Columns["StoreId"], theDTStock.Columns["ExpiryDate"] };
                    DataView  theDV = new DataView(theDTStock);
                    DataTable dtNew = null;
                    theDV.RowFilter = "ItemId=" + theItemIdGbl + " and BatchId=" + BatchId + " and StoreId=" + StoreId + " and ExpiryDate='" + ExpiryDate + "'";
                    if (theDV.Count > 0)
                    {
                        theDV.Delete(0);

                        dtNew = dt11.ToTable();

                        if (dtNew.Rows.Count > 0)
                        {
                            for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++)
                            {
                                if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString())
                                {
                                    ShowGrid(dtb);
                                    IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this);
                                    return;
                                }
                            }
                        }
                        DataRow theDRow = theDTStock.NewRow();
                        if (lstSearchBatch.SelectedValue == null)
                        {
                            BindFunctions theBindManager = new BindFunctions();
                            IMasterList   objItemlist    = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                            DataSet       theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text);
                            theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]);
                            theDTBatch.Clear();
                            theDTBatch = theDSBatchName.Tables[1];
                            theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id");
                        }
                        else
                        {
                            theDRow["BatchId"] = lstSearchBatch.SelectedValue;
                        }
                        theDRow["ItemId"]         = lstSearch.SelectedValue;
                        theDRow["ItemName"]       = txtItemName.Text;
                        theDRow["StoreId"]        = ddlStore.SelectedValue;
                        theDRow["StoreName"]      = ddlStore.Text;
                        theDRow["DispensingUnit"] = txtDispensingUnit.Text;
                        theDRow["BatchNo"]        = txtBatchName.Text;
                        theDRow["ExpiryDate"]     = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDRow["Quantity"]       = txtOpeningQty.Text;
                        theDRow["OpeningStock"]   = 0;
                        //theDRow["TransDate"] = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDTStock.Rows.Add(theDRow);
                    }
                    else
                    {
                        dtNew = dt11.ToTable();
                        if (dtNew.Rows.Count > 0)
                        {
                            for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++)
                            {
                                if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString())
                                {
                                    ShowGrid(theDTStock);
                                    IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this);
                                    return;
                                }
                            }
                        }

                        DataRow theDRow = theDTStock.NewRow();
                        if (lstSearchBatch.SelectedValue == null)
                        {
                            BindFunctions theBindManager = new BindFunctions();
                            IMasterList   objItemlist    = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                            //DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId);

                            DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text);


                            theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]);
                            theDTBatch.Clear();
                            theDTBatch = theDSBatchName.Tables[1];
                            theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id");
                        }
                        else
                        {
                            theDRow["BatchId"] = lstSearchBatch.SelectedValue;
                        }

                        theDRow["ItemId"]         = lstSearch.SelectedValue;
                        theDRow["ItemName"]       = txtItemName.Text;
                        theDRow["StoreId"]        = ddlStore.SelectedValue;
                        theDRow["StoreName"]      = ddlStore.Text;
                        theDRow["DispensingUnit"] = txtDispensingUnit.Text;
                        theDRow["BatchNo"]        = txtBatchName.Text;
                        theDRow["ExpiryDate"]     = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDRow["Quantity"]       = txtOpeningQty.Text;
                        theDRow["OpeningStock"]   = 0;
                        //theDRow["TransacDate"] = string.Format("{0:dd-MMM-yyyy}", dtpTransdate.Text);
                        theDTStock.Rows.Add(theDRow);
                    }
                    theDTStock.AcceptChanges();
                    ShowGrid(theDTStock);
                    Clear();
                }
                catch (Exception err)
                {
                    if (err.GetType().FullName == "System.Data.ConstraintException")
                    {
                        IQCareWindowMsgBox.ShowWindow("DuplicateItemName", this);
                    }
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Populates the payment mode.
        /// </summary>
        void PopulatePaymentMode()
        {
            BindFunctions BindManager = new BindFunctions();
            IQCareUtils   theUtils    = new IQCareUtils();

            using (DataSet theDSXML = new DataSet())
            {
                /// DataTable theDT;
                // theDSXML.ReadXml(MapPath("~\\XMLFiles\\AllMasters.con"));

                IBilling  bMgr      = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling,BusinessProcess.SCM");
                DataTable dtDeposit = bMgr.GetPatientDeposit(this.PatientID, this.BillLocationID);
                //string rowFilter = "DeleteFlag=0 and CodeID=212 and Name <> 'WriteOff'";
                //if (dtDeposit.Rows.Count == 0 || Convert.ToDecimal(dtDeposit.Rows[0]["AvailableAmount"]) == 0.0M)
                //    rowFilter = "DeleteFlag=0 and CodeID=212 and Name <> 'Deposit'";


                List <PaymentMethod> _paymentMethods = bMgr.GetPaymentMethods("");
                //if (_paymentMethods != null)
                //{
                //    var c = _paymentMethods.Where(_p => _p.Active == true && _p.Name != "WriteOff");
                //}
                // DataView theDV = new DataView(theDSXML.Tables["Mst_Decode"]);
                // theDV.RowFilter = rowFilter;
                if (_paymentMethods != null)
                {
                    //  DataTable theDT = (DataTable)theUtils.CreateTableFromDataView(theDV);
                    bool showdeposit = true;
                    if (dtDeposit.Rows.Count == 0 || Convert.ToDecimal(dtDeposit.Rows[0]["AvailableAmount"]) == 0.0M)
                    {
                        showdeposit = false;
                        //_paymentMethods.DefaultIfEmpty(null).FirstOrDefault(p=> p.Name =="Deposit")
                    }
                    _paymentMethods.RemoveAll(p => p.Active = false || p.Name == "WriteOff" || (showdeposit == false && p.Name == "Deposit"));

                    List <string> PayMethods = PaymentConfigHelper.PayMethods();

                    ddlPaymentMode.Items.Clear();
                    foreach (PaymentMethod method in _paymentMethods)
                    {
                        string name = method.Name;
                        if (PayMethods.Exists(x => x == name))
                        {
                            ddlPaymentMode.Items.Add(new ListItem(method.Name, method.ID.ToString()));
                        }
                    }

                    //Kk - Fix specifically for mbungoni
                    //-----------------------------------
                    IBilling bMrg = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling,BusinessProcess.SCM");
                    ddlPaymentMode.SelectedIndex = ddlPaymentMode.Items.IndexOf(ddlPaymentMode.Items.FindByText(bMrg.GetPatientPaymentMode(PatientID, BillID)));
                    //----------------------------------

                    //foreach (DataRow row in theDT.Rows)
                    //{
                    //    string name = row["Name"].ToString();

                    //    if (PayMethods.Exists(x => x == name))
                    //    {
                    //        ddlPaymentMode.Items.Add(new ListItem(row["Name"].ToString(), row["ID"].ToString()));
                    //    }
                    //}
                    // theDV.Dispose();
                    // theDT.Clear();
                }
                bMgr = null;
            }
        }
Esempio n. 23
0
        private void BindItemList(int itemTypeId, int subitemId, int Programid)
        {
            try
            {
                chkItemList.DataSource = null;
                IMasterList objItemlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                // drglbItemList = objItemlist.GetItemList(itemTypeId, subitemId);
                DataSet theDS = objItemlist.GetItemList(itemTypeId, subitemId, Programid);
                theItemListDT = theDS.Tables[0];
                theItemList   = theDS.Tables[1];

                //DataView theDV = new DataView(theItemList);
                //theDV.RowFilter = "ItemTypeID ="+ itemTypeId.ToString();

                if (theItemList.Rows.Count > 0)
                {
                    chkPrg.Enabled = true;
                }
                else
                {
                    chkPrg.Enabled = false;
                }

                BindFunctions theBind = new BindFunctions();
                theBind.Win_BindCheckListBox(chkItemList, theItemList, "ItemName", "ItemID");
                //for (int i = 0; i < drglbItemList.Rows.Count; i++)
                //{
                //    if (drglbItemList.Rows[i]["MappedItem"].ToString() == "True")
                //    {
                //        this.chkItemList.SetItemChecked(i, true);
                //    }
                //}
                for (int i = 0; i < theItemListDT.Rows.Count; i++)
                {
                    for (int j = 0; j < chkItemList.Items.Count; j++)
                    {
                        if (Convert.ToInt32(theItemListDT.Rows[i]["ItemTypeID"]) == itemTypeId && Convert.ToInt32(theItemListDT.Rows[i]["ItemID"]) == Convert.ToInt32((((System.Data.DataRowView)(chkItemList.Items[j])).Row.ItemArray[0]).ToString()) && theItemListDT.Rows[i]["ItemName"].ToString() == chkItemList.GetItemText(chkItemList.Items[j]))
                        {
                            this.chkItemList.SetItemChecked(j, true);
                        }
                    }
                }
                bool IsAllcheck = true;
                for (int i = 0; i < chkItemList.Items.Count; i++)
                {
                    if (chkItemList.GetItemChecked(i) == false)
                    {
                        IsAllcheck = false;
                        break;
                    }
                }
                chkPrg.Checked = IsAllcheck;

                if (chkItemList.Items.Count == 0)
                {
                    chkPrg.Checked = false;
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }
Esempio n. 24
0
        private void txtDispenseUnitPrice_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_decimal(e);
        }
Esempio n. 25
0
        void txtAdjustedQuantity_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBind = new BindFunctions();

            theBind.Win_Integer(e);
        }
Esempio n. 26
0
        private void txtdespensingMargin_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_decimalNagetive(e);
        }
Esempio n. 27
0
        public void formInit()
        {
            try
            {
                //IMasterList objPOItem = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                IPurchase objPOItem = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
                dsPOItemsDetail = objPOItem.GetPurchaseOrderDetailsByPoid(GblIQCare.PurchaseOrderID);
                if (dsPOItemsDetail.Tables.Count > 0)
                {
                    if (dsPOItemsDetail.Tables[0].Rows.Count > 0)
                    {
                        dtpOrderDate.Text         = dsPOItemsDetail.Tables[0].Rows[0]["OrderDate"].ToString();
                        dtpOrderDate.CustomFormat = "dd-MMM-yyyy";
                        dtpOrderDate.Enabled      = false;
                        txtOrderNumber.Text       = dsPOItemsDetail.Tables[0].Rows[0]["OrderNo"].ToString();
                        txtOrderNumber.Enabled    = false;
                        // ddlSourceStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["SourceStoreID"].ToString());

                        ddlDestinationStore.DataSource = null;
                        DataSet XMLDS = new DataSet();
                        XMLDS.ReadXml(GblIQCare.GetXMLPath() + "\\AllMasters.con");
                        BindFunctions theBindManager = new BindFunctions();
                        // Id <>" + StoreID + " or
                        DataView theDV = new DataView(XMLDS.Tables["Mst_Store"]);
                        //DataView theDV = new DataView(dsPOItemsDetail.Tables[3]);
                        theDV.RowFilter = "(DeleteFlag =0 or DeleteFlag is null )and  (Id =" + Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["DestinStoreID"].ToString()) + ") ";
                        DataTable theStoreDT = theDV.ToTable();
                        theBindManager.Win_BindCombo(ddlDestinationStore, theStoreDT, "Name", "Id");
                        // ddlDestinationStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["DestinStoreID"].ToString());
                        ddlSourceStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["SourceStoreID"].ToString());
                        ddlSourceStore.Enabled       = false;

                        ddlDestinationStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["DestinStoreID"].ToString());
                        ddlPreparedBy.SelectedValue       = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["PreparedBy"].ToString());
                        if (dsPOItemsDetail.Tables[0].Rows[0]["Status"].ToString() == "1")
                        {
                            chkRejectedStatus.Visible = true;
                            Btndelete.Enabled         = true;
                            btnSave.Enabled           = true;
                            IsPOUpdated      = true;
                            btnPrint.Enabled = false;
                        }
                        else if (dsPOItemsDetail.Tables[0].Rows[0]["Status"].ToString() == "5")
                        {
                            btnSave.Enabled           = false;
                            Btndelete.Enabled         = false;
                            IsPOUpdated               = false;
                            chkRejectedStatus.Visible = true;
                            chkRejectedStatus.Checked = true;
                            chkRejectedStatus.Enabled = false;
                            btnPrint.Enabled          = true;
                        }
                        else
                        {
                            ddlAuthorisedBy.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["AuthorizedBy"].ToString());
                            btnSave.Enabled           = false;
                            Btndelete.Enabled         = false;
                            chkRejectedStatus.Visible = false;
                            btnPrint.Enabled          = true;
                        }
                        lblTotalAmount.Text = dsPOItemsDetail.Tables[1].Rows[0]["TotalAmount"].ToString();
                        BindGrid(dsPOItems);
                        dgwItemSubitemDetails.AllowUserToAddRows = true;
                        dgwItemSubitemDetails.DataSource         = dsPOItemsDetail.Tables[1];
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
Esempio n. 28
0
        private void Bind_Controls()
        {
            string[]    theItem       = GblIQCare.theItemId.ToString().Split('-');
            IMasterList theMasterList = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList, BusinessProcess.SCM");
            DataSet     theDS         = theMasterList.GetItemDetails(Convert.ToInt32(theItem[2]));

            theDTAllItems = theDS.Tables[5];
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_BindCombo(cmbPurchaseUnit, theDS.Tables[3].Copy(), "Name", "Id");
            theBindManager.Win_BindCombo(cmbManufacturer, theDS.Tables[4], "Name", "Id");
            theBindManager.Win_BindCombo(cmbDispensingUnit, theDS.Tables[3].Copy(), "Name", "Id");
            theBindManager.Win_BindCombo(cmbVolumeUnit, theDS.Tables[6].Copy(), "Name", "Id");
            if (theDS.Tables[0].Rows.Count > 0)
            {
                txtItemType.Text    = theItem[0].ToString();
                txtItemSubtype.Text = theItem[1].ToString();
                if (theDS.Tables[0].Rows[0].IsNull("DrugId") == true)
                {
                    txtItemCode.Text = "";
                }
                else
                {
                    txtItemCode.Text = theDS.Tables[0].Rows[0]["DrugId"].ToString();
                }
                ItemCode = txtItemCode.Text;
                if (theDS.Tables[0].Rows[0].IsNull("FDACode") == true)
                {
                    txtFDACode.Text = "";
                }
                else
                {
                    txtFDACode.Text = theDS.Tables[0].Rows[0]["FDACode"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("GenericName") == true)
                {
                    txtGeneric.Text = "";
                }
                else
                {
                    txtGeneric.Text = theDS.Tables[0].Rows[0]["GenericName"].ToString();
                }
                txtTradeName.Text = theDS.Tables[0].Rows[0]["DrugName"].ToString();
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnit") == true)
                {
                    cmbDispensingUnit.SelectedValue = 0;
                }
                else
                {
                    cmbDispensingUnit.SelectedValue = theDS.Tables[0].Rows[0]["DispensingUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("GenAbbr") == true)
                {
                    txtArvAbbrevstion.Text = "";
                }
                else
                {
                    txtArvAbbrevstion.Text = theDS.Tables[0].Rows[0]["GenAbbr"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnit") == true)
                {
                    cmbPurchaseUnit.SelectedValue = 0;
                }
                else
                {
                    cmbPurchaseUnit.SelectedValue = theDS.Tables[0].Rows[0]["PurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("QtyPerPurchaseUnit") == true)
                {
                    txtUnitQty.Text = "";
                }
                else
                {
                    txtUnitQty.Text = theDS.Tables[0].Rows[0]["QtyPerPurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnitPrice") == true)
                {
                    txtPurchaseUnitPrice.Text = "";
                }
                else
                {
                    txtPurchaseUnitPrice.Text = theDS.Tables[0].Rows[0]["PurchaseUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("Manufacturer") == true)
                {
                    cmbManufacturer.SelectedValue = 0;
                }
                else
                {
                    cmbManufacturer.SelectedValue = theDS.Tables[0].Rows[0]["Manufacturer"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnitPrice") == true)
                {
                    txtDispenseUnitPrice.Text = "";
                }
                else
                {
                    txtDispenseUnitPrice.Text = theDS.Tables[0].Rows[0]["DispensingUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingMargin") == true)
                {
                    txtdespensingMargin.Text = "";
                }
                else
                {
                    txtdespensingMargin.Text = theDS.Tables[0].Rows[0]["DispensingMargin"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("EffectiveDate") == true)
                {
                    dtpEffectiveDate.CustomFormat = "dd-MMM-yyyy";
                }
                else
                {
                    dtpEffectiveDate.CustomFormat = "dd-MMM-yyyy";
                    dtpEffectiveDate.Text         = theDS.Tables[0].Rows[0]["EffectiveDate"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("SellingUnitPrice") == true)
                {
                    txteditsellingprice.Text = "";
                }
                else
                {
                    txteditsellingprice.Text = theDS.Tables[0].Rows[0]["SellingUnitPrice"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("MinStock") == true)
                {
                    txtMinStock.Text = "";
                }
                else
                {
                    txtMinStock.Text = theDS.Tables[0].Rows[0]["MinStock"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("MaxStock") == true)
                {
                    txtMaxStock.Text = "";
                }
                else
                {
                    txtMaxStock.Text = theDS.Tables[0].Rows[0]["MaxStock"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DeleteFlag") == true)
                {
                    cmbStatus.SelectedIndex = 0;
                }
                else
                {
                    cmbStatus.SelectedIndex = Convert.ToInt32(theDS.Tables[0].Rows[0]["DeleteFlag"]);
                }
                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("QtyUnitDisp") == true)
                {
                    txtDispensingUnitQuantity.Text = "";
                }
                else
                {
                    txtDispensingUnitQuantity.Text = theDS.Tables[0].Rows[0]["QtyUnitDisp"].ToString();
                }

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

                if (theDS.Tables[0].Rows[0].IsNull("PerlblVolUnits") == true)
                {
                    txtPerlblVolUnits.Text = "";
                }
                else
                {
                    txtPerlblVolUnits.Text = theDS.Tables[0].Rows[0]["PerlblVolUnits"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DosesDispenseUnit") == true)
                {
                    txtDispensingUnit.Text = "";
                }
                else
                {
                    txtDispensingUnit.Text = theDS.Tables[0].Rows[0]["DosesDispenseUnit"].ToString();
                }

                chkSyrups.Checked = theDS.Tables[0].Rows[0]["syrup"].ToString() == "1" ? true : false;

                CalculateSellingPrice();
            }
        }
Esempio n. 29
0
        private void txtUnitQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_Numeric(e);
        }
Esempio n. 30
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);
        }