public void GetBalanceDrawRequest()
 {
     BalanceDrawRequestQuery query = new BalanceDrawRequestQuery();
     query.FromDate = dataStart;
     query.ToDate = dataEnd;
     query.UserName = txtUserName.Text;
     query.UserId = userId;
     query.PageIndex = pager.PageIndex;
     DbQueryResult distributorBalanceDrawRequests = DistributorHelper.GetDistributorBalanceDrawRequests(query);
     grdBalanceDrawRequest.DataSource = distributorBalanceDrawRequests.Data;
     grdBalanceDrawRequest.DataBind();
     pager.TotalRecords = distributorBalanceDrawRequests.TotalRecords;
 }
 public void BindBalanceDrawRequest()
 {
     BalanceDrawRequestQuery query = new BalanceDrawRequestQuery();
     query.FromDate = dataStart;
     query.ToDate = dataEnd;
     query.UserName = txtUserName.Text;
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     DbQueryResult balanceDrawRequests = MemberHelper.GetBalanceDrawRequests(query);
     grdBalanceDrawRequest.DataSource = balanceDrawRequests.Data;
     grdBalanceDrawRequest.DataBind();
     pager1.TotalRecords = pager.TotalRecords = balanceDrawRequests.TotalRecords;
     pager.TotalRecords = pager.TotalRecords = balanceDrawRequests.TotalRecords;
 }
 public void BindBalanceDrawRequest()
 {
     BalanceDrawRequestQuery query = new BalanceDrawRequestQuery();
     if (userId > 0)
     {
         query.UserId = new int?(userId);
     }
     query.UserName = userName;
     query.FromDate = dateStart;
     query.ToDate = dateEnd;
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     DbQueryResult balanceDrawRequests = UnderlingHelper.GetBalanceDrawRequests(query);
     grdBalanceDrawRequest.DataSource = balanceDrawRequests.Data;
     grdBalanceDrawRequest.DataBind();
     pager.TotalRecords = balanceDrawRequests.TotalRecords;
     pager1.TotalRecords = balanceDrawRequests.TotalRecords;
 }
Beispiel #4
0
 public static DbQueryResult GetBalanceDrawRequests(BalanceDrawRequestQuery query)
 {
     return UnderlingProvider.Instance().GetBalanceDrawRequests(query);
 }
Beispiel #5
0
 public static DbQueryResult GetDistributorBalanceDrawRequests(BalanceDrawRequestQuery query)
 {
     return DistributorProvider.Instance().GetDistributorBalanceDrawRequests(query);
 }
Beispiel #6
0
 public abstract DbQueryResult GetDistributorBalanceDrawRequests(BalanceDrawRequestQuery query);
Beispiel #7
0
 public abstract DbQueryResult GetBalanceDrawRequestsNoPage(BalanceDrawRequestQuery query);
Beispiel #8
0
 static string BuildBalanceDrawRequestQuery(BalanceDrawRequestQuery query)
 {
     StringBuilder builder = new StringBuilder();
     if (query.UserId.HasValue)
     {
         builder.AppendFormat(" AND UserId = {0}", query.UserId.Value);
     }
     if (!string.IsNullOrEmpty(query.UserName))
     {
         builder.AppendFormat(" AND UserId IN (SELECT UserId FROM vw_aspnet_Distributors WHERE UserName='******')", DataHelper.CleanSearchString(query.UserName));
     }
     if (query.FromDate.HasValue)
     {
         builder.AppendFormat(" AND RequestTime >= '{0}'", DataHelper.GetSafeDateTimeFormat(query.FromDate.Value));
     }
     if (query.ToDate.HasValue)
     {
         builder.AppendFormat(" AND RequestTime <= '{0}'", DataHelper.GetSafeDateTimeFormat(query.ToDate.Value));
     }
     return builder.ToString();
 }
Beispiel #9
0
 public override DbQueryResult GetDistributorBalanceDrawRequests(BalanceDrawRequestQuery query)
 {
     if (null == query)
     {
         return new DbQueryResult();
     }
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     string str = BuildBalanceDrawRequestQuery(query);
     builder.AppendFormat("select top {0} *", query.PageSize);
     builder.Append(" from Hishop_DistributorBalanceDrawRequest B where 0=0 ");
     if (query.PageIndex == 1)
     {
         builder.AppendFormat("{0} ORDER BY RequestTime DESC", str);
     }
     else
     {
         builder.AppendFormat(" and RequestTime < (select min(RequestTime) from (select top {0} RequestTime from Hishop_DistributorBalanceDrawRequest where 0=0 {1} ORDER BY RequestTime DESC ) as tbltemp) {1} ORDER BY RequestTime DESC", (query.PageIndex - 1) * query.PageSize, str);
     }
     if (query.IsCount)
     {
         builder.AppendFormat(";select count(*) as Total from Hishop_DistributorBalanceDrawRequest where 0=0 {0}", str);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         result.Data = DataHelper.ConverDataReaderToDataTable(reader);
         if (query.IsCount && reader.NextResult())
         {
             reader.Read();
             result.TotalRecords = reader.GetInt32(0);
         }
     }
     return result;
 }
Beispiel #10
0
 public static DbQueryResult GetBalanceDrawRequestsNoPage(BalanceDrawRequestQuery query)
 {
     return MemberProvider.Instance().GetBalanceDrawRequestsNoPage(query);
 }
Beispiel #11
0
 public override DbQueryResult GetBalanceDrawRequests(BalanceDrawRequestQuery query)
 {
     if (null == query)
     {
         return null;
     }
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     string str = BuildBalanceDrawRequestQuery(query);
     builder.AppendFormat("SELECT Top {0} * FROM distro_BalanceDrawRequest B WHERE 0=0", query.PageSize);
     if (query.PageIndex == 1)
     {
         builder.AppendFormat("{0} ORDER BY RequestTime DESC;", str);
     }
     else
     {
         builder.AppendFormat(" AND RequestTime < (SELECT MIN(RequestTime) FROM (SELECT TOP {0} RequestTime FROM distro_BalanceDrawRequest WHERE 0=0 {1} ORDER BY RequestTime DESC ) as T) {1} ORDER BY RequestTime DESC;", (query.PageIndex - 1) * query.PageSize, str);
     }
     if (query.IsCount)
     {
         builder.AppendFormat("SELECT COUNT(*) AS Total from distro_BalanceDrawRequest WHERE 0=0 {0}", str);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         result.Data = DataHelper.ConverDataReaderToDataTable(reader);
         if (query.IsCount && reader.NextResult())
         {
             reader.Read();
             result.TotalRecords = reader.GetInt32(0);
         }
     }
     return result;
 }
Beispiel #12
0
 public override DbQueryResult GetBalanceDrawRequestsNoPage(BalanceDrawRequestQuery query)
 {
     if (null == query)
     {
         return new DbQueryResult();
     }
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     string str = BuildBalanceDrawRequestQuery(query);
     builder.Append("select *");
     builder.Append(" from Hishop_BalanceDrawRequest B where 0=0 ");
     builder.AppendFormat("{0} ORDER BY RequestTime DESC", str);
     if (query.IsCount)
     {
         builder.AppendFormat(";select count(*) as Total from Hishop_BalanceDrawRequest where 0=0 {0}", str);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         result.Data = DataHelper.ConverDataReaderToDataTable(reader);
         if (query.IsCount && reader.NextResult())
         {
             reader.Read();
             result.TotalRecords = reader.GetInt32(0);
         }
     }
     return result;
 }