示例#1
0
 private bool DoEdit(int _id)
 {
     BLL.article_goods goods_bll = new BLL.article_goods();
     //保存商品信息
     string[] specGoodsIdArr       = Request.Form.GetValues("hide_goods_id");
     string[] specGoodsNoArr       = Request.Form.GetValues("spec_goods_no");
     string[] specMarketPriceArr   = Request.Form.GetValues("spec_market_price");
     string[] specSellPriceArr     = Request.Form.GetValues("spec_sell_price");
     string[] specSellDateArr      = Request.Form.GetValues("hide_spec_sell_date");
     string[] specStockQuantityArr = Request.Form.GetValues("spec_stock_quantity");
     string[] specSpecIdsArr       = Request.Form.GetValues("hide_spec_ids");
     string[] specTextArr          = Request.Form.GetValues("hide_spec_text");
     string[] specGroupPriceArr    = Request.Form.GetValues("hide_group_price");
     if (specGoodsIdArr != null && specGoodsNoArr != null && specMarketPriceArr != null && specSellPriceArr != null && specSellDateArr != null && specStockQuantityArr != null &&
         specSpecIdsArr != null && specTextArr != null && specGroupPriceArr != null &&
         specGoodsIdArr.Length > 0 && specGoodsNoArr.Length > 0 && specMarketPriceArr.Length > 0 && specSellPriceArr.Length > 0 &&
         specStockQuantityArr.Length > 0 && specSpecIdsArr.Length > 0 && specTextArr.Length > 0 && specGroupPriceArr.Length > 0)
     {
         List <Model.article_goods> goodsList = new List <Model.article_goods>();
         for (int i = 0; i < specGoodsNoArr.Length; i++)
         {
             List <Model.user_group_price> groupList = new List <Model.user_group_price>();
             if (!string.IsNullOrEmpty(specGroupPriceArr[i]))
             {
                 groupList = (List <Model.user_group_price>)JsonHelper.JSONToObject <List <Model.user_group_price> >(specGroupPriceArr[i]);
             }
             goodsList.Add(new Model.article_goods
             {
                 goods_no       = specGoodsNoArr[i],
                 spec_ids       = specSpecIdsArr[i],
                 spec_text      = specTextArr[i],
                 stock_quantity = Utils.StrToInt(specStockQuantityArr[i], 0),
                 market_price   = Utils.StrToDecimal(specMarketPriceArr[i], 0),
                 sell_price     = Utils.StrToDecimal(specSellPriceArr[i], 0),
                 sell_date      = Utils.StrToDateTime(specSellDateArr[i], DateTime.Now),
                 group_prices   = groupList
             });
         }
         if (goods_bll.Update(goodsList, _id, PLRequest.GetQueryDateTime("date").ToString("yyyy-MM-dd")))
         {
             AddAdminLog(PLEnums.ActionEnum.Edit.ToString(), "修改价格规格频道内容:" + article_model.title); //记录日志
             return(true);
         }
     }
     return(false);
 }