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