public List<Model.Query.PromotionsBonusSerialHistoryQuery> QueryById(PromotionsBonusSerialHistoryQuery query, out int TotalCount) { StringBuilder sb = new StringBuilder(); StringBuilder sbStr = new StringBuilder(); try { sb.AppendFormat("SELECT id,serial,promotion_id,created,pseh.user_id,user_email "); sbStr.AppendFormat(" from promotions_bonus_serial_history pseh LEFT JOIN users u on pseh.user_id=u.user_id where `promotion_id` = '{0}'", query.promotion_id); TotalCount = 0; if (query.IsPage) { DataTable _dt = _access.getDataTable(" select count(id) as ToTalCount " + sbStr.ToString()); if (_dt != null && _dt.Rows.Count > 0) { TotalCount = Convert.ToInt32(_dt.Rows[0]["ToTalCount"]); } sbStr.AppendFormat(" limit {0},{1}", query.Start, query.Limit); } return _access.getDataTableForObj<PromotionsBonusSerialHistoryQuery>(sb.ToString() + sbStr.ToString()); } catch (Exception ex) { throw new Exception("PromotionsBonusSerialHistoryDao-->QueryById-->" + ex.Message + sb.ToString(), ex); } }
public List<Model.Query.PromotionsBonusSerialHistoryQuery> QueryById(PromotionsBonusSerialHistoryQuery query, out int TotalCount) { try { return _bonusDao.QueryById(query,out TotalCount); } catch (Exception ex) { throw new Exception("PromotionsBonusSerialHistoryMgr-->QueryById-->" + ex.Message, ex); } }
public HttpResponseBase PromotionsBonusSerialHistoryLists2() { string json = string.Empty; int totalcount = 0; PromotionsBonusSerialHistoryQuery query = new PromotionsBonusSerialHistoryQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); List<PromotionsBonusSerialHistoryQuery> stores = new List<PromotionsBonusSerialHistoryQuery>(); _promBnusSeralHitory = new PromotionsBonusSerialHistoryMgr(mySqlConnectionString); try { query.promotion_id = Convert.ToInt32(Request.Params["ids"]); int id = Convert.ToInt32(Request.Params["ids"]); stores = _promBnusSeralHitory.QueryById(query, out totalcount); foreach (var item in stores) { item.user_email = item.user_email.Split('@')[0] + "@***"; } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalcount + ",data:" + JsonConvert.SerializeObject(stores, 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:true,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }