Пример #1
0
        public string QueryExplainPic()
        {
            int apporexplain = Convert.ToInt32(Request["apporexplain"]);
            string json = string.Empty;
            SetPath(apporexplain);
            if (string.IsNullOrEmpty(Request.Params["product_id"]))
            {
                //查找臨時表記錄
                _pPicTempMgr = new ProductPictureTempImplMgr(connectionString);
                int writer_Id = (Session["caller"] as Caller).user_id;
                ProductPictureTemp temp = new ProductPictureTemp { writer_Id = writer_Id, combo_type = COMBO_TYPE };
                if (!string.IsNullOrEmpty(Request.Params["OldProductId"]))
                {
                    temp.product_id = Request.Params["OldProductId"];
                }
                List<ProductPictureTemp> picList = _pPicTempMgr.Query(temp, apporexplain);

                foreach (var item in picList)
                {
                    if (item.image_filename != "")
                    {
                        if (item.pic_type == 2) ///edti by wwei0216w 當是手機圖片時,將查找的物理路徑改變為手機的路徑
                        {
                            descPath = "/product_picture/mobile/";
                        }
                        item.image_filename = imgServerPath + descPath + GetDetailFolder(item.image_filename) + item.image_filename;
                    }
                }
                json = "{success:true,items:" + JsonConvert.SerializeObject(picList) + "}";
                json = json.Replace("image_filename", "img");
            }
            else
            {
                //查詢正式表
                _productPicMgr = new ProductPictureMgr(connectionString);

                int product_id = int.Parse(Request.Params["product_id"]);
                List<ProductPicture> pList = _productPicMgr.Query(product_id, apporexplain);
                foreach (var item in pList)
                {
                    if (item.image_filename != "")
                    {
                        if (item.pic_type == 2) ///edti by wwei0216w 當是手機圖片時,將查找的物理路徑改變為手機的路徑
                        {
                            descPath = "/product_picture/mobile/";
                        }
                        item.image_filename = imgServerPath + descPath + GetDetailFolder(item.image_filename) + item.image_filename;

                    }
                }
                json = "{success:true,items:" + JsonConvert.SerializeObject(pList) + "}";
                json = json.Replace("image_filename", "img");
            }


            return json;
        }
Пример #2
0
 //[HttpPost]
 public string QueryExplainPic()
 {
     BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
     int writerID = (int)vendorModel.vendor_id;
     string json = string.Empty;
     string serverDescPath = imgServerPath + descPath;
     ProductPictureTemp query = new ProductPictureTemp();
     query.writer_Id = writerID;
     if (!string.IsNullOrEmpty(Request.Params["product_id"]))
     {
         query.product_id = Request.Form["product_id"];
     }
     uint pid = 0;
     if (uint.TryParse(Request.Params["product_id"], out pid))
     {
         #region 正式表
         _pPicMgr = new ProductPictureMgr(connectionString);
         List<ProductPicture> picProList = _pPicMgr.Query(Convert.ToInt32(Request.Form["product_id"]));
         foreach (var item in picProList)
         {
             if (item.image_filename != "")
             {
                 item.image_filename = serverDescPath + GetDetailFolder(item.image_filename) + item.image_filename;
             }
         }
         json = "{success:true,items:" + JsonConvert.SerializeObject(picProList) + "}";
         json = json.Replace("image_filename", "img");
         #endregion
     }
     else
     {
         #region 供應商 臨時表
         _pPicTempMgr = new ProductPictureTempImplMgr(connectionString);
         List<ProductPictureTemp> picList = _pPicTempMgr.VendorQuery(query);
         foreach (var item in picList)
         {
             if (item.image_filename != "")
             {
                 item.image_filename = serverDescPath + GetDetailFolder(item.image_filename) + item.image_filename;
             }
         }
         json = "{success:true,items:" + JsonConvert.SerializeObject(picList) + "}";
         json = json.Replace("image_filename", "img");
         #endregion
     }
     return json;
 }