/// <summary>
        /// 将用户绑定到lue上。
        /// </summary>
        /// <param name="lueControl"></param>
        public static void FillLueUser(DevExpress.XtraEditors.LookUpEdit lueControl)
        {
            //设置显示格式和字段
            lueControl.Properties.Appearance.Font                    = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            lueControl.Properties.Appearance.Options.UseFont         = true;
            lueControl.Properties.AppearanceDropDown.Font            = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lueControl.Properties.AppearanceDropDown.Options.UseFont = true;

            lueControl.Properties.Columns.Clear();
            lueControl.Properties.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] {
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo("F_USER_ID", "用户编号")
                , new DevExpress.XtraEditors.Controls.LookUpColumnInfo("F_USER_NAME", "用户名")
            });

            lueControl.Properties.DisplayMember = "F_USER_NAME";
            lueControl.Properties.ValueMember   = "F_USER_ID";

            lueControl.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;


            ProxyBllSYSTEM_USER bllSystemUser = new ProxyBllSYSTEM_USER();

            //获得数据集
            DataSet dsUsers = bllSystemUser.GetAllList();

            //有数据情况下绑定
            if (dsUsers != null && dsUsers.Tables.Count > 0)
            {
                lueControl.Properties.DataSource = dsUsers.Tables[0];
            }
        }
Beispiel #2
0
        /// <summary>
        /// 填充表格
        /// </summary>
        private void BindGridview()
        {
            _dsUsers = _bllSystemUser.GetAllList();

            //绑定数据
            if (_dsUsers != null && _dsUsers.Tables.Count > 0)
            {
                gcList.DataSource = _dsUsers.Tables[0];
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取角色中包含的用户
        /// </summary>
        private void GetUsersInRole()
        {
            //角色id
            string roleId = lueRole.EditValue.ToString();

            //读取数据源
            DataSet dsAllUers = _bllSystemUser.GetAllList();

            //绑定数据
            chklistAllModules.DataSource = dsAllUers.Tables[0];

            //设定显示数据和数值数据
            chklistAllModules.DisplayMember = "F_USER_NAME";
            chklistAllModules.ValueMember   = "F_USER_ID";


            //将所有选项都删除
            chklistAllModules.UnCheckAll();


            //已授权模块
            DataSet dsUsersOfRole = _bllSystemRoleAuth.GetUsersOfRole(roleId);


            //便利全部授权模块
            for (int indexOfAllModules = 0; indexOfAllModules < chklistAllModules.ItemCount; indexOfAllModules++)
            {
                //便利已授权记录
                foreach (DataRow dataRow in dsUsersOfRole.Tables[0].Rows)
                {
                    //如果两个记录相等
                    if (chklistAllModules.GetItemValue(indexOfAllModules).ToString() == dataRow["F_USER_ID"].ToString())
                    {
                        //设置勾选状态
                        chklistAllModules.SetItemChecked(indexOfAllModules, true);
                    }
                }
            }
        }