예제 #1
0
        /// <summary>
        /// 修改订单
        /// </summary>
        /// <param name="order">订单模型</param>
        /// <param name="goodsDic">订单中的商品数据</param>
        /// <returns>是否修改成功</returns>
        public bool UpdateOrder(T_Order order, Dictionary <int, int> goodsDic)
        {
            //使用事务进行数据库操作
            using (var tran = this.nContext.Database.BeginTransaction())
            {
                try
                {
                    IShopSaleBLL saleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    //更新商品剩余数量
                    foreach (var Goods in order.OrderDetails)
                    {
                        var sale = saleBll.GetEntity(s => s.Id == Goods.ShopSaleId);
                        sale.RemainingAmout = sale.RemainingAmout + Goods.SaledAmount;
                        saleBll.Update(sale);
                    }

                    //删除该订单中的商品详细关联数据
                    this.nContext.Database.ExecuteSqlCommand("delete from T_OrderDetails where OrderId=" + order.Id);

                    //重新给订单添加商品
                    foreach (var Goods in goodsDic)
                    {
                        var sale = saleBll.GetEntity(s => s.Id == Goods.Key);
                        if (sale != null)
                        {
                            order.OrderDetails.Add(new T_OrderDetails()
                            {
                                ShopSaleId  = Goods.Key,
                                SaledAmount = Goods.Value,
                                Price       = sale.Price * Goods.Value
                            });
                            sale.RemainingAmout = sale.RemainingAmout + Goods.Value;
                            saleBll.Update(sale);
                        }
                    }
                    //更新
                    base.Update(order);
                    //提交事务
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public JsonResult EditShopSales(ShopSaleModel Model)
        {
            JsonModel Jm = new JsonModel();

            if (ModelState.IsValid)
            {
                //促销BLL
                IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                T_ShopSale ShopSale = SaleBLL.GetEntity(a => a.Id == Model.Id);
                if (ShopSale != null)
                {
                    ShopSale.Title           = Model.Title;
                    ShopSale.Phone           = Model.Phone;
                    ShopSale.Content         = Model.Content;
                    ShopSale.GoodsCategoryId = Model.GoodsCategoryId.Value;
                    ShopSale.RemainingAmout  = Model.RemainingAmout;
                    ShopSale.Price           = Model.Price;
                    //保存修改
                    SaleBLL.Update(ShopSale);
                }
                else
                {
                    Jm.Msg = "该商品不存在";
                }
                //记录日志
                Jm.Content = Property.Common.PropertyUtils.ModelToJsonString(Model);
            }
            else
            {
                Jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(Jm, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult EditShopSales(int id)
        {
            //初始化模型
            ShopSaleModel model = new ShopSaleModel();
            //促销BLL
            IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            var lst = SaleBLL.GetEntity(a => a.Id == id);

            if (lst != null)
            {
                model.Id                = lst.Id;
                model.Title             = lst.Title;
                model.Content           = lst.Content;
                model.Phone             = lst.Phone;
                model.RemainingAmout    = lst.RemainingAmout;
                model.Price             = lst.Price;
                model.GoodsCategoryId   = lst.GoodsCategoryId;
                model.GoodsCategoryList = GetGoodsCategoryList(lst.GoodsCategory.ShopId);
                return(View(model));
            }
            else
            {
                return(RedirectToAction("SaleList"));
            }
        }
예제 #4
0
        /// <summary>
        /// 取消订单
        /// </summary>
        /// <param name="order">要取消的订单实体对象</param>
        /// <returns></returns>
        public bool CancelOrder(T_Order order)
        {
            //使用事务进行数据库操作
            using (var tran = this.nContext.Database.BeginTransaction())
            {
                try
                {
                    IShopSaleBLL saleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    //更新商品剩余数量
                    foreach (var Goods in order.OrderDetails)
                    {
                        var sale = saleBll.GetEntity(s => s.Id == Goods.ShopSaleId);
                        sale.RemainingAmout = sale.RemainingAmout + Goods.SaledAmount;
                        saleBll.Update(sale);
                    }
                    //更新
                    base.Update(order);
                    //提交事务
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
        public JsonResult ShopSalesValidate(int id, string Title)
        {
            bool result = true;
            //促销BLL
            IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            result = (SaleBLL.GetEntity(a => a.Id != id && a.Title.Equals(Title)) == null);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        /// <summary>
        /// 促销详细页面
        /// </summary>
        /// <param name="id">促销ID</param>
        /// <returns></returns>
        public ActionResult SaleDetail(int id)
        {
            //获取要查看详细的门店实体对象
            IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            T_ShopSale Sale = SaleBll.GetEntity(s => s.Id == id);

            return(View(Sale));
        }
예제 #7
0
        public ActionResult ShopSalesDetail(int id = 0)
        {
            //促销BLL
            IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            var lst = SaleBLL.GetEntity(a => a.Id == id);

            if (lst != null)
            {
                return(View(lst));
            }
            else
            {
                return(RedirectToAction("SaleList"));
            }
        }
예제 #8
0
        public JsonResult DelShopSales(int id)
        {
            JsonModel Jm = new JsonModel();

            try
            {
                //促销BLL
                IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                T_ShopSale ShopSale = SaleBLL.GetEntity(a => a.Id == id);
                //图片集合
                List <string> Path = new List <string>();
                //缩略图集合
                List <string> ThumPath = new List <string>();
                if (!string.IsNullOrEmpty(ShopSale.ImgPath) && !string.IsNullOrEmpty(ShopSale.ImgThumbnail))
                {
                    Path     = ShopSale.ImgPath.Split(new char[] { ';' }).ToList();
                    ThumPath = ShopSale.ImgThumbnail.Split(new char[] { ';' }).ToList();
                }
                //删除文件
                for (int i = 0; i < ThumPath.Count; i++)
                {
                    if (!string.IsNullOrEmpty(Path[i].Trim()))
                    {
                        //删除缩略图
                        DelFile(ThumPath[i]);
                        //删除图片
                        //DelFile(Path[i]);
                    }
                }
                if (ShopSale.OrderDetails.Count > 0)
                {
                    Jm.Msg = "该商品已被订购,无法删除";
                }
                else
                {
                    //执行删除
                    SaleBLL.Delete(ShopSale);
                }
            }
            catch
            {
                Jm.Msg = "删除失败";
            }
            return(Json(Jm, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public ActionResult Upload(int id)
        {
            //门店BLL
            IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            T_ShopSale    Model = SaleBLL.GetEntity(a => a.Id == id);
            ShopSaleModel List  = new ShopSaleModel();

            List.Id = Model.Id;
            if (Model.ImgPath != null && Model.ImgThumbnail != null)
            {
                List <string> pathstr  = Model.ImgPath.Split(new char[] { ';' }).ToList();
                List <string> ThumPath = Model.ImgThumbnail.Split(new char[] { ';' }).ToList();
                List.PathList     = pathstr;
                List.ThumPathList = ThumPath;
            }
            return(View(List));
        }
예제 #10
0
        public ActionResult ReAddShopSales(int id)
        {
            JsonModel    Jm      = new JsonModel();
            int          ShopId  = GetCurrentShopId().Value;//当前门店
            IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            T_ShopSale ShopSale = SaleBLL.GetEntity(a => a.Id == id);

            if (ShopSale != null)
            {
                ShopSale.CreateTime = DateTime.Now;
                ShopSale.InSales    = 1;
            }
            else
            {
                Jm.Msg = "该商品已经上架";
            }
            SaleBLL.Update(ShopSale);
            return(Json(Jm, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        public ApiResultModel SetOnSale(GoodsInfoModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果商家用户存在
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    if (model.Id.HasValue)
                    {
                        IShopSaleBLL shopSaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                        var goods = shopSaleBll.GetEntity(g => g.Id == model.Id.Value);
                        //修改商品上/下架
                        if (goods != null)
                        {
                            goods.InSales = model.InSales;

                            if (goods.InSales == 0)
                            {
                                goods.UnShelveTime = DateTime.Now;
                            }
                            else
                            {
                                goods.CreateTime = DateTime.Now;
                            }

                            shopSaleBll.Update(goods);
                        }
                        else
                        {
                            resultModel.Msg = "不存在当前商品分类";
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
예제 #12
0
        public ApiResultModel DelGoods(GoodsInfoModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果商家用户存在
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    if (model.Id.HasValue)
                    {
                        IShopSaleBLL shopSaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                        var goods = shopSaleBll.GetEntity(g => g.Id == model.Id.Value);

                        if (goods == null)
                        {
                            resultModel.Msg = "该商品不存在";
                        }
                        else
                        {
                            if (goods.OrderDetails.Count > 0)
                            {
                                resultModel.Msg = "该商品已被订购,无法删除";
                            }
                            else
                            {
                                var imagePath    = goods.ImgPath;
                                var imgThumbnail = goods.ImgThumbnail;

                                shopSaleBll.Delete(goods);

                                if (!string.IsNullOrWhiteSpace(imagePath))
                                {
                                    if (imagePath.Contains(";"))
                                    {
                                        foreach (var path in imagePath.Split(';'))
                                        {
                                            DelFile(path);
                                        }
                                    }
                                    else
                                    {
                                        DelFile(imagePath);
                                    }
                                }

                                if (!string.IsNullOrWhiteSpace(imgThumbnail))
                                {
                                    if (imgThumbnail.Contains(";"))
                                    {
                                        foreach (var path in imgThumbnail.Split(';'))
                                        {
                                            DelFile(path);
                                        }
                                    }
                                    else
                                    {
                                        DelFile(imgThumbnail);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
예제 #13
0
        public ApiResultModel EditGoods(GoodsInfoModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果商家用户存在
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    if (model.Id.HasValue)
                    {
                        IShopSaleBLL shopSaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                        var goods = shopSaleBll.GetEntity(g => g.Id == model.Id.Value);

                        //修改商品分类
                        if (goods != null)
                        {
                            //基础信息
                            goods.Title           = model.Name;
                            goods.Content         = model.Content;
                            goods.Price           = model.Price;
                            goods.RemainingAmout  = model.RemainingAmount;
                            goods.GoodsCategoryId = model.GoodCategoryId;

                            //图片和压缩图
                            var sourceImgList           = goods.ImgPath == null ? null : goods.ImgPath.Split(';').ToList();
                            var sourceImgThumbnailArray = goods.ImgThumbnail == null ? null : goods.ImgThumbnail.Split(';').ToArray();

                            var remainingImgList          = goods.ImgPath == null ? new List <string>() : goods.ImgPath.Split(';').ToList();
                            var remainingImgThumbnailList = goods.ImgThumbnail == null ? new List <string>() : goods.ImgThumbnail.Split(';').ToList();


                            //要删除的缩略图列表
                            var delImgThumbnailList = new List <string>();

                            if (sourceImgList != null)
                            {
                                //对要删除的图片列表进行删除
                                if (!string.IsNullOrWhiteSpace(model.delPicList))
                                {
                                    foreach (var path in model.delPicList.Split(';'))
                                    {
                                        int index = sourceImgList.FindIndex(m => m == path);

                                        if (index < sourceImgThumbnailArray.Count())
                                        {
                                            delImgThumbnailList.Add(sourceImgThumbnailArray[index]);
                                        }

                                        remainingImgList.Remove(path);
                                        DelFile(path);
                                    }
                                }
                            }


                            foreach (var path in delImgThumbnailList)
                            {
                                remainingImgThumbnailList.Remove(path);
                                DelFile(path);
                            }

                            var strRemainedImg = "";

                            foreach (var item in remainingImgList)
                            {
                                if (!string.IsNullOrEmpty(item.Trim()))
                                {
                                    strRemainedImg = strRemainedImg + item + ";";
                                }
                            }

                            var strReminedThumbnailImg = "";

                            foreach (var item in remainingImgThumbnailList)
                            {
                                if (!string.IsNullOrEmpty(item.Trim()))
                                {
                                    strReminedThumbnailImg = strReminedThumbnailImg + item + ";";
                                }
                            }

                            //图片上传
                            if (!string.IsNullOrEmpty(model.PicList))
                            {
                                //文件资源保存目录
                                string dir = HttpContext.Current.Server.MapPath(ConstantParam.SHOP_Sales);

                                if (!Directory.Exists(dir))
                                {
                                    Directory.CreateDirectory(dir);
                                }

                                var    fileName = DateTime.Now.ToFileTime().ToString() + ".zip";
                                string filepath = Path.Combine(dir, fileName);

                                using (FileStream fs = new FileStream(filepath, FileMode.Create))
                                {
                                    using (BinaryWriter bw = new BinaryWriter(fs))
                                    {
                                        byte[] datas = Convert.FromBase64String(model.PicList);
                                        bw.Write(datas);
                                        bw.Close();
                                    }
                                }

                                var imgZipParth = PropertyUtils.UnZip(filepath, dir, ConstantParam.SHOP_Sales);
                                //图片集路径保存
                                goods.ImgPath = strRemainedImg + imgZipParth;

                                StringBuilder imgsSB = new StringBuilder();
                                //生成缩略图保存
                                foreach (var path in imgZipParth.Split(';'))
                                {
                                    string thumpFile = DateTime.Now.ToFileTime().ToString() + ".jpg";
                                    string thumpPath = Path.Combine(HttpContext.Current.Server.MapPath(ConstantParam.SHOP_Sales_ThumIMG), thumpFile);
                                    PropertyUtils.getThumImage(Path.Combine(HttpContext.Current.Server.MapPath(path)), 18, 3, thumpPath);

                                    imgsSB.Append(ConstantParam.SHOP_Sales_ThumIMG + "/" + thumpFile + ";");
                                }

                                goods.ImgThumbnail = imgsSB.ToString();
                                goods.ImgThumbnail = strReminedThumbnailImg + goods.ImgThumbnail.Substring(0, goods.ImgThumbnail.Length - 1);
                            }
                            else
                            {
                                goods.ImgPath      = strRemainedImg;
                                goods.ImgThumbnail = strReminedThumbnailImg;
                            }

                            shopSaleBll.Update(goods);
                        }
                        else
                        {
                            resultModel.Msg = "不存在当前商品";
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
예제 #14
0
        public ApiResultModel GetGoods([FromUri] GoodsInfoModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果商家用户存在
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    if (model.Id.HasValue)
                    {
                        IShopSaleBLL shopSaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                        var goods = shopSaleBll.GetEntity(g => g.Id == model.Id.Value);
                        //商品详情
                        if (goods != null)
                        {
                            resultModel.result = new
                            {
                                Name              = goods.Title,
                                Content           = goods.Content,
                                Price             = goods.Price,
                                RemaintAmount     = goods.RemainingAmout,
                                GoodsCategoryId   = goods.GoodsCategoryId,
                                GoodsCategoryName = goods.GoodsCategory.Name,
                                ImgPath           = goods.ImgPath,
                                ImgThumbnail      = goods.ImgThumbnail
                            };
                        }
                        else
                        {
                            resultModel.Msg = "不存在当前商品";
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
예제 #15
0
        public JsonResult DelFile(int id, string href, string thum)
        {
            JsonModel Jm = new JsonModel();

            try
            {
                //促销BLL
                IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                T_ShopSale ShopSale = SaleBLL.GetEntity(a => a.Id == id);

                //删除缩略图路径
                List <string> ImgThumbnailList = ShopSale.ImgThumbnail.Split(';').ToList();
                ImgThumbnailList.Remove(href);

                string newImgThumbnails = "";
                foreach (var item in ImgThumbnailList)
                {
                    if (!string.IsNullOrEmpty(item.Trim()))
                    {
                        newImgThumbnails = newImgThumbnails + item + ";";
                    }
                }
                if (!string.IsNullOrEmpty(newImgThumbnails))
                {
                    newImgThumbnails = newImgThumbnails.Substring(0, newImgThumbnails.Length - 1);
                }
                ShopSale.ImgThumbnail = newImgThumbnails;
                //获取缩略图片文件
                string path = Server.MapPath(href);
                if (System.IO.File.Exists(path))
                {
                    try
                    {
                        System.IO.File.Delete(path);
                    }
                    catch { }
                }

                //删除大图路径
                List <string> ImgPathList = ShopSale.ImgPath.Split(';').ToList();
                ImgPathList.Remove(thum);

                string newImgPaths = "";
                foreach (var item in ImgPathList)
                {
                    if (!string.IsNullOrEmpty(item.Trim()))
                    {
                        newImgPaths = newImgPaths + item + ";";
                    }
                }
                if (!string.IsNullOrEmpty(newImgPaths))
                {
                    newImgPaths = newImgPaths.Substring(0, newImgPaths.Length - 1);
                }
                ShopSale.ImgPath = newImgPaths;
                string thumPath = Server.MapPath(thum);
                if (System.IO.File.Exists(thumPath))
                {
                    try
                    {
                        //删除原图片
                        System.IO.File.Delete(thumPath);
                    }
                    catch { }
                }
                SaleBLL.Update(ShopSale);
                //记录log
                Jm.Content = "删除商品图片" + href;
            }
            catch
            {
                Jm.Msg = "删除出现异常";
            }
            return(Json(Jm));
        }
예제 #16
0
        public JsonResult Upload(ShopSaleModel Model)
        {
            JsonModel jm = new JsonModel();

            try
            {
                //促销BLL
                IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                T_ShopSale ShopSale = SaleBLL.GetEntity(a => a.Id == Model.Id);
                //图片路径
                string PathList = string.IsNullOrEmpty(ShopSale.ImgPath) ? "" : ShopSale.ImgPath + ";";
                //缩略图路径
                string ThumPathList    = string.IsNullOrEmpty(ShopSale.ImgThumbnail) ? "" : ShopSale.ImgThumbnail + ";";
                int    currentImgCount = PathList.Split(';').Count() - 1;
                if (Request.Files.Count + currentImgCount > 6)
                {
                    jm.Msg = "最多只能上传6张商品图片";
                    return(Json(jm, JsonRequestBehavior.AllowGet));
                }
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFileBase file = Request.Files[i];

                    if (file != null)
                    {
                        var fileName = DateTime.Now.ToFileTime() + Path.GetExtension(file.FileName);
                        //判断图片路径是否存在
                        if (!System.IO.Directory.Exists(Server.MapPath(ConstantParam.SHOP_Sales)))
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath(ConstantParam.SHOP_Sales));
                        }
                        //判断缩略图路径是否存在
                        if (!System.IO.Directory.Exists(Server.MapPath(ConstantParam.SHOP_Sales_ThumIMG)))
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath(ConstantParam.SHOP_Sales_ThumIMG));
                        }
                        //保存图片
                        var path = Path.Combine(Server.MapPath(ConstantParam.SHOP_Sales), fileName);
                        file.SaveAs(path);
                        //生成缩略图
                        string thumpFile = DateTime.Now.ToFileTime() + ".jpg";

                        var thumpPath = Path.Combine(Server.MapPath(ConstantParam.SHOP_Sales_ThumIMG), thumpFile);
                        PropertyUtils.getThumImage(path, 18, 3, thumpPath);
                        PathList     += ConstantParam.SHOP_Sales + "/" + fileName + ";";
                        ThumPathList += ConstantParam.SHOP_Sales_ThumIMG + "/" + thumpFile + ";";
                    }
                }
                ShopSale.ImgPath      = PathList.Substring(0, PathList.Length - 1);
                ShopSale.ImgThumbnail = ThumPathList.Substring(0, ThumPathList.Length - 1);;

                //保存
                SaleBLL.Update(ShopSale);
                jm.Content = "商品:" + Model.Title + "上传图片";
            }
            catch (Exception e)
            {
                jm.Msg = e.Message;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }