protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_AdminUser user = new Hi.Model.SYS_AdminUser(); user.UserType = 4; if (Common.SysUserExistsAttribute("LoginName", txtUserName.Value.Trim())) { JScript.AlertMsg(this, "该用户已存在。"); return; } if (ddlOrg.SelectedValue == "-1") { JScript.AlertMsg(this, "请选择机构。"); return; } if (txtUserName.Value.Trim() == "") { JScript.AlertMsg(this, "登录帐号不能为空。"); return; } user.LoginName = Common.NoHTML(txtUserName.Value.Trim()); user.LoginPwd = Util.md5(txtUserPwd.Value.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.CreateDate = DateTime.Now; user.IsEnabled = 1; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; user.OrgID = int.Parse(ddlOrg.SelectedValue); new Hi.BLL.SYS_AdminUser().Add(user); ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>window.location.href='OrgUserList.aspx';</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { Hi.Model.SYS_AdminUser model = HttpContext.Current.Session["AdminUser"] as Hi.Model.SYS_AdminUser; //判断是否存在装修审核权限,不加业务员ID查询 string sql = "select rf.* from SYS_RoleSysFun rf join SYS_AdminUser u on u.RoleID=rf.RoleID where rf.FunCode='3215' and u.ID=" + UserID; DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0]; if (dt != null && dt.Rows.Count > 0) { Binds(); } else if (model.UserType == 1) { Binds(); } else { ulComp.Visible = false; } } catch (Exception ex) { Tiannuo.LogHelper.LogHelper.Error("Error", ex); } } }
protected void Page_Load(object sender, EventArgs e) { //string SysFoder = Common.AdminFoder; if (Session["AdminUser"] != null) { Hi.Model.SYS_AdminUser model = (Hi.Model.SYS_AdminUser)Session["AdminUser"]; //记录退出日志 //Utils.EditLog("安全日志", "用户" + model.Name + "退出管理系统", "系统安全模块", "logout.aspx", 0); } Session["AdminUser"] = null; Session.Clear(); Session.Abandon(); Response.Clear(); base.Response.Redirect("login.aspx");//新的登录页面 }
protected void Page_Load(object sender, EventArgs e) { if (Session["AdminUser"] != null) { Hi.Model.SYS_AdminUser model = Session["AdminUser"] as Hi.Model.SYS_AdminUser; if (model != null) { login_name = model.LoginName; login_Tname = model.TrueName; } } if (!IsPostBack) { SendShip(); OffShip(); } }
protected void Page_Load(object sender, EventArgs e) { Hi.Model.SYS_AdminUser model = HttpContext.Current.Session["AdminUser"] as Hi.Model.SYS_AdminUser; if (model != null) { if (model.UserType == 1) { //系统管理 this.xtgl.Visible = true; this.xtyhjqx.Visible = true; //this.ssgjz.Visible = true; this.xwfb.Visible = true; this.hyflgl.Visible = true; //this.spflgl.Visible = true; this.kfly.Visible = true; //this.ptskzh.Visible = true; this.dlrz.Visible = true; this.ywrz.Visible = true; this.yyda.Visible = true; //this.gmfwyh.Visible = true; //机构管理 this.jggl.Visible = true; this.jgwh.Visible = true; this.jgyhwh.Visible = true; this.jgywywh.Visible = true; //厂商管理 this.hxqygl.Visible = true; this.hxqyxz.Visible = true; this.hxqysh.Visible = true; this.hxqywh.Visible = true; this.qyyhwh.Visible = true; this.hxqyzx.Visible = false; this.hxqyzxsh.Visible = true; //代理商管理 this.jxsgl.Visible = true; this.jxscx.Visible = true; //this.jxsglycx.Visible = true; //商品查询 this.spgls.Visible = true; this.spcx.Visible = true; //订单查询 this.ddcxs.Visible = true; this.ddcx.Visible = true; //报表查询 this.bbcxs.Visible = true; this.xsddcx.Visible = true; this.jxsxssj.Visible = true; this.spxssj.Visible = true; this.xssjyfbd.Visible = true; this.yszk.Visible = true; this.zd.Visible = true; this.dpdjlcx.Visible = true; this.ipdjlcx.Visible = true; } else { string sql = "select rf.* from SYS_RoleSysFun rf join SYS_AdminUser u on u.RoleID=rf.RoleID where u.ID=" + model.ID; DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0]; foreach (DataRow dr in dt.Rows) { switch (dr["FunCode"].ToString()) { //系统管理 case "3010": this.xtgl.Visible = true; this.xtyhjqx.Visible = true; break; case "3011": this.xtgl.Visible = true; this.xwfb.Visible = true; break; case "3012": this.xtgl.Visible = true; this.hyflgl.Visible = true; break; case "3013": this.xtgl.Visible = true; //this.spflgl.Visible = true; break; case "3015": this.xtgl.Visible = true; //this.ptskzh.Visible = true; break; case "3016": this.xtgl.Visible = true; this.dlrz.Visible = true; break; case "3017": this.xtgl.Visible = true; this.ywrz.Visible = true; break; case "3018": this.xtgl.Visible = true; this.yyda.Visible = true; break; //机构管理 case "3110": this.jggl.Visible = true; this.jgwh.Visible = true; break; case "3111": this.jggl.Visible = true; this.jgyhwh.Visible = true; break; case "3112": this.jggl.Visible = true; this.jgywywh.Visible = true; break; //厂商管理 case "3210": this.hxqygl.Visible = true; this.hxqyxz.Visible = true; break; case "3211": this.hxqygl.Visible = true; this.hxqysh.Visible = true; break; case "3212": this.hxqygl.Visible = true; this.hxqywh.Visible = true; break; case "3213": this.hxqygl.Visible = true; this.qyyhwh.Visible = true; break; case "3214": this.hxqygl.Visible = true; this.hxqyzx.Visible = true; break; case "3215": this.hxqygl.Visible = true; this.hxqyzxsh.Visible = true; break; //代理商管理 case "3310": this.jxsgl.Visible = true; this.jxscx.Visible = true; break; case "3311": this.jxsgl.Visible = true; //this.jxsglycx.Visible = true; break; //商品查询 case "3410": this.spgls.Visible = true; this.spcx.Visible = true; break; //订单查询 case "3511": this.ddcxs.Visible = true; this.ddcx.Visible = true; break; //报表查询 case "3611": this.bbcxs.Visible = true; this.xsddcx.Visible = true; break; case "3612": this.bbcxs.Visible = true; this.jxsxssj.Visible = true; break; case "3613": this.bbcxs.Visible = true; this.spxssj.Visible = true; break; case "3614": this.bbcxs.Visible = true; this.xssjyfbd.Visible = true; break; case "3615": this.bbcxs.Visible = true; this.yszk.Visible = true; break; case "3616": this.bbcxs.Visible = true; this.zd.Visible = true; break; case "3617": this.bbcxs.Visible = true; this.dpdjlcx.Visible = true; break; case "3618": this.bbcxs.Visible = true; this.ipdjlcx.Visible = true; break; } } } } else { Response.Write("用户不存在!"); Response.End(); } }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_AdminUser Adminuser = null; if (txtpwd.Text.Trim() != txtpwd2.Text.Trim()) { JScript.AlertMsg(this, "两次密码不一致,请确认!"); return; } if (KeyID != 0) { Adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID); if (Adminuser.LoginPwd != Common.NoHTML(txtpwd.Text.Trim())) { Adminuser.LoginPwd = Util.md5(Common.NoHTML(txtpwd.Text.Trim())); } Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim()); Adminuser.Phone = Common.NoHTML(txttel.Value.Trim()); Adminuser.Remark = Common.NoHTML(txtRemark.Value.Trim()); if (this.rdoStatus1.Checked) { Adminuser.IsEnabled = 0; } else { Adminuser.IsEnabled = 1; } if (this.rdotype2.Checked) { Adminuser.UserType = 2;//系统用户 } if (salemanid.Value != "0") { Adminuser.UserType = 4;//系统用户 } Adminuser.ts = DateTime.Now; Adminuser.modifyuser = UserID; Adminuser.SalesManID = Convert.ToInt32(salemanid.Value); Adminuser.OrgID = Convert.ToInt32(orgids.Value); if (new Hi.BLL.SYS_AdminUser().Update(Adminuser)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='UserInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("UserInfo.aspx?KeyID=" + KeyID); } } else { Adminuser = new Hi.Model.SYS_AdminUser(); Adminuser.LoginName = Common.NoHTML(txtusername.Value.Trim()); if (DisExistsAttribute("LoginName", Adminuser.LoginName)) { JScript.AlertMsg(this, "该登录帐号已存在。"); return; } Adminuser.LoginPwd = Util.md5(txtpwd.Text.Trim()); Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim()); Adminuser.Phone = Common.NoHTML(txttel.Value.Trim()); if (this.rdotype2.Checked) { Adminuser.UserType = 2;//系统用户 } if (salemanid.Value != "0") { Adminuser.UserType = 4;//系统用户 } Adminuser.Remark = Common.NoHTML(txtRemark.Value.Trim()); Adminuser.RoleID = Convert.ToInt32(Request["RoleID"]); if (this.rdoStatus1.Checked) { Adminuser.IsEnabled = 0; } else { Adminuser.IsEnabled = 1; } //标准参数 Adminuser.CreateDate = DateTime.Now; Adminuser.CreateUserID = UserID; Adminuser.ts = DateTime.Now; Adminuser.modifyuser = UserID; Adminuser.SalesManID = Convert.ToInt32(salemanid.Value); Adminuser.OrgID = Convert.ToInt32(orgids.Value); int newuserid = 0; newuserid = new Hi.BLL.SYS_AdminUser().Add(Adminuser); if (newuserid > 0) { Response.Redirect("../Role/RoleInfo.aspx?KeyID=" + Request["RoleID"]); } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.SYS_AdminUser model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.SYS_AdminUser model) { return(dal.Add(model)); }
/// <summary> /// 登录操作日志 /// </summary> /// <param name="EditLog">日志文本</param> /// <param name="LName">模块页面</param> /// <param name="Module">系统模块</param> /// <param name="LoginPage">模块页面</param> /// <param name="login">登录是否成功: 0: 不成功 1: 成功</param> /// <param name="LoginType">类型0:登录跟踪 1:表示操作跟踪</param> /// <param name="Remark"></param> /// <param name="Type">用户登录类型 0:平台总后台登录 1:代理商用户 2:公共用户 3:企业用户 4:企业管理员 5:代理商管理员 </param> public static void EditLog(string EditLog, string LName, string Remark, string Module, string LoginPage, int LoginType, int login, int type) { try { int LoginId = 0; //登录人Id string LoginName = LName; //登录人名称 string LoginIp = string.Empty; //登录Ip DateTime LoginStartDate = DateTime.Now; //登录时间 int LoginUserType = type; //用户登录类型 //代理商端ip //LoginIp = HttpContext.Current.Request.ServerVariables.Get("Remote_Addr").ToString(); //if (LoginIp == "::1" || LoginIp == "") //{ // //代理商端主机名ip // LoginIp = HttpContext.Current.Request.ServerVariables.Get("Remote_Host").ToString(); //} LoginIp = Utils.GetIP(); if (type != 0) { LoginModel AdminUserModel = null; if (HttpContext.Current.Session["UserModel"] is LoginModel) { AdminUserModel = HttpContext.Current.Session["UserModel"] as LoginModel; //得到登录LoginId if (AdminUserModel != null) { LoginId = AdminUserModel.UserID; //LoginName = AdminUserModel.TrueName == "" ? AdminUserModel.UserName : AdminUserModel.TrueName; LoginName = AdminUserModel.UserName; } else { LoginName = LName; } } } else { Hi.Model.SYS_AdminUser UModel = null; if (HttpContext.Current.Session["AdminUser"] != null) { UModel = HttpContext.Current.Session["AdminUser"] as Hi.Model.SYS_AdminUser; //得到登录LoginId if (UModel != null) { LoginId = UModel.ID; //LoginName = UModel.TrueName == "" ? UModel.LoginName : UModel.TrueName; LoginName = UModel.LoginName; } else { LoginName = LName; } } } string LoginNote = string.Empty; if (LoginType == 1) { LoginNote = LoginName + ":" + EditLog; } else { LoginNote = EditLog; } string sql = "insert into [A_LoginLog] (LoginStartDate,LoginNote,Module,LoginPage,LoginType,Remark,LoginId,LoginName,LoginIp,[LoginUserType],[Login]) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')"; SqlHelper.ExecuteSql(Connection, string.Format(sql, LoginStartDate, LoginNote, Module, LoginPage, LoginType, Remark, LoginId, LoginName, LoginIp, LoginUserType, login)); } catch { } #region //LSY.Model.A_AdminLog LogModel = new LSY.Model.A_AdminLog(); //LogModel.LoginStartDate = DateTime.Now; //if (LoginType == 1)//操作日志 //{ // LogModel.LoginNote = UModel.Name + ":" + EditLog; //} //else //{ // LogModel.LoginNote = EditLog; //} //LogModel.Module = Module; //LogModel.LoginPage = LoginPage; //LogModel.LoginType = LoginType; //LogModel.Remark = Remark; //if (UModel != null) //{ // LogModel.LoginId = UModel.id; // LogModel.LoginName = UModel.LoginId; // LogModel.LoginIp = UModel.LastLoginIP; //} //else //{ // LogModel.LoginIp = HttpContext.Current.Request.ServerVariables.Get("Remote_Addr").ToString(); //} //new LSY.BLL.A_AdminLog().Add(LogModel); #endregion }
protected void btnAdd_Click(object sender, EventArgs e) { if (KeyID > 0) { Hi.Model.BD_Org org = new Hi.BLL.BD_Org().GetModel(KeyID); if (org != null) { if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim(), KeyID.ToString())) { JScript.AlertMsg(this, "该机构名称已存在。"); return; } org.OrgName = Common.NoHTML(txtOrgName.Value.Trim()); org.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); org.Phone = Common.NoHTML(txtPhone.Value.Trim()); org.IsEnabled = rdEbleYes.Checked ? 1 : 0; org.SortIndex = Common.NoHTML(txtSortIndex.Value.Trim()); org.Remark = Common.NoHTML(txtRemark.Value.Trim()); org.ts = DateTime.Now; org.modifyuser = UserID; if (new Hi.BLL.BD_Org().Update(org)) { List <Hi.Model.SYS_AdminUser> user = new Hi.BLL.SYS_AdminUser().GetList("", " isnull(dr,0)=0 and orgid='" + KeyID + "' and usertype in(3)", ""); if (user.Count > 0) { if (user[0].LoginPwd != txtUpwd.Text.Trim()) { user[0].LoginPwd = Util.md5(txtUpwd.Text.Trim()); } user[0].TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user[0].IsEnabled = rdEbleYes.Checked ? 1 : 0; user[0].ts = DateTime.Now; user[0].modifyuser = UserID; new Hi.BLL.SYS_AdminUser().Update(user[0]); Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1"); } else { Hi.Model.SYS_AdminUser userModel = new Hi.Model.SYS_AdminUser(); userModel.OrgID = KeyID; userModel.UserType = 3; userModel.IsEnabled = rdEbleYes.Checked ? 1 : 0; userModel.LoginName = Common.NoHTML(txtUsername.Value.Trim()); userModel.LoginPwd = Util.md5(txtUpwd.Text.Trim()); userModel.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); userModel.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); userModel.CreateDate = DateTime.Now; userModel.CreateUserID = UserID; userModel.ts = DateTime.Now; userModel.modifyuser = UserID; if (new Hi.BLL.SYS_AdminUser().Add(userModel) > 0) { Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1"); } else { new Hi.BLL.BD_Org().Delete(KeyID); } } } } } else { if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim())) { JScript.AlertMsg(this, "该机构名称已存在。"); return; } if (Common.SysUserExistsAttribute("LoginName", txtUsername.Value.Trim())) { JScript.AlertMsg(this, "该登录帐号已存在。"); return; } Hi.Model.BD_Org org = new Hi.Model.BD_Org(); org.OrgName = Common.NoHTML(txtOrgName.Value.Trim()); org.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); org.Phone = Common.NoHTML(txtPhone.Value.Trim()); org.IsEnabled = rdEbleYes.Checked ? 1 : 0; org.SortIndex = Common.NoHTML(txtSortIndex.Value.Trim()); org.Remark = Common.NoHTML(txtRemark.Value.Trim()); org.ts = DateTime.Now; org.modifyuser = UserID; int Orgid = 0; if ((Orgid = new Hi.BLL.BD_Org().Add(org)) > 0) { Hi.Model.SYS_AdminUser user = new Hi.Model.SYS_AdminUser(); user.OrgID = Orgid; user.UserType = 3; user.IsEnabled = rdEbleYes.Checked ? 1 : 0; user.LoginName = Common.NoHTML(txtUsername.Value.Trim()); user.LoginPwd = Util.md5(txtUpwd.Text.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; if (new Hi.BLL.SYS_AdminUser().Add(user) > 0) { Response.Redirect("OrgInfo.aspx?KeyID=" + Orgid + "&type=2&page=1"); } else { new Hi.BLL.BD_Org().Delete(Orgid); } } } }