protected override void Render(HtmlTextWriter writer) { if (!Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.SelectServerAgent) { return; } DistributorsQuery agentQuery = new DistributorsQuery { PageIndex = 1, PageSize = 1000, IsAgent = -1,//包括天使和非天使 IsServiceStore = 1, }; DbQueryResult agentsInfo = DistributorsBrower.GetDistributors(agentQuery); if (agentsInfo.TotalRecords > 0) { StringBuilder builder = new StringBuilder(); builder.AppendLine(" <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择服务门店<span class=\"caret\"></span></button>"); builder.AppendLine("<ul id=\"agentsUl\" class=\"dropdown-menu\" role=\"menu\">"); builder.AppendFormat("<li><a href=\"#\" name=\"{1}\" value=\"{1}\">{0}</a></li>", "无", 0).AppendLine(); foreach (DataRow row in ((System.Data.DataTable)agentsInfo.Data).Rows) { string userId = row["UserId"].ToString(); string StoreName = row["StoreName"].ToString(); builder.AppendFormat("<li><a href=\"#\" name=\"{1}\" value=\"{1}\">{0}</a></li>", StoreName, userId).AppendLine(); } builder.AppendLine("</ul>"); writer.Write(builder.ToString()); } }
private void BindData() { DistributorsQuery entity = new DistributorsQuery { GradeId = int.Parse(this.Grade), StoreName = this.StoreName, CellPhone = this.CellPhone, StoreName1 = this.StoreName1, RealName = this.RealName, MicroSignal = this.MicroSignal, UserName = this.UserName, ReferralStatus = int.Parse(this.Status), PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortOrder = SortAction.Desc, SortBy = "userid" }; Globals.EntityCoding(entity, true); DbQueryResult result = VShopHelper.GetDistributors(entity, null, null); this.reDistributor.DataSource = result.Data; this.reDistributor.DataBind(); this.pager.TotalRecords = result.TotalRecords; DataTable distributorsNum = VShopHelper.GetDistributorsNum(); this.ListActive.Text = "分销商列表(" + distributorsNum.Rows[0]["active"].ToString() + ")"; this.Listfrozen.Text = "已冻结(" + distributorsNum.Rows[0]["frozen"].ToString() + ")"; }
protected void Page_Load(object sender, EventArgs e) { Utility.RegisterTypeForAjax(typeof(DistributorList)); this.localUrl = base.Request.Url.ToString(); string str = base.Request.QueryString["task"]; if (!string.IsNullOrEmpty(str)) { string s = "{error:1,msg:'未定义操作!'}"; if (str == "readinfo") { int num; if (int.TryParse(this.Page.Request.QueryString["UserId"], out num)) { DistributorsQuery entity = new DistributorsQuery { UserId = int.Parse(this.Page.Request.QueryString["UserId"]), ReferralStatus = -1, PageIndex = 1, PageSize = 1, SortOrder = SortAction.Desc, SortBy = "userid" }; Globals.EntityCoding(entity, true); DbQueryResult result = VShopHelper.GetDistributors(entity, null, null); if (result.Data != null) { DataTable data = new DataTable(); data = (DataTable)result.Data; s = s = "{error:0,Data:" + JsonConvert.SerializeObject(data) + "}"; } else { s = "{error:1,msg:'分销商信息不存在'}"; } } else { s = "{error:1,msg:'userid错误'}"; } } base.Response.Write(s); base.Response.End(); } this.reDistributor.ItemCommand += new RepeaterCommandEventHandler(this.reDistributor_ItemCommand); this.btnSearchButton.Click += new EventHandler(this.btnSearchButton_Click); this.FrozenCheck.Click += new EventHandler(this.FrozenCheck_Click); this.CancleCheck.Click += new EventHandler(this.CancleCheck_Click); this.PassCheck.Click += new EventHandler(this.PassCheck_Click); this.GradeCheck.Click += new EventHandler(this.GradeCheck_Click); this.EditSave.Click += new EventHandler(this.EditSave_Click); this.UpdateCommission.Click += new EventHandler(this.UpdateCommission_Click); this.LoadParameters(); if (!base.IsPostBack) { this.BindData(); this.GradeCheckList.DataBind(); this.DrGrade.DataBind(); this.DrGrade.SelectedValue = new int?(int.Parse(this.Grade)); } }
private void BindData(string title) { DistributorsQuery entity = new DistributorsQuery { GradeId = 0, StoreName = title, PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortOrder = SortAction.Desc, SortBy = "userid" }; Globals.EntityCoding(entity, true); DbQueryResult result = VShopHelper.GetDistributors(entity, null, null); if (result.TotalRecords > 0) { this.rptList.DataSource = result.Data; this.rptList.DataBind(); this.pager.TotalRecords = result.TotalRecords; if (this.pager.TotalRecords <= this.pager.PageSize) { this.pager.Visible = false; } } else { this.divEmpty.Visible = true; } }
public DataTable GetDownDistributors(DistributorsQuery query) { StringBuilder builder = new StringBuilder("1=1"); string str = ""; if (query.GradeId > 0) { if (query.GradeId == 2) { builder.AppendFormat(" AND ( ReferralPath LIKE '%|{0}' OR ReferralPath='{0}')", DataHelper.CleanSearchString(query.ReferralPath)); } if (query.GradeId == 3) { builder.AppendFormat(" AND ReferralPath LIKE '{0}|%' ", DataHelper.CleanSearchString(query.ReferralPath)); } } if (query.UserId > 0) { str = " UserId=" + query.UserId + " AND "; } string str2 = string.Concat(new object[] { "select TOP ", query.PageSize, " UserId,StoreName,GradeId,CreateTime,isnull((select SUM(OrderTotal) from Hishop_Commissions where ", str, " ReferralUserId=aspnet_Distributors.UserId),0) as OrderTotal,isnull((select SUM(CommTotal) from Hishop_Commissions where ", str, " ReferralUserId=aspnet_Distributors.UserId),0) as CommTotal from aspnet_Distributors WHERE ", builder.ToString(), " order by CreateTime desc" }); DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str2); return(this.database.ExecuteDataSet(sqlStringCommand).Tables[0]); }
private void BindData() { DistributorsQuery distributorsQuery = new DistributorsQuery(); distributorsQuery.GradeId = int.Parse(this.Grade); distributorsQuery.StoreName = this.StoreName; distributorsQuery.CellPhone = this.CellPhone; distributorsQuery.StoreName1 = this.StoreName1; distributorsQuery.RealName = this.RealName; distributorsQuery.MicroSignal = this.MicroSignal; distributorsQuery.ReferralStatus = int.Parse(this.Status); distributorsQuery.PageIndex = this.pager.PageIndex; distributorsQuery.PageSize = this.pager.PageSize; distributorsQuery.SortOrder = SortAction.Desc; distributorsQuery.SortBy = "userid"; Globals.EntityCoding(distributorsQuery, true); DbQueryResult distributors = VShopHelper.GetDistributors(distributorsQuery, null, null); this.reDistributor.DataSource = distributors.Data; this.reDistributor.DataBind(); this.pager.TotalRecords = distributors.TotalRecords; System.Data.DataTable distributorsNum = VShopHelper.GetDistributorsNum(); this.ListActive.Text = "分销商列表(" + distributorsNum.Rows[0]["active"].ToString() + ")"; this.Listfrozen.Text = "已冻结(" + distributorsNum.Rows[0]["frozen"].ToString() + ")"; }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); this.hiddTotal = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal"); DistributorsQuery distributorsQuery = new DistributorsQuery(); distributorsQuery.PageIndex = 0; distributorsQuery.PageSize = 10; DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId(), true); if (currentDistributors.ReferralStatus != 0) { System.Web.HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { distributorsQuery.GradeId = 3; int userId = 0; if (int.TryParse(this.Page.Request.QueryString["UserId"], out userId)) { distributorsQuery.UserId = userId; } distributorsQuery.ReferralPath = userId.ToString(); int num = 0; DataTable threeDistributors = DistributorsBrower.GetThreeDistributors(distributorsQuery, out num); this.hiddTotal.Value = num.ToString(); this.rpdistributor.DataSource = threeDistributors; this.rpdistributor.DataBind(); } }
private void BindData(string title) { DistributorsQuery distributorsQuery = new DistributorsQuery(); distributorsQuery.GradeId = 0; distributorsQuery.StoreName = title; distributorsQuery.PageIndex = this.pager.PageIndex; distributorsQuery.PageSize = this.pager.PageSize; distributorsQuery.SortOrder = SortAction.Desc; distributorsQuery.SortBy = "userid"; Globals.EntityCoding(distributorsQuery, true); DbQueryResult distributors = VShopHelper.GetDistributors(distributorsQuery, null, null); int totalRecords = distributors.TotalRecords; if (totalRecords > 0) { this.rptList.DataSource = distributors.Data; this.rptList.DataBind(); this.pager.TotalRecords = distributors.TotalRecords; if (this.pager.TotalRecords <= this.pager.PageSize) { this.pager.Visible = false; return; } } else { this.divEmpty.Visible = true; } }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); this.hiddTotal = (HtmlInputHidden)this.FindControl("hiddTotal"); DistributorsQuery query = new DistributorsQuery { PageIndex = 0, PageSize = 10 }; if (DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId(), true).ReferralStatus != 0) { HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { query.GradeId = 3; int result = 0; if (int.TryParse(this.Page.Request.QueryString["UserId"], out result)) { query.UserId = result; } query.ReferralPath = result.ToString(); int total = 0; DataTable threeDistributors = DistributorsBrower.GetThreeDistributors(query, out total); this.hiddTotal.Value = total.ToString(); this.rpdistributor.DataSource = threeDistributors; this.rpdistributor.DataBind(); } }
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()); query.GradeId = 2; this.twodistributor.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.GetDownDistributors(query); this.rpdistributor.DataBind(); }
public void BindDDLDistributors() { DistributorsQuery query = new DistributorsQuery(); this.DDL_ReferralUser.DataSource = DistributorsBrower.SelectDistributors(query); this.DDL_ReferralUser.DataTextField = "StoreName"; this.DDL_ReferralUser.DataValueField = "UserId"; this.DDL_ReferralUser.DataBind(); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.litMysubMember = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubMember"); this.litMysubFirst = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubFirst"); this.litMysubSecond = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubSecond"); int currentMemberUserId = Globals.GetCurrentMemberUserId(); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMemberUserId); this.litUserId = (System.Web.UI.WebControls.Literal) this.FindControl("litUserId"); this.litUserId.Text = userIdDistributors.UserId.ToString(); DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId); if (distributorsSubStoreNum != null || distributorsSubStoreNum.Rows.Count > 0) { this.litMysubMember.Text = distributorsSubStoreNum.Rows[0]["memberCount"].ToString(); this.litMysubFirst.Text = distributorsSubStoreNum.Rows[0]["firstV"].ToString(); this.litMysubSecond.Text = distributorsSubStoreNum.Rows[0]["secondV"].ToString(); } else { this.litMysubMember.Text = "0"; this.litMysubFirst.Text = "0"; this.litMysubSecond.Text = "0"; } this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); this.hiddTotal = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal"); DistributorsQuery distributorsQuery = new DistributorsQuery(); distributorsQuery.PageIndex = 0; distributorsQuery.PageSize = 10; DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId(), true); if (currentDistributors.ReferralStatus != 0) { System.Web.HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { distributorsQuery.GradeId = 2; int gradeId = 0; if (int.TryParse(this.Page.Request.QueryString["gradeId"], out gradeId)) { distributorsQuery.GradeId = gradeId; } distributorsQuery.ReferralPath = currentDistributors.UserId.ToString(); distributorsQuery.UserId = currentDistributors.UserId; int num = 0; DataTable downDistributors = DistributorsBrower.GetDownDistributors(distributorsQuery, out num); this.hiddTotal.Value = num.ToString(); this.rpdistributor.DataSource = downDistributors; this.rpdistributor.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["UserId"], out this.userid)) { this.Page.Response.Redirect("DistributorList.aspx"); } this.ListImage1.ImageUrl = "/Templates/common/images/user.png"; DistributorsQuery entity = new DistributorsQuery { UserId = this.userid, ReferralStatus = -1, PageIndex = 1, PageSize = 1, SortOrder = SortAction.Desc, SortBy = "userid" }; Globals.EntityCoding(entity, true); DbQueryResult result = VShopHelper.GetDistributors(entity, null, null); DataTable data = new DataTable(); if (result.Data != null) { data = (DataTable)result.Data; } else { this.Page.Response.Redirect("DistributorList.aspx"); } if ((data.Rows[0]["UserHead"] != DBNull.Value) && (data.Rows[0]["UserHead"].ToString().Trim() != "")) { this.ListImage1.ImageUrl = data.Rows[0]["UserHead"].ToString(); } this.txtCellPhone.InnerText = (data.Rows[0]["CellPhone"] == DBNull.Value) ? "" : ((string)data.Rows[0]["CellPhone"]); this.txtStoreName.InnerText = (string)data.Rows[0]["StoreName"]; this.txtMicroName.InnerText = (string)data.Rows[0]["UserName"]; this.txtUserBindName.InnerText = (data.Rows[0]["UserBindName"] == DBNull.Value) ? "" : data.Rows[0]["UserBindName"].ToString(); this.txtRealName.InnerText = (data.Rows[0]["RealName"] == DBNull.Value) ? "" : ((string)data.Rows[0]["RealName"]); this.txtCreateTime.InnerText = ((DateTime)data.Rows[0]["CreateTime"]).ToString("yyyy-MM-dd HH:mm:ss"); this.txtName.InnerText = (data.Rows[0]["Name"] == DBNull.Value) ? "" : ((string)data.Rows[0]["Name"]); string str = Globals.HostPath(HttpContext.Current.Request.Url) + "/Default.aspx?ReferralId=" + entity.UserId; this.txtUrl.InnerText = str; this.StoreCode.ImageUrl = "http://s.jiathis.com/qrcode.php?url=" + str; this.OrdersTotal.InnerText = "¥" + Convert.ToDouble(data.Rows[0]["OrdersTotal"]).ToString("0.00"); this.ReferralOrders.InnerText = data.Rows[0]["ReferralOrders"].ToString(); this.ReferralBlance.InnerText = "¥" + Convert.ToDouble(data.Rows[0]["ReferralBlance"]).ToString("0.00"); this.ReferralRequestBalance.InnerText = "¥" + Convert.ToDouble(data.Rows[0]["ReferralRequestBalance"]).ToString("0.00"); decimal num = decimal.Parse(data.Rows[0]["ReferralBlance"].ToString()) + decimal.Parse(data.Rows[0]["ReferralRequestBalance"].ToString()); this.TotalReferral.InnerText = "¥" + Convert.ToDouble(num.ToString()).ToString("0.00"); this.BindData(entity.UserId); }
public static string GetZnodes(string TopUserId) { string znodes = string.Empty; DistributorsInfo topDistributor = DistributorsBrower.GetDistributorInfo(Convert.ToInt32(TopUserId)); if (topDistributor != null) { DataTable dt = new DataTable(); if (topDistributor.IsAgent == 1) { DistributorsQuery dquery = new DistributorsQuery { PageIndex = 1, PageSize = int.MaxValue, AgentPath = topDistributor.UserId.ToString(), GradeId = 99,//所有下属分销商和代理商 }; dt = DistributorsBrower.GetDownDistributorsAndA(dquery); } else { DistributorsQuery dquery = new DistributorsQuery { PageIndex = 1, PageSize = int.MaxValue, ReferralPath = topDistributor.UserId.ToString(), GradeId = 99,//所有三级分销商 }; dt = DistributorsBrower.GetThreeDownDistributors(dquery); } if (dt != null)//如果当前角色下有可以使用的菜单 { dt.PrimaryKey = new DataColumn[] { dt.Columns["UserId"] }; for (int i = 0; i < dt.Rows.Count; i++) { string userid = dt.Rows[i]["userid"].ToString(); string isagent = dt.Rows[i]["isagent"].ToString(); string name = dt.Rows[i]["storename"].ToString() + " " + (dt.Rows[i]["isagent"].ToString() == "1" ? "(代理商)" : "(分销商)"); string storename = dt.Rows[i]["username"].ToString(); string pid = dt.Rows[i]["ParentUserId"].ToString(); znodes += "{\"id\":\"" + userid + "\",\"isagent\":\"" + isagent + "\",\"name\":\"" + name + "\",\"open\":\"true\",\"storename\":\"" + storename + "\",\"pid\":\"" + pid + "\"},"; } znodes = znodes.TrimEnd(','); } } else { return("出错了"); } return(znodes); }
private void Bind() { DistributorsQuery entity = new DistributorsQuery { UserId = int.Parse(this.Page.Request.QueryString["UserId"]), IsAgent = int.Parse(this.Page.Request.QueryString["IsAgent"] == null ? "-1" : this.Page.Request.QueryString["IsAgent"]), PageIndex = 1, PageSize = 1, SortOrder = SortAction.Desc, SortBy = "userid" }; if (entity.IsAgent == 1) { TypeTitle = "代理商"; } Globals.EntityCoding(entity, true); DbQueryResult distributors = VShopHelper.GetDistributors(entity); if (distributors.Data != null) { System.Data.DataTable data = new System.Data.DataTable(); data = (System.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(); this.txtStoreName.Text = data.Rows[0]["StoreName"].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); } }
private Literal rightTitle; //右侧动态标题 protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.onedistributor = (Panel)this.FindControl("onedistributor"); this.twodistributor = (Panel)this.FindControl("twodistributor"); this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); this.leftTitle = (Literal)this.FindControl("leftTitle"); this.rightTitle = (Literal)this.FindControl("rightTitle"); DistributorsQuery query = new DistributorsQuery { PageIndex = 1, PageSize = 0x2710 }; DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId()); query.GradeId = 2; this.twodistributor.Visible = false; int result = 0; if (int.TryParse(this.Page.Request.QueryString["gradeId"], out result)) { query.GradeId = result; } query.UserId = currentDistributors.UserId; //新增判断,如果是代理商,[我的下属]页面就会变成下级代理+下级分销的模式, 如果是分销商,则按默认的来 switch (currentDistributors.IsAgent) { case 1: //代理商 query.AgentPath = currentDistributors.UserId.ToString(); this.rpdistributor.DataSource = DistributorsBrower.GetDownDistributorsAndAgents(query); this.leftTitle.Text = "下级代理商"; this.rightTitle.Text = "下级分销商"; break; case 0: //分销商 query.ReferralPath = currentDistributors.UserId.ToString(); this.rpdistributor.DataSource = DistributorsBrower.GetDownDistributors(query); this.leftTitle.Text = "二级分销商"; this.rightTitle.Text = "三级分销商"; break; } this.rpdistributor.DataBind(); }
public string GetJson(HttpContext context) { DistributorsQuery query = new DistributorsQuery { StoreName = (context.Request.QueryString["userName"] != null) ? context.Request.QueryString["userName"] : "" }; DataTable table = DistributorsBrower.SelectDistributors(query); string str = "["; if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { object obj2 = str + "{"; object obj3 = string.Concat(new object[] { obj2, "\"StoreName\":\"", table.Rows[i]["StoreName"], "\"," }); str = string.Concat(new object[] { obj3, "\"UserId\":\"", table.Rows[i]["UserId"], "\"" }) + "},"; } str = str.TrimEnd(new char[] { ',' }); } return(str + "]"); }
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); System.Data.DataTable data = (System.Data.DataTable)VShopHelper.GetDistributors(entity).Data; this.reDistributor.DataSource = data; this.reDistributor.DataBind(); }
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; }
public DataTable GetDistributorsCommission(DistributorsQuery query) { StringBuilder builder = new StringBuilder("1=1"); //if (query.GradeId > 0) //{ // builder.AppendFormat("AND GradeId = {0}", query.GradeId); //} if (query.ReferralUserId2 > 0) { builder.AppendFormat("AND ReferralUserId2 = {0}", query.ReferralUserId2); } else { builder.AppendFormat("AND ReferralUserId = {0}", query.ReferralUserId); } 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,(select UserName from aspnet_Members where userid = aspnet_Distributors.UserId) UserName from aspnet_Distributors WHERE ", builder.ToString(), " order by CreateTime " }); DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str); return(this.database.ExecuteDataSet(sqlStringCommand).Tables[0]); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); DistributorsQuery query = new DistributorsQuery { PageIndex = 1, PageSize = 0x2710 }; DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId()); if (this.Page.Request.QueryString["gradeId"] == "3") { query.ReferralUserId2 = currentDistributors.UserId; } else { query.ReferralUserId = currentDistributors.UserId; } query.UserId = currentDistributors.UserId; this.rpdistributor.DataSource = DistributorsBrower.GetDistributorsCommission(query); this.rpdistributor.DataBind(); }
protected override void AttachChildControls() { this.orderTotalPrice = (Literal)this.FindControl("orderTotalPrice"); //下属订单总额 this.orderTotalCount = (Literal)this.FindControl("orderTotalCount"); //下属订单总数 this.underDistributorsCount = (Literal)this.FindControl("underDistributorsCount"); //下属总数 this.vshoporders = (VshopTemplatedRepeater)this.FindControl("vshoporders"); this.txtTotal = (HtmlInputHidden)this.FindControl("txtTotal"); //当前分销商信息 DistributorsInfo currentDistributor = null; try { currentDistributor = DistributorsBrower.GetUserIdDistributors(MemberProcessor.GetCurrentMember().UserId); } catch //如果当前用户未登录或者是不是分销商引发为空异常,则跳转到个人中心 { this.Page.Response.Redirect("MemberCenter.aspx"); } PageTitle.AddSiteNameTitle("店铺订单"); int result = 0; int.TryParse(HttpContext.Current.Request.QueryString.Get("status"), out result); int num2; int num3; if (!int.TryParse(this.Page.Request.QueryString["page"], out num2)) { num2 = 1; } if (!int.TryParse(this.Page.Request.QueryString["size"], out num3)) { num3 = 5; } OrderQuery query = new OrderQuery { UserId = currentDistributor.UserId, PageIndex = num2, PageSize = num3, SortBy = "OrderDate ", SortOrder = SortAction.Desc, StartDate = DateTime.Now, EndDate = DateTime.Now, Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), result.ToString()), customKeyword = new System.Collections.Generic.List <string> { }, }; if (this.Page.Request.QueryString["status"] != null || this.Page.Request.QueryString["keywords"] != null) { query.StartDate = null; query.EndDate = null; } //获取搜索关键字 if (this.Page.Request.QueryString["keywords"] != null) { string[] keywords = this.Page.Request.QueryString["keywords"].ToString().Split(','); for (int i = 0; i < keywords.Length; i++) { int result1; if (keywords[i].Length == 15 && int.TryParse(keywords[0], out result1))//如果长度是15位并且是数字就是订单 { query.OrderId = keywords[0]; } else { query.customKeyword.Add(keywords[i]);//不然的话加入自定义查找列表内 } } } //获取搜索日期区间 if (this.Page.Request.QueryString["dateStart"] != null) { DateTime dateStart = DateTime.MinValue; DateTime.TryParse(this.Page.Request.QueryString["dateStart"].ToString(), out dateStart); query.StartDate = dateStart; } if (this.Page.Request.QueryString["dateEnd"] != null) { query.EndDate = Convert.ToDateTime(this.Page.Request.QueryString["dateEnd"].ToString()); } DbQueryResult userRedPagerList = DistributorsBrower.GetUnderOrders(query); //循环获取上一级分销商的名字 foreach (DataRow row in ((DataTable)userRedPagerList.Data).Rows) { DistributorsInfo parentDistributor = DistributorsBrower.GetDistributorInfo(int.Parse(row["referralUserId"].ToString()));//上一级分销商信息 if (parentDistributor != null) { row["ParentName"] = parentDistributor.StoreName.ToString(); } else { row["ParentName"] = "暂无上级负责人"; } } //开始绑定 this.vshoporders.DataSource = userRedPagerList.Data; this.txtTotal.SetWhenIsNotNull(userRedPagerList.TotalRecords.ToString()); //订单总数 this.orderTotalCount.Text = userRedPagerList.TotalRecords.ToString(); query.PageIndex = 1; query.PageSize = int.MaxValue; //订单金额总数 DataTable total = (DataTable)DistributorsBrower.GetUnderOrders(query).Data; decimal totalPrice = 0M; for (int i = 0; i < total.Rows.Count; i++) { totalPrice += decimal.Parse(total.Rows[i]["OrderTotal"].ToString()); } this.orderTotalPrice.Text = totalPrice.ToString("0.00"); //下属总数 DistributorsQuery dquery = new DistributorsQuery { PageIndex = 1, PageSize = 0x2710, AgentPath = currentDistributor.UserId.ToString(), GradeId = 3,//所有分销商 }; this.underDistributorsCount.Text = DistributorsBrower.GetDownDistributorsAndAgents(dquery).Rows.Count.ToString(); this.vshoporders.DataBind(); }
private void BindData() { if (!string.IsNullOrEmpty(this.startDate)) { this.calendarStartDate.SelectedDate = Convert.ToDateTime(this.startDate); } if (!string.IsNullOrEmpty(this.endDate)) { this.calendarEndDate.SelectedDate = Convert.ToDateTime(this.endDate); } 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), IsAgent = int.Parse(this.IsAgent), PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortOrder = SortAction.Desc, SortBy = "userid" }; Globals.EntityCoding(entity, true); //DbQueryResult distributors = VShopHelper.GetDistributors(entity); DistributorsInfo topDistributor = DistributorsBrower.GetDistributorInfo(this.distributorId); hidTopUserId.Value = distributorId.ToString(); if (topDistributor != null) { DataTable dt = new DataTable(); /* * if (topDistributor.IsAgent == 1) * { * litShowInfo.Text = "<p style='color:red'>您当前查询的用户【" + topDistributor.StoreName + "】是代理商,以下是所有下属的信息</p>"; * DistributorsQuery dquery = new DistributorsQuery * { * PageIndex = 1, * PageSize = int.MaxValue, * AgentPath = topDistributor.UserId.ToString(), * GradeId = 99,//所有下属分销商和代理商 * }; * dt = DistributorsBrower.GetDownDistributorsAndA(dquery); * } * else * { * litShowInfo.Text = "<p style='color:red'>您当前查询的用户【" + topDistributor.StoreName + "】是分销商,以下是三级分销内的下属信息</p>"; * DistributorsQuery dquery = new DistributorsQuery * { * PageIndex = 1, * PageSize = int.MaxValue, * ReferralPath = topDistributor.UserId.ToString(), * GradeId = 99,//所有三级分销商 * }; * dt = DistributorsBrower.GetThreeDownDistributors(dquery); * } */ //dt.Rows.Add(topDistributor.UserName, topDistributor.UserHead, topDistributor.UserId, topDistributor.IsAgent, topDistributor.StoreName); DataTable dtDownDistributor = DistributorsBrower.GetDownDistributor(this.distributorId, this.startDate, this.endDate); dt = dtDownDistributor.Clone();//拷贝数据集结构 if (!dt.Columns.Contains("HasChild")) { dt.Columns.Add("HasChild", typeof(int)); } /* * if (!dt.Columns.Contains("ParentStoreName")) * { * dt.Columns.Add("ParentStoreName", typeof(string)); * } */ DataRow[] rows = dtDownDistributor.Select(string.Format("ReferralPath='{0}' or ReferralPath like '%|{0}' or userid={0}", this.distributorId), "userid"); foreach (DataRow row in rows) // 将查询的结果添加到dt中; { DataRow dr = dt.Rows.Add(row.ItemArray); dr["HasChild"] = dtDownDistributor.Select(string.Format("ReferralPath='{0}' or ReferralPath like '%|{0}'", dr["userid"]), "userid").Length > 0 ? 1 : 0; //dr["ParentStoreName"] = topDistributor.StoreName; } this.reDistributor.DataSource = dt; this.reDistributor.DataBind(); this.pager.TotalRecords = dt.Rows.Count; } else//如果当前没有传值,则显示所有一级分销商的信息 { DataTable firstDistributors = DistributorsBrower.GetFirstDistributors(this.startDate, this.endDate); DataTable dt = firstDistributors.Clone();//拷贝数据集结构 if (!dt.Columns.Contains("HasChild")) { dt.Columns.Add("HasChild", typeof(int)); } foreach (DataRow row in firstDistributors.Rows) // 将查询的结果添加到dt中; { DataRow dr = dt.Rows.Add(row.ItemArray); dr["HasChild"] = Convert.ToInt32(row["childCount"]) > 0? 1 : 0; } this.reDistributor.DataSource = dt; this.reDistributor.DataBind(); this.pager.TotalRecords = firstDistributors.Rows.Count; litShowInfo.Text = "<p style='color:red'>以下是所有顶级分销或代理商以及其下属信息,共" + firstDistributors.Rows.Count + "条记录</p>"; } }
public static DataTable GetDownDistributors(DistributorsQuery query) { return(new DistributorsDao().GetDownDistributors(query)); }
public static DataTable SelectDistributors(DistributorsQuery query) { return(new DistributorsDao().SelectDistributors(query, null, null)); }
public static DataTable GetDistributorsCommission(DistributorsQuery query) { return(new DistributorsDao().GetDistributorsCommission(query)); }
public static DbQueryResult GetDistributors(DistributorsQuery query) { return(new DistributorsDao().GetDistributors(query, null, null)); }
public static DbQueryResult GetDistributors(DistributorsQuery query, string topUserId = null, string level = null) { return(new DistributorsDao().GetDistributors(query, topUserId, level)); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("下级分销商"); this.litMysubMember = (Literal)this.FindControl("litMysubMember"); this.litMysubFirst = (Literal)this.FindControl("litMysubFirst"); this.litMysubSecond = (Literal)this.FindControl("litMysubSecond"); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); this.litUserId = (Literal)this.FindControl("litUserId"); this.litUserId.Text = userIdDistributors.UserId.ToString(); DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId); if ((distributorsSubStoreNum != null) || (distributorsSubStoreNum.Rows.Count > 0)) { this.litMysubMember.Text = distributorsSubStoreNum.Rows[0]["memberCount"].ToString(); this.litMysubFirst.Text = distributorsSubStoreNum.Rows[0]["firstV"].ToString(); this.litMysubSecond.Text = distributorsSubStoreNum.Rows[0]["secondV"].ToString(); } else { this.litMysubMember.Text = "0"; this.litMysubFirst.Text = "0"; this.litMysubSecond.Text = "0"; } this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor"); this.hiddTotal = (HtmlInputHidden)this.FindControl("hiddTotal"); DistributorsQuery query = new DistributorsQuery { PageIndex = 0, PageSize = 10 }; DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId(false), true); if (currentDistributors.ReferralStatus != 0) { HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { query.GradeId = 2; 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; string str = this.Page.Request.QueryString["sort"]; if (string.IsNullOrWhiteSpace(str)) { str = "CreateTime"; } string str2 = this.Page.Request.QueryString["order"]; if (string.IsNullOrWhiteSpace(str2)) { str2 = "desc"; } int total = 0; DataTable table2 = DistributorsBrower.GetDownDistributors(query, out total, str, str2); this.hiddTotal.Value = total.ToString(); this.rpdistributor.DataSource = table2; this.rpdistributor.DataBind(); } }
public DbQueryResult GetDistributors(DistributorsQuery query) { StringBuilder builder = new StringBuilder(); if (query.GradeId > 0) { if (builder.Length > 0) { builder.Append(" AND "); } builder.AppendFormat("DistributorGradeId = {0}", query.GradeId); } if (query.UserId > 0) { if (builder.Length > 0) { builder.Append(" AND "); } builder.AppendFormat("UserId = {0}", query.UserId); } if (query.UserId > 0) { if (builder.Length > 0) { builder.Append(" AND "); } builder.AppendFormat("UserId = {0}", query.UserId); } if (query.IsAgent > -1) { if (builder.Length > 0) { builder.Append(" AND "); } builder.AppendFormat("IsAgent = {0}", query.IsAgent); } 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, "*")); }