Example #1
0
        public string AddShopCategory(int shopCategorySort, string shopCategoryNo, string picno, int imgWidth, int imgHeight, int imgLength)
        {
            HttpPostedFileBase file = Request.Files["shopCategoryImgfile"];

            if (file != null && file.ContentLength > 0)
            {
                SaveImg(file, imgWidth, imgHeight, imgLength);
                if (rsPic.Keys.Contains("error"))
                {
                    return("{\"status\":1,\"message\":\"" + rsPic["error"] + "\"}");
                }
                else
                {
                    picno = rsPic["success"];
                }
            }

            if (picno.Length > 0)//上传成功或已有图
            {
                SWfsAppShopCategory obj = new SWfsAppShopCategory();
                obj.Sort       = shopCategorySort;
                obj.CategoryNo = shopCategoryNo;
                obj.PicNo      = picno;
                obj.CreateDate = DateTime.Now;
                appIndexService.UpdateAppShopCategory(obj);

                return("{\"status\":0,\"message\":\"" + picno + "\"}");
            }
            else
            {
                return("{\"status\":1,\"message\":\"图片上传失败\"}");
            }
        }
Example #2
0
        public string AddShopCategory2(int categoryCount, string picno, int imgWidth, int imgHeight, int imgLength)
        {
            string             errorInfo = string.Empty;
            HttpPostedFileBase file      = Request.Files["shopCategoryImgfile"];

            if (file != null && file.ContentLength > 0)
            {
                SaveImg(file, imgWidth, imgHeight, 100);
                if (rsPic.Keys.Contains("error"))
                {
                    return("{\"status\":1,\"message\":\"" + rsPic["error"] + "\"}");
                }
                else
                {
                    picno = rsPic["success"];
                }
            }

            if (picno.Length > 0)//上传成功或已有图
            {
                for (int i = 1; i <= categoryCount; i++)
                {
                    SWfsAppShopCategory obj = new SWfsAppShopCategory();
                    obj.Sort       = i;
                    obj.CategoryNo = Request.Form["shopCategoryNo" + i.ToString()];
                    obj.PicNo      = picno;
                    obj.CreateDate = DateTime.Now;
                    appIndexService.UpdateAppShopCategory(obj);
                }
                if (categoryCount == 6)
                {
                    appIndexService.DeleteAppShopCategoryBySorts(7, 8, 9);
                }

                return("{\"status\":0,\"message\":\"" + picno + "\"}");
            }
            else
            {
                return("{\"status\":1,\"message\":\"图片上传失败\"}");
            }
        }
Example #3
0
 /// <summary>
 /// 添加/修改搜索页商城分类
 /// 指定位置不存在的insert,存在的update
 /// </summary>
 /// <param name="obj"></param>
 public void UpdateAppShopCategory(SWfsAppShopCategory obj)
 {
     DapperUtil.Execute("ComBeziWfs_SWfsAppShopCategory_Update", new { Sort = obj.Sort, CategoryNo = obj.CategoryNo, PicNo = obj.PicNo, CreateDate = obj.CreateDate });
 }