protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["GroupId"], out this.currentGroupId)) { base.GotoResourceNotFound(); } else { this.BtnAddMembers.Click += new EventHandler(this.BtnAddMembers_Click); this.lkbDelectCheck.Click += new EventHandler(this.lkbDelectCheck_Click); this.grdMemberList.RowDeleting += new GridViewDeleteEventHandler(this.grdMemberList_RowDeleting); if (!base.IsPostBack) { CustomGroupingInfo groupInfoById = CustomGroupingHelper.GetGroupInfoById(this.currentGroupId); if (groupInfoById != null) { this.GroupName.Text = groupInfoById.GroupName; this.BindData(); } else { base.Response.Redirect("CustomDistributorList.aspx"); } } } }
protected void grdMemberList_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (CustomGroupingHelper.DelGroupUser(this.grdMemberList.DataKeys[e.RowIndex].Value.ToString(), this.currentGroupId)) { this.BindData(); } }
protected void rptList_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem) { int groupId = (int)System.Web.UI.DataBinder.Eval(e.Item.DataItem, "Id"); int num = 0; int num2 = 0; int num3 = 0; System.Data.DataTable customGroupingUser = CustomGroupingHelper.GetCustomGroupingUser(groupId); if (customGroupingUser.Rows.Count > 0) { num = customGroupingUser.Select("LastOrderDate is null").Length; int activeDay = MemberHelper.GetActiveDay(); num2 = customGroupingUser.Select(" PayOrderDate is not null and PayOrderDate >='" + System.DateTime.Now.AddDays((double)(-(double)activeDay)).ToString("yyyy-MM-dd HH:mm:ss") + "'").Length; num3 = customGroupingUser.Select(" PayOrderDate is null or PayOrderDate <'" + System.DateTime.Now.AddDays((double)(-(double)activeDay)).ToString("yyyy-MM-dd HH:mm:ss") + "'").Length; } System.Web.UI.WebControls.Literal literal = e.Item.FindControl("ltMemberNumList") as System.Web.UI.WebControls.Literal; literal.Text = string.Concat(new object[] { "<td>", num, "</td><td>", num2, "</td><td>", num3, "</td>" }); } }
protected void btnaddgroup_Click(object sender, EventArgs e) { string str = Globals.HtmlEncode(this.txtaddgroupname.Text.Trim()); if (string.IsNullOrEmpty(str)) { this.ShowMsg("分组名称不允许为空!", false); } else { CustomGroupingInfo customGroupingInfo = new CustomGroupingInfo { GroupName = str }; string s = CustomGroupingHelper.AddCustomGrouping(customGroupingInfo); if (Globals.ToNum(s) > 0) { this.ShowMsg("添加分组成功!", true); this.BindData(); } else { this.ShowMsg("添加分组失败," + s, false); } } }
protected void btnupdategroup_Click(object sender, EventArgs e) { int s = Globals.ToNum(this.hdgroupId.Value.Trim()); string str = Globals.HtmlEncode(this.txtgroupname.Text.Trim()); if (Globals.ToNum(s) <= 0) { this.ShowMsg("选择的分组有误,请重新选择", false); } else if (string.IsNullOrEmpty(str)) { this.ShowMsg("分组名称不允许为空", false); } else { CustomGroupingInfo customGroupingInfo = new CustomGroupingInfo { GroupName = str, Id = s }; string str2 = CustomGroupingHelper.UpdateCustomGrouping(customGroupingInfo); if (Globals.ToNum(str2) > 0) { this.ShowMsg("修改商品分组成功", true); this.BindData(); } else { this.ShowMsg("修改商品分组失败," + str2, false); } } }
protected void Page_Load(object sender, EventArgs e) { this.localUrl = base.Request.Url.ToString(); if (!int.TryParse(this.Page.Request.QueryString["GroupId"], out this.currentGroupId)) { base.GotoResourceNotFound(); } else { this.btnSelect.Click += new EventHandler(this.btnSelect_Click); this.btnJoin.Click += new EventHandler(this.btnJoin_Click); if (!base.IsPostBack) { CustomGroupingInfo groupInfoById = CustomGroupingHelper.GetGroupInfoById(this.currentGroupId); if (groupInfoById != null) { this.GroupName.Text = groupInfoById.GroupName; this.resultDiv.Visible = false; } else { this.ShowMsgAndReUrl("参数错误!", false, "CustomDistributorList.aspx"); } } } }
protected void lkbDelectCheck_Click(object sender, System.EventArgs e) { string text = ""; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdMemberList.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox.Checked) { text = text + this.grdMemberList.DataKeys[gridViewRow.RowIndex].Value.ToString() + ","; } } text = text.TrimEnd(new char[] { ',' }); if (string.IsNullOrEmpty(text)) { this.ShowMsg("请先选择要移除的会员账号!", false); return; } if (CustomGroupingHelper.DelGroupUser(text, this.currentGroupId)) { this.BindData(); } }
protected void btnupdategroup_Click(object sender, System.EventArgs e) { int num = Globals.ToNum(this.hdgroupId.Value.Trim()); string text = Globals.HtmlEncode(this.txtgroupname.Text.Trim()); if (Globals.ToNum(num) <= 0) { this.ShowMsg("选择的分组有误,请重新选择", false); return; } if (string.IsNullOrEmpty(text)) { this.ShowMsg("分组名称不允许为空", false); return; } string text2 = CustomGroupingHelper.UpdateCustomGrouping(new CustomGroupingInfo { GroupName = text, Id = num }); if (Globals.ToNum(text2) > 0) { this.ShowMsg("修改商品分组成功", true); this.BindData(); return; } this.ShowMsg("修改商品分组失败," + text2, false); }
private void GetUserCustomGroup(HttpContext context) { context.Response.ContentType = "application/json"; try { new StringBuilder(); IList <CustomGroupingInfo> customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); List <CustomGroup> list2 = new List <CustomGroup>(); if (customGroupingList.Count > 0) { foreach (CustomGroupingInfo info in customGroupingList) { CustomGroup item = new CustomGroup { id = info.Id, Name = info.GroupName }; list2.Add(item); } } var type = new { type = "success", data = list2 }; string s = JsonConvert.SerializeObject(type); context.Response.Write(s); } catch (Exception exception) { context.Response.Write("{\"type\":\"error\",data:\"" + exception.Message + "\"}"); } }
protected void grdMemberList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { string userId = this.grdMemberList.DataKeys[e.RowIndex].Value.ToString(); if (CustomGroupingHelper.DelGroupUser(userId, this.currentGroupId)) { this.BindData(); } }
protected void btnSelect_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <int> memberList = CustomGroupingHelper.GetMemberList(this.GetMemberQuery()); if (memberList != null) { this.resultDiv.Visible = true; this.litMembersNum.Text = memberList.Count.ToString(); } }
private void GroupCheck_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>(); foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdMemberList.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox.Checked) { int item = 0; if (int.TryParse(this.grdMemberList.DataKeys[gridViewRow.RowIndex].Value.ToString(), out item)) { list.Add(item); } } } if (list.Count == 0) { this.ShowMsg("请先选择需要设置分组的用户", false); return; } if (!string.IsNullOrEmpty(this.hdCustomGroup.Value)) { System.Collections.Generic.IList <int> list2 = new System.Collections.Generic.List <int>(); if (this.hdCustomGroup.Value.Contains(",")) { string[] array = this.hdCustomGroup.Value.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string s = array[i]; int item2 = 0; if (int.TryParse(s, out item2)) { list2.Add(item2); } } } else if (!this.hdCustomGroup.Value.Equals("-1")) { int item3 = 0; if (int.TryParse(this.hdCustomGroup.Value, out item3)) { list2.Add(item3); } } foreach (int current in list) { CustomGroupingHelper.SetUserCustomGroup(current, list2); } this.ShowMsg("设置成功!", true); this.BindData(); return; } this.ShowMsg("请先选择分组", false); }
private void GroupCheck_Click(object sender, EventArgs e) { IList <int> list = new List <int>(); foreach (GridViewRow row in this.grdMemberList.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if (box.Checked) { int result = 0; if (int.TryParse(this.grdMemberList.DataKeys[row.RowIndex].Value.ToString(), out result)) { list.Add(result); } } } if (list.Count == 0) { this.ShowMsg("请先选择需要设置分组的用户", false); } else if (!string.IsNullOrEmpty(this.hdCustomGroup.Value)) { IList <int> groupIdList = new List <int>(); if (this.hdCustomGroup.Value.Contains(",")) { foreach (string str in this.hdCustomGroup.Value.Split(new char[] { ',' })) { int num2 = 0; if (int.TryParse(str, out num2)) { groupIdList.Add(num2); } } } else if (!this.hdCustomGroup.Value.Equals("-1")) { int num3 = 0; if (int.TryParse(this.hdCustomGroup.Value, out num3)) { groupIdList.Add(num3); } } foreach (int num4 in list) { CustomGroupingHelper.SetUserCustomGroup(num4, groupIdList); } this.ShowMsg("设置成功!", true); this.BindData(); } else { this.ShowMsg("请先选择分组", false); } }
protected void btnJoin_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <int> memberList = CustomGroupingHelper.GetMemberList(this.GetMemberQuery()); if (memberList != null) { CustomGroupingHelper.AddCustomGroupingUser(memberList, this.currentGroupId); this.ShowMsgAndReUrl("添加成功!", true, "/Admin/member/CustomDistributorDetail.aspx?GroupId=" + this.currentGroupId); return; } this.ShowMsg("未找到符合条件的会员,请重新选择条件!", false); }
private void GetUserCustomGroupAndGrade(HttpContext context) { context.Response.ContentType = "application/json"; try { new StringBuilder(); IList <CustomGroupingInfo> customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); List <CustomGroup> list2 = new List <CustomGroup>(); if (customGroupingList.Count > 0) { foreach (CustomGroupingInfo info in customGroupingList) { CustomGroup item = new CustomGroup { id = info.Id, Name = info.GroupName }; list2.Add(item); } } new StringBuilder(); IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades(); List <SimpleGradeClass> list4 = new List <SimpleGradeClass>(); if (memberGrades.Count > 0) { foreach (MemberGradeInfo info2 in memberGrades) { SimpleGradeClass class2 = new SimpleGradeClass { GradeId = info2.GradeId, Name = info2.Name }; list4.Add(class2); } } var type = new { type = "success", data = list2, gradedata = list4 }; string s = JsonConvert.SerializeObject(type); context.Response.Write(s); } catch (Exception exception) { context.Response.Write("{\"type\":\"error\",data:\"" + exception.Message + "\"}"); } }
private void GetMemberGroup(HttpContext context) { context.Response.ContentType = "application/json"; StringBuilder builder = new StringBuilder("{"); int result = 0; if (!int.TryParse(context.Request["userId"], out result)) { builder.Append("\"Status\":\"ok\"}"); } else { builder.Append("\"Status\":\"" + CustomGroupingHelper.GetMemberGroupList(result) + "\"}"); } context.Response.Write(builder); }
protected string GetModelMemberCustomGroup() { StringBuilder builder = new StringBuilder(); IList <CustomGroupingInfo> customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); if ((customGroupingList != null) && (customGroupingList.Count > 0)) { foreach (CustomGroupingInfo info in customGroupingList) { builder.Append(" <label class=\"middle mr20\">"); builder.AppendFormat("<input type=\"checkbox\" class=\"ModelCustomGroup\" value=\"{0}\">{1}", info.Id, info.GroupName); builder.Append(" </label>"); } } return(builder.ToString()); }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { string str; if (((str = e.CommandName) != null) && (str == "delete")) { if (CustomGroupingHelper.DelGroup(Globals.ToNum(e.CommandArgument.ToString()))) { this.ShowMsg("成功删除了指定的分组", true); this.BindData(); } else { this.ShowMsg("删除分组失败", false); } } }
private void GetMemberGroup(System.Web.HttpContext context) { context.Response.ContentType = "application/json"; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("{"); int userId = 0; if (!int.TryParse(context.Request["userId"], out userId)) { stringBuilder.Append("\"Status\":\"ok\"}"); } else { string memberGroupList = CustomGroupingHelper.GetMemberGroupList(userId); stringBuilder.Append("\"Status\":\"" + memberGroupList + "\"}"); } context.Response.Write(stringBuilder); }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["GroupId"], out this.currentGroupId)) { base.GotoResourceNotFound(); return; } this.BtnAddMembers.Click += new System.EventHandler(this.BtnAddMembers_Click); this.lkbDelectCheck.Click += new System.EventHandler(this.lkbDelectCheck_Click); this.grdMemberList.RowDeleting += new System.Web.UI.WebControls.GridViewDeleteEventHandler(this.grdMemberList_RowDeleting); if (!base.IsPostBack) { CustomGroupingInfo groupInfoById = CustomGroupingHelper.GetGroupInfoById(this.currentGroupId); this.GroupName.Text = groupInfoById.GroupName; this.BindData(); } }
protected string GetMemberCustomGroup() { StringBuilder builder = new StringBuilder(); IList <CustomGroupingInfo> customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); if ((customGroupingList != null) && (customGroupingList.Count > 0)) { foreach (CustomGroupingInfo info in customGroupingList) { builder.Append(" <label class=\"middle mr20\">"); builder.AppendFormat("<input type=\"checkbox\" class=\"CustomGroup\" value=\"{0}\">{1}", info.Id, info.GroupName); builder.Append(" </label>"); } } else { builder.Append("暂无分组信息,去<a href='../member/CustomDistributorList.aspx'>创建新分组</a>"); } return(builder.ToString()); }
protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { string commandName; if ((commandName = e.CommandName) != null) { if (!(commandName == "delete")) { return; } int groupid = Globals.ToNum(e.CommandArgument.ToString()); if (CustomGroupingHelper.DelGroup(groupid)) { this.ShowMsg("成功删除了指定的分组", true); this.BindData(); return; } this.ShowMsg("删除分组失败", false); } }
protected void BtnAddMembers_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.txtUserNames.Text.Trim())) { this.ShowMsg("请输入用户名", false); return; } System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>(); string text = this.txtUserNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", ","); string[] array = text.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string username = array[i]; int memberIdByUserNameOrNiChen = MemberHelper.GetMemberIdByUserNameOrNiChen(username, ""); if (memberIdByUserNameOrNiChen > 0) { list.Add(memberIdByUserNameOrNiChen); } } this.txtUserNames.Text = ""; if (list.Count > 0) { string text2 = CustomGroupingHelper.AddCustomGroupingUser(list, this.currentGroupId); if (string.IsNullOrEmpty(text2)) { this.ShowMsg("添加成功!", true); } else { this.ShowMsg(text2, false); } this.BindData(); return; } this.ShowMsg("未找到会员", false); }
private void btnModelGroupCheck_Click(object sender, System.EventArgs e) { int userId = 0; if (int.TryParse(this.hdModelGroupCheckUserId.Value, out userId)) { if (!string.IsNullOrEmpty(this.hdModelCustomGroup.Value)) { System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>(); if (this.hdModelCustomGroup.Value.Contains(",")) { string[] array = this.hdModelCustomGroup.Value.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string s = array[i]; int item = 0; if (int.TryParse(s, out item)) { list.Add(item); } } } else if (!this.hdModelCustomGroup.Value.Equals("-1")) { int item2 = 0; if (int.TryParse(this.hdModelCustomGroup.Value, out item2)) { list.Add(item2); } } CustomGroupingHelper.SetUserCustomGroup(userId, list); this.ShowMsg("设置成功!", true); return; } this.ShowMsg("请先选择分组", false); } }
protected void btnaddgroup_Click(object sender, System.EventArgs e) { string text = Globals.HtmlEncode(this.txtaddgroupname.Text.Trim()); if (string.IsNullOrEmpty(text)) { this.ShowMsg("分组名称不允许为空!", false); return; } string text2 = CustomGroupingHelper.AddCustomGrouping(new CustomGroupingInfo { GroupName = text }); if (Globals.ToNum(text2) > 0) { this.ShowMsg("添加商品分组成功!", true); this.BindData(); return; } this.ShowMsg("添加分组失败," + text2, false); }
protected void lkbDelectCheck_Click(object sender, EventArgs e) { string str = ""; foreach (GridViewRow row in this.grdMemberList.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if (box.Checked) { str = str + this.grdMemberList.DataKeys[row.RowIndex].Value.ToString() + ","; } } str = str.TrimEnd(new char[] { ',' }); if (string.IsNullOrEmpty(str)) { this.ShowMsg("请先选择要移除的会员账号!", false); } else if (CustomGroupingHelper.DelGroupUser(str, this.currentGroupId)) { this.BindData(); } }
private void btnModelGroupCheck_Click(object sender, EventArgs e) { int result = 0; if (int.TryParse(this.hdModelGroupCheckUserId.Value, out result)) { if (!string.IsNullOrEmpty(this.hdModelCustomGroup.Value)) { IList <int> groupIdList = new List <int>(); if (this.hdModelCustomGroup.Value.Contains(",")) { foreach (string str in this.hdModelCustomGroup.Value.Split(new char[] { ',' })) { int num2 = 0; if (int.TryParse(str, out num2)) { groupIdList.Add(num2); } } } else if (!this.hdModelCustomGroup.Value.Equals("-1")) { int num3 = 0; if (int.TryParse(this.hdModelCustomGroup.Value, out num3)) { groupIdList.Add(num3); } } CustomGroupingHelper.SetUserCustomGroup(result, groupIdList); this.ShowMsg("设置成功!", true); } else { this.ShowMsg("请先选择分组", false); } } }
protected void BtnAddMembers_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtUserNames.Text.Trim())) { this.ShowMsg("请输入用户名", false); } else { IList <int> userIdList = new List <int>(); foreach (string str2 in this.txtUserNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", ",").Split(new char[] { ',' })) { int memberIdByUserNameOrNiChen = MemberHelper.GetMemberIdByUserNameOrNiChen(str2, ""); if (memberIdByUserNameOrNiChen > 0) { userIdList.Add(memberIdByUserNameOrNiChen); } } this.txtUserNames.Text = ""; if (userIdList.Count > 0) { string str3 = CustomGroupingHelper.AddCustomGroupingUser(userIdList, this.currentGroupId); if (string.IsNullOrEmpty(str3)) { this.ShowMsg("添加成功!", true); } else { this.ShowMsg(str3, false); } this.BindData(); } else { this.ShowMsg("未找到会员", false); } } }
protected string GetMemberCustomGroup() { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); System.Collections.Generic.IList <CustomGroupingInfo> customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); if (customGroupingList != null && customGroupingList.Count > 0) { foreach (CustomGroupingInfo current in customGroupingList) { if (current.Id != this.currentGroupId) { stringBuilder.Append(" <label class=\"middle mr20\">"); stringBuilder.AppendFormat("<input type=\"checkbox\" class=\"CustomGroup\" value=\"{0}\">{1}", current.Id, current.GroupName); stringBuilder.Append(" </label>"); } } } return(stringBuilder.ToString()); }
public string GetMemberGarde(string applyMembers, string defualtGroup, string customGroup) { StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(applyMembers)) { IList <MemberGradeInfo> memberGrades = null; if (applyMembers == "0") { memberGrades = MemberHelper.GetMemberGrades(); } else { memberGrades = MemberHelper.GetMemberGrades(applyMembers); } if ((memberGrades != null) && (memberGrades.Count > 0)) { foreach (MemberGradeInfo info in memberGrades) { builder.Append(info.Name + ","); } } } if (!string.IsNullOrEmpty(customGroup)) { IList <CustomGroupingInfo> customGroupingList = null; if (customGroup == "0") { customGroupingList = CustomGroupingHelper.GetCustomGroupingList(); } else { customGroupingList = CustomGroupingHelper.GetCustomGroupingList(customGroup); } if ((customGroupingList != null) && (customGroupingList.Count > 0)) { foreach (CustomGroupingInfo info2 in customGroupingList) { builder.Append(info2.GroupName + ","); } } } if (!string.IsNullOrEmpty(defualtGroup)) { if (defualtGroup.IndexOf('1') > -1) { builder.Append("新会员,"); } if (defualtGroup.IndexOf('2') > -1) { builder.Append("活跃会员,"); } if (defualtGroup.IndexOf('3') > -1) { builder.Append("沉睡会员,"); } } if (!string.IsNullOrEmpty(builder.ToString())) { return(builder.ToString().Substring(0, builder.Length - 1)); } return(""); }