Esempio n. 1
0
        private void BindTreeView()
        {
            IMasterList theItemManager = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList, BusinessProcess.SCM");
            DataSet     theDS          = theItemManager.GetItemMasterListing();

            theDrugListing = theDS.Tables[0];
            string theItemType     = "";
            string theDrugTypeName = "";
            string theGenericName  = "";
            //string theDrugName="";
            TreeNode theRootNode        = new TreeNode();
            TreeNode theRootDTypeNode   = new TreeNode();
            TreeNode theRootGenericNode = new TreeNode();

            foreach (DataRow theDR in theDS.Tables[0].Rows)
            {
                if (theItemType != theDR["ItemTypeName"].ToString())
                {
                    theRootNode      = new TreeNode();
                    theRootNode.Text = theDR["ItemTypeName"].ToString();
                    tvSCMlist.Nodes.Add(theRootNode);
                    theItemType = theDR["ItemTypeName"].ToString();
                }
                if (theDrugTypeName != theDR["DrugTypeName"].ToString())
                {
                    theRootDTypeNode      = new TreeNode();
                    theRootDTypeNode.Text = theDR["DrugTypeName"].ToString();
                    theRootNode.Nodes.Add(theRootDTypeNode);
                    theDrugTypeName = theDR["DrugTypeName"].ToString();
                }
                if (theGenericName != theDR["GenericName"].ToString())
                {
                    theRootGenericNode      = new TreeNode();
                    theRootGenericNode.Text = theDR["GenericName"].ToString();
                    theRootDTypeNode.Nodes.Add(theRootGenericNode);
                    theGenericName = theDR["GenericName"].ToString();
                }
                if (theDR["DrugName"].ToString() != "")
                {
                    TreeNode theDrugNode = new TreeNode();
                    theDrugNode.Text = theDR["DrugName"].ToString();
                    theDrugNode.Tag  = theItemType + "-" + theDrugTypeName + "-" + theDR["Drug_Pk"].ToString();
                    theRootGenericNode.Nodes.Add(theDrugNode);
                }
            }
        }