Пример #1
0
        public ActionResult Update(int Id)
        {
            ProductCommissionDto dto = _productCommissionContract.Edit(Id);
            string strStoreName      = string.Empty;
            string strBrandName      = string.Empty;
            string strSeasonName     = string.Empty;

            if (dto != null)
            {
                Store store = _storeContract.View(dto.StoreId);
                if (store != null)
                {
                    strStoreName = store.StoreName;
                }
                Brand brand = _brandContract.View(dto.BrandId);
                if (brand != null)
                {
                    strBrandName = brand.BrandName;
                }
                Season season = _seasonContract.View(dto.SeasonId);
                if (season != null)
                {
                    strSeasonName = season.SeasonName;
                }
            }
            dto.StoreName  = strStoreName;
            dto.BrandName  = strBrandName;
            dto.SeasonName = strSeasonName;
            return(View(dto));
        }
Пример #2
0
        public JsonResult Update(ProductCommissionDto dto)
        {
            var result = _productCommissionContract.Update(dto);

            return(Json(result));
        }
Пример #3
0
        public JsonResult Create(ProductCommissionDto dto)
        {
            var result = _productCommissionContract.Insert(dto);

            return(Json(result));

            #region 注释代码
            //if (Brands != null)
            //{

            //    var checkName = _productCommissionContract.CheckName(productCommission.CommissionName);
            //    if (!checkName)
            //    {
            //        return Json(new OperationResult(OperationResultType.Error, "用户名已经存在!"), JsonRequestBehavior.AllowGet);
            //    }
            //    var listDiscount = _productCommissionContract.ProductCommissions.Where(x => x.IsDeleted == false && x.IsEnabled == true);
            //    List<ProductCommission> listBrand = listDiscount.Where(x => Brands.Where(k => k == x.BrandId.ToString()).Count() > 0).ToList();
            //    if (Seasons != null)
            //    {
            //        listBrand = listBrand.Where(x => Seasons.Where(k => k == x.SeasonId.ToString()).Count() > 0).ToList();
            //    }
            //    if (Stores != null)
            //    {
            //        listBrand = listBrand.Where(x => Stores.Where(k => k == x.StoreId.ToString()).Count() > 0).ToList();
            //    }
            //    if (listBrand.Count > 0)
            //    {
            //        bool isDel = _productCommissionContract.Delete(listBrand);
            //        if (isDel == false)
            //        {
            //            return Json(new OperationResult(OperationResultType.Error, "添加失败"), JsonRequestBehavior.AllowGet);
            //        }
            //    }
            //    List<ProductCommission> listProductComm = new List<ProductCommission>();
            //    for (int i = 0; i < Brands.Length; i++)
            //    {
            //        ProductCommission comm = new ProductCommission();
            //        comm.BrandId = int.Parse(Brands[i]);
            //        comm.CommissionName = productCommission.CommissionName;
            //        comm.Percentage = productCommission.Percentage;
            //        comm.OperatorId = AuthorityHelper.OperatorId;
            //        listProductComm.Add(comm);
            //    }
            //    if (Stores != null)
            //    {
            //        List<ProductCommission> listStore = new List<ProductCommission>();
            //        for (int i = 0; i < Stores.Length; i++)
            //        {
            //            foreach (var item in listProductComm)
            //            {
            //                item.StoreId = int.Parse(Stores[i]);
            //                listStore.Add(item);
            //            }
            //        }
            //        listProductComm = listStore;
            //    }
            //    if (Seasons != null)
            //    {
            //        List<ProductCommission> listSeason = new List<ProductCommission>();
            //        for (int i = 0; i < Seasons.Length; i++)
            //        {
            //            foreach (var item in listProductComm)
            //            {
            //                item.SeasonId = int.Parse(Seasons[i]);
            //                listSeason.Add(item);
            //            }
            //        }
            //        listProductComm = listSeason;
            //    }
            //    productCommission.OperatorId = AuthorityHelper.OperatorId;
            //    productCommission.Children = listProductComm;
            //    var result = _productCommissionContract.Insert(productCommission);
            //    return Json(result, JsonRequestBehavior.AllowGet);
            //}
            //else
            //{
            //    return Json(new OperationResult(OperationResultType.Error, "请选择品牌"), JsonRequestBehavior.AllowGet);
            //}
            #endregion
        }