public HttpResponseBase DeleteProductFromCategorySet() { string bids = Request.Params["brandids"]; string cids = Request.Params["categoryid"]; string pids = Request.Params["productids"]; string resultStr = "{success:false}"; try { ProductCategorySetMgr _categorySetMgr = new ProductCategorySetMgr(connectionString); if (_categorySetMgr.DeleteProductByModelArry(bids, cids, pids)) { 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); } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase SaveProductCategorySet() { string[] bids = Request.Params["brandids"].Split('|'); string categoryid = Request.Params["categoryid"]; string[] pids = Request.Params["productids"].Split('|'); string proIds = string.Empty;//保存已經存在于categorset中的product string resultStr = "{success:false}"; try { for (int i = 0; i < bids.Length; i++) { if (bids[i].ToString() != "" && pids[i].ToString() != "") { ProductCategorySetMgr _categorySetMgr = new ProductCategorySetMgr(connectionString); ProductCategorySet pcs = new ProductCategorySet(); pcs.Brand_Id = Convert.ToUInt32(bids[i]); pcs.Category_Id = Convert.ToUInt32(categoryid); pcs.Product_Id = Convert.ToUInt32(pids[i]); List<ProductCategorySet> queryList = _categorySetMgr.Query(pcs); if (queryList.Count == 0)//該類別下不存在該商品時才新增 { _categorySetMgr.Insert(pcs); } else { proIds += queryList[0].Product_Id; if (i != bids.Length - 1) { proIds += ","; } } } } resultStr = "{success:true,\"proIds\":\"" + proIds + "\"}"; } 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 DeleteProductFromCategorySet() { string[] bids = Request.Params["brandids"].Split('|'); string categoryid = Request.Params["categoryid"]; string[] pids = Request.Params["productids"].Split('|'); string resultStr = "{success:false}"; try { for (int i = 0; i < bids.Length; i++) { if (bids[i].ToString() != "" && pids[i].ToString() != "") { ProductCategorySetMgr _categorySetMgr = new ProductCategorySetMgr(connectionString); ProductCategorySet pcs = new ProductCategorySet(); pcs.Brand_Id = Convert.ToUInt32(bids[i]); pcs.Category_Id = Convert.ToUInt32(categoryid); pcs.Product_Id = Convert.ToUInt32(pids[i]); try { _categorySetMgr.DeleteProductByModel(pcs); } catch (Exception) { } } } 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); } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
/// <summary> /// 刪除全館數據 /// </summary> /// <returns></returns> public HttpResponseBase DeleteAllClassProductByModel() { ProductCategorySetMgr _categorySetMgr = new ProductCategorySetMgr(connectionString); string categoryid = Request.Params["categoryid"]; string resultStr = "{success:false}"; ProductCategorySet pcs = new ProductCategorySet(); pcs.Brand_Id = 0; pcs.Category_Id = Convert.ToUInt32(categoryid); pcs.Product_Id = 999999; try { _categorySetMgr.DeleteProductByModel(pcs); 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); } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
/// <summary> /// 刪除商品 /// </summary> /// <returns></returns> public bool Delete(uint product_Id) { ArrayList delList = new ArrayList(); ProductComboMgr proComboMgr = new ProductComboMgr(""); delList.Add(proComboMgr.Delete(Convert.ToInt32(product_Id))); ItemPriceMgr itemPriceMgr = new ItemPriceMgr(""); delList.Add(itemPriceMgr.DeleteByProductId(Convert.ToInt32(product_Id))); PriceMasterMgr priceMaster = new PriceMasterMgr(""); delList.Add(priceMaster.DeleteByProductId(Convert.ToInt32(product_Id))); ProductTagSetMgr proTagSetMgr = new ProductTagSetMgr(""); delList.Add(proTagSetMgr.Delete(new ProductTagSet { product_id = product_Id })); ProductNoticeSetMgr proNoticeSetMgr = new ProductNoticeSetMgr(""); delList.Add(proNoticeSetMgr.Delete(new ProductNoticeSet { product_id = product_Id })); ProductPictureMgr proPicMgr = new ProductPictureMgr(""); delList.Add(proPicMgr.Delete(Convert.ToInt32(product_Id))); ProductSpecMgr proSpecMgr = new ProductSpecMgr(""); delList.Add(proSpecMgr.Delete(product_Id)); ProductCategorySetMgr proCategorySetMgr = new ProductCategorySetMgr(""); delList.Add(proCategorySetMgr.Delete(new ProductCategorySet { Product_Id = product_Id })); #region 課程相關 CourseProductMgr courProdMgr = new CourseProductMgr(""); delList.Add(courProdMgr.Delete(product_Id)); CourseDetailItemMgr courDetaItemMgr = new CourseDetailItemMgr(""); delList.Add(courDetaItemMgr.Delete(product_Id)); #endregion ProductItemMgr proItemMgr = new ProductItemMgr(""); delList.Add(proItemMgr.Delete(new ProductItem { Product_Id = product_Id })); ProductStatusHistoryMgr proStatusHistoryMgr = new ProductStatusHistoryMgr(""); delList.Add(proStatusHistoryMgr.Delete(new ProductStatusHistory { product_id = product_Id })); #region 推薦商品刪除 add by zhuoqin0830w 2015/10/08 RecommendedProductAttributeMgr recommendedProductAttributeMgr = new RecommendedProductAttributeMgr(""); delList.Add(recommendedProductAttributeMgr.DeleteProductAttribute(Convert.ToInt32(product_Id))); #endregion delList.Add(_productDao.Delete(product_Id)); MySqlDao mySqlDao = new MySqlDao(connectionStr); return mySqlDao.ExcuteSqls(delList); }
public HttpResponseBase DeletLessThen() { uint producateid = Convert.ToUInt32(Request.Params["producateid"]); //uint key_id = 0; string product_name = string.Empty; int types = 0; if (!string.IsNullOrEmpty(Request.Params["types"]))//變動3 { types = int.Parse(Request.Params["types"]); } string site = "0";//站台改成多個站台的site_id字符串 edit by shuangshuang0420j 20140925 13:40 if (!string.IsNullOrEmpty(Request.Params["websiteid"])) { site = Request.Params["websiteid"]; } ProductCategorySetMgr _categorySetMgr = new ProductCategorySetMgr(mySqlConnectionString); List<ProductCategorySet> categoryList = _categorySetMgr.QueryMsg(new ProductCategorySetQuery { Category_Id = producateid }); ProductMgr _prodMgr = new ProductMgr(mySqlConnectionString); int totalCount = 0; PromotionsMaintainDao pmDao = new PromotionsMaintainDao(mySqlConnectionString); string pricemaster_in = ""; foreach (ProductCategorySet pcs in categoryList) { QueryVerifyCondition query = new QueryVerifyCondition(); query.name_number = pcs.Product_Id.ToString(); query.site_ids = site; if (!string.IsNullOrEmpty(product_name)) { query.product_name = product_name; } List<QueryandVerifyCustom> tempPros = pmDao.QueryByProSite(query, out totalCount, 0); if (1 <= tempPros.Count) { pricemaster_in += tempPros[0].price_master_id + ","; } } pricemaster_in = pricemaster_in.TrimEnd(','); string jsonStr = String.Empty; try { PromoAdditionalPriceQuery model = new PromoAdditionalPriceQuery(); _promoadditionproceMgr = new PromoAdditionalPriceMgr(mySqlConnectionString); model.id = Convert.ToInt32(Request.Params["rowid"].ToString()); model.fixed_price = Convert.ToInt32(Request.Params["fixed_price"].ToString()); model.price_master_in = pricemaster_in; if (string.IsNullOrEmpty(pricemaster_in)) { jsonStr = "{success:true,\"delcount\":\"" + 0 + "\" }"; } else { int result = _promoadditionproceMgr.DeletLessThen(model, types); if (result > 0) { jsonStr = "{success:true,\"delcount\":\"" + 1 + "\" }"; } else if (result == 0) { jsonStr = "{success:true,\"delcount\":\"" + 0 + "\" }"; } else { jsonStr = "{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); jsonStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(jsonStr.ToString()); this.Response.End(); return this.Response; }