Example #1
0
        public void Delete_ComponentInCategory_Item(string CategoryID, string Module_ItemID)
        {
            int Item_Count = Sum_CategoryItems(CategoryID, Module_ItemID);

            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Module_Item myModule_Item = myModuleMgr.Get_Module_Item(Module_ItemID);

            if (myModule_Item != null)
            {
                Item_Count--;

                if (Item_Count < 1)
                {
                    Remove_ComponentInCategory_ByCategoryID(CategoryID, Module_ItemID);
                }
                else
                {
                    ComponentInCategory myComponentInCategory = Get_ComponentInCategory(CategoryID, Module_ItemID);

                    e2Data[] UpdateData =
                    {
                        new e2Data("RelationID", myComponentInCategory.RelationID),
                        new e2Data("Item_Count", Item_Count.ToString())
                    };

                    Edit_ComponentInCategory(UpdateData);
                }
            }
        }
Example #2
0
        public void Delete_PageTags(PageTag DeleteTag, string Module_ItemID)
        {
            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Module_Item myModule_Item = myModuleMgr.Get_Module_Item(Module_ItemID);

            if (myModule_Item != null)
            {
                //Add new Tag list to Page Tags

                int Item_Count = Sum_PageTagItems(DeleteTag.PageTageID, Module_ItemID);

                Item_Count--;

                if (Item_Count < 1)
                {
                    Remove_ComponentInTag_ByPageTagID(DeleteTag.PageTageID, Module_ItemID);

                    // Check if need remove Tag_Name
                    int Tag_Name_Count = Sum_PageTagItems(DeleteTag.PageTageID);

                    if (Tag_Name_Count < 1)
                    {
                        Remove_ComponentInTag_ByPageTagID(DeleteTag.PageTageID);
                        Remove_PageTag(DeleteTag.PageTageID);
                    }
                }
                else
                {
                    ComponentInTag myComponentInTag = Get_ComponentInTag(DeleteTag.PageTageID, Module_ItemID);

                    e2Data[] UpdateData =
                    {
                        new e2Data("RelationID", myComponentInTag.RelationID),
                        new e2Data("Item_Count", Item_Count.ToString())
                    };

                    Edit_ComponentInPageTag(UpdateData);
                }
            }
        }
Example #3
0
        public void Add_ComponentInCategory_Item(string CategoryID, string Module_ItemID)
        {
            int Item_Count = Sum_CategoryItems(CategoryID, Module_ItemID);

            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Module_Item myModule_Item = myModuleMgr.Get_Module_Item(Module_ItemID);

            if (myModule_Item != null)
            {
                if (Item_Count < 1)
                {
                    e2Data[] UpdateData =
                    {
                        new e2Data("Module_ItemID", Module_ItemID),
                        new e2Data("ModuleID",      myModule_Item.ModuleID),
                        new e2Data("CategoryID",    CategoryID),
                        new e2Data("Item_Count",    "1")
                    };

                    Add_ComponentInCategory(UpdateData);
                }
                else
                {
                    Item_Count++;

                    ComponentInCategory myComponentInCategory = Get_ComponentInCategory(CategoryID, Module_ItemID);

                    e2Data[] UpdateData =
                    {
                        new e2Data("RelationID", myComponentInCategory.RelationID),
                        new e2Data("Item_Count", Item_Count.ToString())
                    };

                    Edit_ComponentInCategory(UpdateData);
                }
            }
        }
Example #4
0
        public string Add_PageTags(string NewTag, string Module_ItemID)
        {
            Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr();

            Modules.Module_Item myModule_Item = myModuleMgr.Get_Module_Item(Module_ItemID);

            if (myModule_Item != null)
            {
                //Add new Tag list to Page Tags
                if (Chk_PageTag(NewTag))
                {
                    #region Tag 已存在

                    PageTag myPageTag = Get_PageTag_ByTagName(NewTag);

                    int Item_Count = Sum_PageTagItems(myPageTag.PageTageID, Module_ItemID);

                    if (Item_Count < 1)
                    {
                        e2Data[] UpdateData =
                        {
                            new e2Data("Module_ItemID", Module_ItemID),
                            new e2Data("ModuleID",      myModule_Item.ModuleID),
                            new e2Data("PageTagID",     myPageTag.PageTageID),
                            new e2Data("Item_Count",    "1")
                        };

                        Add_ComponentInTag(UpdateData);
                    }
                    else
                    {
                        Item_Count++;

                        ComponentInTag myComponentInTag = Get_ComponentInTag(myPageTag.PageTageID, Module_ItemID);

                        e2Data[] UpdateData =
                        {
                            new e2Data("RelationID", myComponentInTag.RelationID),
                            new e2Data("Item_Count", Item_Count.ToString())
                        };

                        Edit_ComponentInPageTag(UpdateData);
                    }

                    return(myPageTag.PageTageID);

                    #endregion
                }
                else
                {
                    #region 发现新的Tag

                    string PageTagID = Tools.IDGenerator.Get_New_GUID();

                    e2Data[] UpdateData_PageTag =
                    {
                        new e2Data("PageTagID", PageTagID),
                        new e2Data("Tag_Name",  NewTag)
                    };

                    Add_PageTag(UpdateData_PageTag);

                    e2Data[] UpdateData_ComponentInTag =
                    {
                        new e2Data("Module_ItemID", Module_ItemID),
                        new e2Data("ModuleID",      myModule_Item.ModuleID),
                        new e2Data("PageTagID",     PageTagID),
                        new e2Data("Item_Count",    "1")
                    };

                    Add_ComponentInTag(UpdateData_ComponentInTag);

                    return(PageTagID);

                    #endregion
                }
            }

            return(null);
        }