public HttpResponseBase Product_Cancel() { string resultStr = "{success:false}"; //初始化數據庫連接 _productTempMgr = new ProductTempMgr(connectionString); try { if (!string.IsNullOrEmpty(Request.Form["Product_Id"])) { string[] pro_Ids = Request.Form["Product_Id"].Split('|'); foreach (string item in pro_Ids.Distinct()) { ProductTemp productTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = item, Temp_Status = 12, Create_Channel = 2 }).FirstOrDefault(); if (productTemp != null) { productTemp.Product_Status = 0; _productTempMgr.CancelVerify(productTemp); } } } resultStr = "{success:true}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); resultStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase VerifyApply() { string prodcutIdStr = Request.Params["prodcutIdStr"]; List<QueryandVerifyCustom> resultList = new List<QueryandVerifyCustom>(); string result = "{success:false}"; //初始化數據庫連接 _productTempMgr = new ProductTempMgr(connectionString); try { string[] productIds = prodcutIdStr.Split(','); foreach (string item in productIds.Distinct()) { ProductTemp productTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = item, Temp_Status = 12, Create_Channel = 2 }).FirstOrDefault(); if (productTemp != null) { productTemp.Product_Status = 1; //狀態 -> 申請審核 _productTempMgr.UpdateAchieve(productTemp); } } result = "{success:true}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } Response.Clear(); Response.Write(result); Response.End(); return this.Response; }
public HttpResponseBase GetProNotice() { string json = string.Empty; try { //獲取當前登入的供應商 BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; StringBuilder strJson = new StringBuilder(""); _productNoticeMgr = new ProductNoticeMgr(connectionString); List<ProductNotice> notices = _productNoticeMgr.Query(new ProductNotice { notice_status = 1 }); if (notices != null) { _productNoticeSetTempMgr = new ProductNoticeSetTempMgr(connectionString); ProductNoticeSetTemp queryProductNotice = new ProductNoticeSetTemp(); if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { string productId = Request.Form["ProductId"].ToString(); queryProductNotice.product_id = productId; } //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // queryProductNotice.product_id = Request.Form["OldProductId"].ToString(); //} queryProductNotice.Writer_Id = (int)vendorModel.vendor_id; queryProductNotice.Combo_Type = COMBO_TYPE; List<ProductNoticeSetTemp> noticeSets = _productNoticeSetTempMgr.QueryVendorProdNotice(queryProductNotice); _productTempMgr = new ProductTempMgr(connectionString); ProductTemp proTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Writer_Id = (int)vendorModel.vendor_id, Combo_Type = COMBO_TYPE, Product_Id = queryProductNotice.product_id, Create_Channel = 2 }).FirstOrDefault(); bool check = (proTemp != null && !string.IsNullOrEmpty(proTemp.Page_Content_2)) ? false : true; foreach (var item in notices) { strJson.AppendFormat("<input type='checkbox' id='notice_{0}' name='notices' value='{0}' ", item.notice_id); if (check || noticeSets.Exists(m => m.notice_id == item.notice_id)) { strJson.Append("checked='true'"); } strJson.AppendFormat("/><label for='notice_{0}'>{1}</label>", item.notice_id, item.notice_name); } } json = strJson.ToString(); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase SaveDescription() { string json = string.Empty; try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writeId = (int)vendorModel.vendor_id; string tags = Request.Form["Tags"] ?? ""; string notices = Request.Form["Notice"] ?? ""; JavaScriptSerializer jsSer = new JavaScriptSerializer(); _productTempMgr = new ProductTempMgr(connectionString); string product_id = string.Empty; if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { product_id = Request.Form["ProductId"].ToString(); } //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // product_id = Request.Form["OldProductId"].ToString(); //} if (!string.IsNullOrEmpty(product_id)) { ProductTemp oldProdTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = product_id, Combo_Type = COMBO_TYPE, Create_Channel = 2, Writer_Id = writeId }).FirstOrDefault(); if (oldProdTemp != null) { oldProdTemp.Page_Content_1 = Request.Form["page_content_1"] ?? ""; oldProdTemp.Page_Content_2 = Request.Form["page_content_2"] ?? ""; oldProdTemp.Page_Content_3 = Request.Form["page_content_3"] ?? ""; oldProdTemp.Product_Keywords = Request.Form["product_keywords"] ?? ""; if (!string.IsNullOrEmpty(Request.Form["product_buy_limit"])) { oldProdTemp.Product_Buy_Limit = uint.Parse(Request.Form["product_buy_limit"]); } oldProdTemp.Writer_Id = writeId; oldProdTemp.Combo_Type = COMBO_TYPE; List<ProductTagSetTemp> tagTemps = jsSer.Deserialize<List<ProductTagSetTemp>>(tags); foreach (ProductTagSetTemp item in tagTemps) { item.Writer_Id = writeId; item.Combo_Type = COMBO_TYPE; item.product_id = oldProdTemp.Product_Id; } List<ProductNoticeSetTemp> noticeTemps = jsSer.Deserialize<List<ProductNoticeSetTemp>>(notices); //noticeTemps.ForEach(m => m.Writer_Id = writer_id); foreach (ProductNoticeSetTemp item in noticeTemps) { item.Writer_Id = writeId; item.Combo_Type = COMBO_TYPE; item.product_id = oldProdTemp.Product_Id; } _productTempMgr = new ProductTempMgr(connectionString); if (_productTempMgr.VendorDescriptionInfoUpdate(oldProdTemp, tagTemps, noticeTemps)) { json = "{success:true}"; } else { json = "{success:false}"; } } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase SaveBaseInfo() { ProductTemp pTemp = new ProductTemp();//儲存前台輸入的數據 _productTempMgr = new ProductTempMgr(connectionString); string json = "{success:true}"; BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; uint brand_id = uint.Parse(Request.Form["brand_id"]); uint product_sort = uint.Parse(Request.Form["product_sort"]); uint product_start = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_start"]).ToString()); uint product_end = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_end"]).ToString()); uint expect_time = uint.Parse(CommonFunction.GetPHPTime(Request.Form["expect_time"]).ToString()); uint product_freight_set = uint.Parse(Request.Form["product_freight_set"]); uint product_mode = uint.Parse(Request.Form["product_mode"]); string product_name = Request.Form["product_name"]; string product_vendor_code = Request.Form["product_vendor_code"]; int tax_type = int.Parse(Request.Form["tax_type"]); string expect_msg = Request.Form["expect_msg"] ?? ""; pTemp.Brand_Id = brand_id; pTemp.Product_Name = product_name; pTemp.Product_Sort = product_sort; pTemp.Product_Vendor_Code = product_vendor_code; pTemp.Product_Start = product_start; pTemp.Product_End = product_end; pTemp.Expect_Time = expect_time; pTemp.Product_Freight_Set = product_freight_set; pTemp.Product_Mode = product_mode; pTemp.Tax_Type = tax_type; pTemp.expect_msg = expect_msg; pTemp.Combo_Type = COMBO_TYPE; pTemp.Product_Ipfrom = Request.UserHostAddress;//获取当前ip if (string.IsNullOrEmpty(Request.Params["product_id"]))//新增 { //查找臨時表是否存在數據,存在:更新,不存在插入 pTemp.Writer_Id = (int)vendorModel.vendor_id; pTemp.Product_Status = 20; pTemp.Combo_Type = COMBO_TYPE; pTemp.Temp_Status = 11; pTemp.Create_Channel = 2; pTemp.Product_Createdate = uint.Parse(CommonFunction.GetPHPTime(DateTime.Now.ToString()).ToString()); pTemp.Product_Updatedate = pTemp.Product_Createdate; ProductTemp pTempList = null; if (pTempList == null) { //插入 string result = string.Empty; try { result = _productTempMgr.vendorBaseInfoSave(pTemp); if (result != null) { json = "{success:true,rid:'" + result + "'}"; } else { json = "{success:false}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:'" + Resources.VendorProduct.ADD_FAIL + "'}"; } } else { pTemp.Temp_Status = 11; //更新 if (pTemp.Product_Mode != 2) { pTemp.Bag_Check_Money = 0; } else { pTemp.Bag_Check_Money = pTempList.Bag_Check_Money; } try { _productTempMgr.vendorBaseInfoUpdate(pTemp); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:'" + Resources.VendorProduct.SAVE_FAIL + "'}"; } } } else//編輯臨時表數據 { ProductTemp prodTemp = new ProductTemp();//儲存查到的數據 //product_id存在時表修改查詢product表。 prodTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Params["product_id"].ToString(), Writer_Id = (int)vendorModel.vendor_id, Create_Channel = 2 }).FirstOrDefault(); prodTemp.Brand_Id = brand_id; prodTemp.Product_Name = product_name; prodTemp.Product_Sort = product_sort; prodTemp.Product_Vendor_Code = product_vendor_code; prodTemp.Product_Start = product_start; prodTemp.Product_End = product_end; prodTemp.Expect_Time = expect_time; prodTemp.Product_Freight_Set = product_freight_set; prodTemp.Product_Mode = product_mode; if (product_mode != 2) { prodTemp.Bag_Check_Money = 0; } prodTemp.Tax_Type = tax_type; prodTemp.expect_msg = expect_msg; prodTemp.Writer_Id = (int)vendorModel.vendor_id; prodTemp.Product_Status =20; prodTemp.Combo_Type = COMBO_TYPE; //prodTemp.Temp_Status = 12;//修改时商品状态都为供应商新建 prodTemp.Create_Channel = 2; prodTemp.Product_Ipfrom = Request.UserHostAddress;//获取当前ip prodTemp.Product_Updatedate = uint.Parse(CommonFunction.GetPHPTime(DateTime.Now.ToString()).ToString()); int result = 0; try { result = _productTempMgr.vendorBaseInfoUpdate(prodTemp); if (result == 1) { json = "{success:true,msg:'" + Resources.VendorProduct.SAVE_SUCCESS + "'}"; } else { json = "{success:false,msg:'" + Resources.VendorProduct.SAVE_FAIL + "'}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:'" + Resources.VendorProduct.EDIT_FAIL + "'}"; } } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
/// <summary> /// 刪除服務器上的圖片 /// </summary> /// <param name="prod">商品圖是否刪除</param> /// <param name="spec">規格圖是否是否刪除</param> /// <param name="desc">說明圖是否刪除</param> /// <param name="spec_id">規格id</param> /// <param name="product_id">商品id</param> public void DeletePicOnServer(bool prod, bool spec, bool desc, uint spec_id, string product_id) { try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writerId = (int)vendorModel.vendor_id; _productTempMgr = new ProductTempMgr(connectionString); _specTempMgr = new ProductSpecTempMgr(connectionString); _pPicTempMgr = new ProductPictureTempImplMgr(connectionString); ArrayList ImgList = new ArrayList(); //刪除對應的圖片 //商品圖 if (prod) { ProductTemp query = new ProductTemp { Writer_Id = writerId, Combo_Type = COMBO_TYPE, Create_Channel = 2, Product_Id = product_id }; string fileName = _productTempMgr.GetProTempByVendor(query).FirstOrDefault().Product_Image; if (!string.IsNullOrEmpty(fileName)) { ImgList.Add(imgLocalPath + prodPath + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod50Path + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod150Path + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod280Path + GetDetailFolder(fileName) + fileName); } } //規格圖 if (spec) { ProductSpecTemp pSpec = new ProductSpecTemp(); pSpec.Writer_Id = writerId; pSpec.spec_type = 1; if (spec_id != 0) { pSpec.spec_id = spec_id; } if (!string.IsNullOrEmpty(product_id)) { pSpec.product_id = product_id; } List<ProductSpecTemp> pSList = _specTempMgr.VendorQuery(pSpec); foreach (var item in pSList) { if (item.spec_image != "") { ImgList.Add(imgLocalPath + specPath + GetDetailFolder(item.spec_image) + item.spec_image); ImgList.Add(imgLocalPath + spec100Path + GetDetailFolder(item.spec_image) + item.spec_image); ImgList.Add(imgLocalPath + spec280Path + GetDetailFolder(item.spec_image) + item.spec_image); } } } //商品說明圖 if (desc) { ProductPictureTemp query = new ProductPictureTemp { writer_Id = writerId, combo_type = COMBO_TYPE, product_id = product_id }; List<ProductPictureTemp> pPList = _pPicTempMgr.VendorQuery(query); foreach (var item in pPList) { ImgList.Add(imgLocalPath + descPath + GetDetailFolder(item.image_filename) + item.image_filename); ImgList.Add(imgLocalPath + desc400Path + GetDetailFolder(item.image_filename) + item.image_filename); } } foreach (string item in ImgList) { //刪除服務器上對應的圖片 if (System.IO.File.Exists(item)) { System.IO.File.Delete(item); } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } }
public HttpResponseBase GetCatagory(string id = "true") { List<ProductCategory> categoryList = new List<ProductCategory>(); List<ProductCategoryCustom> cateList = new List<ProductCategoryCustom>(); string resultStr = ""; BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; try { _procateMgr = new ProductCategoryMgr(connectionString); categoryList = _procateMgr.QueryAll(new ProductCategory { }); cateList = getCate(categoryList, "5"); List<ProductCategorySetTemp> TempresultList = new List<ProductCategorySetTemp>(); List<ProductCategorySet> resultList = new List<ProductCategorySet>(); ProductCategorySetTemp query = new ProductCategorySetTemp(); if (!string.IsNullOrEmpty(Request.Params["ProductId"])) { uint product_id = 0; if (uint.TryParse(Request.Params["ProductId"], out product_id)) //正式表數據 { _categorySetMgr = new ProductCategorySetMgr(connectionString); resultList = _categorySetMgr.Query(new ProductCategorySet { Product_Id = uint.Parse(Request.Params["ProductId"]) }); TempresultList = null; } else { resultList = null; query.Product_Id = Request.Params["ProductId"]; _productTempMgr = new ProductTempMgr(connectionString); ProductTemp productT = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Params["ProductId"] }).FirstOrDefault(); if (productT != null) { query.Combo_Type = productT.Combo_Type; } else { query.Combo_Type = COMBO_TYPE; } query.Writer_Id = (int)vendorModel.vendor_id; _categoryTempSetMgr = new ProductCategorySetTempMgr(connectionString); TempresultList = (from c in _categoryTempSetMgr.QueryByVendor(query) select new { Id = c.Id, Product_Id = c.Product_Id, Category_Id = c.Category_Id, Brand_Id = c.Brand_Id }).ToList().ConvertAll<ProductCategorySetTemp>(m => new ProductCategorySetTemp { Id = m.Id, Product_Id = m.Product_Id, Category_Id = m.Category_Id, Brand_Id = m.Brand_Id }); } } //調試resultlist是否為空 GetCategoryList(categoryList, ref cateList, TempresultList, resultList); List<ProductCategoryCustom> cateListResult = new List<ProductCategoryCustom>(); cateListResult = getCate(categoryList, "0"); cateListResult[0].children = getCate(categoryList, cateListResult[0].id.ToString()); int cateLen = cateListResult[0].children.Count; int i = 0; while (cateLen > 0) { if (cateListResult[0].children[i].id == "5") { i++; } else { cateListResult[0].children.Remove(cateListResult[0].children[i]); } cateLen--; } cateListResult[0].children[0].children = cateList; resultStr = JsonConvert.SerializeObject(cateListResult); resultStr = resultStr.Replace("Checked", "checked"); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase QueryProduct() { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; string json = string.Empty; string prodTempID = string.Empty; int writerId = (int)vendorModel.vendor_id; try { _productTempMgr = new ProductTempMgr(connectionString); if (!string.IsNullOrEmpty(Request.Form["ProductId"]))//非新增時 { prodTempID = Request.Form["ProductId"].ToString(); } ProductTemp queryProdTemp = new ProductTemp(); queryProdTemp.Product_Id = prodTempID; queryProdTemp.Writer_Id = writerId; if (string.IsNullOrEmpty(queryProdTemp.Product_Id)) { queryProdTemp.Temp_Status = 11; } queryProdTemp.Create_Channel = 2; if (!string.IsNullOrEmpty(prodTempID)) { ProductTemp productT = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Params["ProductId"] }).FirstOrDefault(); if (productT != null) { queryProdTemp.Combo_Type = productT.Combo_Type; } else { queryProdTemp.Combo_Type = COMBO_TYPE; } } else { queryProdTemp.Combo_Type = COMBO_TYPE; } uint pid = 0; if (uint.TryParse(Request.Params["ProductId"], out pid)) { #region 正式表 Product product = new Product(); product.Product_Id = Convert.ToUInt32(Request.Params["ProductId"]); _product = new ProductMgr(connectionString); Product prod = _product.Query(product).FirstOrDefault(); if (prod != null) { if (!string.IsNullOrEmpty(prod.Product_Image)) { prod.Product_Image = imgServerPath + prodPath + GetDetailFolder(prod.Product_Image) + prod.Product_Image; } else { prod.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(prod) + "}"; #endregion } else { #region 供應商 臨時表 ProductTemp prodTemp = _productTempMgr.GetProTempByVendor(queryProdTemp).FirstOrDefault(); if (prodTemp != null) { if (!string.IsNullOrEmpty(prodTemp.Product_Image)) { prodTemp.Product_Image = imgServerPath + prodPath + GetDetailFolder(prodTemp.Product_Image) + prodTemp.Product_Image; } else { prodTemp.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(prodTemp) + "}"; #endregion } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "[]"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase ISVendorProduct() { string resultStr = "{success:false}"; try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writer_id = Convert.ToInt32(vendorModel.vendor_id); VendorBrand vb = new VendorBrand(); vb.Vendor_Id = vendorModel.vendor_id;//todo:獲取該供應商下的所有品牌,暫時寫死 vbMgr = new VendorBrandMgr(connectionString); List<VendorBrand> brandList = vbMgr.GetProductBrandList(vb); uint brand = 0; if (!string.IsNullOrEmpty(Request.Form["ProductId"]))//編輯數據 { uint product_id = 0; if (uint.TryParse(Request.Form["ProductId"], out product_id)) //正式表數據 { _productMgr = new ProductMgr(connectionString); Product p = _productMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault(); if (p != null) { brand = p.Brand_Id; } } else {//臨時表數據 _productTempMgr = new ProductTempMgr(connectionString); ProductTemp pTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Form["ProductId"], Writer_Id = writer_id, Create_Channel = 2, Temp_Status = 12 }).FirstOrDefault(); if (pTemp != null) { brand = pTemp.Brand_Id; } } foreach (VendorBrand item in brandList) { if (brand == item.Brand_Id) { resultStr = "{success:true}"; break; } } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); resultStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase UpdatePrice() { string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { _productTempMgr = new ProductTempMgr(connectionString); ProductTemp pro = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Form["ProductId"].ToString(), Create_Channel = 2 }).FirstOrDefault(); if (!string.IsNullOrEmpty(Request.Form["product_price_list"])) { pro.Product_Price_List = uint.Parse(Request.Form["product_price_list"]); } if (!string.IsNullOrEmpty(Request.Form["bag_check_money"])) { pro.Bag_Check_Money = uint.Parse(Request.Form["bag_check_money"]); } pro.show_listprice = Convert.ToUInt32((Request.Form["show_listprice"] ?? "") == "on" ? 1 : 0); pro.Combo_Type = COMBO_TYPE; bool result = _productTempMgr.UpdateAchieve(pro); json = "{success:" + result.ToString().ToLower() + "}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase SaveBaseInfo() { ProductTemp pTemp = new ProductTemp(); _productTempMgr = new ProductTempMgr(connectionString); _productMgr = new ProductMgr(connectionString); string json = "{success:true}"; BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int write_Id = Convert.ToInt32(vendorModel.vendor_id); if (Request.Params["product_id"] != "") { pTemp.Product_Id = Request.Params["product_id"]; } //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // pTemp.Product_Id = Request.Form["OldProductId"].ToString(); //} //庫存 if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"])) { string[] Value = Request.Params["ig_sh_InsertValue"].Split(','); pTemp.Ignore_Stock = int.Parse(Value[0]); pTemp.Shortage = int.Parse(Value[1]); pTemp.stock_alarm = int.Parse(Value[2]); } ProductTemp query = new ProductTemp { Writer_Id = write_Id, Combo_Type = COMBO_TYPE, Product_Id = pTemp.Product_Id, Create_Channel = 2 }; if (_productTempMgr.GetProTempByVendor(query).FirstOrDefault() != null) { pTemp = _productTempMgr.GetProTempByVendor(query).FirstOrDefault(); } #region 獲取前台數據 uint brand_id = 0; string product_name = ""; uint product_sort = 0; string product_vendor_code = ""; uint product_start = 0; uint product_end = 0; uint expect_time = 0; uint product_freight_set = 0; int tax_type = 0; uint combination = 0; uint product_mode = 0; string expect_msg = string.Empty; //庫存 if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"])) { string[] Value = Request.Params["ig_sh_InsertValue"].Split(','); pTemp.Ignore_Stock = int.Parse(Value[0]); pTemp.Shortage = int.Parse(Value[1]); pTemp.stock_alarm = int.Parse(Value[2]); } else { brand_id = uint.Parse(Request.Form["brand_id"]); product_name = Request.Form["product_name"]; product_sort = uint.Parse(Request.Form["product_sort"]); product_vendor_code = Request.Form["product_vendor_code"]; product_start = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_start"]).ToString()); product_end = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_end"]).ToString()); expect_time = uint.Parse(CommonFunction.GetPHPTime(Request.Form["expect_time"]).ToString()); product_freight_set = uint.Parse(Request.Form["product_freight_set"]); tax_type = int.Parse(Request.Form["tax_type"]); combination = uint.Parse(Request.Form["combination"]); product_mode = uint.Parse(Request.Params["product_mode"]); expect_msg = Request.Form["expect_msg"] ?? ""; } #endregion pTemp.Brand_Id = brand_id; pTemp.Product_Name = product_name; pTemp.Product_Sort = product_sort; pTemp.Product_Vendor_Code = product_vendor_code; pTemp.Product_Start = product_start; pTemp.Product_End = product_end; pTemp.Expect_Time = expect_time; pTemp.Product_Freight_Set = product_freight_set; pTemp.Product_Mode = product_mode; pTemp.Tax_Type = tax_type; pTemp.Combination = combination; pTemp.expect_msg = expect_msg; pTemp.Combo_Type = COMBO_TYPE; //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // pTemp.Vendor_Product_Id = Request.Form["OldProductId"].ToString(); //} pTemp.Writer_Id = write_Id; pTemp.Product_Status = 20; pTemp.Product_Ipfrom = Request.UserHostAddress; #region 表處理 //新增數據處理 if (string.IsNullOrEmpty(Request.Params["product_id"]) || pTemp == null) { try { pTemp.Temp_Status = 11; pTemp.Create_Channel = 2; pTemp.Product_Createdate = uint.Parse(CommonFunction.GetPHPTime(DateTime.Now.ToString()).ToString()); pTemp.Product_Updatedate = pTemp.Product_Createdate; string product_id = _productTempMgr.vendorBaseInfoSave(pTemp); if (!string.IsNullOrEmpty(product_id)) { ViewBag.ProductId = product_id; json = "{success:true,msg:'" + product_id + "'}"; } else { json = "{success:false}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:'" + Resources.VendorProduct.SAVE_FAIL + "'}"; } } else//編輯數據處理 複製商品處理和新增商品處理 { //更新 try { pTemp.Product_Updatedate = uint.Parse(CommonFunction.GetPHPTime(DateTime.Now.ToString()).ToString()); if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"])) { _productTempMgr.ProductTempUpdateByVendor(pTemp, "stock"); } else { if (pTemp.Product_Mode != 2) { pTemp.Bag_Check_Money = 0; } else { pTemp.Bag_Check_Money = pTemp.Bag_Check_Money; } _productTempMgr.vendorBaseInfoUpdate(pTemp); } json = "{success:true,resurt:\"" + Resources.VendorProduct.SAVE_SUCCESS + "\"}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:'" + Resources.VendorProduct.SAVE_FAIL + "'}"; } } #endregion this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
/// <summary> /// 從product_temp product_spec_temp 和product_picture中獲取圖片路徑 刪除服務器上面的圖片 /// </summary> /// <param name="prod">是否獲取product_temp圖片路徑數據</param> /// <param name="spec">是否獲取product_spec_temp圖片路徑數據</param> /// <param name="desc">是否獲取product_picture_temp圖片路徑數據</param> /// <param name="product_id">商品id</param> public void DeletePicOnServer(bool prod, bool spec, bool desc, string product_id) { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int write_Id = Convert.ToInt32(vendorModel.vendor_id); _productTempMgr = new ProductTempMgr(connectionString); _specTempMgr = new ProductSpecTempMgr(connectionString); _pPicTempMgr = new ProductPictureTempImplMgr(connectionString); ArrayList ImgList = new ArrayList(); ProductSpecTemp pSpec = new ProductSpecTemp(); pSpec.Writer_Id = write_Id; pSpec.product_id = product_id; pSpec.spec_type = 1; //刪除對應的圖片 //商品圖 if (prod) { ProductTemp query = new ProductTemp { Writer_Id = write_Id, Combo_Type = COMBO_TYPE, Product_Id = product_id, Create_Channel = 2 }; string fileName = _productTempMgr.GetProTempByVendor(query).FirstOrDefault().Product_Image; if (!string.IsNullOrEmpty(fileName)) { ImgList.Add(imgLocalPath + prodPath + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod50Path + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod150Path + GetDetailFolder(fileName) + fileName); ImgList.Add(imgLocalPath + prod280Path + GetDetailFolder(fileName) + fileName); } } //規格圖 if (spec) { List<ProductSpecTemp> pSList = _specTempMgr.Query(pSpec); foreach (var item in pSList) { if (item.spec_image != "") { ImgList.Add(imgLocalPath + specPath + GetDetailFolder(item.spec_image) + item.spec_image); ImgList.Add(imgLocalPath + spec100Path + GetDetailFolder(item.spec_image) + item.spec_image); ImgList.Add(imgLocalPath + spec280Path + GetDetailFolder(item.spec_image) + item.spec_image); } } } //商品說明圖 if (desc) { ProductPictureTemp query = new ProductPictureTemp { writer_Id = write_Id, combo_type = COMBO_TYPE, product_id = product_id }; List<ProductPictureTemp> pPList = _pPicTempMgr.Query(query); foreach (var item in pPList) { ImgList.Add(imgLocalPath + descPath + GetDetailFolder(item.image_filename) + item.image_filename); ImgList.Add(imgLocalPath + desc400Path + GetDetailFolder(item.image_filename) + item.image_filename); } } foreach (string item in ImgList) { //刪除服務器上對應的圖片 if (System.IO.File.Exists(item)) { System.IO.File.Delete(item); } } }
public HttpResponseBase QueryProduct() { string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Form["ProductId"]))//編輯數據 { uint product_id = 0; if (!uint.TryParse(Request.Form["ProductId"], out product_id)) //臨時數據編輯處理 { _productTempMgr = new ProductTempMgr(connectionString); ProductTemp productTemp = new ProductTemp(); if (!string.IsNullOrEmpty(Request.Form["childId"]) && Request.Form["childId"] == "true")//為組合商品添加臨時表裡面的子商品 { productTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Form["ProductId"].ToString() }).FirstOrDefault(); } else { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int write_Id = Convert.ToInt32(vendorModel.vendor_id); productTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Writer_Id = write_Id, Product_Id = Request.Form["ProductId"].ToString(), Create_Channel = 2 }).FirstOrDefault(); } if (productTemp != null) { if (productTemp.Product_Image != "") { productTemp.Product_Image = imgServerPath + prod50Path + GetDetailFolder(productTemp.Product_Image) + productTemp.Product_Image; } else { productTemp.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(productTemp) + "}"; } else { _productMgr = new ProductMgr(connectionString); Product product = _productMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault(); if (product != null) { if (product.Product_Image != "") { product.Product_Image = imgServerPath + prod50Path + GetDetailFolder(product.Product_Image) + product.Product_Image; } else { product.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(product) + "}"; } } else//新增數據 { _productTempMgr = new ProductTempMgr(connectionString); BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int write_Id = Convert.ToInt32(vendorModel.vendor_id); ProductTemp query = new ProductTemp { Writer_Id = write_Id, Combo_Type = COMBO_TYPE, Temp_Status = 11, Create_Channel = 2 }; //if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))//複製商品 //{ // query.Vendor_Product_Id = Request.Form["OldProductId"]; //} ProductTemp proTemp = _productTempMgr.GetProTempByVendor(query).FirstOrDefault(); if (proTemp != null) { if (proTemp.Product_Image != "") { proTemp.Product_Image = imgServerPath + prod50Path + GetDetailFolder(proTemp.Product_Image) + proTemp.Product_Image; } else { proTemp.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(proTemp) + "}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "[]"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase vaiteVerifyBack() { bool flag = false; string resultStr = ""; _prodTempMgr = new ProductTempMgr(connectionString); try { string productIds = Request.Params["productIds"]; //string backReason = Request.Params["backReason"]; //駁回原因 string[] products = productIds.Split(','); foreach (string item in products) { ProductTemp query = new ProductTemp(); query.Product_Id = item; ProductTemp prodTempModel = _prodTempMgr.GetProTempByVendor(query).FirstOrDefault(); if (prodTempModel != null) { prodTempModel.Product_Status = 20; //將商品狀態修改為新建立完成的商品 if (_prodTempMgr.UpdateAchieve(prodTempModel)) { flag = true; } } } resultStr = "{success:" + flag.ToString().ToLower() + "}"; } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } Response.Clear(); Response.Write(resultStr); Response.End(); return this.Response; }
public HttpResponseBase QueryProduct() { string json = string.Empty; string prodTempID = string.Empty; try { if (!string.IsNullOrEmpty(Request.Form["ProductId"])) { uint product_id = 0; if (uint.TryParse(Request.Form["ProductId"], out product_id)) { _prodMgr = new ProductMgr(connectionString); Product product = _prodMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault(); if (product != null) { if (!string.IsNullOrEmpty(product.Product_Image)) { product.Product_Image = imgServerPath + prodPath + GetDetailFolder(product.Product_Image) + product.Product_Image; } else { product.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(product) + "}"; } else { _prodTempMgr = new ProductTempMgr(connectionString); //int writerId = (Session["caller"] as Caller).user_id; if (!string.IsNullOrEmpty(Request.Form["ProductId"]))//非新增時 { prodTempID = Request.Form["ProductId"].ToString(); } ProductTemp queryProdTemp = new ProductTemp(); queryProdTemp.Product_Id = prodTempID; //queryProdTemp.Writer_Id = writerId; if (string.IsNullOrEmpty(queryProdTemp.Product_Id)) { queryProdTemp.Temp_Status = 11; } queryProdTemp.Create_Channel = 2; //queryProdTemp.Combo_Type = COMBO_TYPE; 查詢組合商品查不出來數據 ProductTemp prodTemp = _prodTempMgr.GetProTempByVendor(queryProdTemp).FirstOrDefault(); if (prodTemp != null) { if (!string.IsNullOrEmpty(prodTemp.Product_Image)) { prodTemp.Product_Image = imgServerPath + prodPath + GetDetailFolder(prodTemp.Product_Image) + prodTemp.Product_Image; } else { prodTemp.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(prodTemp) + "}"; } } else { _prodTempMgr = new ProductTempMgr(connectionString); int writerId = (Session["caller"] as Caller).user_id; ProductTemp query = new ProductTemp { Writer_Id = writerId, Combo_Type = COMBO_TYPE }; if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) { query.Product_Id = Request.Form["OldProductId"]; } ProductTemp proTemp = _prodTempMgr.GetProTemp(query); if (proTemp != null) { if (proTemp.Product_Image != "") { proTemp.Product_Image = imgServerPath + prodPath + GetDetailFolder(proTemp.Product_Image) + proTemp.Product_Image; } else { proTemp.Product_Image = imgServerPath + "/product/nopic_150.jpg"; } } json = "{success:true,data:" + JsonConvert.SerializeObject(proTemp) + "}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "[]"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }