protected void Page_Load(object sender, EventArgs e) { m_Filter = PointLogFilter.GetFromFilter("filter"); UserPointType pointType = _Request.Get <UserPointType>("point", Method.Get, UserPointType.Point1); PointLogBO.Instance.GetPointStatInfo(Filter, pointType, out Count, out ProduceCount, out ConsumeCount); }
public override PointLogCollection GetPointLogs(PointLogFilter filter, int pageNumber) { using (SqlQuery query = new SqlQuery()) { StringBuilder sb = new StringBuilder(); if (!string.IsNullOrEmpty(filter.Username)) { sb.Append(" AND UserID IN( SELECT UserID FROM bx_Users WHERE Username = @Username )"); query.CreateParameter <string>("@Username", filter.Username, SqlDbType.NVarChar, 50); } if (filter.OperateID != null) { sb.Append(" AND OperateID = @OperateID"); query.CreateParameter <int>("@OperateID", filter.OperateID.Value, SqlDbType.Int); } if (filter.BeginDate != null) { sb.Append(" AND CreateTime >= @BeginDate"); query.CreateParameter <DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime); } if (filter.EndDate != null) { sb.Append(" AND CreateTime <= @EndDate"); query.CreateParameter <DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime); } if (sb.Length > 0) { sb.Remove(0, 4); } query.Pager.TableName = "bx_PointLogs"; query.Pager.PageNumber = pageNumber; query.Pager.PrimaryKey = "LogID"; query.Pager.SortField = "LogID"; query.Pager.IsDesc = true; query.Pager.PageSize = filter.PageSize; query.Pager.SelectCount = true; query.Pager.Condition = sb.ToString(); using (XSqlDataReader reader = query.ExecuteReader()) { PointLogCollection logs = new PointLogCollection(reader); if (reader.NextResult()) { while (reader.Next) { logs.TotalRecords = reader.Get <int>(0); } } return(logs); } } }
public override void GetPointStatInfo(PointLogFilter filter, int pointIndex, out int count, out int produceCount, out int consumeCount) { using (SqlQuery query = new SqlQuery()) { StringBuilder sb = new StringBuilder(); string sql1 = string.Format("SELECT SUM(Point{0}) FROM bx_PointLogs WHERE Point{0} > 0 ", pointIndex); string sql2 = string.Format("SELECT SUM(Point{0}) FROM bx_PointLogs WHERE Point{0} < 0 ", pointIndex); string sql0 = string.Format("SELECT SUM(Point_{0}) FROM bx_Users WHERE Point_{0}>0", pointIndex + 1); if (!string.IsNullOrEmpty(filter.Username)) { sb.Append(" AND UserID IN( SELECT UserID FROM bx_Users WHERE Username = @Username )"); query.CreateParameter<string>("@Username", filter.Username, SqlDbType.NVarChar, 50); sql2 += " AND Username = @Username;"; } if (filter.OperateID != null) { sb.Append(" AND OperateID = @OperateID"); query.CreateParameter<int>("@OperateID", filter.OperateID.Value, SqlDbType.Int); } if (filter.BeginDate != null) { sb.Append(" AND CreateTime >= @BeginDate"); query.CreateParameter<DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime); } if (filter.EndDate != null) { sb.Append(" AND CreateTime <= @EndDate"); query.CreateParameter<DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime); } sql1 += sb; sql2 += sb; string sql = string.Format("{0};{1};{2};", sql0, sql1, sql2); query.CommandText = sql; count = 0; produceCount = 0; consumeCount = 0; using (XSqlDataReader reader = query.ExecuteReader()) { while (reader.Next) count = reader.Get<int>(0); if (reader.NextResult()) { while (reader.Next) produceCount = reader.Get<int>(0); if (reader.NextResult()) while (reader.Next) consumeCount = reader.Get<int>(0); } } } }
protected void Page_Load(object sender, EventArgs e) { if (_Request.IsClick("search")) { m_Filter = PointLogFilter.GetFromForm(); m_Filter.Apply("filter", "page"); } m_Filter = PointLogFilter.GetFromFilter("filter"); FillSimpleUsers <PointLog>(this.PointLogList); }
public PointLogCollection GetPointLogs(AuthUser operateUser, PointLogFilter filter, int pageNumber) { if (pageNumber <= 0) { pageNumber = 1; } if (filter.PageSize <= 0) { filter.PageSize = Consts.DefaultPageSize; } return(PointLogDao.Instance.GetPointLogs(filter, pageNumber)); }
public void GetPointStatInfo(PointLogFilter filter, UserPointType pointIndex, out int count, out int produceCount, out int consumeCount) { PointLogDao.Instance.GetPointStatInfo(filter, (int)pointIndex, out count, out produceCount, out consumeCount); }
public override void GetPointStatInfo(PointLogFilter filter, int pointIndex, out int count, out int produceCount, out int consumeCount) { using (SqlQuery query = new SqlQuery()) { StringBuilder sb = new StringBuilder(); string sql1 = string.Format("SELECT SUM(Point{0}) FROM bx_PointLogs WHERE Point{0} > 0 ", pointIndex); string sql2 = string.Format("SELECT SUM(Point{0}) FROM bx_PointLogs WHERE Point{0} < 0 ", pointIndex); string sql0 = string.Format("SELECT SUM(Point_{0}) FROM bx_Users WHERE Point_{0}>0", pointIndex + 1); if (!string.IsNullOrEmpty(filter.Username)) { sb.Append(" AND UserID IN( SELECT UserID FROM bx_Users WHERE Username = @Username )"); query.CreateParameter <string>("@Username", filter.Username, SqlDbType.NVarChar, 50); sql2 += " AND Username = @Username;"; } if (filter.OperateID != null) { sb.Append(" AND OperateID = @OperateID"); query.CreateParameter <int>("@OperateID", filter.OperateID.Value, SqlDbType.Int); } if (filter.BeginDate != null) { sb.Append(" AND CreateTime >= @BeginDate"); query.CreateParameter <DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime); } if (filter.EndDate != null) { sb.Append(" AND CreateTime <= @EndDate"); query.CreateParameter <DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime); } sql1 += sb; sql2 += sb; string sql = string.Format("{0};{1};{2};", sql0, sql1, sql2); query.CommandText = sql; count = 0; produceCount = 0; consumeCount = 0; using (XSqlDataReader reader = query.ExecuteReader()) { while (reader.Next) { count = reader.Get <int>(0); } if (reader.NextResult()) { while (reader.Next) { produceCount = reader.Get <int>(0); } if (reader.NextResult()) { while (reader.Next) { consumeCount = reader.Get <int>(0); } } } } } }
public abstract void GetPointStatInfo(PointLogFilter filter, int pointIndex, out int count, out int produceCount, out int consumeCount);
public abstract PointLogCollection GetPointLogs(PointLogFilter filter, int pageNumber);
public override PointLogCollection GetPointLogs(PointLogFilter filter, int pageNumber) { using (SqlQuery query = new SqlQuery()) { StringBuilder sb = new StringBuilder(); if (!string.IsNullOrEmpty(filter.Username)) { sb.Append(" AND UserID IN( SELECT UserID FROM bx_Users WHERE Username = @Username )"); query.CreateParameter<string>("@Username", filter.Username, SqlDbType.NVarChar, 50); } if (filter.OperateID != null) { sb.Append(" AND OperateID = @OperateID"); query.CreateParameter<int>("@OperateID", filter.OperateID.Value, SqlDbType.Int); } if (filter.BeginDate != null) { sb.Append(" AND CreateTime >= @BeginDate"); query.CreateParameter<DateTime>("@BeginDate", filter.BeginDate.Value, SqlDbType.DateTime); } if (filter.EndDate != null) { sb.Append(" AND CreateTime <= @EndDate"); query.CreateParameter<DateTime>("@EndDate", filter.EndDate.Value, SqlDbType.DateTime); } if (sb.Length > 0) sb.Remove(0, 4); query.Pager.TableName = "bx_PointLogs"; query.Pager.PageNumber = pageNumber; query.Pager.PrimaryKey = "LogID"; query.Pager.SortField = "LogID"; query.Pager.IsDesc = true; query.Pager.PageSize = filter.PageSize; query.Pager.SelectCount = true; query.Pager.Condition = sb.ToString(); using (XSqlDataReader reader = query.ExecuteReader()) { PointLogCollection logs = new PointLogCollection(reader); if (reader.NextResult()) while (reader.Next) logs.TotalRecords = reader.Get<int>(0); return logs; } } }