Ejemplo n.º 1
0
        //public ActionResult LoadParentCategory(string StoreID, string ProductTypeID)
        //{
        //    List<CategoriesModels> lstData = _factory.GetListCategory(StoreID, null, ProductTypeID, CurrentUser.ListOrganizationId);
        //    SBInventoryBaseModel model = new SBInventoryBaseModel();
        //    if (lstData != null && lstData.Count > 0)
        //    {
        //        //lstData = lstData.Where(x => string.IsNullOrEmpty(x.ParentName)).ToList();
        //        foreach (CategoriesModels data in lstData)
        //        {
        //            SelectListItem item = new SelectListItem()
        //            {
        //                Value = data.ID,
        //                Text = data.Name // + " [" + data.StoreName + "]";
        //            };
        //            model.ListCategories.Add(item);
        //        }
        //    }
        //    return PartialView("_DDLParentCategory", model);
        //}

        public ActionResult LoadParentCategory(string StoreID, string ProductTypeID)
        {
            List <SBInventoryBaseCateGroupViewModel> lstData = _factory.GetListCategorySortParent(StoreID, null, ProductTypeID, CurrentUser.ListOrganizationId);
            SBInventoryBaseModel model = new SBInventoryBaseModel();

            model.lstCateGroup = lstData;
            return(PartialView("_DDLParentCategory", model));
        }
Ejemplo n.º 2
0
        //public ActionResult LoadCategory(string[] StoreID, string itemType, string cateID = "0")
        //{
        //    List<CategoriesModels> lstData = null;
        //    SBInventoryBaseModel model = new SBInventoryBaseModel();
        //    StoreID =  StoreID.Where(ww => !string.IsNullOrEmpty(ww)).ToArray();
        //    if (StoreID.Length == 0)
        //    {
        //        model.ListCategories.Add(new SelectListItem());
        //    }
        //    else
        //    {
        //        lstData = new List<CategoriesModels>();
        //        foreach (var item in StoreID)
        //        {
        //            var temp = _categoryFactory.GetListCategory(item, null, itemType, CurrentUser.ListOrganizationId);
        //            lstData.AddRange(temp);
        //        }

        //        //SBInventoryBaseModel model = new SBInventoryBaseModel();
        //        if (lstData != null && lstData.Count > 0)
        //        {
        //            foreach (CategoriesModels cate in lstData)
        //            {
        //                if (cate.ListChild != null)
        //                {
        //                    foreach (var item in cate.ListChild)
        //                    {
        //                        model.ListCategories.Add(new SelectListItem
        //                        {
        //                            Value = item.ID,
        //                            Text = item.Name + " [" + item.StoreName + "]",
        //                            Selected = item.ID.Equals(cateID) ? true : false
        //                        });
        //                    }
        //                }
        //                else
        //                {
        //                    model.ListCategories.Add(new SelectListItem
        //                    {
        //                        Value = cate.ID,
        //                        Text = cate.Name + " [" + cate.StoreName + "]",
        //                        Selected = cate.ID.Equals(cateID) ? true : false
        //                    });
        //                }
        //            }
        //        }
        //    }

        //    return PartialView("~/Views/SBInventoryBase/_DropDownListCategory.cshtml", model);
        //}

        //public ActionResult LoadCategory(string StoreID, string itemType, string cateID = "0")
        //{
        //    List<CategoriesModels> lstData = _categoryFactory.GetListCategory(StoreID, null, itemType, CurrentUser.ListOrganizationId);
        //    SBInventoryBaseModel model = new SBInventoryBaseModel();
        //    if (lstData != null && lstData.Count > 0)
        //        foreach (CategoriesModels cate in lstData)
        //        {
        //            if (cate.ListChild != null)
        //            {
        //                foreach (var item in cate.ListChild)
        //                {
        //                    model.ListCategories.Add(new SelectListItem
        //                    {
        //                        Value = item.ID,
        //                        Text = item.Name,// + " [" + item.StoreName + "]",
        //                        Selected = item.ID.Equals(cateID) ? true : false
        //                    });
        //                }
        //            }
        //            else
        //            {
        //                model.ListCategories.Add(new SelectListItem
        //                {
        //                    Value = cate.ID,
        //                    Text = cate.Name + " [" + cate.StoreName + "]",
        //                    Selected = cate.ID.Equals(cateID) ? true : false
        //                });
        //            }
        //        }
        //    return PartialView("~/Views/SBInventoryBase/_DropDownListCategory.cshtml", model);
        //}

        // Updated 08282017
        public ActionResult LoadCategory(string StoreID, string itemType, string cateID = "0")
        {
            List <SBInventoryBaseCateGroupViewModel> lstCateGroup = _categoryFactory.GetListCategorySortParent(StoreID, null, itemType, CurrentUser.ListOrganizationId, cateID);

            SBInventoryBaseModel model = new SBInventoryBaseModel();

            model.lstCateGroup = lstCateGroup;

            return(PartialView("~/Views/SBInventoryBase/_DropDownListCategory.cshtml", model));
        }
Ejemplo n.º 3
0
        public PartialViewResult LoadParentCategory(string[] StoreID, string ProductTypeID)
        {
            List <SBInventoryBaseCateGroupViewModel> lstData = new List <SBInventoryBaseCateGroupViewModel>();

            if (StoreID == null)
            {
                StoreID = new string[] { };
            }
            List <string> lstStoreId = StoreID.Where(w => !string.IsNullOrEmpty(w)).ToList();

            if (lstStoreId != null && lstStoreId.Any())
            {
                lstData = _factory.GetListCategorySortParent(lstStoreId, null, ProductTypeID, CurrentUser.ListOrganizationId);
            }
            SBInventoryBaseModel model = new SBInventoryBaseModel();

            model.lstCateGroup = lstData;

            return(PartialView("_DDLParentCategory", model));
        }