/// <summary> /// 保存管理员信息 /// </summary> protected void UserSave() { mU.UserName = this.UserName.Text; mU.UserPwd = Encryp.DESEncrypt(this.UserPwd.Text); mField mF = new mField(); bField bF = new bField(); mF.TableName = mm.TableName; DataSet ds = bF.FieldList(mF); string Field = "", Val = ""; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Field += ds.Tables[0].Rows[i]["Field"].ToString() + ","; Val += HXD.ModelField.Common.FieldType.FormatField(ds.Tables[0].Rows[i]["Type"].ToString(), ds.Tables[0].Rows[i]["Field"].ToString()) + "{$split$}"; } if (mU.Id == 0) { Field += "Id"; Val += bU.UserInsert(mU).ToString(); bm.ModelInsert(mm.TableName, Field, Val); } else { Field += "1"; Val += "1"; bU.UserUpdate(mU); bm.ModelUpdate(mm.Id, mm.TableName, Field.Trim(','), Val.Trim(',')); } StringDeal.Alter("保存完成!", "User_Manage.aspx?GroupId=" + mU.GroupId + ""); }
protected void Button1_Click(object sender, EventArgs e) { string MenuId = LoginCheck.getadminid(); string username = this.TextBox1.Text.Trim(); string userpwd = Encryp.DESEncrypt(this.TextBox2.Text.Trim()); string tell = this.TextBox4.Text.Trim(); string xuehao = this.TextBox5.Text.Trim(); string xname = this.TextBox6.Text.Trim(); string sqls = "select * from tb_User where UserName='******'"; DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset(sqls); if (ds.Tables[0].Rows.Count == 0) { string sql = "insert into tb_User(UserName,UserPwd,GroupId,classid,islock)values('" + username + "','" + userpwd + "',1,'" + MenuId + "',0)"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql); Session["AdminManage"] = username; System.Threading.Thread.Sleep(1000); string sql2 = "select id from tb_User where UserName='******' and datediff(mi,RegTime,getdate())<=1"; string icd = HXD.DBUtility.SQLHelper.ExecuteScalar(sql2).ToString(); Session["userid"] = icd; string sql3 = "insert into tb_U_User (Id,Tel,msn,name)values('" + icd + "','" + tell + "','" + xuehao + "','" + xname + "')"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql3); Response.Redirect("user/twolist.aspx"); } else { Response.Write("用户名已存在"); } }
protected void Button2_Click(object sender, EventArgs e) { string MenuId = Request.QueryString["MenuId"].ToString(); string username = this.username.Text.Trim(); string userpwd = Encryp.DESEncrypt(this.userpwd.Text.Trim()); string tell = this.Texttell.Text.Trim(); string xname = this.Textname.Text.Trim(); string sqls = "select * from tb_User where UserName='******'"; DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset(sqls); if (ds.Tables[0].Rows.Count == 0) { string sql = "insert into tb_User(UserName,UserPwd,GroupId,classid,islock)values('" + username + "','" + userpwd + "',6,'" + MenuId + "',1)"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql); //Session["AdminManage"] = username; System.Threading.Thread.Sleep(1000); string sql2 = "select id from tb_User where UserName='******' and datediff(mi,RegTime,getdate())<=1"; string icd = HXD.DBUtility.SQLHelper.ExecuteScalar(sql2).ToString(); //Session["userid"] = icd; string sql3 = "insert into tb_U_User (Id,Tel,name)values('" + icd + "','" + tell + "','" + xname + "')"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql3); StringDeal.Alter("添加成功!"); } else { Response.Write("用户名已存在"); } }
protected void Button1_Click(object sender, EventArgs e) { //string MenuId= Request.QueryString["MenuId"].ToString(); string MenuId = LoginCheck.getadminid(); string username = this.txtAdminName.Value.Trim(); string userpwd = Encryp.DESEncrypt(this.TextBox2.Text.Trim()); string email = this.TextBox4.Text.Trim(); string tell = this.TextBox5.Text.Trim(); string dw_name = this.TextBox6.Text.Trim(); string sqls = "select * from tb_User where UserName='******'"; DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset(sqls); if (ds.Tables[0].Rows.Count == 0) { string sql = "insert into tb_User(UserName,UserPwd,GroupId,classid,islock)values('" + username + "','" + userpwd + "',6,'" + MenuId + "',0)"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql); System.Threading.Thread.Sleep(1000); string sql2 = "select id from tb_User where UserName='******' "; string icd = HXD.DBUtility.SQLHelper.ExecuteScalar(sql2).ToString(); string sql3 = "insert into tb_U_User (Id,Tel,msn,name,sc_id)values('" + icd + "','" + tell + "','" + email + "','" + dw_name + "','" + MenuId + "')"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql3); Response.Redirect("user/"); } else { StringDeal.Alter("用户名已存在"); } }
protected void Button1_Click(object sender, EventArgs e) { string psw = Encryp.DESEncrypt("123456"); int id = int.Parse(Request.QueryString["id"].ToString()); string sql = "update tb_user set UserPwd='" + psw + "' where Id=" + id; HXD.DBUtility.SQLHelper.ExecuteScalar(sql); StringDeal.Alter("密码初始化成功 - 默认密码:123456"); }
protected void Button2_Click(object sender, EventArgs e) { string userid = Session["userid"].ToString(); string xx_name = this.TextBox1.Text; string xx_note = Encryp.DESEncrypt(this.TextBox2.Text.Trim()); string sql_u = "update tb_user set userpwd ='" + xx_note + "' where id=" + userid; HXD.DBUtility.SQLHelper.ExecuteScalar(sql_u); StringDeal.Alter("密码更新成功!"); }
protected void Page_Load(object sender, EventArgs e) { mAdmin mA = new mAdmin(); bAdmin bA = new bAdmin(); mA.UserName = Session["AdminManage"].ToString(); mA.UserPwd = Encryp.DESEncrypt(Request["OldPwd"]); if (!bA.IsOldPwd(mA)) { Response.Write("旧密码输入有误!"); } }
protected void Page_Load(object sender, EventArgs e) { LoginCheck.AdminManage(); if (IsPostBack) { mAdmin mA = new mAdmin(); bAdmin bA = new bAdmin(); mA.UserName = Session["AdminManage"].ToString(); mA.UserPwd = Encryp.DESEncrypt(this.UserPwd.Text); if (bA.AdminPwdEdit(mA)) { StringDeal.Alter("修改完成!"); } } }
/// <summary> /// 保存管理员信息 /// </summary> protected void AdminSave() { mA.GroupId = StringDeal.ToInt(this.GroupId.Text); mA.UserName = this.UserName.Text; mA.UserPwd = Encryp.DESEncrypt(this.UserPwd.Text); mA.TrueName = this.TrueName.Text; mA.Tel = this.Tel.Text; mA.Email = this.Email.Text; mA.IsModifyPassword = StringDeal.ToBool(this.IsModifyPassword.Text); mA.IsMultiLogin = StringDeal.ToBool(this.IsMultiLogin.Text); if (mA.Id == 0) { bA.AdminInsert(mA); } else { bA.AdminUpdate(mA); } StringDeal.Alter("保存完成!", "Admin_Manage.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { string username = Session["AdminManage"].ToString(); string MenuId = Session["userid"].ToString(); string jiupwd = Encryp.DESEncrypt(this.jiupwd.Text); string xinpwd1 = this.xinpwd1.Text; string xinpwd2 = this.xinpwd2.Text; string sql2 = "select * from tb_User where UserPwd='" + jiupwd + "' and id='" + MenuId + "'"; DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset(sql2); if (ds.Tables[0].Rows.Count > 0) { if (xinpwd1 != "") { if (xinpwd1 == xinpwd2) { string sql = "update tb_User set UserPwd='" + Encryp.DESEncrypt(xinpwd1) + "' where id='" + MenuId + "'"; HXD.DBUtility.SQLHelper.ExecuteScalar(sql); StringDeal.Alter("修改成功!", "twolist.aspx"); } else { StringDeal.Alter("2次新密码不一致!"); } } else { StringDeal.Alter("新密码不能为空!"); } } else { StringDeal.Alter("原新密码错误!请重新输入"); } }
protected void Button1_Click1(object sender, EventArgs e) { string xsurl = ""; // if((Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "") if (Request.QueryString["ReturnUrl"] != null) { xsurl = Request.QueryString["ReturnUrl"].ToString(); xsurl = xsurl.Replace("[@]", "&"); } else { xsurl = "user/twolist.aspx"; } string url = ""; string uname = this.username.Value; uname = uname.Replace("'", ""); uname = HXD.Common.StringDeal.RemoveUnsafeHtml(uname); string userpsw = Encryp.DESEncrypt(this.pwd.Value); string classid = LoginCheck.getadminid(); string sql = "select * from tb_User where UserName='******' and UserPwd='" + userpsw + "' and classid='" + classid + "'"; DataSet ds = HXD.DBUtility.SQLHelper.ExecuteDataset(sql); if (ds.Tables[0].Rows.Count > 0) { bool stra = bool.Parse(ds.Tables[0].Rows[0]["islock"].ToString()); if (stra == true) { Session["AdminManage"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["userid"] = ds.Tables[0].Rows[0]["id"].ToString(); int groupid = int.Parse(ds.Tables[0].Rows[0]["GroupId"].ToString()); switch (groupid) { case 7: //局长 url = "Edu/ulist.aspx"; break; case 6: //校长 url = "edumaste/olist.aspx"; break; case 5: //老师 url = "user/tlist.aspx"; break; case 1: //学生 url = xsurl; break; default: break; } Response.Redirect(url); } else { Response.Redirect("user/"); } } else { Response.Write("用户名或密码错误"); } }
protected void Button1_Click(object sender, EventArgs e) { //try //{ if (fuload.FileName == "") { //lbmsg.Text = "请选择文件"; //return null; StringDeal.Alter("请选择文件", "file.aspx"); } else { DataTable dt = xsldata(); //dataGridView2.DataSource = ds.Tables[0]; int errorcount = 0; //记录错误信息条数 int insertcount = 0; //记录插入成功条数 int updatecount = 0; //记录更新信息条数 //string strcon = "server=localhost;database=database1;uid=sa;pwd=sa"; //SqlConnection conn = new SqlConnection(strcon);//链接数据库 //conn.Open(); for (int i = 0; i < dt.Rows.Count; i++) { //dt.Rows[i]["Name"].ToString(); "Name"即为Excel中Name列的表头 string excl_xuehao = dt.Rows[i][0].ToString(); //学号 string excl_name = dt.Rows[i][1].ToString(); //姓名 string excl_sex = dt.Rows[i][2].ToString(); //性别 string excl_Birthday = dt.Rows[i][3].ToString(); //生日 string excl_nationality = dt.Rows[i][4].ToString(); //民族 string excl_address = dt.Rows[i][5].ToString(); //家庭住址 string excl_ksname = dt.Rows[i][6].ToString(); //科室名称 string excl_nianji = dt.Rows[i][7].ToString(); //年级 string excl_banji = dt.Rows[i][8].ToString(); //班级 string excl_tel = dt.Rows[i][9].ToString(); //电话号码 string excl_tel2 = dt.Rows[i][10].ToString(); //其他联系方式 string excl_jieji = dt.Rows[i][11].ToString(); //届级 string UserPwd = Encryp.DESEncrypt("123456"); //string userid = Session["userid"].ToString(); //string sqlcl = "select classid from tb_user where id=" + userid; //string MenuId = HXD.DBUtility.SQLHelper.ExecuteScalar(sqlcl).ToString(); string MenuId = LoginCheck.getadminid();//学校ID if (excl_xuehao != "" && excl_name != "" && excl_nianji != "" && excl_banji != "") { string sql = "select count(id) from tb_user where username='******'"; int count = Convert.ToInt32(HXD.DBUtility.SQLHelper.ExecuteScalar(sql)); if (count > 0) { updatecount++; } else { string sqlin1 = "insert into tb_User(UserName,UserPwd,GroupId,classid,islock)values('" + excl_xuehao + "','" + UserPwd + "',1,'" + MenuId + "',1)"; HXD.DBUtility.SQLHelper.ExecuteScalar(sqlin1); System.Threading.Thread.Sleep(100); string sqlin2 = "select id from tb_User where UserName='******' and datediff(mi,RegTime,getdate())<=1"; string icd = HXD.DBUtility.SQLHelper.ExecuteScalar(sqlin2).ToString(); Session["userid"] = icd; string sqlin3 = "insert into tb_U_User (Id,msn,name,sex,shengri,nationality,Address,ks_name,nianji,banji,tel,Mobile,jieji,sc_id)values('" + icd + "','" + excl_xuehao + "','" + excl_name + "','" + excl_sex + "','" + excl_Birthday + "','" + excl_nationality + "','" + excl_address + "','" + excl_ksname + "','" + excl_nianji + "','" + excl_banji + "','" + excl_tel + "','" + excl_tel2 + "','" + excl_jieji + "','" + MenuId + "')"; HXD.DBUtility.SQLHelper.ExecuteScalar(sqlin3); //string sqlinsert = "insert into users(Name,Sex,Age,Address) values('" + Name + "','" + Sex + "'," + Age + ",'" + Address + "')"; //HXD.DBUtility.SQLHelper.ExecuteNonQuery(sqlinsert); insertcount++; } } else { errorcount++; } } string msgg = insertcount + "条数据导入成功!" + updatecount + "条数据重复!" + errorcount + "条数据部分信息为空没有导入!"; StringDeal.Alter(msgg, "font_list2.aspx"); //catch (Exception ex) //{ }//} }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { mAdmin m = new mAdmin(); m.UserName = this.tUserName.Text; m.UserPwd = Encryp.DESEncrypt(this.tUserPwd.Text); m.LastLoginIp = Request.UserHostAddress.ToString(); string Code = this.tCode.Text; if (hidden1.Value == "1") { Code = Session["SGQ_WebValidate"].ToString().ToLower(); } if (Session["SGQ_WebValidate"] == null) { Msg = "验证码过期,请重试!"; } else if (Session["SGQ_WebValidate"].ToString().ToLower() != Code.ToLower()) { Msg = "验证码输入错误,请重试!"; } else { bAdmin b = new bAdmin(); IList <mAdmin> list = b.AdminLogin(m); string state = list[0].Temp; if (state == "0") { Msg = "密码输入有误!"; } else if (state == "1") { Msg = "密码输入有误!"; } else if (state == "2") { Msg = "帐号被锁定!"; } else { mOnlineAdmin mOA = new mOnlineAdmin(); bOnlineAdmin bOA = new bOnlineAdmin(); mOA.UserName = m.UserName; mOA.SessionId = Session.SessionID; if (Caches.GetCache("Admin_" + m.UserName) == null || b.GetAdminMultiLogin(m) || bOA.GetUpdateTimeSpan(mOA) > 10) { Caches.SetCache("Admin_" + m.UserName, "manage"); Session["AdminManage"] = m.UserName; bOA.OnlineAdminInsert(mOA); Response.Redirect("Default.aspx", true); } else { StringDeal.Alter("此管理帐号处于登陆状态,不允许多人同时登陆!"); } } } } else { this.tUserName.Text = "admin"; this.tUserPwd.Attributes.Add("value", "admin"); if (Systemlogin("IsManageCode").ToString().Trim() == "True") { yinc = ""; hidden1.Value = "0"; } else { hidden1.Value = "1"; yinc = " style=\"display:none;\""; } } }