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; }