Ejemplo n.º 1
0
        public ActionResult Header()
        {
            List <Model.SysMoudle> ListModel = new List <Model.SysMoudle>();

            Model.SysUser cm = (Model.SysUser)Session["UserInfo"];
            if (Session["MoudleInfo"] == null)
            {
                ListModel             = Opr.GetListByRole(cm.RoleID);
                Session["MoudleInfo"] = ListModel;
            }
            else
            {
                ListModel = (List <SysChain.Model.SysMoudle>)Session["MoudleInfo"];
            }
            List <Model.SysMoudle> Li = new List <Model.SysMoudle>();

            foreach (Model.SysMoudle m in ListModel)
            {
                if (m.ParentID == 0)
                {
                    Li.Add(m);
                }
            }
            return(PartialView("~/Areas/Admin/Views/Shared/_Header.cshtml", Li));
        }
Ejemplo n.º 2
0
 public SessionUser()
 {
     //
     // TODO: 在此处添加构造函数逻辑
     //
     _UserInfo = null;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <returns>返回对象实体</returns>
 /// <param name="dr">行</param>
 private Model.SysUser SetEntity(DataRow dr)
 {
     Model.SysUser model = new Model.SysUser();
     if (dr != null)
     {
         if (dr["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(dr["UserID"].ToString());
         }
         model.LoginName = dr["LoginName"].ToString();
         if (dr["ParentID"].ToString() != "")
         {
             model.ParentID = int.Parse(dr["ParentID"].ToString());
         }
         if (dr["State"].ToString() != "")
         {
             if ((dr["State"].ToString() == "1") || (dr["State"].ToString().ToLower() == "true"))
             {
                 model.State = true;
             }
             else
             {
                 model.State = false;
             }
         }
         model.RoleID = int.Parse(dr["RoleID"].ToString());
         return(model);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加一个系统用户。
        /// </summary>
        /// <param name="su">系统用户类对象</param>
        /// <returns>布尔值提示添加是否成功</returns>
        public bool addUser(Model.SysUser su)
        {
            string sqltext = "insert sysuser(userId,staffNum,password,job) values(@userId,@staffNum,@password,@job)";
            string maxid   = DBTools.searchID("sysuser", "userId");
            int    id      = maxid != null?int.Parse(maxid) : 0;

            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@userId", (id + 1).ToString());
            SqlParameter        sqlpara2 = new SqlParameter("@staffNum", su.StaffNum);
            SqlParameter        sqlpara3 = new SqlParameter("@password", su.Password);
            SqlParameter        sqlpara4 = new SqlParameter("@job", su.Job);

            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新用户登陆及基本信息
        /// </summary>
        /// <returns>The update.</returns>
        /// <param name="model">Model.</param>
        /// <param name="info">Info.</param>
        public int Update(Model.SysUser model, Model.SysUserInfo info)
        {
            List <string> li     = new List <string>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" Update SysUser set LoginName='" + model.LoginName + "',RoleID=" + model.RoleID + " where UserID= " + model.UserID + "");
            strSql.Append(" Update SysUserInfo set Gender=" + (info.Gender == true ? "1" : "0") + ",Name='" + info.Name + "',Telephone='" + info.Telephone + "',Department='" + info.Department + "' where UserID= " + info.UserID);
            li.Add(strSql.ToString());
            return(DbHelperSQL.ExecuteSqlTran(li));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtValiteCode.Text))
            {
                if (Request.Cookies["valicode"] != null)
                {
                    if (!txtValiteCode.Text.Trim().ToUpper().Equals(Request.Cookies["valicode"].Value.Trim().ToUpper()))
                    {
                        Common.MessageBox.ShowLayer(this, "输入验证码不一致!请重新输入", 5);
                        return;
                    }
                }
                else
                {
                    Common.MessageBox.ShowLayer(this, "验证码过期,请重新输入", 5);
                    return;
                }
            }
            else
            {
                Common.MessageBox.ShowLayer(this, "请输入验证码", 5);
                return;
            }
            string password = txtPassword.Text.Trim();

            try
            {
                Model.SysUser sysUser  = new Model.SysUser();
                string        UserName = txtMobilePhone.Text.Trim();
                sysUser = Factory.GetExecution().SelectModel <Model.SysUser>(UserName);
                if (sysUser != null && sysUser.PassWord == password)
                {
                    Session["UserInfo"] = sysUser;
                    Session["MenuList"] = PlatformManagment.User.GetBusinessAreaMenu();
                    Response.AddHeader("P3P", "CP=CAO PSA OUR");
                    Response.Redirect("Main.aspx");
                }
            }
            catch (Exception ex)
            {
                if ("用户未配置任何的页面权限".Equals(ex.Message))
                {
                    Common.MessageBox.ShowLayer(this, "登录失败,没有任何页面权限!", 2);
                }
                else
                {
                    Common.MessageBox.ShowLayer(this, "登录失败,请稍后重试!", 2);
                }
                LogTool.LogWriter.WriteError("登录失败:" + ex);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新用户登陆及基本信息
 /// </summary>
 /// <returns>The update.</returns>
 public int Update(Model.VM_SysUser model)
 {
     Model.SysUser m = new Model.SysUser();
     m.UserID    = model.UserID;
     m.LoginName = model.LoginName;
     m.RoleID    = model.RoleID;
     Model.SysUserInfo ui = new Model.SysUserInfo();
     ui.Gender     = model.Gender;
     ui.Department = model.Department;
     ui.Name       = model.Name;
     ui.Telephone  = model.Telephone;
     ui.UserID     = model.UserID;
     return(dal.Update(m, ui));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 新增系统用户
 /// </summary>
 public int Insert(Model.VM_SysUser model)
 {
     Model.SysUser m = new Model.SysUser();
     m.LoginName     = model.LoginName;
     m.LoginPassword = "******";
     m.ParentID      = model.ParentID;
     m.RoleID        = model.RoleID;
     m.State         = true;
     Model.SysUserInfo ui = new Model.SysUserInfo();
     ui.Gender       = model.Gender;
     ui.Department   = model.Department;
     ui.Name         = model.Name;
     ui.RegisterDate = DateTime.Now;
     ui.Telephone    = model.Telephone;
     return(dal.Insert(m, ui));
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 是否已有某个员工编号的用户.
        /// </summary>
        /// <param name="nnum">员工编号</param>
        /// <returns>如果有,则返回True;如果没有,则返回False.</returns>
        public bool hasUserOfNum(string nnum)
        {
            Model.SysUser       sysuser  = new Model.SysUser();
            string              sqltext  = "select * from sysuser where staffNum=@staffNum";
            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@staffNum", nnum);

            para.Add(sqlpara1);
            SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para);

            while (sdr.Read())
            {
                sdr.Close();
                DBTools.DBClose();
                return(true);
            }
            sdr.Close();
            return(false);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取所有系统用户.
        /// </summary>
        /// <returns>用户对象的泛型列表.</returns>
        public List <Model.SysUser> getAllUsers()
        {
            List <Model.SysUser> sysuser = new List <Model.SysUser>();
            string        sqltext        = "select * from sysuser";
            SqlDataReader sdr            = DBTools.exereaderSQL(sqltext, new List <SqlParameter> ());

            while (sdr.Read())
            {
                Model.SysUser s = new Model.SysUser();
                s.UserId   = sdr["userId"].ToString();
                s.StaffNum = sdr["staffNum"].ToString();
                s.Staff    = new DAL.StaffDAO().getStaffByNum(s.StaffNum);
                s.Password = sdr["password"].ToString();
                s.Job      = sdr["job"].ToString();
                sysuser.Add(s);
            }
            sdr.Close();
            DBTools.DBClose();
            return(sysuser);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 新增系统用户
        /// </summary>
        /// <returns>The add.</returns>
        /// <param name="Model">Model.</param>
        public int Insert(Model.SysUser Model, Model.SysUserInfo Info)
        {
            List <string> li     = new List <string>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" Declare  @ID int;  ");
            strSql.Append(" set  @ID=0;  ");
            strSql.Append(" if not exists(select LoginName from SysUser where LoginName ='" + Model.LoginName + "' ) begin ");
            strSql.Append(" insert into SysUser(");
            strSql.Append(" LoginName,LoginPassword,ParentID,RoleID,State)");
            strSql.Append(" values (");
            strSql.Append(" '" + Model.LoginName + "','" + DBUtility.DESEncrypt.Encrypt(Model.LoginPassword) + "'," + Model.ParentID + "," + Model.RoleID + "," + (Model.State == true?"1":"0") + ")");
            strSql.Append(" ; set @ID=@@IDENTITY; ");
            strSql.Append(" END;");
            strSql.Append(" if @ID>0 begin ");
            strSql.Append(" insert into SysUserInfo(");
            strSql.Append("  UserID,Gender,Name,Telephone,Department,RegisterDate)");
            strSql.Append(" values( @ID," + (Info.Gender == true ? "1" : "0") + ",'" + Info.Name + "','" + Info.Telephone + "','" + Info.Department + "','" + Info.RegisterDate + "');");
            strSql.Append(" END;");
            li.Add(strSql.ToString());
            return(DbHelperSQL.ExecuteSqlTran(li));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 新增/修改 展示页面
        /// </summary>
        /// <returns>The new.</returns>
        /// <param name="id">Identifier.</param>
        public ActionResult New(int?id)
        {
            int UserID = id == null ? 0 : (int)id;

            Model.VM_SysUser model = new Model.VM_SysUser();

            if (UserID > 0)
            {
                model          = Opr.GetEntity(UserID);
                ViewBag.Title  = "正在编辑用户: " + model.Name;
                ViewBag.RoleID = model.RoleID;
            }
            else
            {
                Model.SysUser cm = (Model.SysUser)Session["UserInfo"];
                model.ParentID = cm.UserID;
                model.UserID   = 0;
                model.State    = true;
                ViewBag.Title  = "后端管理系统-新增系统用户";
            }
            return(View(model));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取某个员工id的用户对象.
        /// </summary>
        /// <param name="ss">用户id</param>
        /// <returns>系统用户类对象</returns>
        public Model.SysUser getUserById(string sid)
        {
            Model.SysUser       sysuser  = null;
            string              sqltext  = "select * from sysuser where userId=@userId";
            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@userId", sid);

            para.Add(sqlpara1);
            SqlDataReader sdr = DBTools.exereaderSQL(sqltext, para);

            while (sdr.Read())
            {
                sysuser          = new Model.SysUser();
                sysuser.UserId   = sdr["userId"].ToString();
                sysuser.StaffNum = sdr["staffNum"].ToString();
                sysuser.Staff    = new DAL.StaffDAO().getStaffByNum(sysuser.StaffNum);
                sysuser.Password = sdr["password"].ToString();
                sysuser.Job      = sdr["job"].ToString();
            }
            sdr.Close();
            DBTools.DBClose();
            return(sysuser);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 新增或修改用户信息
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ActionResult EditSysUser(Model.SysUser user)
 {
     using (EFContext db = new EFContext())
     {
         if (user.UserID > 0)//如果是编辑
         {
             bool HasUser = db.SysUser.Any(m => m.UserCode == user.UserCode && m.UserID != user.UserID);
             if (HasUser)
             {
                 return(FailResult(1, $"系统已有代码为【{user.UserCode}】的用户,请修改用户代码"));
             }
             var dbSysUser = db.SysUser.Where(m => m.UserID == user.UserID).FirstOrDefault();
             dbSysUser.UserModified = DateTime.Now;
             dbSysUser.UserName     = user.UserName;
             dbSysUser.UserCode     = user.UserCode;
             dbSysUser.UserMail     = user.UserMail;
             db.SaveChanges();
             return(SuccessResult("用户修改成功"));
         }
         else
         {
             bool HasUser = db.SysUser.Any(m => m.UserCode == user.UserCode);
             if (HasUser)
             {
                 return(FailResult(1, $"系统已有代码为【{user.UserCode}】的用户,请修改用户代码"));
             }
             user.UserCreate   = DateTime.Now;
             user.UserModified = DateTime.Now;
             user.UserPwd      = Cryptography.MD5Encrypt64(user.UserPwd);
             db.SysUser.Add(user);
             LoggerHelper.Info("新增用户:" + GetContent(user), new cuser().usercode);
             db.SaveChanges();
             return(SuccessResult("添加成功"));
         }
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 通过员工编号,更新用户信息.员工编号跟用户ID不能修改.
        /// </summary>
        /// <param name="su">要更新的用户对象.员工编号不可更改.</param>
        /// <returns>通过布尔值提示是否完成.</returns>
        public bool updateUser(Model.SysUser su)
        {
            string sqltext               = "update sysuser set password=@password,job=@job where userId=@userId";
            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@userId", su.UserId);
            //SqlParameter sqlpara2 = new SqlParameter("@staffNum", su.StaffNum);
            SqlParameter sqlpara3 = new SqlParameter("@password", su.Password);
            SqlParameter sqlpara4 = new SqlParameter("@job", su.Job);

            //para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara1);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = SessionUser.GetSession();
            //user.ValidateAuthority("Auth_News_Retrieve");
            if (!user.hasAuthority("Auth_News_Add"))
            {
                href1.Visible = false;
            }
            if (!user.hasAuthority("Auth_News_Examine"))
            {
                A1.Visible = false;
            }
            if (!IsPostBack)
            {
                RGrid_NewsList.Visible = false;
                //初始化分类选择下拉树
                List<Model.Category> cgList = cg.DataTableToList(cg.GetList(5, "1", -1, 0, false).Tables[0]);
                cgList.RemoveAll(CT => !CT.Memo.Contains("R"));
                DataTable table = new DataTable();
                table.Columns.Add("AutoID");
                table.Columns.Add("ParentCategoryID");
                table.Columns.Add("CategoryName");
                foreach (Model.Category cgm in cgList)
                {
                    if (cgm.ParentCategoryID == -1)
                    {
                        table.Rows.Add(new String[] { cgm.AutoID.ToString(), null, cgm.CategoryName });
                    }
                    else
                    {
                        table.Rows.Add(new String[] { cgm.AutoID.ToString(), cgm.ParentCategoryID.ToString(), cgm.CategoryName });
                    }
                }
                RadDropDownTree2.DataFieldID = "AutoID";
                RadDropDownTree2.DataFieldParentID = "ParentCategoryID";
                RadDropDownTree2.DataValueField = "AutoID";
                RadDropDownTree2.DataTextField = "CategoryName";
                RadDropDownTree2.DataSource = table;
                RadDropDownTree2.DataBind();
                RadTreeView categoryTreeView = RadDropDownTree2.Controls[0] as RadTreeView;
                //categoryTreeView.Nodes[0].Expanded = true;
                categoryTreeView.ShowLineImages = false;

                List<Model.SysCodeDetail> dataSoucerList = scd.GetModelList(0, "DataSource", -1, -1, false);
                dataSoucerList.RemoveAll(rt => rt.IsValid == false);
                Model.SysCodeDetail dsModel = new Model.SysCodeDetail();
                dsModel.SYSCodeDetialID = "0";
                dsModel.SYSCodeDetialContext = "不限";
                dataSoucerList.Insert(0, dsModel);
                RCB_DataSource.DataValueField = "SYSCodeDetialID";
                RCB_DataSource.DataTextField = "SYSCodeDetialContext";
                RCB_DataSource.DataSource = dataSoucerList;
                RCB_DataSource.DataBind();

                List<Model.SysUser> suList = su.GetModelList(-1, "", -1, 4, true);
                Model.SysUser sm = new Model.SysUser();
                sm.UserID = "0";
                sm.UserName = "******";
                suList.Insert(0, sm);
                suList.ForEach(st => st.UserName = st.UserName + " [" + st.UserID + "]");
                RCB_Publisher.DataValueField = "UserID";
                RCB_Publisher.DataTextField = "USerName";
                RCB_Publisher.DataSource = suList;
                RCB_Publisher.DataBind();
                RCB_Publisher.SelectedValue = user.UserInfo.UserID;
            }
        }
Ejemplo n.º 17
0
        protected void Bt_Add_Click(object sender, EventArgs e)
        {
            string loginName = TB_LoginName.Text.Trim();
            string password = TB_Password.Text.Trim();
            string pwdCheck = TB_PwdCheck.Text.Trim();
            string userName = TB_UserName.Text.Trim();
            string employeeID = TB_EmployeeID.Text.Trim();
            string matchPass_LoginName = @"^[a-z0-9A-Z_-]{1,20}$";
            string matchPass_Password = @"^[a-z0-9A-Z_-]{7,20}$";

            if (loginName == "" || !(Regex.IsMatch(loginName, matchPass_LoginName)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('登录名必须为1-10个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (password == "" || !(Regex.IsMatch(password, matchPass_Password)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('密码必须为7-20个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (password != pwdCheck)
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('两次密码输入不一致!');", true);
                return;
            }
            if (userName == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('姓名必须为1-50个字符!');", true);
                return;
            }
            string roleId = RCB_Role.SelectedValue;
            bool enable = RCB_Enable.SelectedItem.Value == "1" ? true : false;

            Model.SysUser suModel = new Model.SysUser();
            suModel.UserID = loginName;
            suModel.Password = password;
            suModel.UserName = userName;
            suModel.EmployeeID = employeeID;
            suModel.IsValid = enable;
            SysUser su = new SysUser();
            bool isAdd = false;
            long scrAdd = 0;
            Model.Log logModel = new Model.Log();
            try
            {
                logModel.OperationItem = "添加用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                logModel.OperationDetail = "登录名:" + loginName + " - 用户名:" + userName + " - 角色:" + RCB_Role.SelectedItem.Text;
                isAdd = su.Add(suModel);
                Model.SysCodeRelation scrModel = new Model.SysCodeRelation();
                if (isAdd)
                {
                    scrModel.SysCodeDetialID = loginName;
                    scrModel.SysCodeDetialIDEx = roleId;
                    scrAdd = scr.Add(scrModel);
                }

                if (isAdd && scrAdd!=0)
                {
                    logModel.Memo = "成功";
                }
                else if (!isAdd)
                {
                    logModel.Memo = "失败!";
                }
                else
                {
                    logModel.Memo = "角色设置失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (isAdd && scrAdd!=0)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('恭喜!操作员\"" + loginName + "\"添加成功!');", true);
                }
                else if (!isAdd)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c6", "OpenAlert('抱歉!操作员\"" + loginName + "\"添加失败!');", true);

                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c6", "OpenAlert('操作员\"" + loginName + "\"添加成功!但是角色设置失败,请到系统代码中重新关联该用户角色!!');", true);

                }
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 更新某个用户的信息,员工编号保持不变.
 /// </summary>
 /// <param name="su">要更新的用户类对象</param>
 /// <returns>通过布尔值提示是否完成.</returns>
 public bool updateUser(Model.SysUser su)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 19
0
        protected void Bt_Modify_Click(object sender, EventArgs e)
        {
            SysUser su = new SysUser();
            Model.SysUser suModel = new Model.SysUser();
            suModel = su.GetModel(loginID);
            if (suModel == null)
                return;

            string loginName = loginID.Trim();
            string password = TB_Password.Text == "" ? suModel.Password : TB_Password.Text;
            string pwdCheck = TB_PwdCheck.Text == "" ? suModel.Password : TB_PwdCheck.Text;
            string userName = TB_UserName.Text.Trim();
            string employeeID = TB_EmployeeID.Text.Trim();

            string matchPass_Password = @"^[a-z0-9A-Z_-]{7,20}$";

            if (!(Regex.IsMatch(password, matchPass_Password)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('登录名必须为1-10个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (password != pwdCheck)
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('两次密码输入不一致!');", true);
                return;
            }
            if (userName == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('姓名必须为1-50个字符!');", true);
                return;
            }
            DataSet egDsRole = scd.GetListBySysCode(suModel.UserID, "Role");
            string egrole = egDsRole.Tables[0].Rows[0]["SYSCodeDetialID"].ToString(); //原角色

            string roleId = RCB_Role.SelectedValue;
            suModel.Password = password;
            suModel.UserName = userName;
            suModel.EmployeeID = employeeID;
            bool enable = RCB_Enable.SelectedItem.Value == "1";
            suModel.IsValid = enable;
            bool isUpdate = false;
            Model.Log logModel = new Model.Log();
            logModel.OperationItem = "修改操作员信息";
            logModel.Operator = user.UserInfo.UserID;
            logModel.OperationTime = DateTime.Now;
            logModel.OperationDetail = "操作员姓名:" + userName + " - 员工号:" + employeeID + " - 状态:" + enable + " - 角色编号:" + roleId;
            try
            {
                bool updateScr = true;
                List<Model.SysCodeRelation> scrModelList = scr.DataTableToList(scr.GetList(1, suModel.UserID).Tables[0]);
                scrModelList.AddRange(scr.DataTableToList(scr.GetList(2, suModel.UserID).Tables[0]));
                foreach (Model.SysCodeRelation scrM in scrModelList)
                {
                    if (scrM.SysCodeDetialID.Equals(egrole))
                    {
                        updateScr = false;
                        scrM.SysCodeDetialID = roleId;
                        updateScr = scr.Update(scrM);
                    }
                    else if (scrM.SysCodeDetialIDEx.Equals(egrole))
                    {
                        updateScr = false;
                        scrM.SysCodeDetialIDEx = roleId;
                        updateScr = scr.Update(scrM);
                    }
                    if (updateScr == false)
                    {
                        break;
                    }
                }
                if (updateScr)
                {
                    isUpdate = su.Update(suModel);
                }
                if (isUpdate)
                {
                    logModel.Memo = "成功";
                }
                else
                {
                    if (updateScr)
                    {
                        logModel.Memo = "失败!";
                    }
                    else
                    {
                        logModel.Memo = "失败!角色区域更新失败!";
                    }
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);

                if (isUpdate)
                {
                    ReadValue();
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('修改操作员成功!');", true);
                }
                else
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('修改操作员失败!');", true);
            }
        }
Ejemplo n.º 20
0
 private void ReadValue()
 {
     List<Model.SysUser> suList = new List<Model.SysUser>();
     suList = su.GetModelList(-1, "", -1, 4, true);
     suList.RemoveAll(st => st.UserID.Equals(user.UserInfo.UserID));
     Model.SysUser sm = new Model.SysUser();
     sm.UserID = "0";
     sm.UserName = "******";
     suList.Insert(0, sm);
     RCB_Publisher.DataValueField = "UserID";
     RCB_Publisher.DataTextField = "USerName";
     RCB_Publisher.DataSource = suList;
     RCB_Publisher.DataBind();
 }
Ejemplo n.º 21
0
 //支付卡方式设置Session
 /// <summary>
 /// 设置登录Session
 /// </summary>
 /// <param name="LoginID">登录ID</param>
 /// <param name="Password">登录密码</param>
 /// <param name="Session">Session</param>
 public void SetSession(string LoginID, string Password, HttpSessionState Session)
 {
     SysUser su = new SysUser();
     Model.SysUser user = su.GetModel(LoginID);
     if (user == null || !user.IsValid)
         return;
     if (user.Password.Equals(Password))
     {   //Role
         _UserInfo = user;
         DataSet roleDs = scd.GetListBySysCode(UserInfo.UserID, "Role");
         List<Model.SysCodeDetail> roleList = scd.DataTableToList(roleDs.Tables[0]);
         _Role = new KeyValuePair<string, string>(roleList[0].SYSCodeDetialID, roleList[0].SYSCodeDetialContext);
         DataSet authDs = scd.GetListBySysCode(_Role.Key, "Auth");
         List<Model.SysCodeDetail> authList = scd.DataTableToList(authDs.Tables[0]);
         _Authority = new Dictionary<string, string>();
         foreach (Model.SysCodeDetail scdM in authList)
         {
             _Authority.Add(scdM.SYSCodeDetialID, scdM.SYSCodeDetialContext);
         }
         Session[LoginSessionName] = this;
     }
     else//得到用户信息失败
     {
         _UserInfo = null;
         _Role = new KeyValuePair<string, string>(null, null);
         Session[LoginSessionName] = null;
     }
 }