コード例 #1
0
        public ActionResult Create(WholeSaleProductEditModel model)
        {
            if (!ModelState.IsValid)
            {
                model.ToCompanyList = CompanySvc.LoadCompanyByType((short)CompanyType.WholeSaleCompany);
                ModelState.AddModelError(string.Empty, "请输入正确信息!");
                return View(model);
            }

            IIdentity id = HttpContext.User.Identity;
            var product = AgriculturalProductSvc.LoadById(model.AgriculturalProductId);

            model.InsertUserName = id.Name;
            model.AgriculturalProductName = product.ProductName;
            model.ProductStatus = ProductStatus.WholeSale;

            int productId = WholeSaleProductSvc.Insert(model.ToWholeSaleProduct());

            if (productId > 0)
            {

                product.ProductStatus = ProductStatus.WholeSale;

                AgriculturalProductSvc.Update(product);
            }
            return RedirectToAction("WholeSold");
        }
コード例 #2
0
 public ActionResult Create(int agriculturalProductId)
 {
     var model = new WholeSaleProductEditModel
     {
         AgriculturalProductId = agriculturalProductId,
         ToCompanyList = CompanySvc.LoadCompanyByType((short)CompanyType.WholeSaleCompany)
     };
     return View(model);
 }
コード例 #3
0
        public ActionResult Cut(WholeSaleProductEditModel model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "请输入正确的信息!");
                return View(model);
            }

            IIdentity id = HttpContext.User.Identity;
            var product = AgriculturalProductSvc.LoadById(model.AgriculturalProductId);

            model.InsertUserName = id.Name;
            model.AgriculturalProductName = product.ProductName;
            model.ProductStatus = ProductStatus.CanWholeSale;

            int productId = WholeSaleProductSvc.Insert(model.ToWholeSaleProduct());

            if (productId > 0)
            {

                var wholeSaleProduct = WholeSaleProductSvc.LoadById(model.ParentId);
                wholeSaleProduct.ProductStatus = ProductStatus.CutWholeSaleProduct;

                WholeSaleProductSvc.Update(wholeSaleProduct);
            }

            return RedirectToAction("CutWholeSaleProduct");
        }
コード例 #4
0
        public ActionResult Cut(int agriculturalProductId, int parentId)
        {
            var product = WholeSaleProductSvc.LoadById(parentId);
            var model = new WholeSaleProductEditModel
            {
                AgriculturalProductId = agriculturalProductId,
                ParentId = parentId,
                ToCompanyId = product.ToCompany.Id,
                AgriculturalProductName = product.AgriculturalProductName
            };

            return View(model);
        }
コード例 #5
0
        public ActionResult Detail(int id)
        {
            var product = WholeSaleProductSvc.LoadById(id);
            var model = new WholeSaleProductEditModel(product);

            return View(model);
        }