public bool Delete(int schedule, string ids, string item_type, string item_value) { try { ArrayList arrayList = new ArrayList(); //獲得供應商對應旗下的商品id集合 IProductImplDao _productDao = new ProductDao(conStr); IScheduleRelationImplDao _scheduleDao = new ScheduleRelationDao(conStr); List<Product> listProduct = _productDao.GetProductByVendor(Convert.ToInt32(item_value)); string id = ""; foreach (var item in listProduct) //連接id { id += item.Product_Id + ","; } id = id.Remove(id.Length - 1, 1); arrayList.Add(_scheduleDao.Delete(item_type, id, schedule)); arrayList.Add(_scheduleItemDao.Delete(schedule, ids)); MySqlDao sqlDao = new MySqlDao(conStr); return sqlDao.ExcuteSqls(arrayList); } catch (Exception ex) { throw new Exception("ScheduleItemMgr-->Delete" + ex.Message, ex); ; } }
public bool insertPic(List<Model.Query.TrialPictureQuery> PicList) { ArrayList arrList = new ArrayList(); try { foreach (var item in PicList) { arrList.Add(_ITrialPictureDao.SavePic(item)); } MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(arrList); } catch (Exception ex) { throw new Exception("TrialPictureMgr.insertPic-->" + ex.Message, ex); } }
public bool Save(List<PriceUpdateApplyHistory> pHList) { try { ArrayList aList = new ArrayList(); foreach (var item in pHList) { aList.Add(_pHDao.Save(item)); } MySqlDao mySqlDao = new MySqlDao(connectionString); return mySqlDao.ExcuteSqls(aList); } catch (Exception ex) { throw new Exception("PriceUpdateApplyHistoryMgr-->SingleCompareSave-->" + ex.Message, ex); } }
public bool SaveUserList(Model.Query.UsersListQuery usr, List<Model.UserLife> userLife) { try { ArrayList sqlList = new ArrayList(); sqlList.Add(_UserIplDao.SaveUserList(usr)); UserLifeDao _UserLifeDao = new UserLifeDao(conn); sqlList.Add(_UserLifeDao.DeleteUserLife(usr.user_id));//刪除原有數據 foreach (Model.UserLife model in userLife) { sqlList.Add(_UserLifeDao.SaveUserLife(model)); } List<Model.UserLife> old_user_life = _UserLifeDao.GetUserLife(usr.user_id); var alist = old_user_life.Find(m => m.info_type == "cancel_info_time"); if (alist == null) { if (!usr.send_sms_ad) { sqlList.Add(_UserLifeDao.UpdateCancelTime(usr.user_id, (uint)Common.CommonFunction.GetPHPTime(), usr.update_user)); } } else { if (usr.send_sms_ad) { sqlList.Add(_UserLifeDao.UpdateCancelTime(usr.user_id, 0, usr.update_user)); } } MySqlDao _MySqlDao = new MySqlDao(conn); return _MySqlDao.ExcuteSqls(sqlList); } catch (MySqlException ex) { throw new Exception(ex.Number.ToString() + ":UsersListMgr-->SaveUserList-->" + ex.Message, ex); } catch (Exception ex) { throw new Exception("UsersListMgr-->SaveUserList-->" + ex.Message, ex); } }
public bool Save(List<ProductPicture> PicList,int type=1) { try { ArrayList arrList = new ArrayList(); //先刪除商品說明圖記錄 arrList.Add(_productPicDao.Delete(PicList[0].product_id, type)); foreach (var item in PicList) { arrList.Add(_productPicDao.Save(item, type)); } MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(arrList); } catch (Exception ex) { throw new Exception("ProductPictureMgr-->SingleCompareSave-->" + ex.Message, ex); } }
public bool Update(List<Model.PriceMasterTemp> priceMasterTempList, List<ItemPrice> itemPrices) { ArrayList sqls = new ArrayList(); if (priceMasterTempList != null) { foreach (var item in priceMasterTempList) { sqls.Add(_priceMasterTempDao.Update(item)); } } if (itemPrices != null) { ItemPriceTempMgr itemPriceTempMgr = new ItemPriceTempMgr(""); foreach (var item in itemPrices) { sqls.Add(itemPriceTempMgr.Update(item)); } } MySqlDao mySqlDao = new MySqlDao(connctionString); return mySqlDao.ExcuteSqls(sqls); }
//add by wwei0216w 2015/1/27 /// <summary> /// 獲得Product.SaleStatus狀態以及相關的列 /// </summary> /// <param name="p">查詢條件</param> /// <returns>List<ProductCustom>集合</returns> public void UpdateSaleStatusBatch() { try { Int64 dateTime = CommonFunction.GetPHPTime(DateTime.Now.ToString()); MySqlDao sqldao = new MySqlDao(connectionStr); ArrayList list = new ArrayList(); list.Add(_productDao.UpdateSaleStatusBatch(dateTime)); sqldao.ExcuteSqls(list); } catch (Exception ex) { throw new Exception("productMgr-->UpdateSaleStatusBatch" + ex.Message, ex); } }
public bool ExecTicketReturnSql(ArrayList arrList) { try { MySqlDao myDao = new MySqlDao(connStr); return myDao.ExcuteSqls(arrList); } catch (Exception ex) { throw new Exception("TicketReturnDao-->ExecTicketReturnSql-->"+ ex.Message, ex); } }
public bool UpdateByVendor(List<Model.PriceMasterTemp> priceMasterTempList, List<ItemPrice> itemPrices) { ArrayList sqls = new ArrayList(); try { if (priceMasterTempList != null) { foreach (var item in priceMasterTempList) { sqls.Add(_priceMasterTempDao.UpdateByVendor(item)); } } //if (itemPrices != null) //{ // ItemPriceTempMgr itemPriceTempMgr = new ItemPriceTempMgr(""); // foreach (var item in itemPrices) // { // sqls.Add(itemPriceTempMgr.Update(item)); // } //} MySqlDao mySqlDao = new MySqlDao(connctionString); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("PriceMasterTempMgr-->UpdateByVendor-->" + ex.Message + sqls.ToString(), ex); } }
public bool Update(List<ProductSpecTemp> pSpecList, string updateType) { try { ArrayList sqls = new ArrayList(); foreach (var item in pSpecList) { sqls.Add(_tempDao.Update(item, updateType)); } MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("ProductSpecTempMgr-->Update-->" + ex.Message, ex); } }
public bool ExecSql(ArrayList arrayList) { try { MySqlDao myDao = new MySqlDao(connStr); return myDao.ExcuteSqls(arrayList); } catch (Exception ex) { throw new Exception("InspectionReportDao-->InsertInspectionRe-->" + arrayList + ex.Message, ex); } }
public bool UpdateStockAlarm(List<Model.ProductItemTemp> productItemTemp) { try { ArrayList sqls = new ArrayList(); foreach (var item in productItemTemp) { sqls.Add(_productItemTempDao.UpdateStockAlarm(item)); } MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("ProductItemTempMgr.UpdateStockAlarm-->" + ex.Message, ex); } }
public ActionResult QueryProdname(ProdNameExtendCustom pron, bool isOverdue) { string ids = Request["Ids"]; try { int state = 0;//判斷是否需要重新查詢的依據 _prodnameExtendMgr = new ProdNameExtendMgr(connectionString); IPriceMasterImplMgr pmMgr = new PriceMasterMgr(connectionString); MySqlDao _mySqlDao = new MySqlDao(connectionString); ArrayList sqlList = new ArrayList(); List<ProdNameExtendCustom> list = _prodnameExtendMgr.Query(pron, ids);//根據條件查詢商品信息 //判斷過期商品 和 審核商品 中是否存在錯誤數據 edit by zhuoqin0830w 2015/05/07 List<ProdNameExtendCustom> listDelete = list.FindAll(m => m.Flag == 3 || m.Flag == 1); //查詢過程中,為防止未去掉前後綴,卻到期的商品,進行一次遍歷,去掉前後綴 edit by wwei 0216w 2014/12/22 //獲取 前一天 時間的時間戳 edit by zhuoqin0830w 2015/05/07 long time = CommonFunction.GetPHPTime(Convert.ToString(DateTime.Now)) - 86400; foreach (ProdNameExtendCustom pec in listDelete) { pec.Product_Name = pec.Product_Name.Replace(PriceMaster.L_HKH + pec.Product_Prefix + PriceMaster.R_HKH, "").Replace(PriceMaster.L_HKH + pec.Product_Suffix + PriceMaster.R_HKH, ""); PriceMaster p = new PriceMaster(); p.price_master_id = pec.Price_Master_Id; p.product_name = pec.Product_Name; switch (pec.Flag) { case 1://審核商品 //判斷結束時間 是否 小於 前一天 時間的時間戳 edit by zhuoqin0830w 2015/05/07 if (pec.Event_End <= time) { sqlList.Add(pmMgr.UpdateName(p)); state = 1;//如果審核商品中結束時間小於前一天的時間,則賦值為1; _mySqlDao.ExcuteSqls(sqlList); break; } break; case 3://過期商品 //如果在過期的商品名稱中能找到前綴後綴~則調用刪除前後綴的方法 if ((pec.Product_Name.Contains(PriceMaster.L_HKH + pec.Product_Prefix + PriceMaster.R_HKH) || pec.Product_Name.Contains(PriceMaster.L_HKH + pec.Product_Suffix + PriceMaster.R_HKH))) { _prodnameExtendMgr.ResetExtendName(new Caller()); state = 1;//如果有過期商品包含前後綴,則賦值為1; break; } break; } } if (state == 1) { list = _prodnameExtendMgr.Query(pron, ids);//替換掉之前包含前後綴的商品名稱 } for (int i = 0; i < list.Count; i++) { list[i].Key_Id = i; }//add by wwei0216w 2014/12/30 為key_id賦值 if (isOverdue)//查詢過期 { list.RemoveAll(p => p.Flag != 3); } else //查詢未過期 { list.RemoveAll(p => p.Flag == 3); } return Json(new { item = list }); } 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); } return Json(new List<ProdNameExtendCustom>()); }
/// <summary> /// 添加規格時添加子商品價格 /// <param name="list">存放需要執行的sql語句集合</param> /// <param name="connectionStr">連接字符串</param> /// <param name="return">返回執行后的結果</param> /// add by wangwei 0216w 2014/9/22 /// </summary> public bool AddItemPricBySpec(ArrayList list, string connectionStr) { MySqlDao msd = new MySqlDao(connectionStr); return msd.ExcuteSqls(list); }
/// <summary> /// 批量對數據進行更改和添加操作 /// </summary> public bool UpdateByBacth(List<ScheduleItem> lists) { ArrayList listStr = new ArrayList(); try { foreach(ScheduleItem s in lists) { switch(s.id) { case 0: listStr.Add(Save(s)); break; default: listStr.Add(Update(s)); break; } } MySqlDao mysql = new MySqlDao(conStr); return mysql.ExcuteSqls(listStr); } catch (Exception ex) { throw new Exception("ScheduleItemMgr-->UpdateByBacth" + ex.Message,ex); } }
/// <summary> /// 新增數據 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Save(string[] values, ProductCategoryBannerQuery query) { try { ArrayList insertList = new ArrayList(); insertList.Add(_prodCategoryBannerDao.DeleteByBanCateId(query)); for (int i = 0; i < values.Length; i++) { insertList.Add(_prodCategoryBannerDao.Save(values[i].Split(','), query)); } MySqlDao mySqlDao = new MySqlDao(connectionStr); return mySqlDao.ExcuteSqls(insertList); } catch (Exception ex) { throw new Exception("ProductCategoryBannerMgr-->Save-->" + ex.Message, ex); } }
public bool Vendor_Delete(string product_Id) {// producd_id uint change string 臨時表刪除 //20140905 暫時先刪除主表信息 確定之後再刪除關聯信息 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 })); //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 })); delList.Add(_productDao.Vendor_Delete(product_Id)); MySqlDao mySqlDao = new MySqlDao(connectionStr); return mySqlDao.ExcuteSqls(delList); }
/// <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); }
/// <summary> /// 多表更新 /// </summary> /// <param name="p">product表</param> /// <param name="pIList">ProductSpec表</param> /// <param name="pSList">ProductPicture</param> /// <returns></returns> public bool Update_Product_Spec_Picture(Product p, List<ProductSpec> pSList, List<ProductPicture> pPList, List<ProductPicture> appList = null) { ArrayList sqlList = new ArrayList(); _productSpecMgr = new ProductSpecMgr(connectionStr); List<Product> pList = _productDao.Query(p); pList[0].Product_Image = p.Product_Image; pList[0].product_media = p.product_media; pList[0].Mobile_Image = p.Mobile_Image; // edit by wwei0216w 2015/3/18 添加關於Mobile的修改 pList[0].Product_alt = p.Product_alt; if (p.Product_Image != "" || p.product_media != "" || p.Mobile_Image != "" || p.Product_alt != "")// edit by wwei0216w 2015/3/18 添加關於Mobile的修改 { sqlList.Add(_productDao.Update(pList[0])); } //ProductSpec表 foreach (var item in pSList) { //查詢product_item表 ProductSpec spec = _productSpecMgr.query(int.Parse(item.spec_id.ToString())); spec.spec_image = item.spec_image; spec.spec_sort = item.spec_sort; spec.spec_status = item.spec_status; sqlList.Add(_productSpecMgr.Update(spec)); } //ProductPicture表 sqlList.Add(_productPicDao.Delete(int.Parse(p.Product_Id.ToString()))); foreach (var item in pPList) { sqlList.Add(_productPicDao.Save(item)); } sqlList.Add(_productPicDao.Delete(int.Parse(p.Product_Id.ToString()), 2)); //1:商品說明表 2:手機app圖檔表 foreach (var item in appList) { sqlList.Add(_productPicDao.Save(item, 2)); } MySqlDao mySqlDao = new MySqlDao(connectionStr); return mySqlDao.ExcuteSqls(sqlList); }
public bool Save(List<Model.PriceMaster> priceMasterList) { ArrayList sqls = new ArrayList(); foreach (var item in priceMasterList) { sqls.Add(_priceMasterDao.Save(item)); } MySqlDao mySqlDao = new MySqlDao(connectionString); return mySqlDao.ExcuteSqls(sqls); }
public bool DeleteByCateId(ProductCategoryBannerQuery query) { try { MySqlDao mySqlDao = new MySqlDao(connectionStr); ArrayList insertList = new ArrayList(); insertList.Add(_prodCategoryBannerDao.DeleteByBanCateId(query)); return mySqlDao.ExcuteSqls(insertList); } catch (Exception ex) { throw new Exception("ProductCategoryBannerMgr-->DeleteByCateId-->" + ex.Message, ex); } }
public bool UpdateSaleStatusByCondition(Product p) { try { Int64 dateTime = CommonFunction.GetPHPTime(DateTime.Now.ToString()); MySqlDao sqldao = new MySqlDao(connectionStr); ArrayList list = new ArrayList(); string str = _productDao.UpdateSaleStatusByCondition(dateTime, p); if (str != "") { list.Add(str); return sqldao.ExcuteSqls(list); } else { return false; } } catch (Exception ex) { throw new Exception("productMgr-->UpdateSaleStatusByCondition" + ex.Message, ex); } }
public bool UpdateByVendor(ArrayList exculsql) { try { MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(exculsql); } catch (Exception ex) { throw new Exception("ItemPriceTempMgr.UpdateByVendor-->" + ex.Message, ex); } }
/// <summary> /// 刪除臨時表 /// </summary> /// <returns></returns> public bool DeleteTemp(int writerId, int combo_type, string product_Id) { try { ArrayList sqls = new ArrayList(); sqls.Add(Delete(new ProductTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id.ToString() })); //edit by xiangwang0413w 2015/03/11 ICourseProductTempImplMgr _courProdTempMgr = new CourseProductTempMgr(""); _courProdTempMgr.DeleteSql(new CourseProductTemp { Writer_Id = writerId , Product_Id = uint.Parse(product_Id)}); ProductItemTempMgr proItemTempMgr = new ProductItemTempMgr(""); sqls.Add(proItemTempMgr.DeleteSql(new ProductItemTemp { Writer_Id = writerId, Product_Id = product_Id })); //edit by xiangwang0413w 2015/03/11 ICourseDetailItemTempImplMgr _courDetaItemTempMgr = new CourseDetailItemTempMgr(""); sqls.Add(_courDetaItemTempMgr.DeleteSql(writerId)); //add by xiangwang0413w 2014/11/06 ProductDeliverySetTempMgr proDelSetTempMgr = new ProductDeliverySetTempMgr(""); sqls.Add(proDelSetTempMgr.Delete(new ProductDeliverySetTemp { Writer_Id = writerId,Combo_Type = combo_type, Product_id = int.Parse(product_Id) })); ProductNoticeSetTempMgr proNoticeSetTempMgr = new ProductNoticeSetTempMgr(""); sqls.Add(proNoticeSetTempMgr.Delete(new ProductNoticeSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id })); ProductTagSetTempMgr proTagSetTempMgr = new ProductTagSetTempMgr(""); sqls.Add(proTagSetTempMgr.Delete(new ProductTagSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id })); ProductSpecTempMgr proSpecTempMgr = new ProductSpecTempMgr(""); sqls.Add(proSpecTempMgr.TempDelete(new ProductSpecTemp { Writer_Id = writerId, product_id = product_Id })); ProductPictureTempImplMgr proPicTempMgr = new ProductPictureTempImplMgr(""); sqls.Add(proPicTempMgr.Delete(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id },1)); //刪除說明圖 sqls.Add(proPicTempMgr.Delete(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id },2)); //刪除APP圖 ProductCategorySetTempMgr proCateSetTempMgr = new ProductCategorySetTempMgr(""); sqls.Add(proCateSetTempMgr.TempDelete(new ProductCategorySetTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id })); ItemPriceTempMgr itemPriceMgr = new ItemPriceTempMgr(""); sqls.Add(itemPriceMgr.Delete(product_Id, combo_type, writerId)); PriceMasterTempMgr priceMasterTempMgr = new PriceMasterTempMgr(""); sqls.Add(priceMasterTempMgr.Delete(new PriceMasterTemp { writer_Id = writerId, product_id = product_Id, combo_type = combo_type })); ProductComboTempMgr proComboTempMgr = new ProductComboTempMgr(""); sqls.Add(proComboTempMgr.TempDelete(new ProductComboTemp { Writer_Id = writerId, Parent_Id = product_Id })); //add by dongya 2015/08/25 14:03 根據writeid和productId刪除商品推薦屬性臨時表中信息 複製的邏輯:首先是刪除臨時表中的數據,然後把數據插入到臨時表; RecommendedProductAttributeMgr rmendeAttribute =new RecommendedProductAttributeMgr(""); sqls.Add(rmendeAttribute.TempDelete(writerId,Convert.ToInt32(product_Id),combo_type)); MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("ProductTempMg.DeleteTemp-->" + ex.Message, ex); } }
/// <summary> /// 刪除供應商商品數據 /// </summary> /// <returns></returns> public bool DeleteVendorProductTemp(int writerId, int combo_type, string product_Id) { try { ArrayList sqls = new ArrayList(); sqls.Add(DeleteProductTemp(new ProductTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id })); ProductItemTempMgr proItemTempMgr = new ProductItemTempMgr(""); sqls.Add(proItemTempMgr.DeleteVendorSql(new ProductItemTemp { Writer_Id = writerId, Product_Id = product_Id })); ProductNoticeSetTempMgr proNoticeSetTempMgr = new ProductNoticeSetTempMgr(""); sqls.Add(proNoticeSetTempMgr.DeleteVendor(new ProductNoticeSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id })); ProductTagSetTempMgr proTagSetTempMgr = new ProductTagSetTempMgr(""); sqls.Add(proTagSetTempMgr.DeleteVendor(new ProductTagSetTemp { Writer_Id = writerId, Combo_Type = combo_type, product_id = product_Id })); ProductSpecTempMgr proSpecTempMgr = new ProductSpecTempMgr(""); sqls.Add(proSpecTempMgr.TempDeleteByVendor(new ProductSpecTemp { Writer_Id = writerId, product_id = product_Id })); ProductPictureTempImplMgr proPicTempMgr = new ProductPictureTempImplMgr(""); sqls.Add(proPicTempMgr.DeleteByVendor(new ProductPictureTemp { writer_Id = writerId, combo_type = combo_type, product_id = product_Id })); ProductCategorySetTempMgr proCateSetTempMgr = new ProductCategorySetTempMgr(""); sqls.Add(proCateSetTempMgr.TempDeleteByVendor(new ProductCategorySetTemp { Writer_Id = writerId, Combo_Type = combo_type, Product_Id = product_Id })); ItemPriceTempMgr itemPriceMgr = new ItemPriceTempMgr(""); sqls.Add(itemPriceMgr.DeleteByVendor(product_Id.ToString(), combo_type, writerId)); PriceMasterTempMgr priceMasterTempMgr = new PriceMasterTempMgr(""); sqls.Add(priceMasterTempMgr.DeleteByVendor(new PriceMasterTemp { writer_Id = writerId, product_id = product_Id, combo_type = combo_type })); ProductComboTempMgr proComboTempMgr = new ProductComboTempMgr(""); sqls.Add(proComboTempMgr.TempDeleteByVendor(new ProductComboTemp { Writer_Id = writerId, Parent_Id = product_Id })); MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("ProductTempMg.DeleteTemp-->" + ex.Message, ex); } }
public bool DescriptionInfoSave(ProductTemp proTemp, List<ProductTagSetTemp> tagTemps, List<ProductNoticeSetTemp> noticeTemps) { try { ArrayList sqls = new ArrayList(); sqls.Add(_pTempDao.DescriptionInfoSave(proTemp)); if (tagTemps != null) { IProductTagSetTempImplMgr _productTagSetTempMgr = new ProductTagSetTempMgr(connStr); sqls.Add(_productTagSetTempMgr.Delete(new ProductTagSetTemp { Writer_Id = proTemp.Writer_Id, Combo_Type = proTemp.Combo_Type, product_id = proTemp.Product_Id })); foreach (var item in tagTemps) { sqls.Add(_productTagSetTempMgr.Save(item)); } } if (noticeTemps != null) { IProductNoticeSetTempImplMgr _productNoticeSetTempMgr = new ProductNoticeSetTempMgr(connStr); sqls.Add(_productNoticeSetTempMgr.Delete(new ProductNoticeSetTemp { Writer_Id = proTemp.Writer_Id, Combo_Type = proTemp.Combo_Type, product_id = proTemp.Product_Id })); foreach (var item in noticeTemps) { sqls.Add(_productNoticeSetTempMgr.Save(item)); } } MySqlDao mySqlDao = new MySqlDao(connStr); return mySqlDao.ExcuteSqls(sqls); } catch (Exception ex) { throw new Exception("ProductTempMgr.DescriptionInfoSave-->" + ex.Message, ex); } }
public bool execInsertSql(ArrayList arrayList) { try { MySqlDao myDao = new MySqlDao(connStr); return myDao.ExcuteSqls(arrayList); } catch (Exception ex) { throw new Exception(" EmsDao-->execInsertSql--> " + arrayList + ex.Message, ex); } }
/// <summary> /// 調用儲存過程為price_master 裱中的name添加前後綴 /// </summary> /// <param name="days">過期天數(超多少天的前後綴自動刪除)</param> /// <returns>受影響的行數</returns> public int ResetExtendName(Caller callId, uint product_id = 0) { try { IPriceMasterImplMgr pmMgr = new PriceMasterMgr(connectionStr); MySqlDao _mySqlDao = new MySqlDao(connectionStr); ArrayList sqlList = new ArrayList(); string msg = string.Empty; List<ProdNameExtendCustom> list = new List<ProdNameExtendCustom>(); if (product_id != 0) { list = peDao.GetPastProductById(product_id); } else { list = peDao.GetPastProduct(); } foreach (var pM in list) { //pM.Product_Name = pM.Product_Name.Replace(PriceMaster.L_HKH + pM.Product_Prefix + PriceMaster.R_HKH, "")//替換掉priceMaster中product_name的前綴 //.Replace(PriceMaster.L_HKH + pM.Product_Suffix + PriceMaster.R_HKH, "");//替換掉priceMaster中product_name的後綴 bool tempFlag = true; int index = 0;///定義index防止錯誤導致下面的while無限循環 while(tempFlag)///循環刪除前後綴 { index ++; pM.Product_Name = ClearPreSuName(pM.Product_Name, PriceMaster.L_HKH.ToString(), PriceMaster.R_HKH.ToString()); if (pM.Product_Name.IndexOf(PriceMaster.L_HKH.ToString()) == -1 && pM.Product_Name.IndexOf(PriceMaster.R_HKH.ToString()) == -1||index>10) { tempFlag = false; } } PriceMaster p = new PriceMaster(); p.price_master_id = pM.Price_Master_Id; p.product_name = pM.Product_Name; sqlList.Add(pmMgr.UpdateName(p)); //將去掉前後綴的名稱update到price_master表 pM.Flag = 3;//過期 pM.Event_End = pM.Event_End; pM.Event_Start = pM.Event_Start; } if (_mySqlDao.ExcuteSqls(sqlList)) { peDao.Update(list.Select(p => (ProdNameExtend)p).ToList()); } if (msg == "") { int days = 30;//過期多少天刪除 return peDao.DeleteExtendName(days); } else { return -1; } } catch (Exception ex) { throw new Exception("ProdNameExtendMgr-->ResetExtendName-->" + ex.Message, ex); } }
public bool UpdateActive(EventPromoAdditionalPrice model) { ArrayList _list = new ArrayList(); try { _list.Add(dao.UpdateActive(model)); //處理輔表活動商品設定 if (model.condition_type == 1) { EventPromoBrandDao _epbDao = new EventPromoBrandDao(conn); _list.Add(_epbDao.UpdateActive(new EventPromoBrand { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } else if (model.condition_type == 2) { EventPromoCategoryDao _epcateDao = new EventPromoCategoryDao(conn); _list.Add(_epcateDao.UpdateActive(new EventPromoCategory { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } else if (model.condition_type == 3) { EventPromoClassDao _epclassDao = new EventPromoClassDao(conn); _list.Add(_epclassDao.UpdateActive(new EventPromoClass { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } else if (model.condition_type == 4) { EventPromoProductDao _epproDao = new EventPromoProductDao(conn); _list.Add(_epproDao.UpdateActive(new EventPromoProduct { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } else if (model.condition_type == 5) { EventPromoShoppingcartDao _epcartDao = new EventPromoShoppingcartDao(conn); _list.Add(_epcartDao.UpdateActive(new EventPromoShoppingcart { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } else if (model.condition_type == 6) { EventPromoPaymentDao _eppayDao = new EventPromoPaymentDao(conn); _list.Add(_eppayDao.UpdateActive(new EventPromoPayment { event_status = model.event_status, modify_user = model.modify_user, modify_time = model.modify_time, event_id = model.event_id })); } MySqlDao _mySqlDao = new MySqlDao(conn); return _mySqlDao.ExcuteSqls(_list); } catch (Exception ex) { throw new Exception("EventPromoAdditionalPriceMgr-->UpdateActive" + ex.Message, ex); } }
public bool SaveAll(ArrayList list) { MySqlDao excuteDao = new MySqlDao(connStr); return excuteDao.ExcuteSqls(list); }