예제 #1
0
        private void SaveElement(XmlDocument doc, XmlElement Parent, DataTable childtable)
        {
            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                int    childpkid;
                string ChsName;
                string URL;

                childpkid = (int)childtable.Rows[i]["PKID"];
                ChsName   = (string)childtable.Rows[i]["ChineseName"];
                if (childtable.Rows[i]["URL"] != null || childtable.Rows[i]["URL"].ToString() != "")
                {
                    URL = childtable.Rows[i]["URL"].ToString();
                }
                else
                {
                    URL = "";
                }
                RoleMenu checkmenu = new RoleMenu();
                checkmenu.SessionInstance = session;
                BusinessFilter checkfilter = new BusinessFilter("RoleMenu");
                checkfilter.AddFilterItem("FK_Menu", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkfilter.AddFilterItem("FK_Role", this.rolepkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkfilter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkmenu.AddFilter(checkfilter);
                checkmenu.Load();
                if (checkmenu.HaveRecord)
                {
                    System.Xml.XmlElement child = GlobalFacade.XDom.CreateDocumentElement(doc, "TREENODE");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "TEXT", ChsName);
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "NODEDATA", childpkid.ToString());
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "EXPANDED", "false");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "TARGET", "main");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "NAVIGATEURL", URL);
                    Parent.AppendChild(child);

                    System.Data.DataTable    subchildTable;
                    BusinessObjectCollection subchild = new BusinessObjectCollection("Menu");
                    subchild.SessionInstance = session;
                    BusinessFilter filter = new BusinessFilter("Menu");
                    filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                    filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                    subchild.AddFilter(filter);
                    /* Andy Modify 2007-04-26 Add Order By */
                    subchild.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
                    subchildTable = subchild.GetDataTable();
                    if (subchildTable.Rows.Count > 0)
                    {
                        SaveElement(doc, child, subchildTable);
                    }
                }
            }
        }
예제 #2
0
파일: CWOneChild.cs 프로젝트: Jhubbs86/POS
        /// <summary>
        /// 导出独生子女统计列表
        /// </summary>
        /// <param name="pageSize">页大小(一次取出的记录数)</param>
        /// <param name="pageIndex">页码(1开始)</param>
        /// <param name="subfilter">筛选条件对象</param>
        /// <returns>结果集</returns>
        public DataTable GetCWOneChildListForExport(int pageSize, int pageIndex, BusinessFilter subfilter)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("CWOneChild");

            boc.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("CWOneChild");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.AddFilter(filter);
            return(boc.GetDataTable());
        }
예제 #3
0
        private void GenerateElement(Microsoft.Web.UI.WebControls.TreeNode Parent, DataTable childtable)
        {
            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                int    childpkid;
                string Name;
                string path;
                childpkid = (int)childtable.Rows[i]["PKID"];
                Name      = childtable.Rows[i]["Name"].ToString();
                path      = childtable.Rows[i]["path"].ToString();
                Microsoft.Web.UI.WebControls.TreeNode node = new TreeNode();

                node.NodeData = childpkid.ToString();
                node.Text     = Name;
                node.ID       = path;
                Parent.Nodes.Add(node);

                System.Data.DataTable    subchildTable;
                BusinessObjectCollection subchild = new BusinessObjectCollection("Dictionary");
                subchild.SessionInstance = session;
                BusinessFilter filter = new BusinessFilter("Dictionary");
                filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

                filter.AddFilterItem("Type", Convert.ToString((int)type), Operation.Equal, FilterType.NumberType, AndOr.AND);
//				if (type == DictionaryType.Region)
//				{
//					filter.AddFilterItem("Type","1",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else if (type == DictionaryType.Product)
//				{
//					filter.AddFilterItem("Type","2",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else
//				{
//					filter.AddFilterItem("Type","3",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
                filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                subchild.AddFilter(filter);

                subchildTable = subchild.GetDataTable();
                if (subchildTable.Rows.Count > 0)
                {
                    GenerateElement(node, subchildTable);
                }
            }
        }
예제 #4
0
파일: CWInfo.ascx.cs 프로젝트: Jhubbs86/POS
        private void BindForeignKeyData()
        {
            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", GlobalFacade.DictionaryType.Type_1.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            boc.AddFilter(filter);

            ddlDistrict.DataSource     = boc.GetDataTable();
            ddlDistrict.DataTextField  = "Name";
            ddlDistrict.DataValueField = "PKID";
            ddlDistrict.DataBind();
            ddlDistrict.Items.Insert(0, new ListItem(ResourceManager.Instance.GetString("PleaseSelect"), "0"));
        }
예제 #5
0
        public static void DictionaryList(System.Web.UI.WebControls.DropDownList DropOnDictionary, string type)
        {
            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", type, Operation.Equal, FilterType.NumberType, AndOr.AND);

            boc.AddFilter(filter);

            DropOnDictionary.DataSource     = boc.GetDataTable();
            DropOnDictionary.DataTextField  = "Name";
            DropOnDictionary.DataValueField = "PKID";
            DropOnDictionary.DataBind();
            DropOnDictionary.Items.Insert(0, new ListItem(ResourceManager.Instance.GetString("PleaseSelect"), "0"));
        }
예제 #6
0
        public void GenerateMenuTreeXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);
            /* Andy Modify 2007-04-26 Add Order By */
            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            GenerateElement(doc, root, childtable);
            outxml = doc.OuterXml;
        }
예제 #7
0
        public string GetMenuXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);

            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            SaveElement(doc, root, childtable);
            return(doc.OuterXml);
        }
예제 #8
0
        private void DeleteNode(int Dictionary_PKID, Wicresoft.Session.Session session)
        {
            // Delete the entry in Dictionary
            BusinessMapping.Dictionary owner = new BusinessMapping.Dictionary();
            owner.SessionInstance = session;
            owner.PKID.Value      = Dictionary_PKID;
            owner.IsValid.Value   = false;
            owner.Update();

            // Delete the entry in Dictionary_RegionDetail
            BusinessObjectCollection region = new BusinessObjectCollection("Dictionary_RegionDetail");

            region.SessionInstance = session;

            BusinessFilter regiondeletefilter = new BusinessFilter("Dictionary_RegionDetail");

            regiondeletefilter.AddFilterItem("FK_Dictionary", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            region.AddFilter(regiondeletefilter);

            ((BusinessMapping.Dictionary_RegionDetail)region.Businessobject).IsValid.Value = false;
            region.UpdateFilter();


            // Delete any child entries
            BusinessObjectCollection child = new BusinessObjectCollection("Dictionary");

            child.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            child.AddFilter(filter);

            DataTable childtable = child.GetDataTable();

            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                DeleteNode(int.Parse(childtable.Rows[i]["PKID"].ToString()), session);
            }
        }
예제 #9
0
        public void GenerateRegionTreeXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection RegionCollection = new BusinessObjectCollection("Dictionary");

            RegionCollection.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            RegionCollection.AddFilter(filter);

            DataTable childtable = RegionCollection.GetDataTable();

            GenerateRegionElement(doc, root, childtable);
            this.outregionxml = doc.OuterXml;
        }
예제 #10
0
 private void GenerateRegionElement(XmlDocument doc, XmlElement Parent, DataTable childtable)
 {
     for (int i = 0; i < childtable.Rows.Count; i++)
     {
         int    childpkid;
         string Name;
         childpkid = (int)childtable.Rows[i]["PKID"];
         Name      = (string)childtable.Rows[i]["Name"];
         System.Xml.XmlElement child      = GlobalFacade.XDom.CreateDocumentElement(doc, "TREENODE");
         RoleDataPermission    HaveRegion = new RoleDataPermission();
         HaveRegion.SessionInstance = session;
         BusinessFilter checkfilter = new BusinessFilter("RoleDataPermission");
         checkfilter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
         checkfilter.AddFilterItem("FK_Role", this.RolePKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         checkfilter.AddFilterItem("FK_Dictionary", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         HaveRegion.AddFilter(checkfilter);
         HaveRegion.Load();
         if (HaveRegion.HaveRecord)
         {
             GlobalFacade.XDom.SetNodeAttribute(doc, child, "checked", "True");
         }
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "checkBox", "True");
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "Expanded", "True");
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "Text", Name);
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "NodeData", childpkid.ToString());
         Parent.AppendChild(child);
         System.Data.DataTable    subchildTable;
         BusinessObjectCollection subchild = new BusinessObjectCollection("Dictionary");
         subchild.SessionInstance = session;
         BusinessFilter filter = new BusinessFilter("Dictionary");
         filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         filter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
         filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
         subchild.AddFilter(filter);
         subchildTable = subchild.GetDataTable();
         if (subchildTable.Rows.Count > 0)
         {
             GenerateRegionElement(doc, child, subchildTable);
         }
     }
 }
예제 #11
0
        public void SaveMenuTreeXML(string path)
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);
            /* Andy Modify 2007-04-26 Add Order By */
            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            SaveElement(doc, root, childtable);
            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            path = path + "\\" + this.rolepkid.ToString() + ".xml";
            doc.Save(path);
        }
예제 #12
0
        public void GenerateTree(Microsoft.Web.UI.WebControls.TreeView tr_region)
        {
            BusinessObjectCollection ParentCollection = new BusinessObjectCollection("Dictionary");

            ParentCollection.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", Level.Top, Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", Convert.ToString((int)type), Operation.Equal, FilterType.NumberType, AndOr.AND);
//			filter.AddFilterItem("Parent","0",Operation.Equal,FilterType.NumberType,AndOr.AND);
//			if (type == DictionaryType.Region)
//			{
//				filter.AddFilterItem("Type","1",Operation.Equal,FilterType.NumberType,AndOr.AND);
//			}
//			else if (type == DictionaryType.Product)
//			{
//				filter.AddFilterItem("Type","2",Operation.Equal,FilterType.NumberType,AndOr.AND);
//			}
//			else
//			{
//				filter.AddFilterItem("Type","3",Operation.Equal,FilterType.NumberType,AndOr.AND);
//			}

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            ParentCollection.AddFilter(filter);

            DataTable parenttable = ParentCollection.GetDataTable();

            for (int i = 0; i < parenttable.Rows.Count; i++)
            {
                Microsoft.Web.UI.WebControls.TreeNode node = new TreeNode();
                node.NodeData = parenttable.Rows[i]["PKID"].ToString();
                node.Text     = parenttable.Rows[i]["Name"].ToString();
                node.ID       = parenttable.Rows[i]["path"].ToString();
                tr_region.Nodes.Add(node);


                BusinessObjectCollection childCollection = new BusinessObjectCollection("Dictionary");
                childCollection.SessionInstance = session;
                BusinessFilter subfilter = new BusinessFilter("Dictionary");
                subfilter.AddFilterItem("Parent", parenttable.Rows[i]["PKID"].ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

                subfilter.AddFilterItem("Type", Convert.ToString((int)type), Operation.Equal, FilterType.NumberType, AndOr.AND);
//				if (type == DictionaryType.Region)
//				{
//					subfilter.AddFilterItem("Type","1",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else if (type == DictionaryType.Product)
//				{
//					subfilter.AddFilterItem("Type","2",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else
//				{
//					subfilter.AddFilterItem("Type","3",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
                subfilter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                childCollection.AddFilter(subfilter);
                DataTable childtable = childCollection.GetDataTable();
                GenerateElement(node, childtable);
            }
        }