/// <summary> /// 追号记录查询 /// </summary> private void SelectCatchNumList() { string jsonDataStr = Request.Params["data"]; if (string.IsNullOrEmpty(jsonDataStr)) { AppGlobal.RenderResult(ApiCode.ParamEmpty); return; } FilterCatchNumListParamerDTO parameter = null; try { parameter = Newtonsoft.Json.JsonConvert.DeserializeObject <FilterCatchNumListParamerDTO>(jsonDataStr); } catch (Exception ex) { Ytg.Scheduler.Comm.LogManager.Error("SelectCatchNumList", ex); } if (parameter == null) { AppGlobal.RenderResult(ApiCode.ParamEmpty); return; } int pageIndex; int totalCount = 0; bool ispageIndex = int.TryParse(Request.Params["pageIndex"], out pageIndex); if (!ispageIndex) { pageIndex = 1; } var source = this.mSysCatchNumService.FilterCatchNumList(this.LoginUserId, parameter, pageIndex, ref totalCount); AppGlobal.RenderResult <List <CatchNumJsonDTO> >(ApiCode.Success, source, "", pageIndex, totalCount); }
/// <summary> /// 查询追号记录 /// </summary> /// <param name="paramer">参数</param> public List <CatchNumJsonDTO> FilterCatchNumList(int userId, FilterCatchNumListParamerDTO paramer, int pageIndex, ref int totalCount) { #region old code //StringBuilder sqlWhere = new StringBuilder(); //if (paramer.BeginTime != null) // sqlWhere.Append(string.Format(" and cn.OccDate between '{0}' and '{1}'", paramer.BeginTime, paramer.EndTime));//时间 //if (!string.IsNullOrEmpty(paramer.CatchNumCode)) // sqlWhere.Append(string.Format(" and cn.CatchNumCode='{0}'", paramer.CatchNumCode));//投注编号 //if (!string.IsNullOrEmpty(paramer.IssueCode)) // sqlWhere.Append(string.Format(" and cn.BeginIssueCode like '%{0}%'", paramer.IssueCode)); //if (!string.IsNullOrEmpty(paramer.LotteryCode)) // sqlWhere.Append(string.Format(" and lv.LotteryCode='{0}'", paramer.LotteryCode)); //if (paramer.Mode != -1) // sqlWhere.Append(string.Format(" and cn.Model={0}", paramer.Mode)); //if (paramer.PalyRadioCode != -1) // sqlWhere.Append(string.Format(" and lv.RadioCode={0}", paramer.PalyRadioCode)); //if (!string.IsNullOrEmpty(paramer.PalyUserCode)) // sqlWhere.Append(string.Format(" and ytguser.Code like '%{0}%'", paramer.PalyUserCode)); //if (paramer.State != -1) // sqlWhere.Append(string.Format(" and cn.Stauts={0}", paramer.State)); //string procName = "sp_CatchNumList";//存储过程名称 //var fc = IoC.Resolve<IDbContextFactory>(); //var p = fc.GetDbParameter("@Where", System.Data.DbType.String); //p.Value = sqlWhere.ToString(); //var p1 = fc.GetDbParameter("@loginId", System.Data.DbType.Int32); //p1.Value = loginUid; //var p2 = fc.GetDbParameter("@UserScope", System.Data.DbType.Int32); //p2.Value = paramer.UserScope; //return this.ExProc<CatchNumJsonDTO>(procName, p, p1, p2); #endregion int pageSize = Ytg.Comm.AppGlobal.ManagerDataPageSize; string sql = @"select b.*,u.Code ,lv.PlayTypeRadioName ,lv.RadioCode,lv.PlayTypeNumName ,lv.PlayTypeName ,lv.LotteryName from CatchNums as b LEFT JOIN SysYtgUser as u ON u.Id = b.UserId LEFT JOIN Lottery_Vw as lv on lv.RadioCode= b.PalyRadioCode where 1=1 "; //order by b.OccDate desc //tradeType INT=1,--交易类型,当天1 历史记录2 //@userType INT,-- 用户类型 -1所有 1 自己 2 直接下级 3 所有下级 string userWhere = ""; string putWhere = ""; switch (paramer.UserScope) { case 1: userWhere = string.Format("SELECT Id FROM SysYtgUser where Id={0}", userId); break; case 2: userWhere = string.Format("SELECT Id FROM SysYtgUser where ParentId={0}", userId); break; case 3: userWhere = string.Format("SELECT * FROM f_SysYtgUser_GetChildren({0})", userId); break; case -1: //所有 userWhere = string.Format("SELECT * FROM f_SysYtgUser_GetChildren({0})", userId); putWhere = string.Format(" or b.UserId={0}", userId); break; } //账号 if (!string.IsNullOrEmpty(paramer.PalyUserCode)) { sql += string.Format(" and u.Code ='{0}'", Utils.ChkSQL(paramer.PalyUserCode)); } else { sql += string.Format(" and (b.UserId in ({0}) {1})", userWhere, putWhere); } string beginDate = Utils.GetNowBeginDate().ToString("yyyy/MM/dd HH:mm:ss"); string endDate = DateTime.Now.AddDays(1).ToString("yyyy/MM/dd HH:mm:ss"); if (null != paramer.BeginTime && null != paramer.EndTime) { beginDate = Utils.GetNowBeginDate().ToString("yyyy/MM/dd ") + paramer.BeginTime.Value.ToString("HH:mm:ss"); endDate = DateTime.Now.AddDays(1).ToString("yyyy/MM/dd ") + paramer.EndTime.Value.ToString("HH:mm:ss"); } if (paramer.tradeType == 2) { beginDate = paramer.BeginTime.Value.ToString("yyyy/MM/dd HH:mm:ss"); endDate = paramer.EndTime.Value.ToString("yyyy/MM/dd HH:mm:ss"); } sql += string.Format(" and b.OccDate between '{0}' and '{1}'", beginDate, endDate); //状态 -1 全部 1 已中奖、2 未中奖、3 未开奖、4 已撤单 if (paramer.State != -1) { sql += string.Format(" and b.Stauts={0}", paramer.State); } //采种 if (!string.IsNullOrEmpty(paramer.LotteryCode)) { sql += string.Format(" and lv.LotteryCode='{0}'", Utils.ChkSQL(paramer.LotteryCode)); } //玩法 if (paramer.PalyRadioCode != -1) { sql += string.Format(" and b.PalyRadioCode={0}", paramer.PalyRadioCode); } //期数 if (!string.IsNullOrEmpty(paramer.IssueCode)) { sql += string.Format(" and b.BeginIssueCode='{0}'", Utils.ChkSQL(paramer.IssueCode)); } //所有模式-1 0元、1角、2分 if (paramer.Mode != -1) { sql += string.Format(" and b.Model={0}", paramer.Mode); } //投注号 if (!string.IsNullOrEmpty(paramer.CatchNumCode)) { sql += string.Format(" and b.CatchNumCode like '%{0}%'", Utils.ChkSQL(paramer.CatchNumCode)); } sql = "(" + sql + ") as t1"; int pageCount = 0; return(this.GetEntitysPage <CatchNumJsonDTO>(sql, "Id", "*", " OccDate desc", ESortType.DESC, pageIndex, pageSize, ref pageCount, ref totalCount)); }