Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] == null && Request.QueryString["subcat"] == null)
            {
                SeeMoreCardTitle.Text = "All Category";
                showProduct(0);
                showButton(0);
            }
            else if (Request.QueryString["id"] != null && Request.QueryString["subcat"].Equals("0"))
            {
                int id = Int32.Parse(Request.QueryString["id"]);
                SeeMoreCardTitle.Text = ProductCategoryRepo.getCategoryName(id);
                showProduct(id);
                showButton(id);
            }
            else if (Request.QueryString["id"] != null && !Request.QueryString["subcat"].Equals("0"))
            {
                int id     = Int32.Parse(Request.QueryString["id"]);
                int Subcat = Int32.Parse(Request.QueryString["subcat"]);

                showButton(id);
                SeeMoreCardTitle.Text = ProductCategoryRepo.getCategoryName(id);
                showProductWithSubCategory(id, Subcat);
            }
        }
Beispiel #2
0
        public void TestMethod3()
        {
            try
            {
                var repo = new ProductCategoryRepo();


                var x = repo.Get();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null && Request.QueryString["subcat"] == null)
     {
         lblPromo.Text = "All Category";
         showProduct(0);
     }
     else if (Request.QueryString["id"] != null && Request.QueryString["subcat"].Equals("0"))
     {
         int id = Int32.Parse(Request.QueryString["id"]);
         lblPromo.Text = ProductCategoryRepo.getCategoryName(id);
         showProduct(id);
     }
 }
Beispiel #4
0
 public void TestMethod2()
 {
     try
     {
         var repo  = new ProductCategoryRepo();
         var uow   = new PDSDBUnitOfWork();
         var suite = new ProductCategory
         {
             Id        = 0,
             Name      = "Product Category 1",
             UpdatedOn = DateTime.Now,
             CreatedOn = DateTime.Now
         };
         repo.Add(suite);
         uow.SaveChanges();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null && Request.QueryString["subcat"] == null)
     {
         Load_Venue();
         Load_Catering();
         Load_Decoration();
     }
     else if (Request.QueryString["id"] != null)
     {
         int id = Int32.Parse(Request.QueryString["id"]);
         showProduct(id);
     }
     else if (Request.QueryString["id"] != null && Request.QueryString["subcat"].Equals("0"))
     {
         int id = Int32.Parse(Request.QueryString["id"]);
         LblClick.Visible = true;
         LblClick.Text    = ProductCategoryRepo.getCategoryName(id);
         showProduct(id);
     }
 }
Beispiel #6
0
        /// <summary>
        /// Get all Category
        /// </summary>
        public static List <SelectListItem> ProductCategoriesByCatalogueId(long catalogueId = 0)
        {
            var categoryList = new List <SelectListItem>();
            var proCatRepo   = new ProductCategoryRepo();
            var menu         = proCatRepo.GetMenuCategoryProduct(catalogueId).ToList();
            var menuTemp     = new List <ViewModel.MenuItem>();

            menuTemp = menu.Where(w => w.Level == 0).OrderBy(o => o.Order).ToList();
            var menuChirld = menu.Where(w => w.Level != 0).OrderByDescending(o => o.Order).ToList();

            foreach (var item in menuChirld)
            {
                var menuParent = menuTemp.Where(w => w.Id == item.ParentId).FirstOrDefault();
                if (menuParent != null)
                {
                    var positon = menuTemp.IndexOf(menuParent);
                    item.Name = "--" + item.Name;
                    if (menuTemp.Count > positon)
                    {
                        menuTemp.Insert(positon + 1, item);
                    }
                    else
                    {
                        menuTemp.Insert(positon, item);
                    }
                }
            }

            categoryList = menuTemp.AsEnumerable().Select(s => new SelectListItem()
            {
                Text = s.Name, Value = s.Id.ToString()
            }).ToList();
            categoryList.Insert(0, new SelectListItem {
                Text = "Nhóm Root", Value = "0"
            });
            return(categoryList);
        }
Beispiel #7
0
        // private readonly ProductCategoryRepo _versionRepo;

        public ProductCategorySerivce()
        {
            _repo = new ProductCategoryRepo();
        }
Beispiel #8
0
 public ProductCategoryService()
 {
     this.unitOfWork = new UnitOfWork();
     this.catRepo    = new UnitOfWork().ProductCategoryRepo;
     this.subCatRepo = new UnitOfWork().ProductSubCategoryRepo;
 }
Beispiel #9
0
 public ProductCategoryService(UnitOfWork unitOfWork, ProductCategoryRepo catRepo, ProductSubCategoryRepo subCatRepo)
 {
     this.unitOfWork = unitOfWork;
     this.catRepo    = unitOfWork.ProductCategoryRepo;
     this.subCatRepo = unitOfWork.ProductSubCategoryRepo;
 }
 public CategorysController(MyContext myContext, IConfiguration config, ProductCategoryRepo repo)
 {
     _context       = myContext;
     _configuration = config;
     _repo          = repo;
 }
Beispiel #11
0
 public ProductCategoryController(ProductCategoryRepo _repo)
 {
     repo = _repo;
 }