protected void Suoshushi_Load(object sender, EventArgs e) { if (!IsPostBack) { Suoshushi.Items.Clear(); //所属市清空 Suoshushi.Items.Add(new ListItem("请选择", "")); //所属市添加请选择 Suoshushi.DataTextField = "cname"; //id Suoshushi.DataValueField = "cname"; XmlDataSource xds = new XmlDataSource(); xds.DataFile = Server.MapPath("~/pc.xml"); //同上 xds.XPath = "//province[@name='" + Suoshusheng.SelectedValue + "']/city"; //同上 Suoshushi.DataSource = xds; Suoshushi.DataTextField = "cname"; //同上 Suoshushi.DataValueField = "cname"; Suoshushi.DataBind(); mu = bu.GetModel(Request.QueryString["UserID"]); Suoshushi.Items.FindByValue(mu.UserCity).Selected = true;//同上 } //if (!IsPostBack) //{ // XmlDataSource xds = new XmlDataSource(); // xds.DataFile = Server.MapPath("~/new.xml"); // xds.XPath = "//Province[@name1='" + Suoshusheng.SelectedValue + "']/City"; // Suoshushi.DataSource = xds; // Suoshushi.DataTextField = "name2"; // Suoshushi.DataValueField = "name2"; // Suoshushi.SelectedValue = mu.UserCity; // Suoshushi.DataBind(); //} }
protected void Suoshusheng_Load(object sender, EventArgs e) { if (!IsPostBack) { //Suoshusheng.Items.Clear(); //Suoshushi.Items.Clear(); Suoshusheng.Items.Add(new ListItem("请选择", ""));//添加请选择 Suoshushi.Items.Add(new ListItem("请选择", "")); DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath("~/pc.xml")); //地址pc.xml Suoshusheng.DataTextField = "name"; //id Suoshusheng.DataValueField = "name"; foreach (DataRow dr in ds.Tables[0].Rows) //循环赋值 { Suoshusheng.Items.Add(new ListItem(dr["name"].ToString(), dr["name"].ToString())); } mu = bu.GetModel(Request.QueryString["UserID"]); Suoshusheng.Items.FindByValue(mu.UserProvince).Selected = true; } //if (!IsPostBack) //{ // DataSet ds = new DataSet(); // ds.ReadXml(Server.MapPath("~/new.xml")); // Suoshusheng.DataTextField = "name1"; // Suoshusheng.DataValueField = "name1"; // foreach (DataRow dr in ds.Tables[0].Rows) // { // Suoshusheng.Items.Add(new ListItem(dr["name1"].ToString(), dr["name1"].ToString())); // } //} //Suoshusheng.SelectedValue = mu.UserProvince; //Suoshusheng.DataBind(); }
protected void Suoshusheng_Load(object sender, EventArgs e) { if (!IsPostBack) { //Suoshusheng.Items.Clear(); //Suoshushi.Items.Clear(); Suoshusheng.Items.Add(new ListItem("请选择", "")); //添加请选择 Suoshushi.Items.Add(new ListItem("请选择", "")); //string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456";//同上 //string sql = "select username from UsersInfo where userid = " + Request.QueryString["UserID"];//同上 //SqlConnection conn = new SqlConnection(constr); //conn.Open();//同上 //SqlCommand cmd = new SqlCommand(sql, conn);//同上 //sql = "select UserProvince from UsersInfo where userid = " + Request.QueryString["UserID"];//同上 //cmd = new SqlCommand(sql, conn); DataSet ds = new DataSet(); //同上 ds.ReadXml(Server.MapPath("~/pc.xml")); //地址pc.xml Suoshusheng.DataTextField = "name"; //id Suoshusheng.DataValueField = "name"; foreach (DataRow dr in ds.Tables[0].Rows) //循环赋值 { Suoshusheng.Items.Add(new ListItem(dr["name"].ToString(), dr["name"].ToString())); } mu = bu.GetModel(Request.QueryString["UserID"]); Suoshusheng.Items.FindByValue(mu.UserProvince).Selected = true; } }
protected void Page_Load(object sender, EventArgs e) { mu = bu.GetModel(Request.QueryString["UserID"]); yonghuming.Text = mu.UserName; zhenshixingming.Text = mu.UserRealName; danwei.Text = bu.danweimingcheng(Request.QueryString["UserID"]).ToString(); xingbie.Text = mu.UserSex; youxiang.Text = mu.UserEmail; shengri.Text = Convert.ToDateTime(mu.UserBirthday).ToShortDateString(); lianxifangshi.Text = mu.UserPhone; xiangxidizhi.Text = mu.UserProvince + " " + mu.UserCity + " " + mu.UserAddress; zhanghaozhuangtai.Text = mu.Enabled; tianjiashijian.Text = Convert.ToDateTime(mu.UserAddTime).ToShortDateString(); //string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456";//数据库连接语句 //SqlConnection conn = new SqlConnection(constr);//执行数据库连接语句 //conn.Open();//打开数据库连接 //string sql = "select username from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'";//sql语句 //SqlCommand cmd = new SqlCommand(sql, conn);//执行sql语句 //yonghuming.Text = cmd.ExecuteScalar().ToString();//用户名赋值 以下重复不做注释 //sql = "select userrealname from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql,conn); //zhenshixingming.Text = cmd.ExecuteScalar().ToString(); //sql = "select unitname from UsersInfo,unitsinfo where UserID = '" + Request.QueryString["UserID"] + "' and usersinfo.unitid=unitsinfo.unitid"; //cmd = new SqlCommand(sql, conn); //danwei.Text = cmd.ExecuteScalar().ToString(); //sql = "select usersex from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //xingbie.Text = cmd.ExecuteScalar().ToString(); //sql = "select useremail from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //youxiang.Text = cmd.ExecuteScalar().ToString(); //sql = "select LEFT(userbirthday,CHARINDEX(' ',userbirthday)-1) as userbirthday from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //shengri.Text = cmd.ExecuteScalar().ToString(); //sql = "select userphone from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //lianxifangshi.Text = cmd.ExecuteScalar().ToString(); //sql = "select useraddress from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //string a = cmd.ExecuteScalar().ToString(); //sql = "select userprovince from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //string b = cmd.ExecuteScalar().ToString(); //sql = "select usercity from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql,conn); //string c = cmd.ExecuteScalar().ToString(); //xiangxidizhi.Text = b + " " + c + " " + a; //sql = "select enabled from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //zhanghaozhuangtai.Text = cmd.ExecuteScalar().ToString(); //sql = "select LEFT(useraddtime,CHARINDEX(' ',useraddtime)-1) as useraddtime from UsersInfo where UserID = '" + Request.QueryString["UserID"] + "'"; //cmd = new SqlCommand(sql, conn); //tianjiashijian.Text = cmd.ExecuteScalar().ToString(); }
protected void Unnamed1_Click(object sender, EventArgs e) { if (signinemail.Value == "")//判断用户名是为空 { FT.Text = "用户名为空"; return; } if (signinpassword.Value == "")//判断密码是否为空 { FT.Text = "密码为空"; return; } if (Password1.Value == "")//判断验证码是否为空 { FT.Text = "验证码为空"; return; } if (BllUsers.GetRecordCount(" UserName='******' ") == 0)//判断用户名是否存在 { FT.Text = "用户名不存在或错误"; return; } if (BllUsers.GetRecordCount(" UserName='******' and UserPassword='******' ") == 0)//判断密码是否正确 { FT.Text = "密码错误"; return; } if (Session["CheckCode"].ToString().ToLower() != Password1.Value.ToLower())//判断验证码是否正确 { FT.Text = "验证码错误"; return; } DataSet ds = BllUsers.GetList(" UserName='******' and UserPassword = '******' "); Maticsoft.Model.UsersInfo molr = BllUsers.GetModel(ds.Tables[0].Rows[0]["UserID"].ToString()); if (molr.Enabled == "未启用") { FT.Text = "账号未启用"; return; } UsersInfo.UserRole = molr.UserIdentity; UsersInfo.UserName = molr.UserName; UsersInfo.UserID = molr.UserID; if (UsersInfo.UserRole == "学生") { FT.Text = "学生无法进入该平台"; return; } Session["yonghuming"] = signinemail.Value; Response.Redirect("~/BackManagement/PersonalIinformation.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (UsersInfo.UserID == "") //判断是否登录 { Response.Write("<script> alert('请先登录'); window.location.href='/BackLogin.aspx' </script>"); //提示并跳转 } else { string id = NavigationPlatformWeb.util.UsersInfo.UserID; if (!IsPostBack) { Maticsoft.Model.UsersInfo UsersInfo_Model = UsersInfo_Bll.GetModel(id);//引用id所在行的数据 } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!String.IsNullOrEmpty(UsersInfo.UserID)) { RadButton2.Attributes["onclick"] = "OpenAddPro();return false;"; //弹窗 Maticsoft.Model.UsersInfo UsersInfo_Model = UsersInfo_Bll.GetModel(UsersInfo.UserID); //引用id所在行的数据 imgPic.ImageUrl = UsersInfo_Model.HeadPortrait; //添加数据 Label9.Text = UsersInfo_Model.UserName; //添加数据 Label10.Text = UsersInfo_Model.UserRealName; //添加数据 Label11.Text = UsersInfo_Model.UserSex; //添加数据 Label12.Text = UsersInfo_Model.UserPhone; //添加数据 Label13.Text = Convert.ToDateTime(UsersInfo_Model.UserBirthday).ToString("yyyy-MM-dd");; //添加数据 Label16.Text = UsersInfo_Model.UserEmail; //添加数据 Label15.Text = UsersInfo_Model.UserProvince + UsersInfo_Model.UserCity + UsersInfo_Model.UserAddress; //添加数据 if (UsersInfo.UserRole == "报修单位用户") { UnitsInfo_Model = UnitsInfo_Bll.GetModel(UsersInfo_Model.UnitID); Label7.Text = UnitsInfo_Model.UnitName; XB.Visible = false; DH.Visible = false; CSRQ.Visible = false; JTZZ.Visible = false; YX.Visible = false; } if (UsersInfo.UserRole == "指导老师") { DW.Visible = false; } if (UsersInfo.UserRole == "系统管理员") { DW.Visible = false; } if (UsersInfo.UserRole == "装备中心管理员") { DW.Visible = false; } if (UsersInfo.UserRole == "维修中心管理员") { DW.Visible = false; } } } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.UsersInfo GetModel(string UserID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 "); strSql.Append(" UserID,UnitID,UserName,UserPassword,UserRealName,UserSex,UserEmail,UserProvince,UserCity,UserBirthday,UserPhone,UserAddress,UserIdentity,UserAddTime,HeadPortrait,Enabled,AAA4,AAA5 "); strSql.Append(" from UsersInfo "); strSql.Append(" where UserID='" + UserID + "' "); Maticsoft.Model.UsersInfo model = new Maticsoft.Model.UsersInfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)//判断是否第一次执行 { mu = bu.GetModel(Request.QueryString["UserID"]); Yonghuming.Text = mu.UserName;//赋值 Zhenshixingming.Text = mu.UserRealName; //if (mu.UserSex == "男")//同上 //{ // xingbienan.Checked = true; //} //if (mu.UserSex == "女")//同上 //{ // xingbienv.Checked = true;//同上 //} //Youxiang.Text = mu.UserEmail; //Lianxidianhua.Text = mu.UserPhone; //Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday);//同上 //Xiangxidizhi.Text = mu.UserAddress; tianjiashijian.Text = Convert.ToDateTime(mu.UserAddTime).ToShortDateString(); //同上 if (mu.Enabled == "启用") //同上 { qiyong.Checked = true; weiqiyong.Checked = false; } else { qiyong.Checked = false; weiqiyong.Checked = true; } if (mu.UserSex == "男") { xingbienan.Checked = true; } else { xingbienv.Checked = true; } Youxiang.Text = mu.UserEmail; Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday); Lianxidianhua.Text = mu.UserPhone; Xiangxidizhi.Text = mu.UserAddress; //if (!IsPostBack) //{ // string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456"; // string sql = "select username from UsersInfo where userid = " + Request.QueryString["UserID"]; // SqlConnection conn = new SqlConnection(constr); // conn.Open(); // SqlCommand cmd = new SqlCommand(sql, conn); // Yonghuming.Text = cmd.ExecuteScalar().ToString(); // sql = "select UserRealName from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Zhenshixingming.Text = cmd.ExecuteScalar().ToString(); // sql = "select UserPassword from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Mima.Attributes.Add("Value", cmd.ExecuteScalar().ToString()); // sql = "select UserIdentity from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // sql = "select UnitID from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // if (cmd.ExecuteScalar().ToString() == "镇江第一中学") // { // Danwei.SelectedIndex = 0; // } // else if (cmd.ExecuteScalar().ToString() == "镇江第二中学") // { // Danwei.SelectedIndex = 1; // } // else if (cmd.ExecuteScalar().ToString() == "镇江第三中学") // { // Danwei.SelectedIndex = 2; // } // else // { // Danwei.SelectedIndex = 3; // } // sql = "select UserSex from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // if (cmd.ExecuteScalar().ToString() == "男") // { // Xingbie.SelectedIndex = 0; // } // else // { // Xingbie.SelectedIndex = 1; // } // sql = "select UserEmail from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Youxiang.Text = cmd.ExecuteScalar().ToString(); // sql = "select UserSex from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Lianxidianhua.Text = cmd.ExecuteScalar().ToString(); // sql = "select UserBirthday from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Chushengriqi.SelectedDate = Convert.ToDateTime(cmd.ExecuteScalar()); // sql = "select UserProvince from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // if (cmd.ExecuteScalar().ToString() == "江苏省") // { // Suoshusheng.SelectedIndex = 0; // } // else // { // Suoshusheng.SelectedIndex = 1; // } // sql = "select UserCity from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // if (cmd.ExecuteScalar().ToString() == "镇江市") // { // Suoshushi.SelectedIndex = 0; // } // else if (cmd.ExecuteScalar().ToString() == "南京市") // { // Suoshushi.SelectedIndex = 1; // } // else if (cmd.ExecuteScalar().ToString() == "常州市") // { // Suoshushi.SelectedIndex = 2; // } // else if (cmd.ExecuteScalar().ToString() == "福州市") // { // Suoshushi.SelectedIndex = 0; // } // else if (cmd.ExecuteScalar().ToString() == "厦门市") // { // Suoshushi.SelectedIndex = 1; // } // else // { // Suoshushi.SelectedIndex = 2; // } // sql = "select UserAddress from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // Xiangxidizhi.Text = cmd.ExecuteScalar().ToString(); // sql = "select UserAddTime from UsersInfo where userid = " + Request.QueryString["UserID"]; // cmd = new SqlCommand(sql, conn); // tianjiashijian.Text = cmd.ExecuteScalar().ToString(); // conn.Close(); //} } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (UsersInfo.UserID == "") { Response.Write("<script>window.location.href='../BackLogin.aspx'</script>"); return; } string url = Request.PhysicalPath; string fileName = Path.GetFileNameWithoutExtension(url); switch (UsersInfo.UserRole) { case "系统管理员": if (!sysPower.Contains(fileName)) { Response.Write("<script>window.location.href='PersonalIinformation.aspx'</script>"); } break; case "报修单位用户": if (!bxdwyh.Contains(fileName)) { Response.Write("<script>window.location.href='PersonalIinformation.aspx'</script>"); } break; case "装备中心管理员": if (!zbzxgly.Contains(fileName)) { Response.Write("<script>window.location.href='PersonalIinformation.aspx'</script>"); } break; case "维修中心管理员": if (!wxzxglr.Contains(fileName)) { Response.Write("<script>window.location.href='PersonalIinformation.aspx'</script>"); } break; case "指导老师": if (!zdls.Contains(fileName)) { Response.Write("<script>window.location.href='PersonalIinformation.aspx'</script>"); } break; } Maticsoft.Model.UsersInfo molui = bllui.GetModel(UsersInfo.UserID);//引用id所在行的数据 lbUserName.Text = UsersInfo.UserName; if (UsersInfo.UserRole == "系统管理员") { PersonalIinformation.Visible = true; //个人中心 Company.Visible = true; //报修单位管理 EquipmentType.Visible = true; //设备类别管理 UserDetailed.Visible = true; //单位用户管理 if (fileName == "PersonalIinformation") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "InformationEdit") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "Company" || fileName == "CompanyEdit" || fileName == "CompanyAdd" || fileName == "CompanyDetailed") { Company1.Attributes["class"] = "active"; } if (fileName == "EquipmentType") { EquipmentType1.Attributes["class"] = "active"; } if (fileName == "UserDetailed" || fileName == "UserEdit" || fileName == "UserAdd" || fileName == "UnitUser") { UserDetailed1.Attributes["class"] = "active"; } } if (UsersInfo.UserRole == "报修单位用户") { PersonalIinformation.Visible = true; //个人中心 RepairBX.Visible = true; //我的报修 if (fileName == "PersonalIinformation") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "InformationEdit") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "RepairBX") { RepairBX1.Attributes["class"] = "active"; } if (fileName == "RepairAdd") { RepairBX1.Attributes["class"] = "active"; } if (fileName == "RepairEdit") { RepairBX1.Attributes["class"] = "active"; } if (fileName == "RepairContent") { RepairBX1.Attributes["class"] = "active"; } } if (UsersInfo.UserRole == "装备中心管理员") { PersonalIinformation.Visible = true; //个人中心 SubstituteMachine.Visible = true; //代用机管理 RepairManagementZB.Visible = true; //维修管理-装备 if (fileName == "PersonalIinformation") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "InformationEdit") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "SubstituteMachine") { SubstituteMachine1.Attributes["class"] = "active"; } if (fileName == "RepairManagementZB") { RepairManagementZB1.Attributes["class"] = "active"; } if (fileName == "SubstituteMachineAdd") { SubstituteMachine1.Attributes["class"] = "active"; } if (fileName == "SubstituteMachineEdit") { SubstituteMachine1.Attributes["class"] = "active"; } if (fileName == "SubstitutionDetails") { SubstituteMachine1.Attributes["class"] = "active"; } if (fileName == "SubstitutionHistory") { SubstituteMachine1.Attributes["class"] = "active"; } } if (UsersInfo.UserRole == "维修中心管理员") { PersonalIinformation.Visible = true; //个人中心- TeacherInformation.Visible = true; //用户管理-维修- Parts.Visible = true; //配件管理- WarehousingDetails.Visible = true; //配件入库管理- RepairManagementWX.Visible = true; //维修管理-维修- if (fileName == "PersonalIinformation") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "InformationEdit") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "TeacherInformation") { TeacherInformation1.Attributes["class"] = "active"; } if (fileName == "TeacherAdd") { TeacherInformation1.Attributes["class"] = "active"; } if (fileName == "TeacherEdit") { TeacherInformation1.Attributes["class"] = "active"; } if (fileName == "TeacherContent") { TeacherInformation1.Attributes["class"] = "active"; } if (fileName == "Parts") { Parts1.Attributes["class"] = "active"; } if (fileName == "PartsHistory") { Parts1.Attributes["class"] = "active"; } if (fileName == "PartsType") { Parts1.Attributes["class"] = "active"; } if (fileName == "PartsWarehousing") { WarehousingDetails1.Attributes["class"] = "active"; } if (fileName == "WarehousingDetails") { WarehousingDetails1.Attributes["class"] = "active"; } if (fileName == "RepairManagementWX") { RepairManagementWX1.Attributes["class"] = "active"; } if (fileName == "RepairDetailedWX") { RepairManagementWX1.Attributes["class"] = "active"; } if (fileName == "MaintenanceListWX") { RepairManagementWX1.Attributes["class"] = "active"; } if (fileName == "MaintenanceListWX") { RepairManagementWX1.Attributes["class"] = "active"; } if (fileName == "RepairManagementWX") { RepairManagementWX1.Attributes["class"] = "active"; } } if (UsersInfo.UserRole == "指导老师") { PersonalIinformation.Visible = true; //个人中心 RepairListLS.Visible = true; //维修管理-老师 StudentInformation.Visible = true; //用户管理-老师 if (fileName == "PersonalIinformation") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "InformationEdit") { PersonalIinformation1.Attributes["class"] = "active"; } if (fileName == "RepairListLS") { RepairListLS1.Attributes["class"] = "active"; } if (fileName == "MaintenanceListLS") { RepairListLS1.Attributes["class"] = "active"; } if (fileName == "RepairDetailedLS") { RepairListLS1.Attributes["class"] = "active"; } if (fileName == "StudentInformation") { StudentInformation1.Attributes["class"] = "active"; } if (fileName == "StudentAdd") { StudentInformation1.Attributes["class"] = "active"; } if (fileName == "StudentDetailed") { StudentInformation1.Attributes["class"] = "active"; } if (fileName == "StudentEdit") { StudentInformation1.Attributes["class"] = "active"; } } tx.Src = molui.HeadPortrait; } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.UsersInfo model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.UserID != null) { strSql1.Append("UserID,"); strSql2.Append("'" + model.UserID + "',"); } if (model.UnitID != null) { strSql1.Append("UnitID,"); strSql2.Append("'" + model.UnitID + "',"); } if (model.UserName != null) { strSql1.Append("UserName,"); strSql2.Append("'" + model.UserName + "',"); } if (model.UserPassword != null) { strSql1.Append("UserPassword,"); strSql2.Append("'" + model.UserPassword + "',"); } if (model.UserRealName != null) { strSql1.Append("UserRealName,"); strSql2.Append("'" + model.UserRealName + "',"); } if (model.UserSex != null) { strSql1.Append("UserSex,"); strSql2.Append("'" + model.UserSex + "',"); } if (model.UserEmail != null) { strSql1.Append("UserEmail,"); strSql2.Append("'" + model.UserEmail + "',"); } if (model.UserProvince != null) { strSql1.Append("UserProvince,"); strSql2.Append("'" + model.UserProvince + "',"); } if (model.UserCity != null) { strSql1.Append("UserCity,"); strSql2.Append("'" + model.UserCity + "',"); } if (model.UserBirthday != null) { strSql1.Append("UserBirthday,"); strSql2.Append("'" + model.UserBirthday + "',"); } if (model.UserPhone != null) { strSql1.Append("UserPhone,"); strSql2.Append("'" + model.UserPhone + "',"); } if (model.UserAddress != null) { strSql1.Append("UserAddress,"); strSql2.Append("'" + model.UserAddress + "',"); } if (model.UserIdentity != null) { strSql1.Append("UserIdentity,"); strSql2.Append("'" + model.UserIdentity + "',"); } if (model.UserAddTime != null) { strSql1.Append("UserAddTime,"); strSql2.Append("'" + model.UserAddTime + "',"); } if (model.HeadPortrait != null) { strSql1.Append("HeadPortrait,"); strSql2.Append("'" + model.HeadPortrait + "',"); } if (model.Enabled != null) { strSql1.Append("Enabled,"); strSql2.Append("'" + model.Enabled + "',"); } if (model.AAA4 != null) { strSql1.Append("AAA4,"); strSql2.Append("'" + model.AAA4 + "',"); } if (model.AAA5 != null) { strSql1.Append("AAA5,"); strSql2.Append("'" + model.AAA5 + "',"); } strSql.Append("insert into UsersInfo("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.UsersInfo DataRowToModel(DataRow row) { Maticsoft.Model.UsersInfo model = new Maticsoft.Model.UsersInfo(); if (row != null) { if (row["UserID"] != null) { model.UserID = row["UserID"].ToString(); } if (row["UnitID"] != null) { model.UnitID = row["UnitID"].ToString(); } if (row["UserName"] != null) { model.UserName = row["UserName"].ToString(); } if (row["UserPassword"] != null) { model.UserPassword = row["UserPassword"].ToString(); } if (row["UserRealName"] != null) { model.UserRealName = row["UserRealName"].ToString(); } if (row["UserSex"] != null) { model.UserSex = row["UserSex"].ToString(); } if (row["UserEmail"] != null) { model.UserEmail = row["UserEmail"].ToString(); } if (row["UserProvince"] != null) { model.UserProvince = row["UserProvince"].ToString(); } if (row["UserCity"] != null) { model.UserCity = row["UserCity"].ToString(); } if (row["UserBirthday"] != null) { model.UserBirthday = row["UserBirthday"].ToString(); } if (row["UserPhone"] != null) { model.UserPhone = row["UserPhone"].ToString(); } if (row["UserAddress"] != null) { model.UserAddress = row["UserAddress"].ToString(); } if (row["UserIdentity"] != null) { model.UserIdentity = row["UserIdentity"].ToString(); } if (row["UserAddTime"] != null) { model.UserAddTime = row["UserAddTime"].ToString(); } if (row["HeadPortrait"] != null) { model.HeadPortrait = row["HeadPortrait"].ToString(); } if (row["Enabled"] != null) { model.Enabled = row["Enabled"].ToString(); } if (row["AAA4"] != null) { model.AAA4 = row["AAA4"].ToString(); } if (row["AAA5"] != null) { model.AAA5 = row["AAA5"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.UsersInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update UsersInfo set "); if (model.UnitID != null) { strSql.Append("UnitID='" + model.UnitID + "',"); } else { strSql.Append("UnitID= null ,"); } if (model.UserName != null) { strSql.Append("UserName='******',"); } else { strSql.Append("UserName= null ,"); } if (model.UserPassword != null) { strSql.Append("UserPassword='******',"); } else { strSql.Append("UserPassword= null ,"); } if (model.UserRealName != null) { strSql.Append("UserRealName='" + model.UserRealName + "',"); } else { strSql.Append("UserRealName= null ,"); } if (model.UserSex != null) { strSql.Append("UserSex='" + model.UserSex + "',"); } else { strSql.Append("UserSex= null ,"); } if (model.UserEmail != null) { strSql.Append("UserEmail='" + model.UserEmail + "',"); } else { strSql.Append("UserEmail= null ,"); } if (model.UserProvince != null) { strSql.Append("UserProvince='" + model.UserProvince + "',"); } else { strSql.Append("UserProvince= null ,"); } if (model.UserCity != null) { strSql.Append("UserCity='" + model.UserCity + "',"); } else { strSql.Append("UserCity= null ,"); } if (model.UserBirthday != null) { strSql.Append("UserBirthday='" + model.UserBirthday + "',"); } else { strSql.Append("UserBirthday= null ,"); } if (model.UserPhone != null) { strSql.Append("UserPhone='" + model.UserPhone + "',"); } else { strSql.Append("UserPhone= null ,"); } if (model.UserAddress != null) { strSql.Append("UserAddress='" + model.UserAddress + "',"); } else { strSql.Append("UserAddress= null ,"); } if (model.UserIdentity != null) { strSql.Append("UserIdentity='" + model.UserIdentity + "',"); } else { strSql.Append("UserIdentity= null ,"); } if (model.UserAddTime != null) { strSql.Append("UserAddTime='" + model.UserAddTime + "',"); } else { strSql.Append("UserAddTime= null ,"); } if (model.HeadPortrait != null) { strSql.Append("HeadPortrait='" + model.HeadPortrait + "',"); } else { strSql.Append("HeadPortrait= null ,"); } if (model.Enabled != null) { strSql.Append("Enabled='" + model.Enabled + "',"); } else { strSql.Append("Enabled= null ,"); } if (model.AAA4 != null) { strSql.Append("AAA4='" + model.AAA4 + "',"); } else { strSql.Append("AAA4= null ,"); } if (model.AAA5 != null) { strSql.Append("AAA5='" + model.AAA5 + "',"); } else { strSql.Append("AAA5= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where UserID='" + model.UserID + "' "); int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
protected void xiugai_Click(object sender, EventArgs e) { mu = bu.GetModel(Request.QueryString["UserID"]); mu.UserID = Request.QueryString["UserID"]; if (Yonghuming.Text == "") //判断同户名是否为空 { Response.Write("<script>alert('请输入用户名');</script>"); //提示语句 } else { if (Regex.IsMatch(Yonghuming.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) //判断是否有特殊字符 { if (Zhenshixingming.Text == "") //同上 { Response.Write("<script>alert('请输入真实姓名');</script>"); //同上 } else { if (Regex.IsMatch(Zhenshixingming.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) //同上 { mu.UserRealName = Zhenshixingming.Text; //同上 if (xs.Checked) { mu.UserIdentity = "学生"; mu.AAA4 = bu.suoshulaoshixingming(suoshulaoshi.SelectedValue); if (qiyong.Checked) { //同上 mu.Enabled = "启用"; //同上 } if (weiqiyong.Checked) //同上 { mu.Enabled = "未启用"; //同上 } bu.Update(mu); //添加 Response.Write("<script>alert('修改成功');window.location.href='UserDetailed.aspx';</script>"); //同上 } else { if (bxdwyh.Checked) { mu.UserIdentity = "报修单位用户"; } else if (zbzxgly.Checked) { mu.UserIdentity = "装备中心管理员"; } else if (wxzxgly.Checked) { mu.UserIdentity = "维修中心管理员"; //同上 } else if (zdls.Checked) { mu.UserIdentity = "指导老师"; } else { mu.UserIdentity = "学生"; } if (zdls.Checked) { } else { mu.UnitID = bu.danweiid(Danwei.SelectedValue); //同上 } if (bxdwyh.Checked) { if (qiyong.Checked) { //同上 mu.Enabled = "启用"; //同上 } if (weiqiyong.Checked) //同上 { mu.Enabled = "未启用"; //同上 } bu.Update(mu); //添加 Response.Write("<script>alert('修改成功');window.location.href='UserDetailed.aspx';</script>"); //同上 } else { if (xingbienan.Checked) //判断性别男是否选择 { mu.UserSex = "男"; //同上 } if (xingbienv.Checked) //判断性别女是否选择 { mu.UserSex = "女"; //同上 } if (Youxiang.Text == "") //同上 { Response.Write("<script>alert('请输入邮箱');</script>"); //同上 } else { if (Regex.IsMatch(Youxiang.Text, @"^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$")) //同上 { mu.UserEmail = Youxiang.Text; //同上 if (Lianxidianhua.Text == "") //同上 { Response.Write("<script>alert('请输入联系电话');</script>"); //同上 } else { if (Regex.IsMatch(Lianxidianhua.Text, @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$")) //同上 { mu.UserPhone = Lianxidianhua.Text; //同上 if (Chushengriqi.DbSelectedDate == null) //同上 { Response.Write("<script>alert('请选择出生日期');</script>"); //同上 } else { if (Chushengriqi.SelectedDate < DateTime.Now) //判断是否小于当前日期 { mu.UserBirthday = Chushengriqi.SelectedDate.ToString(); //同上 if (Suoshusheng.SelectedValue == "") //同上 { Response.Write("<script>alert('请选择所属省');</script>"); //同上 } else { mu.UserProvince = Suoshusheng.SelectedValue; //同上 if (Suoshushi.SelectedValue == "") { Response.Write("<script>alert('请选择所属市');</script>"); //同上 } else { mu.UserCity = Suoshushi.SelectedValue; //同上 if (Xiangxidizhi.Text == "") //同上 { Response.Write("<script>alert('请输入详细地址');</script>"); //同上 } else { if (Regex.IsMatch(Xiangxidizhi.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) //同上 { mu.UserAddress = Xiangxidizhi.Text; //同上 if (qiyong.Checked) { //同上 mu.Enabled = "启用"; //同上 } if (weiqiyong.Checked) //同上 { mu.Enabled = "未启用"; //同上 } bu.Update(mu); //添加 Response.Write("<script>alert('修改成功');window.location.href='UserDetailed.aspx';</script>"); //同上 } else { Response.Write("<script>alert('请输入正确的详细地址');</script>"); //同上 } } } } } else { Response.Write("<script>alert('请输入正确的出生日期');</script>"); //同上 } } } else { Response.Write("<script>alert('请输入正确的联系电话');</script>"); //同上 } } } else { Response.Write("<script>alert('请输入正确的邮箱格式');</script>"); //同上 } } } } } else { Response.Write("<script>alert('请输入正确的真实姓名');</script>"); //同上 } } } else { Response.Write("<script>alert('请输入正确的用户名');</script>");//同上 } } ////string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456";//同上 ////string sql = "select Max(Convert(int,userid+1)) from usersinfo";//同上 ////SqlConnection conn = new SqlConnection(constr); ////conn.Open(); ////SqlCommand cmd = new SqlCommand(sql, conn);//同上 //mu = bu.GetModel(Request.QueryString["UserID"]);//同上 //mu.UserID = Request.QueryString["UserID"];//同上 ////sql = "select username from UsersInfo where username = '******'";//同上 ////cmd = new SqlCommand(sql, conn); ////SqlDataReader sr = cmd.ExecuteReader();//同上 ////if (Yonghuming.Text == "") ////{ //// Response.Write("<script>alert('用户名不能为空');</script>"); ////} ////else ////{ //// if (Regex.IsMatch(Yonghuming.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) //// { //// if (sr.Read()) //// { //// conn.Close(); //// string sql1 = "select username from UsersInfo where userid = " + Request.QueryString["UserID"]; //// SqlConnection conn1 = new SqlConnection(constr); //// conn.Open(); //// SqlCommand cmd1 = new SqlCommand(sql1, conn); //// a = cmd1.ExecuteScalar().ToString(); //// b = "0"; //// } //// if (a != Yonghuming.Text && b == "0") //// { //// Response.Write("<script>alert('用户名重复');</script>"); //// } //// else //// { //// mu.UserName = Yonghuming.Text; // if (Zhenshixingming.Text == "") // { // Response.Write("<script>alert('请输入真实姓名');</script>");//同上 // } // else // { // if (Regex.IsMatch(Zhenshixingming.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$"))//同上 // { // mu.UserRealName = Zhenshixingming.Text; // if (bxdwyh.Checked) // { // mu.UserIdentity = "报修单位用户"; // } // else if (zbzxgly.Checked) // { // mu.UserIdentity = "装备中心管理员"; // } // else if (wxzxgly.Checked) // { // mu.UserIdentity = "维修中心管理员"; // } // else if (zdls.Checked) // { // mu.UserIdentity = "指导老师"; // } // else // { // mu.UserIdentity = "学生"; // } // //mu.UserIdentity = Shenfen.SelectedValue;//同上 // //conn.Close(); // //conn.Open(); // //sql = "select unitid from unitsinfo where unitname = '" + Danwei.SelectedValue + "'";//同上 // //cmd = new SqlCommand(sql, conn); // if (xs.Checked || zdls.Checked) // { // mu.UnitID = ""; // } // else // { // mu.UnitID = bu.danweiid(Danwei.SelectedValue); // } // //if (xingbienan.Checked) // //{//同上 // // mu.UserSex = "男"; // //} // //if (xingbienv.Checked)//同上 // //{ // // mu.UserSex = "女"; // //}//同上 // //if (Youxiang.Text == "") // //{ // // Response.Write("<script>alert('请输入邮箱');</script>");//同上 // //} // //else // //{ // // if (Regex.IsMatch(Youxiang.Text, @"^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$"))//同上 // // { // // mu.UserEmail = Youxiang.Text; // // if (Lianxidianhua.Text == "") // // {//同上 // // Response.Write("<script>alert('请输入联系电话');</script>");//同上 // // } // // else // // { // // if (Regex.IsMatch(Lianxidianhua.Text, @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$"))//同上 // // { // // mu.UserPhone = Lianxidianhua.Text; // // if (Chushengriqi.DbSelectedDate == null)//同上 // // { // // Response.Write("<script>alert('请选择出生日期');</script>");//同上 // // } // // else // // { // // if (Chushengriqi.SelectedDate < DateTime.Now)//判断是否小于当前日期 // // { // // mu.UserBirthday = Chushengriqi.SelectedDate.ToString();//同上 // // if (Suoshusheng.SelectedValue == "") // // { // // Response.Write("<script>alert('请选择所属省');</script>");//同上 // // } // // else // // { // // mu.UserProvince = Suoshusheng.SelectedValue; // // if (Suoshushi.SelectedValue == "") // // { // // Response.Write("<script>alert('请选择所属市');</script>");//同上 // // } // // else // // { // // mu.UserCity = Suoshushi.SelectedValue; // // if (Xiangxidizhi.Text == "") // // { // // Response.Write("<script>alert('请输入详细地址');</script>");//同上 // // } // // else // // { // // if (Regex.IsMatch(Xiangxidizhi.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$"))//同上 // // { // // mu.UserAddress = Xiangxidizhi.Text;//同上 // if (qiyong.Checked == true)//同上 // { // mu.Enabled = "启用"; // } // if (weiqiyong.Checked == true)//同上 // { // mu.Enabled = "未启用"; // } // if (xs.Checked) // { // mu.AAA4 = bu.suoshulaoshixingming(suoshulaoshi.SelectedValue); // } // else // { // mu.AAA4 = ""; // } // bu.Update(mu); // Response.Write("<script>alert('修改成功');window.location.href='UserDetailed.aspx'</script>");//同上 // } // // else // // { // // Response.Write("<script>alert('请输入详细地址');</script>");//同上 // // } // //} // //} // // } // //} // // else // // { // // Response.Write("<script>alert('请输入正确的出生日期');</script>");//同上 // // } // // } // // } // // else // // { // // Response.Write("<script>alert('请输入正确的联系电话');</script>");//同上 // // } // // } // //} // //else // //{ // // Response.Write("<script>alert('请输入正确的邮箱格式');</script>");//同上 // //} // // } // //} // else // { // Response.Write("<script>alert('请输入正确的真实姓名');</script>");//同上 // } // } //} //} // else // { // Response.Write("<script>alert('用户名格式错误');</script>"); // } //queding.Attributes["onclick"] = "alert('修改成功');window.location.href=;'TeacherInformation.aspx'"; //} }
protected void RadButton1_Click1(object sender, EventArgs e) { string search2 = TextBox2.Text; string xxdz2 = TextBox2.Text.Trim(); Regex pattern2 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\]<>/?~!#¥……&*()——|{}【】‘;:”“'。,、? ']");//特殊字符正则判断 if ((pattern2.IsMatch(xxdz2) == true)) { Response.Write("<script>alert('请输入正确的姓名!')</script>"); return; } string search3 = TextBox3.Text; string xxdz3 = TextBox3.Text.Trim(); Regex pattern3 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\]<>/?~!#¥……&*()——|{}【】‘;:”“'。,、?' ]");//特殊字符正则判断 if ((pattern2.IsMatch(xxdz3) == true)) { Response.Write("<script>alert('请输入正确的联系号码!')</script>"); return; } string search4 = TextBox4.Text; string xxdz4 = TextBox4.Text.Trim(); Regex pattern4 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\]<>/?~!#¥……&*()——|{}【】‘;:”“'。,、?' ]");//特殊字符正则判断 if ((pattern2.IsMatch(xxdz4) == true)) { Response.Write("<script>alert('请输入正确的详细地址!')</script>"); return; } string stt = TextBox3.Text;//判断联系方式是否正确 bool isNum1 = System.Text.RegularExpressions.Regex.IsMatch(stt, @"(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$"); if (isNum1) { } else { RadAjaxManager1.Alert("请输入正确的联系方式!"); return; } if (TextBox3.Text.Length != 11)//判断联系方式的号码位数是否正确 { Response.Write("<script>alert(\"请输入正确的联系方式\")</script>"); return; } string youxiang = @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$";//邮箱正则判断 Regex regexYX = new Regex(youxiang); if (TextBox2.Text == "")//判断输入框是否为空 { Response.Write("<script>alert(\"请输入姓名\")</script>"); } else if (TextBox5.Text == "")//判断输入框是否为空 { Response.Write("<script>alert(\"请输入邮箱\")</script>"); } else if (TextBox4.Text == "")//判断输入框是否为空 { Response.Write("<script>alert(\"请输入详细地址\")</script>"); } else if (regexYX.IsMatch(TextBox5.Text) == false)//判断邮箱格式是否正确 { Response.Write("<script>alert(\"请输入正确的邮箱\")</script>"); return; } else if (RadDatePicker1.SelectedDate == null)//判断出生日期是否为空 { Response.Write("<script>alert(\"请输入出生日期\")</script>"); return; } else if (RadDatePicker1.SelectedDate > DateTime.Now)//判断填写日期是否大于当前日期 { Response.Write("<script>alert(\"请输入正确的出生日期\")</script>"); return; } else if (DropDownList1.SelectedItem.Text == "请选择")//判断下拉框是否进行选择 { Response.Write("<script>alert(\"请输入地址\")</script>"); return; } else if (DropDownList2.SelectedItem.Text == "请选择")//判断下拉框是否进行选择 { Response.Write("<script>alert(\"请输入地址\")</script>"); return; } else { Maticsoft.Model.UsersInfo UsersInfo_Model = UsersInfo_Bll.GetModel(UsersInfo.UserID); //引用id所在行的数据 UsersInfo_Model = UsersInfo_Bll.GetModel(UsersInfo.UserID); UsersInfo_Model.UserRealName = TextBox2.Text; //添加数据 UsersInfo_Model.UserPhone = TextBox3.Text; //添加数据 UsersInfo_Model.UserEmail = TextBox5.Text; //添加数据 UsersInfo_Model.UserBirthday = RadDatePicker1.SelectedDate.ToString(); //添加数据 UsersInfo_Model.UserProvince = DropDownList1.SelectedValue; //添加数据 UsersInfo_Model.UserCity = DropDownList2.SelectedValue; //添加数据 UsersInfo_Model.UserSex = RadioButton1.Checked.ToString(); //添加数据 UsersInfo_Model.UserAddress = TextBox4.Text; //添加数据 UsersInfo_Model.HeadPortrait = imgPic.ImageUrl; //添加数据 if (RadioButton1.Checked == true) { UsersInfo_Model.UserSex = "男"; } else { UsersInfo_Model.UserSex = "女"; } UsersInfo_Bll.Update(UsersInfo_Model); //更新数据库 Response.Write("<script>alert('修改成功!');window.location.href='./PersonalIinformation.aspx'</script>"); //提示并跳转页面 } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!String.IsNullOrEmpty(UsersInfo.UserID)) { UsersInfo_Model = UsersInfo_Bll.GetModel(UsersInfo.UserID); //引用id所在行的数据 imgPic.ImageUrl = UsersInfo_Model.HeadPortrait; //添加数据 Label1.Text = UsersInfo_Model.UserName; //添加数据 TextBox2.Text = UsersInfo_Model.UserRealName; //添加数据 TextBox3.Text = UsersInfo_Model.UserPhone; //添加数据 TextBox5.Text = UsersInfo_Model.UserEmail; //添加数据 RadDatePicker1.SelectedDate = Convert.ToDateTime(UsersInfo_Model.UserBirthday); //添加数据 TextBox4.Text = UsersInfo_Model.UserAddress; //添加数据 if (UsersInfo_Model.UserSex == "男") { RadioButton1.Checked = true; } else { RadioButton2.Checked = true; } //添加数据 DropDownList1.Items.Clear(); //清空省下拉框项目 DropDownList2.Items.Clear(); //清空市下拉框项目 DropDownList1.Items.Add(new ListItem("请选择", "")); //给省下拉框添加请选择 //RadDropDownList2.Items.Add(new DropDownListItem("请选择", ""));//给市下拉框添加请选择 DataSet ProvinceDS = new DataSet(); //声明数据库 ProvinceDS.ReadXml(Server.MapPath("~/pc.xml")); //读取pc文件 foreach (DataRow dr in ProvinceDS.Tables[0].Rows) //声明dr,数据库循环 { //逐条向dr添加,文本为dr的name列,值为dr的name列 DropDownList1.Items.Add(new ListItem(dr["name"].ToString(), dr["name"].ToString())); } DropDownList1.SelectedValue = UsersInfo_Model.UserProvince; XmlDataSource xds = new XmlDataSource(); //声明xml数据源 xds.DataFile = Server.MapPath("~/pc.xml"); //读取pc文件 xds.XPath = "//province[@name='" + DropDownList1.SelectedValue + "']/city"; //sql语句 this.DropDownList2.DataSource = xds; //绑定数据源 this.DropDownList2.DataTextField = "cname"; //设置文本字段 this.DropDownList2.DataValueField = "cname"; //设置值字段 this.DropDownList2.DataBind(); //绑定数据源 DropDownList2.Items.Add(new ListItem("请选择", "")); //给市下拉框添加请选择 DropDownList2.SelectedValue = UsersInfo_Model.UserCity; if (UsersInfo.UserRole == "报修单位用户") { UnitsInfo_Model = UnitsInfo_Bll.GetModel(UsersInfo_Model.UnitID); Label7.Text = UnitsInfo_Model.UnitName; XB.Visible = false; LXDH.Visible = false; YX.Visible = false; CSRQ.Visible = false; JTZZ.Visible = false; XXDZ.Visible = false; } if (UsersInfo.UserRole == "指导老师") { DW.Visible = false; } if (UsersInfo.UserRole == "系统管理员") { DW.Visible = false; } if (UsersInfo.UserRole == "装备中心管理员") { DW.Visible = false; } if (UsersInfo.UserRole == "维修中心管理员") { DW.Visible = false; } if (Label7.Text == "") { Label7.Text = "暂无数据"; } } } }
protected void RadButton1_Click(object sender, EventArgs e) { string search = RadTextBox1.Text; string xxdz = RadTextBox1.Text.Trim(); Regex pattern = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ]");//特殊字符正则判断 if ((pattern.IsMatch(xxdz) == true)) { Response.Write("<script>alert('请不要输入特殊字符!')</script>"); return; } string search1 = RadTextBox2.Text; string xxdz1 = RadTextBox2.Text.Trim(); Regex pattern1 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ]");//特殊字符正则判断 if ((pattern1.IsMatch(xxdz1) == true)) { Response.Write("<script>alert('请不要输入特殊字符!')</script>"); return; } string search2 = RadTextBox3.Text; string xxdz2 = RadTextBox3.Text.Trim(); Regex pattern2 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ]");//特殊字符正则判断 if ((pattern2.IsMatch(xxdz2) == true)) { Response.Write("<script>alert('请不要输入特殊字符!')</script>"); return; } string id = UsersInfo.UserID; UsersInfo_Model = UsersInfo_Bll.GetModel(id); //引用id所在行的数据 if (RadTextBox1.Text == "") //判读输入框是否为空 { Response.Write("<script>alert(\"请输入原密码\")</script>"); return; } else if (RadTextBox2.Text == "") //判读输入框是否为空 { Response.Write("<script>alert(\"请输入新密码\")</script>"); return; } else if (RadTextBox3.Text == "") //判读输入框是否为空 { Response.Write("<script>alert(\"请输入确认密码\")</script>"); return; } else if (RadTextBox1.Text != UsersInfo_Model.UserPassword) //判断原密码输入是否正确 { Response.Write("<script>alert(\"原密码输入错误\")</script>"); return; } else if (RadTextBox3.Text != RadTextBox2.Text)//判断新密码与确认密码是否一致 { Response.Write("<script>alert(\"密码不一致\")</script>"); return; } else if (RadTextBox2.Text == RadTextBox1.Text)//判断原密码与新密码是否一致 { Response.Write("<script>alert(\"新密码不可以与旧密码一致\")</script>"); return; } else if (RadTextBox2.Text.Length < 6)//判断密码位数 { Response.Write("<script>alert(\"密码不可以少于六位\")</script>"); return; } else { UsersInfo_Model.UserPassword = RadTextBox2.Text; //添加数据 UsersInfo_Bll.Update(UsersInfo_Model); //更新数据 UsersInfo.UserID = null; UsersInfo.UserName = null; UsersInfo.UserRole = null; //清空用户信息 ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>"); //关闭弹窗 //Response.Write("<script>window.location.href='/BackLogin.aspx'</script>"); } }
protected void xiugai_Click(object sender, EventArgs e) { mu = bu.GetModel(Request.QueryString["UserID"]);//同上 mu.UserID = Request.QueryString["UserID"]; if (Zhenshixingming.Text == "") { Response.Write("<script>alert('请输入真实姓名');</script>");//同上 } else { if (Regex.IsMatch(Zhenshixingming.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$"))//同上 { mu.UserRealName = Zhenshixingming.Text; if (xingbienan.Checked)//同上 { mu.UserSex = "男"; } if (xingbienv.Checked) { mu.UserSex = "女"; } if (Youxiang.Text == "") //同上 { Response.Write("<script>alert('请输入邮箱');</script>"); //同上 } else { if (Regex.IsMatch(Youxiang.Text, @"^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$"))//同上 { mu.UserEmail = Youxiang.Text; if (Lianxidianhua.Text == "") { Response.Write("<script>alert('请输入后联系电话');</script>");//同上 } else { if (Regex.IsMatch(Lianxidianhua.Text, @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$"))//同上 { mu.UserPhone = Lianxidianhua.Text; if (Chushengriqi.DbSelectedDate == null) { Response.Write("<script>alert('请选择出生日期');</script>");//同上 } else { if (Chushengriqi.SelectedDate < DateTime.Now)//判断是否小于当前日期 { mu.UserBirthday = Chushengriqi.SelectedDate.ToString(); if (Suoshusheng.SelectedValue == "") { Response.Write("<script>alert('请选择所属省');</script>");//同上 } else { mu.UserProvince = Suoshusheng.SelectedValue; if (Suoshushi.SelectedValue == "") { Response.Write("<script>alert('请选择所属市');</script>");//同上 } else { mu.UserCity = Suoshushi.SelectedValue; if (Xiangxidizhi.Text == "") { Response.Write("<script>alert('请输入后详细地址');</script>");//同上 } else { if (Regex.IsMatch(Xiangxidizhi.Text, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$"))//同上 { mu.UserAddress = Xiangxidizhi.Text; if (qiyong.Checked == true) { mu.Enabled = "启用"; } if (weiqiyong.Checked == true) { mu.Enabled = "未启用"; } mu.UserIdentity = "指导老师"; bu.Update(mu); Response.Write("<script>alert('修改成功');window.location.href='TeacherInformation.aspx'</script>");//同上 } //else //{ // Response.Write("<script>alert('请输入正确的详细地址');</script>");//同上 //} //} //} //} //} // else // { // Response.Write("<script>alert('请输入正确的出生日期');</script>");//同上 // } //} // } // else // { // Response.Write("<script>alert('请输入正确的联系电话');</script>");//同上 // } // } //} //else //{ // Response.Write("<script>alert('请输入正确的邮箱');</script>");//同上 //} // } //} else { Response.Write("<script>alert('请输入正确的真实姓名');</script>");//同上 } } } //string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456"; //string sql = "select Max(Convert(int,userid+1)) from usersinfo"; //SqlConnection conn = new SqlConnection(constr); //conn.Open(); //SqlCommand cmd = new SqlCommand(sql, conn); //mu = bu.GetModel(Request.QueryString["UserID"].ToString()); //mu.UserID = cmd.ExecuteScalar().ToString(); //mu.UserName = Yonghuming.Text; //mu.UserRealName = Zhenshixingming.Text; //mu.UserPassword = Mima.Text; //mu.UnitID = Danwei.SelectedValue; //mu.UserSex = Xingbie.SelectedValue; //mu.UserEmail = Youxiang.Text; //mu.UserPhone = Lianxidianhua.Text; //mu.UserBirthday = Chushengriqi.SelectedDate.ToString(); //mu.UserProvince = Suoshusheng.SelectedValue; //mu.UserCity = Suoshushi.SelectedValue; //mu.UserAddress = Xiangxidizhi.Text; //mu.UserAddTime = DateTime.Now.ToLocalTime().ToString(); //bu.Update(mu); //Response.Write("<script>alert('修改成功');window.location.href='TeacherInformation.aspx'</script>"); } } } } } } } } } }
//string a; //string b; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)//判断是否第一次 { //string constr = "Data Source=172.16.12.59;Initial Catalog=RepairCenterY;User ID=sa;Password=123456";//连接数据库语句 //string sql = "select username from UsersInfo where userid = " + Request.QueryString["UserID"];//sql语句 //SqlConnection conn = new SqlConnection(constr);//执行连接数据库语句 //conn.Open();//打开数据库连接 //SqlCommand cmd = new SqlCommand(sql, conn);//执行sql语句 mu = bu.GetModel(Request.QueryString["UserID"]); Yonghuming.Text = mu.UserName; //用户名赋值 Zhenshixingming.Text = mu.UserRealName; if (mu.UserIdentity == "报修单位用户") //判断身份 { xingbiehoutai.Visible = false; youxianghoutai.Visible = false; chushengriqihoutai.Visible = false; lianxifangshihoutai.Visible = false; jiatingzhuzhihoutai.Visible = false; xiangxidizhihoutai.Visible = false; bxdwyh.Checked = true; //选项 } else if (mu.UserIdentity == "装备中心管理员") { mu = bu.GetModel(Request.QueryString["UserID"]); if (mu.UserSex == "男") { xingbienan.Checked = true; } else { xingbienv.Checked = true; } Youxiang.Text = mu.UserEmail; Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday); Lianxidianhua.Text = mu.UserPhone; Xiangxidizhi.Text = mu.UserAddress; jiatingzhuzhihoutai.Visible = true; zbzxgly.Checked = true; } else if (mu.UserIdentity == "维修中心管理员") { mu = bu.GetModel(Request.QueryString["UserID"]); if (mu.UserSex == "男") { xingbienan.Checked = true; } else { xingbienv.Checked = true; } Youxiang.Text = mu.UserEmail; Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday); Lianxidianhua.Text = mu.UserPhone; Xiangxidizhi.Text = mu.UserAddress; jiatingzhuzhihoutai.Visible = true; wxzxgly.Checked = true; } else if (mu.UserIdentity == "指导老师") { mu = bu.GetModel(Request.QueryString["UserID"]); if (mu.UserSex == "男") { xingbienan.Checked = true; } else { xingbienv.Checked = true; } Youxiang.Text = mu.UserEmail; Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday); Lianxidianhua.Text = mu.UserPhone; Xiangxidizhi.Text = mu.UserAddress; danweihoutai.Visible = false; zdls.Checked = true; } else { danweihoutai.Visible = false; suoshulaoshihoutai.Visible = true; xingbiehoutai.Visible = false; youxianghoutai.Visible = false; chushengriqihoutai.Visible = false; lianxifangshihoutai.Visible = false; jiatingzhuzhihoutai.Visible = false; xiangxidizhihoutai.Visible = false; mu = bu.GetModel(Request.QueryString["UserID"]); suoshulaoshi.SelectedValue = bu.suoshulaoshiid(mu.AAA4); xs.Checked = true; } //if (mu.UserSex == "男")//同上 //{ // xingbienan.Checked = true; //} //if (mu.UserSex == "女")//同上 //{ // xingbienv.Checked = true; //} //Youxiang.Text = mu.UserEmail; //Lianxidianhua.Text = mu.UserPhone; //Chushengriqi.SelectedDate = Convert.ToDateTime(mu.UserBirthday);//同上 //Suoshushi.Items.FindByValue(cmd.ExecuteScalar().ToString()).Selected = true; //if (cmd.ExecuteScalar().ToString() == "江苏省") //{ // Suoshusheng.SelectedIndex = 0; //} //else //{ // Suoshusheng.SelectedIndex = 1; //} //sql = "select UserCity from UsersInfo where userid = " + Request.QueryString["UserID"]; //cmd = new SqlCommand(sql, conn); //if (cmd.ExecuteScalar().ToString() == "镇江市") //{ // Suoshushi.SelectedIndex = 0; //} //else if (cmd.ExecuteScalar().ToString() == "南京市") //{ // Suoshushi.SelectedIndex = 1; //} //else if (cmd.ExecuteScalar().ToString() == "常州市") //{ // Suoshushi.SelectedIndex = 2; //} //else if (cmd.ExecuteScalar().ToString() == "福州市") //{ // Suoshushi.SelectedIndex = 0; //} //else if (cmd.ExecuteScalar().ToString() == "厦门市") //{ // Suoshushi.SelectedIndex = 1; //} //else //{ // Suoshushi.SelectedIndex = 2; //////} ////Xiangxidizhi.Text = mu.UserAddress;//同上 tianjiashijian.Text = Convert.ToDateTime(mu.UserAddTime).ToShortDateString(); //同上 if (mu.Enabled == "启用") //同上 { qiyong.Checked = true; weiqiyong.Checked = false;//同上 } else { qiyong.Checked = false;//同上 weiqiyong.Checked = true; } if (zbzxgly.Checked || wxzxgly.Checked || zdls.Checked) { yingcangzhi.Text = "0"; } } }