Example #1
0
 //----------------------------------------------------------
 public void AddCategories(ItemsModulesOptions ItemsModule, int ParentID, ModuleBaseTypes ModuleBaseType)
 {
     //-------------------------------------------------------------
     InitialCategory.ParentID     = ParentID;
     InitialCategory.ModuleTypeID = ItemsModule.ModuleTypeID;
     //-------------------------------------------------------------
     for (int i = 0; i < 3; i++)
     {
         if (SiteSettings.Languages_HasArabicLanguages)
         {
             InitialCategory.Details[Languages.Ar] = InitialCategoryArDetails;
         }
         if (SiteSettings.Languages_HasEnglishLanguages)
         {
             InitialCategory.Details[Languages.En] = InitialCategoryEnDetails;
         }
         ExecuteCommandStatus status = ItemCategoriesFactory.Create(InitialCategory, ItemsModule);
         if (status == ExecuteCommandStatus.Done)
         {
             if (ModuleBaseType == ModuleBaseTypes.Items)
             {
                 AddItems(ItemsModule, InitialCategory.CategoryID);
             }
             else if (ModuleBaseType == ModuleBaseTypes.Messages)
             {
                 AddMessages(ItemsModule.ModuleTypeID, InitialCategory.CategoryID);
             }
         }
     }
 }
Example #2
0
        public static void AddToCart(int itemID, ref ItemsEntity item, ref ItemCategoriesEntity category)
        {
            Guid OwnerID = SitesHandler.GetOwnerIDAsGuid();
            //---------------------------------------------------------
            Languages langID = SiteSettings.GetCurrentLanguage();

            if (item == null)
            {
                item = ItemsFactory.GetObject(itemID, langID, UsersTypes.User, OwnerID);
            }
            if (category == null)
            {
                category = ItemCategoriesFactory.GetObject(item.CategoryID, langID, OwnerID);
            }

            if (item != null && category != null)
            {
                List <ItemsOrdersDetailsModel> CartList = GetCartList();
                //---------------------------------------------------------
                bool existIntoCart = false;
                foreach (ItemsOrdersDetailsModel p in CartList)
                {
                    if (p.ItemID == itemID)
                    {
                        p.Quantity   += 1;
                        existIntoCart = true;
                        break;
                    }
                }
                if (!existIntoCart)
                {
                    ItemsOrdersDetailsModel newP = new ItemsOrdersDetailsModel();
                    newP.ItemID   = itemID;
                    newP.Quantity = 1;
                    CartList.Add(newP);
                }
                //---------------------------------------------------------
                //Session["Cart"] = CartList;
            }
        }
Example #3
0
 //----------------------------------------------------------
 #endregion
 public void AddParentCategories(ItemsModulesOptions itemsModule, ModuleBaseTypes ModuleBaseType)
 {
     //-------------------------------------------------------------
     InitialCategoryParent.ParentID     = 0;
     InitialCategoryParent.ModuleTypeID = itemsModule.ModuleTypeID;
     //-------------------------------------------------------------
     for (int i = 0; i < 3; i++)
     {
         if (SiteSettings.Languages_HasArabicLanguages)
         {
             InitialCategoryParent.Details[Languages.Ar] = InitialCategoryArDetails;
         }
         if (SiteSettings.Languages_HasEnglishLanguages)
         {
             InitialCategoryParent.Details[Languages.En] = InitialCategoryEnDetails;
         }
         ExecuteCommandStatus status = ItemCategoriesFactory.Create(InitialCategoryParent, itemsModule);
         if (status == ExecuteCommandStatus.Done)
         {
             AddCategories(itemsModule, InitialCategoryParent.CategoryID, ModuleBaseType);
         }
     }
 }
Example #4
0
        //---------------------------------------------------------
        //BuildCategoriesPathLinksInSubFolder
        //---------------------------------------------------------
        public bool BuildCategoriesPathLinksInSubFolder(int categoryID, bool lastLink, bool setTags)
        {
            bool hasLinks = false;

            if (categoryID > 0)
            {
                List <ItemCategoriesEntity> cdp = ItemCategoriesFactory.GetFullPath(categoryID);
                if (cdp.Count > 0)
                {
                    hasLinks = true;
                    ItemCategoriesEntity lastCat       = null;
                    ItemsModulesOptions  currentModule = ItemsModulesOptions.GetType(cdp[0].ModuleTypeID);
                    string url = "";
                    for (int i = 0; i < cdp.Count; i++)
                    {
                        if (lastLink && i == cdp.Count - 1)
                        {
                            lastCat = cdp[i];
                            _PathControl.AddLink(lastCat.Title, null);
                            if (setTags)
                            {
                                DCMetaBuilder metaBuilder = DCMetaBuilder.Instance;
                                metaBuilder.SubSection = lastCat.Title;
                                metaBuilder.Title      = lastCat.Title;
                            }
                        }
                        else
                        {
                            //url = "../default.aspx?id=" + cdp[i].CategoryID;
                            DCSiteUrls.Instance.BuildItemCategoriesLink(cdp[i].CategoryID, cdp[i].Title, currentModule);
                            _PathControl.AddLink(cdp[i].Title, url);
                        }
                    }
                }
            }
            return(hasLinks);
        }