public List<PromotionBannerRelationQuery> GetRelationList(PromotionBannerRelationQuery query) { query.Replace4MySQL(); StringBuilder sql = new StringBuilder(); try { sql.AppendFormat(@"SELECT pb_id,pbr.brand_id,vb.brand_name from promotion_banner_relation pbr LEFT JOIN vendor_brand vb ON pbr.brand_id=vb.brand_id WHERE 1=1"); if (query.pb_id != 0) { sql.AppendFormat(" AND pb_id={0}", query.pb_id); } if (query.brand_id != 0) { sql.AppendFormat(" AND pbr.brand_id={0}", query.brand_id); } if (query.brand_name != string.Empty) { sql.AppendFormat(" AND vb.brand_name LIKE '%{0}%'", query.brand_name); } return _accessMySql.getDataTableForObj<PromotionBannerRelationQuery>(sql.ToString()); } catch (Exception ex) { throw new Exception("PromotionBannerRelationDao-->GetRelationList-->" + sql.ToString() + ex.Message, ex); } }
public List<PromotionBannerRelationQuery> GetRelationList(PromotionBannerRelationQuery query) { try { return _promotionBannerRelationDao.GetRelationList(query); } catch (Exception ex) { throw new Exception("PromotionBannerRelationMgr-->GetRelationList-->" + ex.Message, ex); } }
public int DeleteBrand(PromotionBannerRelationQuery query) { try { string sql = _promotionBannerRelationDao.DeleteBrand(query); return _accessMySql.execCommand(sql); } catch (Exception ex) { throw new Exception("PromotionBannerRelationMgr-->DeleteBrand-->" + ex.Message, ex); } }
public string AddBrand(PromotionBannerRelationQuery query) { StringBuilder sql = new StringBuilder(); try { sql.AppendFormat(@"INSERT INTO promotion_banner_relation VALUES({0},{1});",query.pb_id,query.brand_id); return sql.ToString(); } catch (Exception ex) { throw new Exception("PromotionBannerRelationDao-->AddBrand-->" + sql.ToString() + ex.Message, ex); } }
public string DeleteBrand(PromotionBannerRelationQuery query) { StringBuilder sql = new StringBuilder(); try { sql.AppendFormat(@"DELETE from promotion_banner_relation WHERE 1=1 ", query.pb_id); if (query.pb_id != 0) { sql.AppendFormat(" AND pb_id={0}", query.pb_id); } if (query.brand_id != 0) { sql.AppendFormat(" AND brand_id={0}", query.brand_id); } sql.AppendFormat(" ;"); return sql.ToString(); } catch (Exception ex) { throw new Exception("PromotionBannerRelationDao-->DeleteBrand-->" + sql.ToString() + ex.Message, ex); } }
public HttpResponseBase GetRelationList() { string json = string.Empty; PromotionBannerRelationQuery query = new PromotionBannerRelationQuery(); List<PromotionBannerRelationQuery> store = new List<PromotionBannerRelationQuery>(); try { _promotionBannerRelationMgr = new PromotionBannerRelationMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Params["pb_id"])) { query.pb_id = Convert.ToInt32(Request.Params["pb_id"]); } if (!string.IsNullOrEmpty(Request.Params["id"])) { query.brand_id = Convert.ToUInt32(Request.Params["id"]); } if (!string.IsNullOrEmpty(Request.Params["name"])) { query.brand_name = Request.Params["name"].Trim(); } store = _promotionBannerRelationMgr.GetRelationList(query); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}"; } 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.ToString()); this.Response.End(); return this.Response; }
public bool UpdateImageInfo(PromotionBannerQuery query, out uint brand_id) { brand_id = 0; ArrayList arr = new ArrayList(); string[] bids = null; try { if (query.brandIDS != string.Empty) { bids = query.brandIDS.Split(','); } if (query.multi == 0)//不允許一個品牌多個促銷圖的話要檢查,否則不檢查 { if (bids != null) { query.date_start = query.pb_startdate; query.date_end = query.pb_enddate; AllowShowOrNot(query, bids, out brand_id); if (brand_id != 0) { return false;//品牌编号在該促銷圖片顯示期間已有其他促銷圖片 且已啟用 } } } PromotionBannerRelationQuery pbr_query = new PromotionBannerRelationQuery(); pbr_query.pb_id = query.pb_id; arr.Add(_promotionBannerRelationDao.DeleteBrand(pbr_query)); if (bids != null) { for (int i = 0; i < bids.Length; i++) { if (bids[i] != string.Empty) { pbr_query.brand_id = Convert.ToUInt32(bids[i]); arr.Add(_promotionBannerRelationDao.AddBrand(pbr_query)); } } } arr.Add(_promotionBannerDao.UpdateImageInfo(query)); return _mysqlDao.ExcuteSqls(arr); } catch (Exception ex) { throw new Exception("PromotionBannerMgr-->UpdateImageInfo-->" + ex.Message, ex); } }
public bool DeleteImage(PromotionBannerQuery query) { try { ArrayList arr = new ArrayList(); PromotionBannerRelationQuery pbr_query = new PromotionBannerRelationQuery(); pbr_query.pb_id = query.pb_id; arr.Add(_promotionBannerRelationDao.DeleteBrand(pbr_query)); arr.Add(_promotionBannerDao.DeleteImage(query)); return _mysqlDao.ExcuteSqls(arr); } catch (Exception ex) { throw new Exception("PromotionBannerMgr-->DeleteImage-->" + ex.Message, ex); } }