Пример #1
0
        public ActionResult ProductsInfo(FormCollection form)
        {
            var mdu    = new ProductsModule <ListFilterBase, PRODUCT>();
            var acName = mdu.SaveProductInfo(form);

            return(RedirectToAction("ProductsInfo"));
        }
Пример #2
0
        public ActionResult Index()
        {
            var mdu = new ProductsModule <ListFilterBase, PRODUCT>();
            Dictionary <bool, string> productInfo = mdu.GetProductInfo();

            TempData["productInfo"] = productInfo;

            ListViewBase model = new ListViewBase();
            Dictionary <int, List <FileViewModel> > files = new Dictionary <int, List <FileViewModel> >();

            using (var module = ListFactoryService.Create(ListMethodType.PRODUCT))
            {
                model.Result = (module.DoGetList(model.Filter) as ListResultBase);

                foreach (var data in (model.Result.Data as List <PRODUCT>))
                {
                    //取檔案
                    using (FileModule fileModule = new FileModule())
                    {
                        var file = fileModule.GetFiles((int)data.ID, "Products");
                        if (!files.ContainsKey(data.ID))
                        {
                            files.Add(data.ID, new List <FileViewModel>());
                        }
                        files[data.ID] = file;
                    }
                }
            }
            TempData["Files"] = files;
            return(View(model));
        }
Пример #3
0
        public ActionResult ProductsInfo()
        {
            var mdu   = new ProductsModule <ListFilterBase, PRODUCT>();
            var model = mdu.GetProductInfo();

            return(View(model));
        }
Пример #4
0
 public IHttpActionResult GetById(int id)
 {
     try
     {
         return(Ok(ProductsModule.getProductsById(id)));
     }
     catch (Exception e)
     {
         return(InternalServerError());
     }
 }
Пример #5
0
 public IHttpActionResult getProductByKriterion(int productId)
 {
     try
     {
         ProductsModule.getProductByKriterion(productId);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
Пример #6
0
 public IHttpActionResult GetAll(int id)
 {
     try
     {
         using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
         {
             ProductsModule.getProductByKriterion(id);
         }
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
        public static ListBaseService Create(ListMethodType methodType)
        {
            ListBaseService listManageModule = null;

            switch (methodType)
            {
            case ListMethodType.PRODUCT:
                listManageModule = new ProductsModule <ListFilterBase, PRODUCT>();
                break;

            default:
                listManageModule = null;
                break;
            }
            return(listManageModule);
        }
Пример #8
0
        public ActionResult Index()
        {
            ViewBag.IsFirstPage = true;
            var mdu = new ProductsModule <ListFilterBase, PRODUCT>();
            Dictionary <bool, string> productInfo = mdu.GetProductInfo();

            TempData["productInfo"] = productInfo;

            HomeDataModel model = new HomeDataModel();
            Dictionary <int, List <FileViewModel> > productFiles = new Dictionary <int, List <FileViewModel> >();
            Dictionary <int, List <FileViewModel> > newstFiles   = new Dictionary <int, List <FileViewModel> >();

            using (var module = ListFactoryService.Create(ListMethodType.PRODUCT))
            {
                ListViewBase   temp            = new ListViewBase();
                List <PRODUCT> bindProductData = new List <PRODUCT>();
                var            productResult   = (module.DoGetList(temp.Filter) as ListResultBase);

                foreach (var data in (productResult.Data as List <PRODUCT>).Take(2))
                {
                    //取檔案
                    using (FileModule fileModule = new FileModule())
                    {
                        var file = fileModule.GetFiles((int)data.ID, "Products");
                        if (!productFiles.ContainsKey(data.ID))
                        {
                            productFiles.Add(data.ID, new List <FileViewModel>());
                        }
                        productFiles[data.ID] = file;
                    }
                    bindProductData.Add(data);
                }
                temp.Result.Data = bindProductData;
                model.Result.Add("Products", temp);
            }
            TempData["ProductFiles"] = productFiles;

            using (var module = ListFactoryService.Create(ListMethodType.NEWS))
            {
                ListViewBase temp         = new ListViewBase();
                List <NEWS>  bindNewsData = new List <NEWS>();

                var newResult = (module.DoGetList(temp.Filter) as ListResultBase);

                foreach (var data in (newResult.Data as List <NEWS>).Take(3))
                {
                    data.CONTENT = data.CONTENT = PublicMethodRepository.StripHTML(data.CONTENT).SplitLengthString(60);
                    //取檔案
                    using (FileModule fileModule = new FileModule())
                    {
                        var file = fileModule.GetFiles((int)data.ID, "News");
                        if (!newstFiles.ContainsKey(data.ID))
                        {
                            newstFiles.Add(data.ID, new List <FileViewModel>());
                        }
                        newstFiles[data.ID] = file;
                        bindNewsData.Add(data);
                    }
                }
                temp.Result.Data = bindNewsData;
                model.Result.Add("News", temp);
            }
            TempData["NewstFiles"] = newstFiles;


            return(View(model));
        }
Пример #9
0
 public List <ProductPrices> getProductByKriterionAndAge(filter filter)
 {
     return(ProductsModule.getProductByKriterionAndAge(filter.id, filter.age));
 }
Пример #10
0
 public List <ProductPrices> GetCategoryComperation(int id)
 {
     return(ProductsModule.getProductByKriterion(id));
 }