Пример #1
0
 protected override void AttachChildControls()
 {
     PageTitle.AddSiteNameTitle("下级分销商");
     this.onedistributor = (Panel) this.FindControl("onedistributor");
     this.twodistributor = (Panel) this.FindControl("twodistributor");
     this.rpdistributor = (VshopTemplatedRepeater) this.FindControl("rpdistributor");
     DistributorsQuery query = new DistributorsQuery {
         PageIndex = 1,
         PageSize = 0x2710
     };
     DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId());
     if (currentDistributors.DistributorGradeId == DistributorGrade.OneDistributor)
     {
         query.GradeId = 2;
         this.twodistributor.Visible = false;
     }
     else
     {
         query.GradeId = 3;
         this.onedistributor.Visible = false;
     }
     int result = 0;
     if (int.TryParse(this.Page.Request.QueryString["gradeId"], out result))
     {
         query.GradeId = result;
     }
     query.ReferralPath = currentDistributors.UserId.ToString();
     query.UserId = currentDistributors.UserId;
     this.rpdistributor.DataSource = DistributorsBrower.GetDistributorsCommission(query);
     this.rpdistributor.DataBind();
 }
Пример #2
0
 private void BindData()
 {
     DistributorsQuery entity = new DistributorsQuery {
         GradeId = 0,
         StoreName = "",
         CellPhone = "",
         RealName = "",
         MicroSignal = "",
         ReferralStatus = 0,
         PageIndex = 1,
         PageSize = 15,
         SortOrder = SortAction.Desc,
         SortBy = "OrdersTotal"
     };
     Globals.EntityCoding(entity, true);
     DataTable data = (DataTable) VShopHelper.GetDistributors(entity).Data;
     this.reDistributor.DataSource = data;
     this.reDistributor.DataBind();
 }
Пример #3
0
 private void BindData()
 {
     DistributorsQuery entity = new DistributorsQuery {
         GradeId = int.Parse(this.Grade),
         StoreName = this.StoreName,
         CellPhone = this.CellPhone,
         RealName = this.RealName,
         MicroSignal = this.MicroSignal,
         ReferralStatus = int.Parse(this.Status),
         PageIndex = this.pager.PageIndex,
         PageSize = this.pager.PageSize,
         SortOrder = SortAction.Desc,
         SortBy = "userid"
     };
     Globals.EntityCoding(entity, true);
     DbQueryResult distributors = VShopHelper.GetDistributors(entity);
     this.reDistributor.DataSource = distributors.Data;
     this.reDistributor.DataBind();
     this.pager.TotalRecords = distributors.TotalRecords;
 }
Пример #4
0
 private void Bind()
 {
     DistributorsQuery entity = new DistributorsQuery {
         UserId = int.Parse(this.Page.Request.QueryString["UserId"]),
         PageIndex = 1,
         PageSize = 1,
         SortOrder = SortAction.Desc,
         SortBy = "userid"
     };
     Globals.EntityCoding(entity, true);
     DbQueryResult distributors = VShopHelper.GetDistributors(entity);
     if (distributors.Data != null)
     {
         DataTable data = new DataTable();
         data = (DataTable) distributors.Data;
         this.litUserName.Text = data.Rows[0]["RealName"].ToString();
         this.lblStoreName.Text = data.Rows[0]["StoreName"].ToString();
         this.litRealName.Text = data.Rows[0]["RealName"].ToString();
         this.litCellPhone.Text = data.Rows[0]["CellPhone"].ToString();
         this.litQQ.Text = data.Rows[0]["QQ"].ToString();
         this.litMicroSignal.Text = data.Rows[0]["MicroSignal"].ToString();
         this.litGreade.Text = (data.Rows[0]["GradeId"].ToString() == "1") ? "一级" : ((data.Rows[0]["GradeId"].ToString() == "2") ? "二级" : "三级");
         this.litOrders.Text = "本站订单数:" + data.Rows[0]["ReferralOrders"].ToString() + ",所有下级分销商订单数:" + VShopHelper.GetDownDistributorNumReferralOrders(data.Rows[0]["UserId"].ToString()).ToString();
         this.litCommission.Text = data.Rows[0]["ReferralBlance"].ToString();
         DistributorsInfo userIdDistributors = VShopHelper.GetUserIdDistributors(int.Parse(data.Rows[0]["ReferralUserId"].ToString()));
         if (userIdDistributors != null)
         {
             this.litUpGrade.Text = userIdDistributors.StoreName;
         }
         else
         {
             this.litUpGrade.Text = "一级分销商";
         }
         this.litDownGradeNum.Text = VShopHelper.GetDownDistributorNum(data.Rows[0]["UserId"].ToString()).ToString();
     }
     else
     {
         this.ShowMsg("分销商信息不存在!", false);
     }
 }
Пример #5
0
 public static DataTable GetDistributorsCommission(DistributorsQuery query)
 {
     return new DistributorsDao().GetDistributorsCommission(query);
 }
Пример #6
0
 public static DbQueryResult GetDistributors(DistributorsQuery query)
 {
     return new DistributorsDao().GetDistributors(query);
 }
Пример #7
0
 public DataTable GetDistributorsCommission(DistributorsQuery query)
 {
     StringBuilder builder = new StringBuilder("1=1");
     if (query.GradeId > 0)
     {
         builder.AppendFormat("AND GradeId = {0}", query.GradeId);
     }
     if (!string.IsNullOrEmpty(query.ReferralPath))
     {
         builder.AppendFormat(" AND (ReferralPath LIKE '{0}|%' OR ReferralPath LIKE '%|{0}|%' OR ReferralPath LIKE '%|{0}' OR ReferralPath='{0}')", DataHelper.CleanSearchString(query.ReferralPath));
     }
     string str = string.Concat(new object[] { "select TOP ", query.PageSize, " UserId,StoreName,GradeId,CreateTime,isnull((select SUM(OrderTotal) from Hishop_Commissions where UserId=", query.UserId, " AND ReferralUserId=aspnet_Distributors.UserId),0) as OrderTotal,isnull((select SUM(CommTotal) from Hishop_Commissions where UserId=", query.UserId, " AND ReferralUserId=aspnet_Distributors.UserId),0) as  CommTotal from aspnet_Distributors WHERE ", builder.ToString(), " order by CreateTime " });
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);
     return this.database.ExecuteDataSet(sqlStringCommand).Tables[0];
 }
Пример #8
0
 public DbQueryResult GetDistributors(DistributorsQuery query)
 {
     StringBuilder builder = new StringBuilder();
     if (query.GradeId > 0)
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("GradeId = {0}", query.GradeId);
     }
     if (query.UserId > 0)
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("UserId = {0}", query.UserId);
     }
     if (query.ReferralStatus > 0)
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("ReferralStatus = '{0}'", query.ReferralStatus);
     }
     if (!string.IsNullOrEmpty(query.StoreName))
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("StoreName LIKE '%{0}%'", DataHelper.CleanSearchString(query.StoreName));
     }
     if (!string.IsNullOrEmpty(query.CellPhone))
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("CellPhone='{0}'", DataHelper.CleanSearchString(query.CellPhone));
     }
     if (!string.IsNullOrEmpty(query.MicroSignal))
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("MicroSignal = '{0}'", DataHelper.CleanSearchString(query.MicroSignal));
     }
     if (!string.IsNullOrEmpty(query.RealName))
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("RealName LIKE '%{0}%'", DataHelper.CleanSearchString(query.RealName));
     }
     if (!string.IsNullOrEmpty(query.ReferralPath))
     {
         if (builder.Length > 0)
         {
             builder.Append(" AND ");
         }
         builder.AppendFormat("(ReferralPath LIKE '{0}|%' OR ReferralPath LIKE '%|{0}|%' OR ReferralPath LIKE '%|{0}' OR ReferralPath='{0}')", DataHelper.CleanSearchString(query.ReferralPath));
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_DistributorsMembers", "UserId", (builder.Length > 0) ? builder.ToString() : null, "*");
 }