public HttpResponseBase VendorProductDelete() { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; _productTempMgr = new ProductTempMgr(connectionString); int writerId = (int)vendorModel.vendor_id; string json = "{success:false}"; try { if (!string.IsNullOrEmpty(Request.Form["Product_Id"])) { string[] pro_Ids = Request.Form["Product_Id"].Split('|'); _productMgr = new ProductMgr(connectionString); foreach (string product_id in pro_Ids.Distinct()) { if (!string.IsNullOrEmpty(product_id)) { ProductTemp product_temp = new ProductTemp(); _productTempMgr = new ProductTempMgr(connectionString); product_temp = _productTempMgr.GetVendorProTemp(new ProductTemp { Product_Id = product_id, Writer_Id = writerId }); int combo_type = product_temp.Combo_Type; bool isDelete = _productTempMgr.DeleteVendorProductTemp(writerId, combo_type, product_id == string.Empty ? "0" : product_id); if (isDelete) { 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 specTempSave() { string resultStr = "{success:true}"; bool result = true; try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writerID = (int)vendorModel.vendor_id; string specType = Request.Params["specType"]; string spec1Name = Request.Params["spec1Name"]; string spec1Result = Request.Params["spec1Result"]; string spec2Name = Request.Params["spec2Name"]; string spec2Result = Request.Params["spec2Result"]; _specTempMgr = new ProductSpecTempMgr(connectionString); _productTempMgr = new ProductTempMgr(connectionString); _productItemTempMgr = new ProductItemTempMgr(connectionString); _serialMgr = new SerialMgr(connectionString); #region 臨時表修改 string proId = string.Empty; if (!string.IsNullOrEmpty(Request.Params["ProductId"])) { proId = Request.Params["ProductId"].ToString(); } if (!string.IsNullOrEmpty(proId)) { if (!specType.Equals("0") && !string.IsNullOrEmpty(specType)) { #region 有規格 List<ProductSpecTemp> spec1List; List<ProductSpecTemp> spec2List; List<ProductSpecTemp> specAllList = new List<ProductSpecTemp>(); JavaScriptSerializer jss = new JavaScriptSerializer(); spec1List = jss.Deserialize<List<ProductSpecTemp>>(spec1Result); foreach (ProductSpecTemp item in spec1List) { item.Writer_Id = writerID;// item.Writer_Id = _caller.user_id; item.product_id = proId; item.spec_type = 1; item.spec_image = ""; specAllList.Add(item); } if (specType.Equals("2")) { spec2List = jss.Deserialize<List<ProductSpecTemp>>(spec2Result); foreach (ProductSpecTemp item in spec2List) { item.Writer_Id = writerID;// item.Writer_Id = _caller.user_id; item.product_id = proId; item.spec_type = 2; item.spec_image = ""; specAllList.Add(item); } } List<ProductSpecTemp> tempList = _specTempMgr.VendorQuery(new ProductSpecTemp { Writer_Id = writerID, product_id = proId }); if (tempList == null || tempList.Count() <= 0) { #region 保存 specAllList.ForEach(p => p.spec_id = uint.Parse(_serialMgr.NextSerial(18).ToString())); bool saveSpecResult = _specTempMgr.SaveByVendor(specAllList); if (saveSpecResult) { _productItemTempMgr.DeleteByVendor(new ProductItemTemp { Writer_Id = writerID, Product_Id = proId }); #region 保存ProductItemTemp List<ProductSpecTemp> specAllResultList = _specTempMgr.VendorQuery(new ProductSpecTemp { Writer_Id = writerID, product_id = proId }); List<ProductSpecTemp> spec1ResultList = specAllResultList.Where(m => m.spec_type == 1).ToList(); List<ProductSpecTemp> spec2ResultList = specAllResultList.Where(m => m.spec_type == 2).ToList(); List<ProductItemTemp> saveItemList = new List<ProductItemTemp>(); if (specType.Equals("1")) { foreach (ProductSpecTemp specTemp1 in spec1ResultList) { ProductItemTemp itemTemp = new ProductItemTemp(); itemTemp.Writer_Id = writerID; itemTemp.Product_Id = proId; itemTemp.Spec_Id_1 = specTemp1.spec_id; itemTemp.Item_Stock = 10; itemTemp.Item_Alarm = 1; saveItemList.Add(itemTemp); } } else if (specType.Equals("2")) { foreach (ProductSpecTemp specTemp1 in spec1ResultList) { foreach (ProductSpecTemp specTemp2 in spec2ResultList) { ProductItemTemp itemTemp = new ProductItemTemp(); itemTemp.Writer_Id = writerID; itemTemp.Product_Id = proId; itemTemp.Spec_Id_1 = specTemp1.spec_id; itemTemp.Spec_Id_2 = specTemp2.spec_id; itemTemp.Item_Stock = 10; itemTemp.Item_Alarm = 1; itemTemp.Item_Code = ""; itemTemp.Barcode = ""; saveItemList.Add(itemTemp); } } } bool saveItemResult = _productItemTempMgr.SaveByVendor(saveItemList); if (!saveItemResult) { result = false; } #endregion } else { result = false; } #endregion } else { #region 更新 string strSpecInit = Request.Params["specInit"]; string[] specs = strSpecInit.Trim().Split(','); List<ProductSpecTemp> addList = specAllList.Where(p => p.spec_id == 0).ToList(); if (addList.Count() > 0) { addList.ForEach(p => p.spec_id = uint.Parse(_serialMgr.NextSerial(18).ToString())); List<ProductSpecTemp> specAllResultList = _specTempMgr.VendorQuery(new ProductSpecTemp { Writer_Id = writerID, product_id = proId }); List<ProductSpecTemp> spec1ResultList = specAllResultList.Where(m => m.spec_type == 1).ToList(); List<ProductSpecTemp> spec2ResultList = specAllResultList.Where(m => m.spec_type == 2).ToList(); List<ProductItemTemp> saveItemList = new List<ProductItemTemp>(); foreach (ProductSpecTemp item in addList) { if (specType.Equals("1")) { if (item.spec_type == 1) { ProductItemTemp saveTemp = new ProductItemTemp(); saveTemp.Writer_Id = writerID; saveTemp.Spec_Id_1 = item.spec_id; saveTemp.Product_Id = proId; saveTemp.Item_Stock = 10; saveTemp.Item_Alarm = 1; saveItemList.Add(saveTemp); } else { ProductItemTemp saveTemp = new ProductItemTemp(); saveTemp.Writer_Id = writerID; saveTemp.Spec_Id_2 = item.spec_id; saveTemp.Product_Id = proId; saveTemp.Item_Stock = 10; saveTemp.Item_Alarm = 1; saveItemList.Add(saveTemp); } } else { if (item.spec_type == 1) { foreach (ProductSpecTemp item1 in spec2ResultList) { ProductItemTemp saveTemp = new ProductItemTemp(); saveTemp.Writer_Id = writerID; saveTemp.Spec_Id_1 = item.spec_id; saveTemp.Spec_Id_2 = item1.spec_id; saveTemp.Item_Stock = 10; saveTemp.Item_Alarm = 1; saveTemp.Product_Id = proId; saveItemList.Add(saveTemp); } foreach (ProductSpecTemp item1 in addList.Where(p => p.spec_type == 2).ToList()) { ProductItemTemp saveTemp = new ProductItemTemp(); saveTemp.Writer_Id = writerID; saveTemp.Spec_Id_1 = item.spec_id; saveTemp.Spec_Id_2 = item1.spec_id; saveTemp.Item_Stock = 10; saveTemp.Item_Alarm = 1; saveTemp.Product_Id = proId; saveItemList.Add(saveTemp); } } else { foreach (ProductSpecTemp item2 in spec1ResultList) { ProductItemTemp saveTemp = new ProductItemTemp(); saveTemp.Writer_Id = writerID; saveTemp.Spec_Id_1 = item2.spec_id; saveTemp.Spec_Id_2 = item.spec_id; saveTemp.Product_Id = proId; saveTemp.Item_Stock = 10; saveTemp.Item_Alarm = 1; saveItemList.Add(saveTemp); } } } } _specTempMgr.SaveByVendor(addList); _productItemTempMgr.SaveByVendor(saveItemList); } if (specs.Length > 0 && !string.IsNullOrEmpty(strSpecInit.Trim())) { List<ProductSpecTemp> updateList = new List<ProductSpecTemp>(); foreach (string initSpecId in specs) { ProductSpecTemp nowItem = specAllList.Where(p => p.spec_id == uint.Parse(initSpecId)).FirstOrDefault(); if (nowItem != null) { updateList.Add(nowItem); } else { ProductItemTemp delTemp = new ProductItemTemp { Writer_Id = writerID, Product_Id = proId }; uint spectype = _specTempMgr.VendorQuery(new ProductSpecTemp { spec_id = uint.Parse(initSpecId), product_id = proId })[0].spec_type; if (spectype == 1) { delTemp.Spec_Id_1 = uint.Parse(initSpecId); } else if (spectype == 2) { delTemp.Spec_Id_2 = uint.Parse(initSpecId); } if (!_productItemTempMgr.DeleteByVendor(delTemp)) { result = false; } if (!_specTempMgr.DeleteByVendor(new ProductSpecTemp { spec_id = uint.Parse(initSpecId), Writer_Id = writerID, product_id = proId })) { result = false; } DeletePicOnServer(false, true, false, uint.Parse(initSpecId), Convert.ToString(proId)); } } if (!_specTempMgr.Update(updateList, "spec")) { result = false; } } #endregion } #region 更新ProductTemp ProductTemp proTemp = new ProductTemp(); proTemp.Writer_Id = writerID; proTemp.Product_Spec = uint.Parse(specType); proTemp.Spec_Title_1 = spec1Name; proTemp.Spec_Title_2 = spec2Name; proTemp.Combo_Type = COMBO_TYPE; proTemp.Product_Id = proId; bool saveProductResult = _productTempMgr.vendorSpecInfoSave(proTemp) > 0 ? true : false; if (!saveProductResult) { result = false; } #endregion #endregion } else { #region 無規格 ProductTemp query = _productTempMgr.GetVendorProTemp(new ProductTemp { Writer_Id = writerID, Combo_Type = COMBO_TYPE, Product_Id = proId }); //如果原數據有規格 if (query.Product_Spec != 0) { //刪除服務器上對應的圖片 DeletePicOnServer(false, true, false, 0, proId); _productItemTempMgr.DeleteByVendor(new ProductItemTemp { Writer_Id = writerID, Product_Id = proId }); _specTempMgr.DeleteByVendor(new ProductSpecTemp { Writer_Id = writerID, product_id = proId }); _productTempMgr.vendorSpecInfoSave(new ProductTemp { Product_Spec = 0, Spec_Title_1 = "", Spec_Title_2 = "", Writer_Id = writerID, Combo_Type = COMBO_TYPE, Product_Id = proId }); List<ProductItemTemp> saveList = new List<ProductItemTemp>(); saveList.Add(new ProductItemTemp { Writer_Id = writerID, Product_Id = proId, Item_Stock = 10, Item_Alarm = 1 }); _productItemTempMgr.SaveByVendor(saveList); } else { List<ProductItemTemp> itemQuery = _productItemTempMgr.QueryByVendor(new ProductItemTemp { Writer_Id = writerID, Product_Id = proId }); if (itemQuery.Count() <= 0) { List<ProductItemTemp> saveList = new List<ProductItemTemp>(); saveList.Add(new ProductItemTemp { Writer_Id = writerID, Product_Id = proId, Item_Stock = 10, Item_Alarm = 1 }); _productItemTempMgr.SaveByVendor(saveList); } } #endregion } } else { result = false; Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", "VendorProductCountroller.cs", "specTempSave()", Resources.VendorProduct.NOTFOUNTKEY); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); resultStr = "{success:false}"; } #endregion } catch (Exception ex) { result = false; 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); } if (!result) { resultStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase tempCategoryAdd() { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writd_Id = (int)vendorModel.vendor_id; string resultStr = "{success:true}"; string tempStr = Request.Params["result"]; string cate_id = Request.Params["cate_id"]; List<ProductCategorySetTemp> saveTempList = new List<ProductCategorySetTemp>(); try { JavaScriptSerializer js = new JavaScriptSerializer(); List<ProductCategorySetCustomTemp> cateCustomList = js.Deserialize<List<ProductCategorySetCustomTemp>>(tempStr); if (string.IsNullOrEmpty(tempStr)) { cateCustomList = new List<ProductCategorySetCustomTemp>(); } string vendor_pId = string.Empty; if (!string.IsNullOrEmpty(Request.Params["ProductId"])) { vendor_pId = Request.Params["ProductId"]; //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // vendor_pId = Request.Form["OldProductId"]; //} _categoryTempSetMgr = new ProductCategorySetTempMgr(connectionString); _productTempMgr = new ProductTempMgr(connectionString); if (string.IsNullOrEmpty(tempStr)) { bool result = _categoryTempSetMgr.DeleteByVendor(new ProductCategorySetTemp { Writer_Id = writd_Id, Combo_Type = COMBO_TYPE, Product_Id = vendor_pId }); } else { ProductCategorySetTemp saveTemp; ProductTemp query = new ProductTemp { Writer_Id = writd_Id, Combo_Type = COMBO_TYPE, Product_Id = vendor_pId }; ProductTemp proTemp = _productTempMgr.GetVendorProTemp(query); foreach (ProductCategorySetCustomTemp item in cateCustomList) { saveTemp = new ProductCategorySetTemp(); saveTemp.Writer_Id = writd_Id; saveTemp.Product_Id = vendor_pId; saveTemp.Category_Id = item.Category_Id; saveTemp.Brand_Id = proTemp.Brand_Id; saveTemp.Combo_Type = COMBO_TYPE; saveTempList.Add(saveTemp); } if (!_categoryTempSetMgr.SaveByVendor(saveTempList)) { resultStr = "{success:false}"; } } if (!_productTempMgr.CategoryInfoUpdateByVendor(new ProductTemp { Writer_Id = writd_Id, Cate_Id = cate_id, Combo_Type = COMBO_TYPE, Product_Id = vendor_pId })) { resultStr = "{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); resultStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase GetSelectedCage() { string resultStr = "{success:false}"; try { string strCateId = string.Empty; uint vendor_pid = 0; BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writd_Id = (int)vendorModel.vendor_id; if (!string.IsNullOrEmpty(Request.Params["ProductId"])) { if (uint.TryParse(Request.Params["ProductId"].ToString(), out vendor_pid)) { #region 從正式表獲取 uint pid = uint.Parse(Request.Params["ProductId"]); _productMgr = new ProductMgr(connectionString); Product result = _productMgr.Query(new Product { Product_Id = pid }).FirstOrDefault(); if (result != null) { strCateId = result.Cate_Id; } #endregion } else { #region 從臨時表獲取 _productTempMgr = new ProductTempMgr(connectionString); ProductTemp query = new ProductTemp { Writer_Id = writd_Id, Combo_Type = COMBO_TYPE, Product_Id = Request.Params["ProductId"].ToString() }; ProductTemp tempResult = _productTempMgr.GetVendorProTemp(query); if (tempResult != null) { strCateId = tempResult.Cate_Id; } #endregion } paraMgr = new ParameterMgr(connectionString); Parametersrc cate2Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = strCateId }).FirstOrDefault(); if (cate2Result != null) { Parametersrc cate1Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = cate2Result.TopValue.ToString() }).FirstOrDefault(); if (cate1Result != null) { StringBuilder stb = new StringBuilder("{"); stb.AppendFormat("cate1Name:\"{0}\",cate1Value:\"{1}\",cate1Rowid:\"{2}\",cate1TopValue:\"{3}\"", cate1Result.parameterName, cate1Result.ParameterCode, cate1Result.Rowid, cate1Result.TopValue); stb.AppendFormat(",cate2Name:\"{0}\",cate2Value:\"{1}\",cate2Rowid:\"{2}\",cate2TopValue:\"{3}\"", cate2Result.parameterName, cate2Result.ParameterCode, cate2Result.Rowid, cate2Result.TopValue); stb.Append("}"); resultStr = "{success:true,data:" + stb.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(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase vaiteVerifyPass() { #region // //string resultStr = "{success:false}"; //bool result = true; //try //{ // Caller _caller = (Session["caller"] as Caller); // _applyMgr = new ProductStatusApplyMgr(connectionString); // _statusHistoryMgr = new ProductStatusHistoryMgr(connectionString); // _prodMgr = new ProductMgr(connectionString); // _pMaster = new PriceMasterMgr(connectionString); // _tableHistoryMgr = new TableHistoryMgr(connectionString); // _prodTempMgr = new ProductTempMgr(connectionString); // _functionMgr = new FunctionMgr(connectionString); // string productIds = Request.Params["prodcutIdStr"]; // string[] products = productIds.Split(','); // string function = Request.Params["function"] ?? ""; // Function fun = _functionMgr.QueryFunction(function, "/ProductList/VerifyList"); // int functionid = fun == null ? 0 : fun.RowId; // HistoryBatch batch = new HistoryBatch { functionid = functionid, kuser = (Session["caller"] as Caller).user_email }; // string batchNo = CommonFunction.GetPHPTime().ToString() + "_" + (Session["caller"] as Caller).user_id + "_"; // foreach (string item in products) // { // ProductTemp queryProdTemp = new ProductTemp() // { // //Temp_Status = 12, // //Create_Channel = 2, // Product_Id = item // }; // ProductTemp modelProdTemp = _prodTempMgr.GetProTempByVendor(queryProdTemp).FirstOrDefault(); // //新增資料至product,并刪除product_temp中的數據 // if (_prodMgr.TempMove2Pro(modelProdTemp.Writer_Id, modelProdTemp.Combo_Type, modelProdTemp.Product_Id) != -1) // { // Product product = _prodMgr.Query(new Product { Product_Id = uint.Parse(item) }).FirstOrDefault(); // ArrayList sqls = new ArrayList(); // if (_applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) }) != null) // { // batch.batchno = batchNo + product.Product_Id; // //更改商品价格之状态 // PriceMaster queryPriceMaster = new PriceMaster(); // if (product.Combination != 0 && product.Combination != 1) //组合商品 // { // queryPriceMaster.child_id = int.Parse(item); // } // else // { // queryPriceMaster.child_id = 0; // } // queryPriceMaster.product_id = uint.Parse(item); // queryPriceMaster.price_status = 2; //只更改价格状态为申请审核的商品价格 // List<PriceMaster> listPriceMaster = _pMaster.PriceMasterQuery(queryPriceMaster); // if (listPriceMaster != null && listPriceMaster.Count() > 0) // { // _pHMgr = new PriceUpdateApplyHistoryMgr(connectionString); // List<PriceUpdateApplyHistory> pHList = new List<PriceUpdateApplyHistory>(); // foreach (var priceMaster in listPriceMaster) // { // ArrayList priceUpdateSqls = new ArrayList(); // priceMaster.price_status = 1; //价格状态为上架 // priceMaster.apply_id = 0; // priceUpdateSqls.Add(_pMaster.Update(priceMaster)); // if (!_tableHistoryMgr.SaveHistory<PriceMaster>(priceMaster, batch, priceUpdateSqls)) // { // result = false; // break; // } // //价格异动记录(price_update_apply_history) // PriceUpdateApplyHistory pH = new PriceUpdateApplyHistory(); // pH.apply_id = int.Parse(priceMaster.apply_id.ToString()); // pH.user_id = (Session["caller"] as Caller).user_id; // pH.price_status = 1; // pH.type = 1; // pHList.Add(pH); // } // if (!_pHMgr.Save(pHList)) // { // result = false; // break; // } // } // //更改商品之状态 // ProductStatusApply queryApply = _applyMgr.Query(new ProductStatusApply { product_id = uint.Parse(item) }); // uint online_mode = queryApply.online_mode; // //申請狀態為審核後立即上架時將上架時間改為當前時間,商品狀態改為上架 // if (online_mode == 2) // { // product.Product_Status = 5; // product.Product_Start = uint.Parse(BLL.gigade.Common.CommonFunction.GetPHPTime(DateTime.Now.ToLongTimeString()).ToString()); // } // else // { // product.Product_Status = 2; // //product.Product_Start = online_mode; // } // sqls.Add(_prodMgr.Update(product)); // ProductStatusHistory saveOne = new ProductStatusHistory(); // saveOne.product_id = product.Product_Id; // saveOne.user_id = product.Brand_Id;//供應商品牌名稱 // saveOne.type = 8; //操作類型(供應商新建商品) // saveOne.product_status = 0;//新建商品 // sqls.Add(_statusHistoryMgr.Save(saveOne)); //保存历史记录 // ProductStatusHistory saveTwo = new ProductStatusHistory(); // saveTwo.product_id = product.Product_Id; // saveTwo.user_id = uint.Parse(_caller.user_id.ToString());//pm名稱 // saveTwo.type = 9; //操作類型(PM核可) // saveTwo.product_status = 0;//新建商品 // sqls.Add(_statusHistoryMgr.Save(saveTwo)); //保存历史记录 // sqls.Add(_applyMgr.Delete(queryApply)); //刪除審核申請表中的數據 // if (!_tableHistoryMgr.SaveHistory<Product>(product, batch, sqls)) // { // result = false; // break; // } // } // else // { // result = false; // break; // } // } // } // resultStr = "{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); //} //Response.Clear(); //Response.Write(resultStr); //Response.End(); //return this.Response; #endregion //todo:此處有待測試 string json = string.Empty; int writerId = (Session["caller"] as Caller).user_id; _prodMgr = new ProductMgr(connectionString); _prodTempMgr = new ProductTempMgr(connectionString); try { string strProductIds = Request.Params["prodcutIdStr"]; string[] productIds = strProductIds.Split(','); string msg = string.Empty; foreach (var product_id in productIds) { try { int productId; ProductTemp productTemp = _prodTempMgr.GetVendorProTemp(new ProductTemp() { Product_Id = product_id }); if (productTemp.Combo_Type == 2) { msg = ChildStatus(productTemp.Product_Id); if (!string.IsNullOrEmpty(msg)) { continue; } else { productId = _prodMgr.Vendor_TempMove2Pro(writerId, productTemp.Combo_Type, product_id, productTemp); } } else { productId = _prodMgr.Vendor_TempMove2Pro(writerId, productTemp.Combo_Type, product_id, productTemp); } if (productId == -1) { msg += "編號為" + productTemp.Product_Id + "商品審核出錯;"; } } 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.Product.SAVE_FAIL + "'}"; } } if (!string.IsNullOrEmpty(msg)) { json = "{success:false,msg:\"" + msg + "\"}"; } else { json = "{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); json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetSelectedCage() { string resultStr = "{success:false}"; try { string strCateId = string.Empty; string vendor_pid = string.Empty; if (!string.IsNullOrEmpty(Request.Params["ProductId"])) { vendor_pid = Request.Params["ProductId"]; } //if (!string.IsNullOrEmpty(Request.Form["OldProductId"])) //{ // vendor_pid = Request.Form["OldProductId"]; //} _prodTempMgr = new ProductTempMgr(connectionString); ProductTemp query = new ProductTemp(); query.Combo_Type = COMBO_TYPE; query.Product_Id = vendor_pid; ProductTemp tempResult = _prodTempMgr.GetVendorProTemp(query); if (tempResult != null) { strCateId = tempResult.Cate_Id; } paraMgr = new ParameterMgr(connectionString); Parametersrc cate2Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = strCateId }).FirstOrDefault(); if (cate2Result != null) { Parametersrc cate1Result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "product_cate", ParameterCode = cate2Result.TopValue.ToString() }).FirstOrDefault(); if (cate1Result != null) { StringBuilder stb = new StringBuilder("{"); stb.AppendFormat("cate1Name:\"{0}\",cate1Value:\"{1}\",cate1Rowid:\"{2}\",cate1TopValue:\"{3}\"", cate1Result.parameterName, cate1Result.ParameterCode, cate1Result.Rowid, cate1Result.TopValue); stb.AppendFormat(",cate2Name:\"{0}\",cate2Value:\"{1}\",cate2Rowid:\"{2}\",cate2TopValue:\"{3}\"", cate2Result.parameterName, cate2Result.ParameterCode, cate2Result.Rowid, cate2Result.TopValue); stb.Append("}"); resultStr = "{success:true,data:" + stb.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(resultStr); this.Response.End(); return this.Response; }