public IActionResult Index(string message)
        {
            var productList = new List <ProductVM>();

            foreach (var product in Database.Products)
            {
                var productVM = new ProductVM()
                {
                    ProductName  = product.Name,
                    Description  = product.Description,
                    Category     = product.Category,
                    ProductPrice = product.Price
                };

                productList.Add(productVM);
            }

            var products = new ProductListVM()
            {
                Products = productList
            };

            ViewBag.Message = message;

            return(View("Products", products));
        }
示例#2
0
        public ActionResult AddToCard(ProductListVM product)
        {
            List <Card> cardItems = new List <Card>();

            if (Session["Card"] != null)
            {
                cardItems = (List <Card>)Session["Card"];
            }
            if (cardItems.Any(c => c.ProductId == product.ProductId))
            {
                Card item = cardItems.Where(c => c.ProductId == product.ProductId).SingleOrDefault();
                cardItems.Remove(item);
                item.Count++;
                item.Sum = item.Count * item.Price;
                cardItems.Add(item);
            }
            else
            {
                cardItems.Add(new Card
                {
                    ProductId   = product.ProductId,
                    ProductName = product.ProductName,
                    Price       = product.Price,
                    Count       = 1,
                    Sum         = product.Price
                });
            }

            Session["Card"] = cardItems;
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ProductListVM Products()
        {
            List <ProductVM> productsList = new List <ProductVM>();

            foreach (Product product in _productRepository.GetProducts())
            {
                ProductVM productVM = new ProductVM()
                {
                    Id          = product.Id,
                    Category    = product.Category,
                    Name        = product.Name,
                    Description = product.Description,
                    Price       = product.Price
                };
                productsList.Add(productVM);
            }

            ProductListVM productListVM = new ProductListVM();
            ProductListVM productVM1    = new ProductListVM()
            {
                NumberOfProducts = _productRepository.GetProducts().Count,
                Products         = productsList
            };

            return(productVM1);
        }
示例#4
0
        public DataTable List(ProductListVM listVM)
        {
            try
            {
                var param = new SqlParameter[6];
                param[0] = new SqlParameter("@TrackingCode", listVM.TrackingCode);

                param[1]       = new SqlParameter("@Meter", SqlDbType.Int);
                param[1].Value = (object)listVM.Meter ?? DBNull.Value;

                param[2]       = new SqlParameter("@OrginalPrice", SqlDbType.NVarChar);
                param[2].Value = (object)listVM.OrginalPrice ?? DBNull.Value;

                param[3]       = new SqlParameter("@DocumentType", SqlDbType.TinyInt);
                param[3].Value = listVM.DocumentType != DocumentForProductType.نامشخص ? (object)listVM.DocumentType : DBNull.Value;

                param[4]       = new SqlParameter("@FloorCoveringType", SqlDbType.TinyInt);
                param[4].Value = listVM.FloorCoveringType != FloorCoveringType.نامشخص ? (object)listVM.FloorCoveringType : DBNull.Value;

                param[5]       = new SqlParameter("@ProductType", SqlDbType.TinyInt);
                param[5].Value = listVM.ProductType != ProductType.نامشخص ? (object)listVM.ProductType : DBNull.Value;

                return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetsProduct", param));
            }
            catch (Exception e) { throw; }
        }
示例#5
0
        public IActionResult Index()
        {
            ViewBag.Error = TempData["Info"];

            var listOfProductsVM = new List <ProductVM>();

            foreach (var product in Database.Products)
            {
                var productVM = new ProductVM()
                {
                    Id          = product.Id,
                    Name        = product.Name,
                    Description = product.Description,
                    Price       = product.Price,
                    Category    = product.Category
                };

                listOfProductsVM.Add(productVM);
            }

            ProductListVM productListVM = new ProductListVM()
            {
                Products = listOfProductsVM
            };

            ViewBag.Title = "Welcome to our Store Page";

            return(View("Products", productListVM));
        }
示例#6
0
        private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e)
        {
            if (myRadDataForm.CanCommitEdit && e.EditAction == EditAction.Commit)
            {
                ProductListVM context = this.DataContext as ProductListVM;
                //if (!UploadPictureForCurrentStyle())
                //{
                //    var isContinue = MessageBox.Show("款式图片未成功上传,是否继续保存成品信息?", "提示", MessageBoxButton.YesNo);
                //    if (isContinue == MessageBoxResult.No)
                //        return;
                //}

                var lbColor   = GetColorListBox();
                var colorSets = lbColor.ItemsSource as List <ProColorForSet>;
                var lbSize    = GetSizeListBox();
                var sizeSets  = lbSize.ItemsSource as List <ProSizeForSet>;
                var style     = (ProStyleBO)myRadDataForm.CurrentItem;
                style.Sizes  = sizeSets.FindAll(cs => cs.IsHold).ToList();
                style.Colors = colorSets.FindAll(cs => cs.IsHold).ToList();

                UIHelper.AddOrUpdateRecord(myRadDataForm, context, e);
            }
            //else if (e.EditAction == EditAction.Cancel)
            //{
            //    var item = (ProStyleBO)myRadDataForm.CurrentItem;
            //    if (item.ID != default(int))//编辑状态
            //    {
            //        myRadDataForm.CurrentItem = context.GetProduct(item.ID);
            //        e.Cancel = true;
            //    }
            //}
        }
示例#7
0
        public IActionResult Index(string message)
        {
            List <ProductVM> listOfProductVM = new List <ProductVM>();

            ViewBag.Message = message;

            foreach (Product product in DB.Products)
            {
                ProductVM productVM = new ProductVM()
                {
                    Id          = product.Id,
                    Category    = product.Category,
                    Name        = product.Name,
                    Description = product.Description,
                    Price       = product.Price
                };
                listOfProductVM.Add(productVM);
            }

            ProductListVM productListVM = new ProductListVM()
            {
                TotalNumberOfProducts = DB.Products.Count,
                Products = listOfProductVM
            };

            return(View("Index", productListVM));
        }
示例#8
0
        public IActionResult ProductList(int?page)
        {
            ProductListVM model = new ProductListVM();

            model.Products = productOperations.GetAllProducts().ToPagedList(page ?? 1, 5);
            return(View(model));
        }
示例#9
0
        private void BtnAddProduct_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentVM == null)
            {
                CurrentWindow.Alert(ResFloorMaintain.Info_SectionChecked);
                return;
            }
            UCProductForSection ucProduct = new UCProductForSection();

            ucProduct.Dialog = CurrentWindow.ShowDialog(ResFloorMaintain.Head_ProductSection, ucProduct, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    var result = args.Data as FloorSectionProductVM;
                    FloorSectionItem sectionItem = LoadSectionItem(result, FloorItemType.Product);
                    sectionItem.ItemProudct      = result.ConvertVM <FloorSectionProductVM, FloorItemProduct>();

                    ServiceFacade.CreateFloorSectionItem(sectionItem, (s, objArgs) =>
                    {
                        if (objArgs.FaultsHandle())
                        {
                            return;
                        }
                        result.SysNo = objArgs.Result;
                        ProductListVM.Add(result);
                        productResult.ItemsSource = ProductListVM;
                    });
                }
            });
        }
示例#10
0
        public IActionResult ExportExcel(ProductListVM vm)
        {
            vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
            var data = vm.GenerateExcel();

            return(File(data, "application/vnd.ms-excel", $"Export_Product_{DateTime.Now.ToString("yyyy-MM-dd")}.xls"));
        }
示例#11
0
        public IActionResult Search(string property, string value, int?page)
        {
            ProductListVM model = new ProductListVM();

            model.Products = productOperations.SearchProductBy(property, value).ToPagedList(page ?? 1, 5);
            return(View("ProductList", model));
        }
        public ProductListPage(string index)
        {
            InitializeComponent();

            productListVM  = new ProductListVM(index);
            BindingContext = productListVM;
        }
示例#13
0
        // GET: Table
        public ActionResult ListProduct()
        {
            ProductBL     productBL     = new ProductBL();
            ProductListVM productListVM = new ProductListVM();

            productListVM.productVMlist = ProductList2ProductVMList(productBL.GetProductList());
            return(View(productListVM));
        }
示例#14
0
        //########################################

        public IActionResult Index(string message)
        {
            ViewBag.Message = message;

            ProductListVM productListVM = _productService.GetProductListVM();

            return(View("Index", productListVM));
        }
示例#15
0
        // Product/List
        public IActionResult List()
        {
            ProductListVM vm = new ProductListVM();

            vm.categories = _categoryBLL.GetAllCategories();
            vm.products   = _productBLL.GetAllProducts();
            return(View(vm));
        }
示例#16
0
        // Product/List/:id
        public IActionResult ListByCategory(Guid id)
        {
            ProductListVM vm = new ProductListVM();

            vm.categories = _categoryBLL.GetAllCategories();
            vm.products   = _productBLL.GetProductsByCategoryID(id);
            return(View("List", vm));
        }
        public IActionResult List()
        {
            var plist = _repo.toList();
            var cart  = _cartService.GetCart();

            var model = new ProductListVM(plist, cart);



            // var p1 = new Product();
            // p1.Name = "Ürün 1";
            // p1.ListPrice = 100;
            // p1.UnitPrice = 85;
            // p1.Stock = 10;

            // _repo.Create(p1);



            // var p2 = new Product();
            // p2.Name = "Ürün 2";
            // p2.ListPrice = 101;
            // p2.UnitPrice = 81;
            // p2.Stock = 20;

            // _repo.Create(p2);


            // var p3 = new Product();
            // p3.Name = "Ürün 3";
            // p3.ListPrice = 145;
            // p3.UnitPrice = 23;
            // p3.Stock = 30;

            // _repo.Create(p3);


            // var p4 = new Product();
            // p4.Name = "Ürün 4";
            // p4.ListPrice = 105;
            // p4.UnitPrice = 23;
            // p4.Stock = 21;

            // _repo.Create(p4);


            // var p5 = new Product();
            // p5.Name = "Ürün 5";
            // p5.ListPrice = 75;
            // p5.UnitPrice = 23;
            // p5.Stock = 21;

            // _repo.Create(p5);



            return(View(model));
        }
示例#18
0
        public IActionResult Index()
        {
            ProductListVM model = new ProductListVM()
            {
                Products = _productOperation.GetAll().OrderByDescending(e => e.Id)
            };

            return(View(model));
        }
示例#19
0
        public ActionResult Index()
        {
            var productListVM = new ProductListVM
            {
                Products = _productService.GetAll()
            };

            return(View(productListVM));
        }
示例#20
0
        public Result <List <ShowProductOnHomePageListVM> > ListForWeb(ProductListVM listVM, int Count)
        {
            var table = ConvertDataTableToList.BindList <ShowProductOnHomePageListVM>(_dataSource.ListForWeb(listVM, Count));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <ShowProductOnHomePageListVM> > .Successful(data : table));
            }
            return(Result <List <ShowProductOnHomePageListVM> > .Failure());
        }
示例#21
0
        public IActionResult Index()
        {
            var           products = _productService.GetAll();
            ProductListVM model    = new ProductListVM()
            {
                Products = products
            };

            return(View(model));
        }
示例#22
0
        public Result <List <Product> > List(ProductListVM listVM)
        {
            var table = ConvertDataTableToList.BindList <Product>(_dataSource.List(listVM));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Product> > .Successful(data : table));
            }
            return(Result <List <Product> > .Failure());
        }
        public ViewResult List()
        {
            ProductListVM productListVM = new ProductListVM()
            {
                Products = productRepository.AllProducts,
                SelectedCategoryName = categoryRepository.AllCategories.ToList()[0].Name
            };

            return View(productListVM);
        }
示例#24
0
        private void BtnBatchAddProduct_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentVM == null)
            {
                CurrentWindow.Alert(ResFloorMaintain.Info_SectionChecked);
                return;
            }
            UCProductSearch ucProduct = new UCProductSearch();

            ucProduct.SelectionMode = SelectionMode.Multiple;
            ucProduct.DialogHandler = CurrentWindow.ShowDialog(ResFloorMaintain.Head_ProductAdd, ucProduct, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    List <ProductVM> products = args.Data as List <ProductVM>;
                    if (products != null && products.Count > 0)
                    {
                        List <FloorSectionItem> sectionItems    = new List <FloorSectionItem>();
                        List <FloorSectionProductVM> proVMItems = new List <FloorSectionProductVM>();

                        products.ForEach(p =>
                        {
                            FloorSectionProductVM vm = EntityConverter <ProductVM, FloorSectionProductVM> .Convert(p, (s, t) =>
                            {
                                t.Priority     = 0;
                                t.ItemPosition = 0;
                                t.IsSelfPage   = 0;
                                t.ProductTitle = s.ProductName;
                                t.ProductPrice = s.CurrentPrice;
                                t.ProductID    = s.ProductID;
                                t.ProductSysNo = s.SysNo.Value;
                            });
                            FloorSectionItem sectionItem = LoadSectionItem(vm, FloorItemType.Product);
                            sectionItem.ItemProudct      = vm.ConvertVM <FloorSectionProductVM, FloorItemProduct>();
                            sectionItems.Add(sectionItem);
                            proVMItems.Add(vm);
                        });

                        ServiceFacade.BtnBatchCreateFloorSectionItem(sectionItems, (s, objArgs) =>
                        {
                            if (objArgs.FaultsHandle())
                            {
                                return;
                            }
                            for (int i = 0; i < objArgs.Result.Count; i++)
                            {
                                proVMItems[i].SysNo = objArgs.Result[i];
                                ProductListVM.Add(proVMItems[i]);
                                productResult.ItemsSource = ProductListVM;
                            }
                        });
                    }
                }
            });
        }
        // GET: Pharmacist/Products
        public async Task <ActionResult> Index(string search)
        {
            ProductListVM model = new ProductListVM();

            model.Products = await db.Products
                             .Where(m => m.Name.Contains(search) ||
                                    search == null || search == string.Empty)
                             .OrderByDescending(p => p.Id)
                             .ToListAsync();

            return(View(model));
        }
示例#26
0
        public IActionResult Index()
        {
            ProductListVM model = new ProductListVM()
            {
                Products = _productOperation.GetAll().Take(3)
            };

            ViewBag.countProducts = _productOperation.GetAll().Count();
            ViewBag.countShops    = _shopOperation.GetAll().Count();

            return(View(model));
        }
        public ProductListPage(Category subCategoryInfo)
        {
            InitializeComponent();

            productListVM  = new ProductListVM(subCategoryInfo);
            BindingContext = productListVM;

            //ProductListScrollView.Scrolled += (object sender, ScrolledEventArgs e) => {
            //    //label.Text = "Position: " + e.ScrollX + " x " + e.ScrollY;
            //    CrossToastPopUp.Current.ShowToastWarning(e.ScrollX + "/" + e.ScrollY + "/" + ((ScrollView)sender).ContentSize, ToastLength.Short);
            //};
        }
示例#28
0
 public IHttpActionResult List(ProductListVM listVM)
 {
     try
     {
         var result = _service.List(listVM);
         return(Ok(result));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
        //==============================================================
        public ProductListVM GetProductListVM()
        {
            List <ProductVM> listOfProductVM = GetAllProductVM.GetListOfProductVM();

            ProductListVM productListVM = new ProductListVM()
            {
                TotalNumberOfProducts = listOfProductVM.Count,
                Products = listOfProductVM
            };

            return(productListVM);
        }
        //public IActionResult Index()
        //{
        //    return View();
        //}

        public ViewResult List()
        {
            //ViewBag.SelectedCategory = _categoryRepository.AllCategories.ToList()[2].Name;
            //return View(_productRepository.AllProducts);

            ProductListVM productListVM = new ProductListVM()
            {
                Products             = _productRepository.AllProducts,
                SelectedCategoryName = _categoryRepository.AllCategories.ToList()[2].Name
            };

            return(View(productListVM));
        }