protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrMember == null) { RedirectToLogin(); } else { phMsg.Visible = false; PlaceHolder1.Visible = false; if (Request.QueryString["id"] != null) { XModel.XMemberUpgrade muobj = bllXMemberUpgrade.GetOneById(Request.QueryString["id"]); if (muobj != null) { XModel.XMember mobj = bllXMember.GetOneById(muobj.SID); if (mobj != null) { txtSJHM.Text = mobj.Phone; txtWXH.Text = mobj.WXCode; txtWXNC.Text = mobj.NickName; txtGrade1.Text = muobj.Grade1.ToString(); txtGrade2.Text = muobj.Grade2.ToString(); if (muobj.IsReply == 0) { PlaceHolder1.Visible = true; } } } } } } }
protected void repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { //联系对象 Literal litCID = e.Item.FindControl("litCID") as Literal; if (litCID != null) { XModel.XMember mobj = bllXMember.GetOneById(litCID.Text); if (mobj != null) { litCID.Text = mobj.NickName; } } //状态 Label litReply = e.Item.FindControl("litReply") as Label; if (litReply != null) { if (litReply.Text == "0") { litReply.Text = "点这里"; litReply.CssClass = "label red circle"; } else { litReply.Text = "已确认"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrAdmin == null) { RedirectToLogin(); } else { if (Request.QueryString["t"] != null && Request.QueryString["t"] == "edit") { //修改 XModel.XMember nobj = bllXMember.GetOneById(Request.QueryString["id"]); if (nobj != null) { txtNickName.Text = nobj.NickName; txtNickName.Enabled = false; txtWxCode.Text = nobj.WXCode; txtPhone.Text = nobj.Phone; TextBox1.Text = nobj.Answer; DropDownList1.Text = nobj.Question; ViewState["hid"] = nobj.MID; ViewState["backurl"] = Request.UrlReferrer.ToString(); } } else { //新增 ViewState["hid"] = ""; ViewState["backurl"] = Request.UrlReferrer.ToString(); } } } }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "lbtnEdit": #region //编辑 { Response.Redirect(string.Format("./?cmd=admin_member_edit&t=edit&id={0}", e.CommandArgument)); } #endregion break; #region 重置密码 case "lbtnPWD": { XModel.XMember mobj = bllXMember.GetOneById(e.CommandArgument.ToString()); if (mobj != null) { mobj.LoginPWD = "654321"; mobj.ManagePWD = "88888888"; mobj.UpdateTime = DateTime.Now; if (bllXMember.Update(mobj)) { JscriptMsg("账号密码已重置为默认密码", string.Empty); } else { JscriptMsg("账号密码重置操作失败,请重新提交!", string.Empty); } } } #endregion break; case "lbtnDisable": { XModel.XMember mobj = bllXMember.GetOneById(e.CommandArgument.ToString()); if (mobj != null) { mobj.IsDisable = mobj.IsDeleted == 0 ? 1 : 0; mobj.UpdateTime = DateTime.Now; if (bllXMember.Update(mobj)) { JscriptMsg("状态已修改", string.Empty); } else { JscriptMsg("状态修改操作失败,请重新提交!", string.Empty); } } } break; } }
protected void Button1_Click(object sender, EventArgs e) { XModel.XMember mobj = bllXMember.GetOneByNickName(txtNickName.Text); if (mobj != null) { if (mobj.WXCode != txtWxCode.Text) { litMsg.Text = "微信号不匹配!"; } else if (mobj.Phone != txtPhone.Text) { litMsg.Text = "手机号码不匹配!"; } else if (mobj.Question != DropDownList1.SelectedItem.Text || mobj.Answer != TextBox1.Text) { litMsg.Text = "密保问题不匹配!"; } else if (txtPassword.Text.Length < 6 || txtNextPWD.Text.Length < 6) { litMsg.Text = "密码长度不得小于6位"; } else if (txtPassword.Text != txtConfirmPassword.Text) { litMsg.Text = "登陆两次输入不匹配"; } else if (txtNextPWD.Text != txtConfirmNextPWD.Text) { litMsg.Text = "二次密码两次输入不匹配!"; } else { mobj.LoginPWD = XCommon.Uitl.MD5(txtPassword.Text); mobj.ManagePWD = XCommon.Uitl.MD5(txtNextPWD.Text); mobj.UpdateTime = DateTime.Now; if (bllXMember.Update(mobj)) { litMsg.Text = "密码重置成功!"; Response.Redirect("./?cmd=member_login"); } else { phMsg.Visible = true; litMsg.Text = "重置失败,请重新操作"; } } } else { phMsg.Visible = true; litMsg.Text = "不存在该昵称用户"; } }
protected void btn_comfirm_Click(object sender, EventArgs e) { if (checkbox1.Checked) { string msg = ""; string tmpID = ""; if (Request.QueryString["id"] != null) { tmpID = Request.QueryString["id"]; XModel.XMemberUpgrade muobj = bllXMemberUpgrade.GetOneById(tmpID); if (muobj != null) { XModel.XMember mobj = bllXMember.GetOneById(muobj.SID); if (mobj.Grade >= muobj.Grade2) { msg = "当前级别已经达到目标级别,无需确认!"; } else { muobj.IsReply = 1; muobj.UpdateTime = DateTime.Now; if (bllXMemberUpgrade.Update(muobj)) { mobj.Grade = muobj.Grade2; mobj.UpdateTime = DateTime.Now; if (bllXMember.Update(mobj)) { Response.Redirect("./?cmd=member_reply"); } else { msg = "数据操作异常,请重新提交"; } } else { msg = "数据操作异常,请重新提交"; } } } else { Response.Redirect("./?cmd=member_reply"); } } } else { Response.Redirect("./?cmd=member_reply"); } }
private void AddSend() { int count = bllXMemberUpgrade.GetCountBySearch(string.Format(" and IsReply=0 and SID='{0}'", CurrMember.MID)); if (count > 0) { litMsg.Text = "申请已发送,请联系相关人员升级!"; List <XModel.XMember> tmpList = bllXMember.GetListBySearch( string.Format(" and MID in(select CID from XMemberUpgrade IsDeleted=0 and IsReply=0 and SID='{0}')", CurrMember.MID) ); if (tmpList.Count > 0) { XModel.XMember mobj = tmpList[0]; txtSJHM.Text = mobj.Phone; txtWXH.Text = mobj.WXCode; txtWXNC.Text = mobj.NickName; } } else { #region 需要新增记录 string[] _pcodeArr = CurrMember.PCodeStr.Split('|'); string[] pcodeArr = _pcodeArr.Reverse().ToArray(); if (CurrMember.Grade >= pcodeArr.Length - 1) { //层级不够 XModel.XMember pobj = bllXMember.GetOneByInviteCode(pcodeArr[pcodeArr.Length - 1]); if (pobj != null && pobj.Grade > CurrMember.Grade && pobj.IsDisable == 0) { #region 新增申请 XModel.XMemberUpgrade muobj = new XModel.XMemberUpgrade() { MUID = CreateID(), CID = pobj.MID, SID = CurrMember.MID, CreateTime = DateTime.Now, Grade1 = CurrMember.Grade, Grade2 = CurrMember.Grade + 1, IsDeleted = 0, IsReply = 0, SortIndex = 100, UpdateTime = DateTime.Now }; #endregion if (bllXMemberUpgrade.Add(muobj)) { txtSJHM.Text = pobj.Phone; txtWXH.Text = pobj.WXCode; txtWXNC.Text = pobj.NickName; litMsg.Text = "申请已发送,请联系相关人员升级!"; } else { litMsg.Text = "申请发送异常!,请重新申请"; } } else { litMsg.Text = "未匹配到合适人员为您升级,请联系管理员!"; } } else { //层次关系够用 //3.2对应层级级别不够,往上追溯 for (int i = CurrMember.Grade + 1; i < pcodeArr.Length; i++) { XModel.XMember pobj = bllXMember.GetOneByInviteCode(pcodeArr[i]); if (pobj != null && pobj.Grade > CurrMember.Grade && pobj.IsDisable == 0) { #region 新增申请 XModel.XMemberUpgrade muobj = new XModel.XMemberUpgrade() { MUID = CreateID(), CID = pobj.MID, SID = CurrMember.MID, CreateTime = DateTime.Now, Grade1 = CurrMember.Grade, Grade2 = CurrMember.Grade + 1, IsDeleted = 0, IsReply = 0, SortIndex = 100, UpdateTime = DateTime.Now }; #endregion if (bllXMemberUpgrade.Add(muobj)) { txtSJHM.Text = pobj.Phone; txtWXH.Text = pobj.WXCode; txtWXNC.Text = pobj.NickName; litMsg.Text = "申请已发送,请联系相关人员升级!"; } else { litMsg.Text = "申请发送异常!,请重新申请"; } break; } } } #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrMember == null) { RedirectToLogin(); } else { if (Request.QueryString["to"] != null) { //添加 //1.是否满级,最高十级 // 2.判断是否需要新增记录,不允许重复申请,不允许跳级 // 3.如果需要新增,判断层级关系,申请的级别与上级层次有关,联系上一级 // 3.1层级关系层次不够,直接找根节点 // 3.2对应级的级别不够,往上追溯 if (CurrMember.Grade < 10) { AddSend(); } else { litMsg.Text = "你已经是最高级别,无需升级!"; } } else { #region 显示 if (Request.QueryString["id"] != null) { XModel.XMemberUpgrade muobj = bllXMemberUpgrade.GetOneById(Request.QueryString["id"]); if (muobj != null) { XModel.XMember mobj = bllXMember.GetOneById(muobj.CID); if (mobj != null) { txtSJHM.Text = mobj.Phone; txtWXH.Text = mobj.WXCode; txtWXNC.Text = mobj.NickName; if (muobj.IsReply == 0) { litMsg.Text = "申请已发送,请联系对方进行升级操作!"; } else { litMsg.Text = "升级操作完成!"; } } else { litMsg.Text = "参数异常,未获取到数据"; } } else { litMsg.Text = "参数异常,未获取到数据"; } } else { litMsg.Text = "参数异常,未获取到数据"; } #endregion } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string tmpID = ""; string backUrl = ""; if (ViewState["hid"] != null) { tmpID = ViewState["hid"].ToString(); } if (ViewState["backurl"] != null) { backUrl = ViewState["backurl"].ToString(); } if (tmpID.Length > 0) { //修改 XModel.XMember nobj = bllXMember.GetOneById(tmpID); if (nobj != null) { nobj.NickName = txtNickName.Text; nobj.WXCode = txtWxCode.Text; nobj.Phone = txtPhone.Text; nobj.Answer = TextBox1.Text; nobj.Question = DropDownList1.Text; nobj.UpdateTime = DateTime.Now; if (bllXMember.Update(nobj)) { JscriptMsg("已成功提交保存!", backUrl); } else { JscriptMsg("提交保存失败,请重新提交!", ""); } } } else { if (bllXMember.CheckReg(txtNickName.Text, txtWxCode.Text, txtPhone.Text) > 0) { string msg = "微信昵称、微信号、手机号码已注册!"; JscriptMsg(msg, ""); } #region 唯一 邀请码 string tmpIC = ""; int tmpICCount = 0; do { tmpIC = XCommon.CreateRandom.Code(6).ToLower(); //6位小写字母和数字 tmpICCount = bllXMember.GetCountBySearch(string.Format(" and InviteCode='{0}'", tmpIC)); }while (tmpICCount > 0); #endregion //新增 XModel.XMember pobj; if (txtInviteID.Text == "") { pobj = new XModel.XMember() { MID = "origin", CreateTime = DateTime.Now, UpdateTime = DateTime.Now, Answer = "origin", IsDeleted = 0, IsDisable = 0, LoginPWD = "123456", ManagePWD = "888888", CurrentCode = "1", Grade = 1, InviteCode = tmpIC, LoginIP = "", LoginName = txtNickName.Text, LoginSign = "", LoginTime = DateTime.Now, NickName = txtNickName.Text, PCode = "origin", PCodeStr = "origin", Phone = "origin", WXCode = "origin", Question = "origin", Remark = "", SortIndex = 1000 }; } else { pobj = bllXMember.GetOneById(txtInviteID.Text); } XModel.XMember nobj = new XModel.XMember() { MID = CreateID(), CreateTime = DateTime.Now, UpdateTime = DateTime.Now, Answer = TextBox1.Text, IsDeleted = 0, IsDisable = 0, LoginPWD = "123456", ManagePWD = "888888", CurrentCode = pobj.CurrentCode, Grade = 1, InviteCode = tmpIC, LoginIP = "", LoginName = txtNickName.Text, LoginSign = "", LoginTime = DateTime.Now, NickName = txtNickName.Text, PCode = pobj.InviteCode, PCodeStr = pobj.PCodeStr + pobj.InviteCode + "|", Phone = txtPhone.Text, WXCode = txtWxCode.Text, Question = DropDownList1.SelectedItem.Text, Remark = "", SortIndex = 100 }; if (bllXMember.Add(nobj)) { AddMemberInvite(nobj); JscriptMsg("已成功提交保存!", backUrl); } else { JscriptMsg("提交保存失败,请重新提交!", ""); } } }