Beispiel #1
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model">角色信息实体</param>
        /// <returns></returns>
        public bool Add(EyouSoft.Model.CompanyStructure.SysRoleManage model)
        {
            if (model != null && model.RoleName == "管理员")
            {
                return(false);
            }

            bool IsTrue = false;

            IsTrue = idal.Add(model);
            #region LGWR
            if (IsTrue)
            {
                EyouSoft.Model.CompanyStructure.SysHandleLogs logInfo = new EyouSoft.Model.CompanyStructure.SysHandleLogs();
                logInfo.CompanyId    = 0;
                logInfo.DepatId      = 0;
                logInfo.EventCode    = EyouSoft.Model.CompanyStructure.SysHandleLogsNO.EventCode;
                logInfo.EventIp      = string.Empty;
                logInfo.EventMessage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "{0}在" + EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.系统设置_角色管理.ToString() + "新增了角色管理信息数据。";
                logInfo.EventTime    = DateTime.Now;
                logInfo.EventTitle   = "新增角色管理信息";
                logInfo.ModuleId     = EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.系统设置_角色管理;
                logInfo.OperatorId   = 0;
                this.Logwr(logInfo);
                logInfo = null;
            }
            #endregion
            return(IsTrue);
        }
Beispiel #2
0
 /// <summary>
 /// 绑定角色的权限
 /// </summary>
 /// <param name="roleIdp"></param>
 protected void BindPermit(int roleIdp)
 {
     EyouSoft.Model.CompanyStructure.SysRoleManage roleModel = roleBll.GetModel(CurrentUserCompanyID, roleIdp);
     EyouSoft.BLL.SysStructure.Permission          permitBll = new EyouSoft.BLL.SysStructure.Permission();
     string[] permits = roleModel.RoleChilds.Split(',');
     cu_perList.SetPermitList = permits;
     selRole.Value            = roleId.ToString();
 }
Beispiel #3
0
 /// <summary>
 /// 获取角色信息实体
 /// </summary>
 /// <param name="CompanyId">公司编号</param>
 /// <param name="Id">角色编号</param>
 /// <returns></returns>
 public EyouSoft.Model.CompanyStructure.SysRoleManage GetModel(int CompanyId, int Id)
 {
     EyouSoft.Model.CompanyStructure.SysRoleManage model = null;
     dcDal = new EyouSoft.Data.EyouSoftTBL(this._db.ConnectionString);
     EyouSoft.Data.SysRoleManage DataModel = dcDal.SysRoleManage.FirstOrDefault(item =>
                                                                                item.CompanyId == CompanyId && item.Id == Id
                                                                                );
     if (DataModel != null)
     {
         model = new EyouSoft.Model.CompanyStructure.SysRoleManage()
         {
             Id         = DataModel.Id,
             RoleName   = DataModel.RoleName,
             RoleChilds = DataModel.RoleChilds
         };
     }
     DataModel = null;
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model">角色信息实体</param>
        /// <returns></returns>
        public bool Update(EyouSoft.Model.CompanyStructure.SysRoleManage model)
        {
            bool      IsTrue = false;
            DbCommand dc     = this._db.GetStoredProcCommand("proc_SysRoleManage_Update");

            this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id);
            this._db.AddInParameter(dc, "CompanyId", DbType.Int32, model.CompanyId);
            this._db.AddInParameter(dc, "RoleName", DbType.String, model.RoleName);
            this._db.AddInParameter(dc, "RoleChilds", DbType.AnsiString, model.RoleChilds);
            this._db.AddOutParameter(dc, "Result", DbType.Int32, 4);
            DbHelper.RunProcedure(dc, _db);
            object Result = this._db.GetParameterValue(dc, "Result");

            if (!Result.Equals(null))
            {
                IsTrue = int.Parse(Result.ToString()) > 0 ? true : false;
            }

            return(IsTrue);
        }
Beispiel #5
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model">角色信息实体</param>
        /// <returns></returns>
        public bool Add(EyouSoft.Model.CompanyStructure.SysRoleManage model)
        {
            dcDal = new EyouSoft.Data.EyouSoftTBL(this._db.ConnectionString);
            bool IsTrue = false;

            EyouSoft.Data.SysRoleManage DataModel = new EyouSoft.Data.SysRoleManage()
            {
                CompanyId  = model.CompanyId,
                RoleChilds = model.RoleChilds.Trim(),
                RoleName   = model.RoleName,
                IsDelete   = "0"
            };
            dcDal.SysRoleManage.InsertOnSubmit(DataModel);
            dcDal.SubmitChanges();
            if (dcDal.ChangeConflicts.Count == 0)
            {
                IsTrue = true;
            }
            DataModel = null;
            return(IsTrue);
        }
Beispiel #6
0
        /// <summary>
        /// 获取公司职务信息集合
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="CompanyId">公司编号</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.CompanyStructure.SysRoleManage> GetList(int PageSize, int PageIndex, ref int RecordCount, int CompanyId)
        {
            IList <EyouSoft.Model.CompanyStructure.SysRoleManage> ResultList = null;
            string tableName          = "tbl_SysRoleManage";
            string identityColumnName = "Id";
            string fields             = "[Id],[RoleChilds],[RoleName]";
            string query         = string.Format("[CompanyId]={0}", CompanyId);
            string orderByString = " [id] ASC";

            using (IDataReader dr = DbHelper.ExecuteReader(_db, PageSize, PageIndex, ref RecordCount, tableName, identityColumnName, fields, query, orderByString))
            {
                ResultList = new List <EyouSoft.Model.CompanyStructure.SysRoleManage>();
                while (dr.Read())
                {
                    EyouSoft.Model.CompanyStructure.SysRoleManage model = new EyouSoft.Model.CompanyStructure.SysRoleManage();
                    model.Id         = dr.GetInt32(dr.GetOrdinal("Id"));
                    model.RoleChilds = dr.GetString(dr.GetOrdinal("RoleChilds"));
                    model.RoleName   = dr.GetString(dr.GetOrdinal("RoleName"));
                    ResultList.Add(model);
                    model = null;
                }
            };
            return(ResultList);
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断权限
            if (!CheckGrant(global::Common.Enum.TravelPermission.系统设置_角色管理_角色管理栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.系统设置_角色管理_角色管理栏目, false);
                return;
            }

            this.cu_perList.SysId = SiteUserInfo.SysId;
            method1 = Utils.GetQueryStringValue("method");     //判断是否为复制
            string method2  = Utils.GetFormValue("hidMethod"); //判断是否为保存
            string showMess = "数据保存成功!";

            roleId = Utils.GetInt(Utils.GetQueryStringValue("roleId"));
            EyouSoft.Model.CompanyStructure.SysRoleManage roleModel = null;
            EyouSoft.BLL.CompanyStructure.SysRoleManage   roleBll   = new EyouSoft.BLL.CompanyStructure.SysRoleManage();//初始化角色bll
            //如果当前操作不为保存则为初次加载
            if (method2 != "save")
            {
                #region 初始化加载数据
                if (roleId != 0)
                {//如果角色编号不为0则加载角色信息
                    roleModel = roleBll.GetModel(CurrentUserCompanyID, roleId);
                    if (roleModel != null)
                    {
                        roleName = roleModel.RoleName;
                        cu_perList.SetPermitList = !string.IsNullOrEmpty(roleModel.RoleChilds) ? roleModel.RoleChilds.Split(',').ToArray() : null;
                    }//获取设置角色拥有的权限
                }
                #endregion
            }
            else
            {
                #region 保存数据
                bool   result  = false;
                string perItem = Utils.GetFormValue("perItem"); //获取权限信息
                roleName = Utils.GetFormValue("txtRoleName");   //获取角色名
                if (roleName == "")
                {
                    MessageBox.Show(this, "角色名称不为空!");
                    return;
                }

                roleModel            = new EyouSoft.Model.CompanyStructure.SysRoleManage();
                roleModel.RoleName   = roleName;
                roleModel.RoleChilds = perItem;

                roleModel.CompanyId = CurrentUserCompanyID;
                if (roleId != 0)
                {
                    if (method1 == "copy")
                    {
                        if (roleName == "管理员")
                        {
                            MessageBox.Show(this, "管理员帐号不能添加!");
                            return;
                        }
                        //添加新角色
                        result = roleBll.Add(roleModel);
                    }
                    else
                    {
                        //修改角色
                        roleModel.Id = roleId;
                        result       = roleBll.Update(roleModel);
                    }
                }
                else
                {
                    //添加新角色
                    result = roleBll.Add(roleModel);
                }
                if (!result)
                {
                    showMess = "数据保存失败!";
                }
                MessageBox.ResponseScript(this, string.Format(";alert('{0}'); window.parent.location='/systemset/rolemanage/RolesManage.aspx';window.parent.Boxy.getIframeDialog('{1}').hide()", showMess, Request.QueryString["iframeId"]));
                return;

                #endregion
            }
        }