📄 updatemember.aspx.cs
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model.Members;
namespace 金利来分销管理系统.Members
{
public partial class UpdateMember : System.Web.UI.Page
{
BLL.Employee.EmployeeBll employeebllshow;
public UpdateMember()
{
employeebllshow = new BLL.Employee.EmployeeBll();
}
protected void Page_Load(object sender, EventArgs e)
{//接收查询页面gridview里的数据
if (!this.IsPostBack)
{
//用户权限
if (Session["employee_id"] == null)
{
Response.Write("<script>alert('请您登陆系统');location.href='../Enter.aspx'</script>");
}
else
{
if (employeebllshow.UserRole(Session["role_id"].ToString(), "36") == true)
{
string id = Session["Member_ID"].ToString();
txtlblupdate.Text = id;
if (id.Substring(0,2)=="KH")
{
txtnamehou.Text = Session["Member_name"].ToString();
txtupdatemobilehou.Text = Session["HYMember_Mobile"].ToString();
txttext.Text = Session["HYMember_Text"].ToString();
txtlblupdate.Enabled = false;
lblleveld.Visible = false;
txtleveld.Visible = false;
lblleveldhou.Visible = false;
ddlleveldhou.Visible = false;
lblname.Visible = false;
txtupdatename.Visible = false;
revname.Visible = false;
lblupdatesex.Visible = false;
txtupdatesex.Visible = false;
lblupdatesexhou.Visible = false;
ddlupdatesexhou.Visible = false;
lblupdatemobile.Visible = false;
txtupdatemobile.Visible = false;
revDianHua.Visible = false;
lblupdatebirthday.Visible = false;
txtupdatebirthday.Visible = false;
revshengri.Visible = false;
btnupdate.Visible = false;
lblupdatemobil.Visible = false;
lblupdatebirthda.Visible = false;
}
else
{
txtleveld.Text = Session["Member_level_id"].ToString();
txtupdatename.Text = Session["Member_name"].ToString();
txtupdatesex.Text = Session["HYMember_Sex"].ToString();
txtupdatemobile.Text = Session["HYMember_Mobile"].ToString();
txtupdatebirthday.Text = Session["HYMember_Birthday"].ToString();
txttext.Text = Session["HYMember_Text"].ToString();
lblleveld.Visible = true;
txtleveld.Visible = true;
lblleveldhou.Visible = true;
ddlleveldhou.Visible = true;
lblname.Visible = true;
txtupdatename.Visible = true;
revname.Visible = true;
lblupdatesex.Visible = true;
txtupdatesex.Visible = true;
lblupdatesexhou.Visible = true;
ddlupdatesexhou.Visible = true;
lblupdatemobile.Visible = true;
txtupdatemobile.Visible = true;
revDianHua.Visible = true;
lblupdatebirthday.Visible = true;
txtupdatebirthday.Visible = true;
revshengri.Visible = true;
txtleveld.Enabled = false;
txtupdatesex.Enabled = false;
txtlblupdate.Enabled = false;
lblnamehou.Visible = false;
txtnamehou.Visible = false;
revnamehou.Visible = false;
lblupdatemobilehou.Visible = false;
txtupdatemobilehou.Visible = false;
revDianHuahou.Visible = false;
btnupda.Visible = false;
lblupdatemobileho.Visible = false;
}
}
else
{
Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
}
}
}
}
//修改会员信息
protected void btnupdate_Click(object sender, EventArgs e)
{
if (ddlleveldhou.Text == "请选择")
{
Response.Write("<script>alert('会员等级不能为空.请重新选择!')</script>");
}
else if (txtupdatename.Text.Length == 0 )
{
Response.Write("<script>alert('会员姓名不能为空.请重新填写!')</script>");
}
else if ( ddlupdatesexhou.Text == "请选择" )
{
Response.Write("<script>alert('会员性别不能为空.请重新选择!')</script>");
}
else if ( txtupdatemobile.Text.Length == 0 )
{
Response.Write("<script>alert('会员手机号码不能为空.请重新填写!')</script>");
}
else
{
BLL.Members.MemberBll bll = new BLL.Members.MemberBll();
Memberb Menberupdate = new Memberb();
Menberupdate.Member_ID = txtlblupdate.Text;
Menberupdate.Member_level_ID = int.Parse(ddlleveldhou.Text);
Menberupdate.Member_name = txtupdatename.Text;
Menberupdate.Member_Sex = ddlupdatesexhou.Text;
Menberupdate.HYMember_Mobile = txtupdatemobile.Text;
Menberupdate.HYMember_Birthday = txtupdatebirthday.Text;
Menberupdate.HYMember_Text = txttext.Text;
bll.update(Menberupdate);
Response.Write("<script>alert('会员信息修改成功!')</script>");
}
}
//返回查询页面
protected void btnclose_Click(object sender, EventArgs e)
{
Response.Redirect("SelectMembers.aspx");
}
//客户信息修改
protected void btnupda_Click(object sender, EventArgs e)
{
if (txtnamehou.Text.Length == 0)
{
Response.Write("<script>alert('客户姓名不能为空.请重新填写!')</script>");
}
else if (txtupdatemobilehou.Text.Length==0)
{
Response.Write("<script>alert('客户联系电话不能为空.请重新填写!')</script>");
}
else
{
BLL.Members.MemberBll bll = new BLL.Members.MemberBll();
Memberb Menberupdate = new Memberb();
Menberupdate.Member_ID = txtlblupdate.Text;
Menberupdate.Member_name = txtnamehou.Text;
Menberupdate.HYMember_Mobile = txtupdatemobilehou.Text;
Menberupdate.HYMember_Text = txttext.Text;
bll.KHupdate(Menberupdate);
Response.Write("<script>alert('客户信息修改成功!')</script>");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -