示例#1
0
        /// <summary>
        /// 取指定岗位下的所有角色
        /// </summary>
        /// <param name="_postid"></param>
        /// <returns></returns>
        public static List <SinoRole> Get_RolesOfGW(string _postid)
        {
            string _sql = string.Format(" select a.jsid,a.jsmc,a.jssm,a.ssdwid from qx2_gwjsgxb t,qx_jsdyb a ");

            _sql += string.Format("where a.jsid = t.jsid and t.gwid = :GWID");
            SqlParameter[] _param =
            {
                new SqlParameter(":GWID", SqlDbType.Decimal),
            };
            _param[0].Value = decimal.Parse(_postid);

            List <SinoRole> roles = new List <SinoRole>();

            SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringProfile, CommandType.Text, _sql, _param);

            while (dr.Read())
            {
                SinoRole _sr = RightFunctions.CreateRoleItem(dr.GetDecimal(0).ToString(),
                                                             dr.IsDBNull(1) ? "" : dr.GetString(1),
                                                             dr.IsDBNull(2) ? "" : dr.GetString(2),
                                                             dr.IsDBNull(3) ? "" : dr.GetDecimal(3).ToString()
                                                             );
                roles.Add(_sr);
            }
            dr.Close();

            return(roles);
        }
示例#2
0
 private void ShowRoleData(SinoRole _sr, TreeListNode _node)
 {
     if (CurrentRoleInfo != null)
     {
         if (CurrentRoleInfo.HaveChanged)
         {
             string       _msg = String.Format("角色{0}的信息有修改,是否保存?", CurrentRoleInfo.Role.RoleName);
             DialogResult _rs  = XtraMessageBox.Show(_msg, "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             if (_rs == DialogResult.Yes)
             {
                 CurrentRoleInfo.SaveData();
             }
         }
     }
     CurrentRoleInfo = null;
     if (_sr != null)
     {
         SinoSZUC_RoleInfo _uc = new SinoSZUC_RoleInfo(_sr, _node, CanUseQueryModelNames);
         _uc.Dock         = DockStyle.Fill;
         _uc.DataChanged += new EventHandler <EventArgs>(_uc_DataChanged);
         this.splitContainerControl1.Panel2.Controls.Clear();
         this.splitContainerControl1.Panel2.Controls.Add(_uc);
         _uc.BringToFront();
         CurrentRoleInfo = _uc;
     }
     this.RaiseMenuChanged();
 }
示例#3
0
        /// <summary>
        /// 取角色列表
        /// </summary>
        private void InitRoleList()
        {
            this.treeList1.BeginUpdate();
            this.treeList1.Nodes.Clear();
            using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient())
            {
                RoleList = _umsc.GetRoleList().ToList <SinoRole>();
            }
            foreach (SinoRole _sr in RoleList)
            {
                TreeListNode _tn = this.treeList1.AppendNode(null, null);
                _tn.ImageIndex       = 0;
                _tn.SelectImageIndex = 0;
                _tn.SetValue(this.treeListColumn1, _sr.RoleName);
                _tn.Tag = _sr;
            }
            this.treeList1.EndUpdate();
            TreeListNode _node = this.treeList1.FocusedNode;

            if (_node != null)
            {
                SinoRole _role = _node.Tag as SinoRole;
                ShowRoleData(_role, _node);
            }
        }
示例#4
0
 public SinoSZUC_RoleInfo(SinoRole _role, TreeListNode _treeNode, List <string> canUseQueryModelNames)
 {
     InitializeComponent();
     RoleDefine            = _role;
     RoleNode              = _treeNode;
     CanUseQueryModelNames = canUseQueryModelNames;
     InitForm();
 }
示例#5
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            TreeListNode _node = e.Node;

            if (_node != null)
            {
                SinoRole _sr = _node.Tag as SinoRole;
                ShowRoleData(_sr, _node);
            }
        }
示例#6
0
        /// <summary>
        /// 取用户的角色
        /// </summary>
        /// <param name="yhid"></param>
        /// <returns></returns>
        public static ArrayList Get_RoleByYHID(string yhid)
        {
            string _sql = string.Format(" select a.jsid,a.jsmc,a.jssm,a.ssdwid from qx_yhjsgxb t,qx_jsdyb a ");

            _sql += string.Format("where a.jsid = t.jsid and yhid = {0}", yhid);
            DataTable _dt   = SqlHelper.Get_Data(_sql, "ROLES");
            ArrayList roles = new ArrayList();

            foreach (DataRow _dr in _dt.Rows)
            {
                SinoRole _sr = RightFunctions.CreateRoleItem(_dr);
                roles.Add(_sr);
            }
            return(roles);
        }
示例#7
0
        private List <SinoRole> GetSelectedRoles()
        {
            List <SinoRole> _ret = new List <SinoRole>();

            foreach (TreeListNode _tn in this.treeList1.Nodes)
            {
                if (_tn.GetValue(this.treeListColumn2) != null)
                {
                    bool _isChecked = (bool)_tn.GetValue(this.treeListColumn2);
                    if (_isChecked)
                    {
                        SinoRole _sr = _tn.Tag as SinoRole;
                        _ret.Add(_sr);
                    }
                }
            }
            return(_ret);
        }
示例#8
0
 private void InitQueryViewRightTree(SinoRole _sr)
 {
     using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient())
     {
         List <UserQueryModelInfo> _qvRightList = _umsc.GetModelRightListByRoleID(_sr.RoleID).ToList <UserQueryModelInfo>();
         TObj_ModelRightList       _qvRights    = new TObj_ModelRightList();
         foreach (UserQueryModelInfo _qmRight in _qvRightList)
         {
             string _qvname = string.Format("{0}.{1}", _qmRight.QueryModelNamespace, _qmRight.QueryModelName);
             if (this.CanUseQueryModelNames.Contains(_qvname))
             {
                 TObj_ModelRightItem _ritem = new TObj_ModelRightItem(_qmRight);
                 _qvRights.Add(_ritem);
             }
         }
         this.treeList3.BeginUpdate();
         this.treeList3.DataSource = _qvRights;
         this.treeList3.EndUpdate();
     }
 }
示例#9
0
        /// <summary>
        /// 添加新角色
        /// </summary>
        /// <returns></returns>
        private bool AddNewRole()
        {
            Dialog_AddRole _ar = new Dialog_AddRole();

            if (_ar.ShowDialog() == DialogResult.OK)
            {
                SinoRole _newRole = new SinoRole();
                _newRole.RoleID   = "";
                _newRole.RoleName = _ar.RoleName;
                _newRole.Descript = _ar.RoleDes;
                using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient())
                {
                    if (_umsc.AddNewRole(_newRole))
                    {
                        InitRoleList();
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#10
0
 private void InitRigtTree(SinoRole _sr)
 {
     if (_sr != null)
     {
         using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient())
         {
             List <UserRightInfo> _rightList    = _umsc.GetRightListByRoleID(_sr.RoleID).ToList <UserRightInfo>();
             UserRightFinder      _finder       = new UserRightFinder("-1");
             List <UserRightInfo> _TopRightList = _rightList.FindAll(new Predicate <UserRightInfo>(_finder.FindByFatherID));
             _TopRightList.Sort(new UserRightInfoComparer());
             RightList = new TObj_RightItemList();
             foreach (UserRightInfo _ri in _TopRightList)
             {
                 TObj_RightItem _ritem = new TObj_RightItem(_ri);
                 RightList.Add(_ritem);
                 AddChildrenRightItem(_ritem, _rightList);
             }
             this.treeList2.BeginUpdate();
             this.treeList2.DataSource = RightList;
             this.treeList2.ExpandAll();
             this.treeList2.EndUpdate();
         }
     }
 }
示例#11
0
 public bool DeleteRole(SinoRole _role)
 {
     return(UserManagerFactroy.DeleteRole(_role));
 }
示例#12
0
 public bool SaveRightsOfRole(SinoRole _role, List <UserRightInfo> _functionRights, List <UserQueryModelInfo> _modelRights)
 {
     return(UserManagerFactroy.SaveRightsOfRole(_role, _functionRights, _modelRights));
 }
示例#13
0
 public bool AddNewRole(SinoRole _newRole)
 {
     return(UserManagerFactroy.AddNewRole(_newRole));
 }