public void GetBalance()
 {
     DistributorQuery query = new DistributorQuery();
     query.Username = searchKey;
     query.RealName = realName;
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     DbQueryResult distributorBalance = DistributorHelper.GetDistributorBalance(query);
     grdDistributorAccountList.DataSource = distributorBalance.Data;
     grdDistributorAccountList.DataBind();
     pager.TotalRecords = distributorBalance.TotalRecords;
     pager1.TotalRecords = distributorBalance.TotalRecords;
 }
Esempio n. 2
0
 public static DbQueryResult GetDistributors(DistributorQuery query)
 {
     return DistributorProvider.Instance().GetDistributors(query);
 }
Esempio n. 3
0
 public abstract DbQueryResult GetDistributors(DistributorQuery query);
Esempio n. 4
0
 public abstract DbQueryResult GetDistributorBalance(DistributorQuery query);
Esempio n. 5
0
 private void BindDistributorRequest()
 {
     DistributorQuery query = new DistributorQuery();
     query.IsApproved = false;
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     query.Username = Keywords;
     query.RealName = RealName;
     query.SortBy = "CreateDate";
     query.SortOrder = SortAction.Desc;
     DbQueryResult distributors = DistributorHelper.GetDistributors(query);
     grdDistributorRequests.DataSource = distributors.Data;
     grdDistributorRequests.DataBind();
     pager.TotalRecords = distributors.TotalRecords;
     pager1.TotalRecords = distributors.TotalRecords;
 }
Esempio n. 6
0
 public override DbQueryResult GetDistributors(DistributorQuery query)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("IsApproved = {0}", query.IsApproved ? 1 : 0);
     if (!string.IsNullOrEmpty(query.Username))
     {
         builder.AppendFormat(" AND UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.Username));
     }
     if (!string.IsNullOrEmpty(query.RealName))
     {
         builder.AppendFormat(" AND RealName LIKE '%{0}%'", DataHelper.CleanSearchString(query.RealName));
     }
     if (query.GradeId.HasValue)
     {
         builder.AppendFormat(" AND GradeId = {0}", query.GradeId);
     }
     if (query.LineId.HasValue)
     {
         builder.AppendFormat(" AND UserId IN (SELECT UserId FROM Hishop_DistributorProductLines WHERE LineId={0})", query.LineId.Value);
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_aspnet_Distributors", "UserId", builder.ToString(), "*");
 }
Esempio n. 7
0
 public override DbQueryResult GetDistributorBalance(DistributorQuery query)
 {
     if (null == query)
     {
         return new DbQueryResult();
     }
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     string str = string.Empty;
     if (!string.IsNullOrEmpty(query.Username))
     {
         str = string.Format("AND UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.Username));
     }
     if (!string.IsNullOrEmpty(query.RealName))
     {
         str = str + string.Format(" AND RealName LIKE '%{0}%'", DataHelper.CleanSearchString(query.RealName));
     }
     builder.AppendFormat("SELECT TOP {0} *", query.PageSize);
     builder.Append(" FROM vw_aspnet_Distributors WHERE IsApproved = 1");
     if (query.PageIndex == 1)
     {
         builder.AppendFormat(" {0} ORDER BY CreateDate DESC", str);
     }
     else
     {
         builder.AppendFormat(" AND CreateDate < (select min(CreateDate) FROM (SELECT TOP {0} CreateDate FROM vw_aspnet_Distributors WHERE IsApproved = 1 {1} ORDER BY CreateDate DESC ) AS tbltemp) {1} ORDER BY CreateDate DESC", (query.PageIndex - 1) * query.PageSize, str);
     }
     if (query.IsCount)
     {
         builder.AppendFormat(" ;SELECT COUNT(CreateDate) AS Total FROM vw_aspnet_Distributors 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;
 }
Esempio n. 8
0
 private void BindDistributors()
 {
     DistributorQuery query = new DistributorQuery();
     query.IsApproved = true;
     query.PageIndex = pager.PageIndex;
     query.PageSize = pager.PageSize;
     query.GradeId = gradeId;
     query.LineId = lineId;
     query.Username = userName;
     query.RealName = realName;
     query.SortBy = grdDistributorList.SortOrderBy;
     if (grdDistributorList.SortOrder.ToLower() == "desc")
     {
         query.SortOrder = SortAction.Desc;
     }
     DbQueryResult distributors = DistributorHelper.GetDistributors(query);
     grdDistributorList.DataSource = distributors.Data;
     grdDistributorList.DataBind();
     pager.TotalRecords = distributors.TotalRecords;
     pager1.TotalRecords = distributors.TotalRecords;
 }