示例#1
0
        private ExecutionMessage[] LoadRolesAndPrivileges(CRMUser user)
        {
            var Msgs = new ExecutionMessageCollection();

            try
            {
                DataSet Roles = null;
                new SecurityDataAdapter(_ConnectionString)
                .LoadRolesAndPrivileges(out Roles, user.UserID);

                // Load RoleNames
                user.RoleList = new System.Collections.ArrayList();
                foreach (DataRow row in Roles.Tables[0].Rows)
                {
                    user.RoleList.Add(row["RoleName"].ToString());
                }

                // Load Privilege Names
                user.PrivilegeList = new System.Collections.ArrayList();
                foreach (DataRow row in Roles.Tables[1].Rows)
                {
                    user.PrivilegeList.Add(row["PrivilegeName"].ToString());
                }
            }
            catch (Exception ex)
            {
                Msgs.Add(new ErrorMessage(ex.FormatMessage("LoadApplicationUsers")));
            }
            return(Msgs.ToArray());
        }
示例#2
0
        /// <summary>
        /// Load the CRM users
        /// </summary>
        /// <param name="tableToFill">The data table to fill</param>
        /// <param name="applicationCode">The applicaton code to load by</param>
        public ExecutionMessage[] LoadApplicationUsers(out DataTable toFill, string applicationCode)
        {
            var Msgs = new ExecutionMessageCollection();

            toFill = null;
            try
            {
                new SecurityDataAdapter(this._ConnectionString)
                .LoadApplicationUsers(out toFill, applicationCode);
            }
            catch (Exception ex)
            {
                Msgs.Add(new ErrorMessage(ex.FormatMessage("LoadApplicationUsers")));
            }
            return(Msgs.ToArray());
        }