Esempio n. 1
0
        /// <summary>
        /// Gets the NVP.
        /// </summary>
        /// <param name="nameValuePairSeqId">The NVP seq ID.</param>
        /// <returns>MNameValuePair.</returns>
        public static MNameValuePair GetNameValuePair(int nameValuePairSeqId)
        {
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        myNameValuePair  = new BNameValuePairs(mSecurityProfile);

            return(new MNameValuePair(myNameValuePair.GetNameValuePair(nameValuePairSeqId)));
        }
Esempio n. 2
0
        /// <summary>
        /// Get a single account given it's id.
        /// </summary>
        /// <param name="id">int or Integer</param>
        /// <returns>MAccountProfile</returns>
        /// <remarks>Returns null object if not found</remarks>
        public static MAccountProfile GetProfile(int id)
        {
            var             mResult = from mProfile in GetAccounts(CurrentProfile()) where mProfile.Id == id select mProfile;
            MAccountProfile mRetVal = null;

            try
            {
                mRetVal = mResult.First();
            }
            catch (InvalidOperationException)
            {
                String mMSG = "Count not find account: " + id + " in the database";
                Logger mLog = Logger.Instance();
                mLog.Error(mMSG);
            }
            catch (IndexOutOfRangeException)
            {
                String mMSG = "Count not find account: " + id + " in the database";
                Logger mLog = Logger.Instance();
                mLog.Error(mMSG);
            }
            if (mRetVal != null)
            {
                BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
                mRetVal = mBAccount.GetProfile(mRetVal.Account);
            }
            return(mRetVal);
        }
Esempio n. 3
0
        /// <summary>
        /// GetNVPs will return all Name Value Pairs avalible for a given account
        /// </summary>
        /// <param name="accountId">The account the list of NVPs are for</param>
        /// <returns>Returns a data table of name value pairs for a given account</returns>
        /// <remarks></remarks>
        public static DataTable GetNameValuePairs(int accountId)
        {
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        myNameValuePair  = new BNameValuePairs(mSecurityProfile);

            return(myNameValuePair.GetAllNameValuePair(accountId));
        }
Esempio n. 4
0
        //private static Collection<MMessageProfile> AllMessages()
        //{
        //    DataTable mDataTable = new DataTable();
        //    Collection<MMessageProfile> mMessagesCollection = null;
        //    BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
        //    DataSet myDataSet = new DataSet();
        //    try
        //    {
        //        int mySecurityEntity = ClientChoicesUtility.SelectedSecurityEntity();
        //        mMessagesCollection = mBMessages.GetMessages(mySecurityEntity);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    finally
        //    {
        //        if ((myDataSet != null))
        //        {
        //            myDataSet.Dispose();
        //            myDataSet = null;
        //        }
        //        if ((mDataTable != null))
        //        {
        //            mDataTable.Dispose();
        //            mDataTable = null;
        //        }
        //        if ((mBMessages != null))
        //        {
        //            mBMessages = null;
        //        }
        //    }
        //    return mMessagesCollection;
        //}

        /// <summary>
        /// Saves the specified profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public static void Save(MMessageProfile profile)
        {
            BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            mBMessages.Save(profile);
            RemoveCachedMessagesCollection();
        }
Esempio n. 5
0
        /// <summary>
        /// Retrieves the selected groups for the name value pair
        /// </summary>
        /// <param name="nameValuePairSeqId">The primary key of the name value pair</param>
        /// <returns>String array list of groups</returns>
        /// <remarks></remarks>
        public static string[] GetSelectedGroups(int nameValuePairSeqId)
        {
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        myNameValuePair  = new BNameValuePairs(mSecurityProfile);
            DataTable myDataTable = myNameValuePair.GetNameValuePairGroups(nameValuePairSeqId);

            return(GetStringArrayList(myDataTable, "Groups"));
        }
Esempio n. 6
0
        /// <summary>
        /// Updated the information in the data store
        /// </summary>
        /// <param name="profile">MDBInformation</param>
        /// <returns>bool or exception</returns>
        public static bool UpdateProfile(MDBInformation profile)
        {
            bool           mRetVal = false;
            BDBInformation mBll    = new BDBInformation(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            mRetVal = mBll.UpdateProfile(profile);
            return(mRetVal);
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the profile.
        /// </summary>
        /// <param name="roleId">The role ID.</param>
        /// <returns>MRoleProfile.</returns>
        public static MRoleProfile GetProfile(int roleId)
        {
            MRoleProfile mProfile = new MRoleProfile();

            mProfile.Id = roleId;
            BRoles mBRoles = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            mProfile = mBRoles.GetProfile(mProfile);
            return(mProfile);
        }
Esempio n. 8
0
        /// <summary>
        /// Searches the specified search critera.
        /// </summary>
        /// <param name="searchCriteria">The search critera.</param>
        /// <returns>DataTable.</returns>
        public static DataTable Search(MSearchCriteria searchCriteria)
        {
            if (searchCriteria == null)
            {
                throw new ArgumentNullException("searchCriteria", "searchCriteria cannot be blank or a null reference (Nothing in Visual Basic)");
            }
            BRoles mBRoles = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            return(mBRoles.Search(searchCriteria));
        }
Esempio n. 9
0
 public static void GetNameValuePairDetails(ref DataTable yourDataTable)
 {
     yourDataTable = (DataTable)HttpContext.Current.Cache[CachedNameValuePairDetailsTableName];
     if (yourDataTable == null)
     {
         MSecurityEntityProfile mSecurityProfile       = SecurityEntityUtility.CurrentProfile();
         BNameValuePairs        myNameValuePairDetails = new BNameValuePairs(mSecurityProfile);
         yourDataTable = myNameValuePairDetails.GetAllNameValuePairDetail();
         CacheController.AddToCacheDependency(CachedNameValuePairDetailsTableName, yourDataTable);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Searches the specified search criteria.
        /// </summary>
        /// <param name="searchCriteria"></param>
        /// <returns></returns>
        public static DataTable Search(MSearchCriteria searchCriteria)
        {
            if (searchCriteria == null)
            {
                throw new ArgumentNullException("searchCriteria", "searchCriteria cannot be a null reference (Nothing in Visual Basic)!");
            }
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        mBNameValuePairs = new BNameValuePairs(mSecurityProfile);

            return(mBNameValuePairs.Search(searchCriteria));
        }
Esempio n. 11
0
        /// <summary>
        /// Updates the roles.
        /// </summary>
        /// <param name="nameValuePairId">The NV p_ ID.</param>
        /// <param name="securityEntityId">The security entity ID.</param>
        /// <param name="commaSeparatedRoles">The comma separated roles.</param>
        /// <param name="nameValuePairProfile">MNameValuePair.</param>
        public static void UpdateRoles(int nameValuePairId, int securityEntityId, string commaSeparatedRoles, MNameValuePair nameValuePairProfile)
        {
            if (nameValuePairProfile == null)
            {
                throw new ArgumentNullException("nameValuePairProfile", "nameValuePairProfile cannot be a null reference (Nothing in Visual Basic)!");
            }
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        myNameValuePair  = new BNameValuePairs(mSecurityProfile);

            myNameValuePair.UpdateRoles(nameValuePairId, securityEntityId, commaSeparatedRoles, nameValuePairProfile);
        }
Esempio n. 12
0
        /// <summary>
        /// Saves the detail.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <returns>System.Int32.</returns>
        public static void SaveDetail(MNameValuePairDetail profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!");
            }
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        mBNameValuePairs = new BNameValuePairs(mSecurityProfile);

            CacheController.RemoveFromCache(CachedNameValuePairDetailsTableName);
            mBNameValuePairs.SaveNameValuePairDetail(profile);
        }
Esempio n. 13
0
 /// <summary>
 /// Searches Security Entities with the specified search criteria.
 /// </summary>
 /// <param name="searchCriteria">The search criteria.</param>
 /// <returns>DataTable.</returns>
 public static DataTable Search(MSearchCriteria searchCriteria)
 {
     try
     {
         BSecurityEntity mBSecurityEntities = new BSecurityEntity(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
         return(mBSecurityEntities.Search(searchCriteria));
     }
     catch (IndexOutOfRangeException)
     {
         return(null);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Moves the specified profiles menu order.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <param name="direction">The direction.</param>
        /// <param name="updatedBy">The updated by.</param>
        /// <param name="updatedDate">Up dated date.</param>
        public static void Move(MFunctionProfile profile, DirectionType direction, int updatedBy, DateTime updatedDate)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!!");
            }
            profile.UpdatedBy   = updatedBy;
            profile.UpdatedDate = updatedDate;
            BFunctions mBAppFunctions = new BFunctions(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            mBAppFunctions.MoveMenuOrder(profile, direction);
            RemoveCachedFunctions();
        }
Esempio n. 15
0
        /// <summary>
        /// Retruns a collection of MAccountProfiles given an MAccountProfile and the current SecurityEntitySeqID
        /// </summary>
        /// <param name="profile">MAccountProfile</param>
        /// <remarks>If the Profiles.IsSysAdmin is true then all accounts will be returned</remarks>
        public static Collection <MAccountProfile> GetAccounts(MAccountProfile profile)
        {
            // was thinking of adding cache here but
            // when you think of it it's not needed
            // account information needs to come from
            // the db to help ensure passwords are correct and what not.
            // besides which a list of accounts is only necessary
            // when editing an account and it that case
            // what accounts that are returned are dependend on the requesting account.IsSysAdmin bit.
            BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            return(mBAccount.GetAccounts(profile));
        }
Esempio n. 16
0
 /// <summary>
 /// Searches the specified search criteria.
 /// </summary>
 /// <param name="searchCriteria">The search criteria.</param>
 /// <returns>DataTable.</returns>
 public static DataTable Search(MSearchCriteria searchCriteria)
 {
     try
     {
         BMessages mBMessages = new BMessages(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
         return(mBMessages.Search(searchCriteria));
     }
     catch (IndexOutOfRangeException ex)
     {
         Logger mLog = Logger.Instance();
         mLog.Debug(ex);
         return(null);
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Saves the specified profile.
 /// </summary>
 /// <param name="profile">The profile.</param>
 public static void Save(MSecurityEntityProfile profile)
 {
     try
     {
         BSecurityEntity mBSecurityEntities = new BSecurityEntity(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
         mBSecurityEntities.Save(profile);
         CacheController.RemoveAllCache();
     }
     catch (DataAccessLayerException ex)
     {
         Logger mLog = Logger.Instance();
         mLog.Error(ex);
     }
 }
Esempio n. 18
0
        /// <summary>
        /// Saves the specified profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public static void Save(MDirectoryProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!");
            }
            CacheController.RemoveFromCache(s_DirectoryInfoCachedName);
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            Logger mLog = Logger.Instance();

            try
            {
                profile.ImpersonatePassword = CryptoUtility.Decrypt(profile.ImpersonatePassword, mSecurityEntityProfile.EncryptionType);
            }
            catch (CryptoUtilityException)
            {
                profile.ImpersonatePassword = CryptoUtility.Encrypt(profile.ImpersonatePassword, mSecurityEntityProfile.EncryptionType);
            }
            try
            {
                profile.Directory = CryptoUtility.Decrypt(profile.Directory, mSecurityEntityProfile.EncryptionType);
            }
            catch (CryptoUtilityException)
            {
                profile.Directory = CryptoUtility.Encrypt(profile.Directory, mSecurityEntityProfile.EncryptionType);
            }
            try
            {
                profile.ImpersonateAccount = CryptoUtility.Decrypt(profile.ImpersonateAccount, mSecurityEntityProfile.EncryptionType);
            }
            catch (CryptoUtilityException)
            {
                profile.ImpersonateAccount = CryptoUtility.Encrypt(profile.ImpersonateAccount, mSecurityEntityProfile.EncryptionType);
            }
            BDirectories myBLL = new BDirectories(mSecurityEntityProfile, ConfigSettings.CentralManagement);

            try
            {
                myBLL.Save(profile);
            }
            catch (DataAccessLayerException ex)
            {
                mLog.Error(ex);
                throw new WebSupportException("Could not save the directory information!");
            }
            String mCacheName = mSecurityEntityProfile.Id.ToString(CultureInfo.CurrentCulture) + "_" + s_DirectoryInfoCachedName;

            CacheController.RemoveFromCache(mCacheName);
        }
Esempio n. 19
0
        /// <summary>
        /// Gets the messages.
        /// </summary>
        /// <returns>Collection{MMessageProfile}.</returns>
        public static Collection <MMessageProfile> Messages()
        {
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            string mCacheName = MessagesUnitCachedCollectionName(mSecurityEntityProfile.Id);
            Collection <MMessageProfile> mMessageCollection = null;

            mMessageCollection = (Collection <MMessageProfile>)HttpContext.Current.Cache[mCacheName];
            if (mMessageCollection == null)
            {
                BMessages mBMessages = new BMessages(mSecurityEntityProfile, ConfigSettings.CentralManagement);
                mMessageCollection = mBMessages.GetMessages(mSecurityEntityProfile.Id);
                CacheController.AddToCacheDependency(mCacheName, mMessageCollection);
            }
            return(mMessageCollection);
        }
Esempio n. 20
0
        /// <summary>
        /// Retrieves all functions from the either the database or cache
        /// </summary>
        /// <returns>A Collection of MFunctinProfiles</returns>
        public static Collection <MFunctionProfile> Functions()
        {
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            BFunctions             mBFunctions            = new BFunctions(mSecurityEntityProfile, ConfigSettings.CentralManagement);
            String mCacheName = mSecurityEntityProfile.Id.ToString(CultureInfo.InvariantCulture) + "_Functions";
            Collection <MFunctionProfile> mRetVal = null;

            mRetVal = (Collection <MFunctionProfile>)(HttpContext.Current.Cache[mCacheName]);
            if (mRetVal == null)
            {
                mRetVal = mBFunctions.GetFunctions(mSecurityEntityProfile.Id);
                CacheController.AddToCacheDependency(mCacheName, mRetVal);
            }
            return(mRetVal);
        }
Esempio n. 21
0
        /// <summary>
        /// Inserts or updates a name value pair given a NameValuePair profile
        /// </summary>
        /// <param name="profile">Details of the profile to added or updated</param>
        /// <returns>The Primary sequence ID</returns>
        /// <remarks></remarks>
        public static int Save(MNameValuePair profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!");
            }
            int mRetVal = -1;
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        myNameValuePair  = new BNameValuePairs(mSecurityProfile);

            CacheController.RemoveFromCache(CachedNameValuePairTableName);
            CacheController.RemoveFromCache(CachedNameValuePairDetailsTableName);
            mRetVal = myNameValuePair.Save(profile);
            return(mRetVal);
        }
Esempio n. 22
0
        /// <summary>
        /// Gets the directories.
        /// </summary>
        /// <returns>Collection{MDirectoryProfile}.</returns>
        public static Collection <MDirectoryProfile> Directories()
        {
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            BDirectories           mBDirectories          = new BDirectories(mSecurityEntityProfile, ConfigSettings.CentralManagement);
            String mCacheName = mSecurityEntityProfile.Id.ToString(CultureInfo.InvariantCulture) + "_" + s_DirectoryInfoCachedName;
            Collection <MDirectoryProfile> mRetVal = null;

            mRetVal = (Collection <MDirectoryProfile>)(HttpContext.Current.Cache[mCacheName]);
            if (mRetVal == null)
            {
                mRetVal = mBDirectories.Directories();
                CacheController.AddToCacheDependency(mCacheName, mRetVal);
            }
            return(mRetVal);
        }
Esempio n. 23
0
        /// <summary>
        /// Gets the menu.
        /// </summary>
        /// <param name="account">The account.</param>
        /// <param name="menuType">Type of the menu.</param>
        /// <returns>DataTable.</returns>
        public static DataTable GetMenu(String account, MenuType menuType)
        {
            if (string.IsNullOrEmpty(account))
            {
                throw new ArgumentNullException("account", "account cannot be a null reference (Nothing in VB) or empty!");
            }
            BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
            DataTable mRetVal   = null;

            if (account.ToUpper(CultureInfo.InvariantCulture) == "ANONYMOUS")
            {
                String mAnonMenu = menuType.ToString() + "Anonymous";
                mRetVal = (DataTable)HttpContext.Current.Cache[mAnonMenu];
                if (mRetVal == null)
                {
                    mRetVal = mBAccount.GetMenu(account, menuType);
                    CacheController.AddToCacheDependency(mAnonMenu, mRetVal);
                }
            }
            else
            {
                String mMenuName = account + "_" + menuType.ToString() + "_MenuData";
                if (HttpContext.Current.Session != null)
                {
                    mRetVal = (DataTable)HttpContext.Current.Session[mMenuName];
                    if (mRetVal == null)
                    {
                        mRetVal = mBAccount.GetMenu(account, menuType);
                        foreach (DataRow item in mRetVal.Rows)
                        {
                            item["URL"] = "?Action=" + item["URL"].ToString();
                        }
                        HttpContext.Current.Session[mMenuName] = mRetVal;
                    }
                }
                else
                {
                    mRetVal = mBAccount.GetMenu(account, menuType);
                    foreach (DataRow item in mRetVal.Rows)
                    {
                        item["URL"] = "?Action=" + item["URL"].ToString();
                    }
                }
            }
            return(mRetVal);
        }
Esempio n. 24
0
        /// <summary>
        /// Gets all roles by BU.
        /// </summary>
        /// <param name="securityEntitySeqId">The SECURIT y_ ENTIT y_ SE q_ ID.</param>
        /// <returns>DataTable.</returns>
        public static DataTable GetAllRolesBySecurityEntity(int securityEntitySeqId)
        {
            DataTable mySecurityEntityRoles = null;

            // attempt to retrieve the information from cache
            mySecurityEntityRoles = (DataTable)HttpContext.Current.Cache[SecurityEntitiesRolesCacheName(securityEntitySeqId)];
            // if the information was not avalible in cache
            // then retieve the information from the DB and put it into
            // cache for subsequent use.
            if (mySecurityEntityRoles == null)
            {
                BRoles myBRoles = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
                mySecurityEntityRoles = myBRoles.GetRolesBySecurityEntity(securityEntitySeqId);
                CacheController.AddToCacheDependency(SecurityEntitiesRolesCacheName(securityEntitySeqId), mySecurityEntityRoles);
            }
            return(mySecurityEntityRoles);
        }
Esempio n. 25
0
        /// <summary>
        /// Saves the specified profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <param name="saveGroups">if set to <c>true</c> [save groups].</param>
        /// <param name="saveRoles">if set to <c>true</c> [save roles].</param>
        public static void Save(MFunctionProfile profile, bool saveGroups, bool saveRoles)
        {
            BFunctions mBAppFunctions = new BFunctions(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            try
            {
                mBAppFunctions.Save(profile, saveGroups, saveRoles);
            }
            catch (DataAccessLayerException ex)
            {
                Logger mLog = Logger.Instance();
                mLog.Error(ex);
            }
            finally
            {
                RemoveCachedFunctions();
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Gets the accounts in role.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <returns>ArrayList.</returns>
        public static ArrayList GetAccountsInRole(MRoleProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be blank or a null reference (Nothing in Visual Basic)");
            }
            ArrayList colAccounts = new ArrayList();
            DataRow   accountsRow = null;
            BRoles    myBRoles    = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
            DataTable myDataTable = myBRoles.GetAccountsInRole(profile);

            foreach (DataRow accountsRow_loopVariable in myDataTable.Rows)
            {
                accountsRow = accountsRow_loopVariable;
                colAccounts.Add((string)accountsRow["ACCT"]);
            }
            return(colAccounts);
        }
Esempio n. 27
0
        /// <summary>
        /// Deletes the specified function given the function seq id.
        /// </summary>
        /// <param name="functionSeqId">The function seq id.</param>
        public static void Delete(int functionSeqId)
        {
            BFunctions mBAppFunctions = new BFunctions(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            try
            {
                mBAppFunctions.Delete(functionSeqId);
            }
            catch (DataAccessLayerException ex)
            {
                Logger mLog = Logger.Instance();
                mLog.Error(ex);
            }
            finally
            {
                RemoveCachedFunctions();
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Deletes the role.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        public static void DeleteRole(MRoleProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be blank or a null reference (Nothing in Visual Basic)");
            }
            BRoles myBRoles = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            try
            {
                myBRoles.DeleteRole(profile);
            }
            catch (DataAccessLayerException ex)
            {
                WebSupportException mEx = new WebSupportException("Could not save the information due to database error please have your administrator check the logs for details.");
                Logger mLog             = Logger.Instance();
                mLog.Error(ex);
                throw mEx;
            }
            RemoveRoleCache(profile.SecurityEntityId);
            FunctionUtility.RemoveCachedFunctions();
        }
Esempio n. 29
0
        /// <summary>
        /// Updates all accounts for role.
        /// </summary>
        /// <param name="roleId">The role ID.</param>
        /// <param name="securityEntitySeqId">The security entity Seq ID.</param>
        /// <param name="accounts">The accounts.</param>
        /// <param name="accountId">The account ID.</param>
        /// <returns><c>true</c> if no errors, <c>true</c> otherwise false</returns>
        public static bool UpdateAllAccountsForRole(int roleId, int securityEntitySeqId, string[] accounts, int accountId)
        {
            if (accounts == null)
            {
                throw new ArgumentNullException("accounts", "accounts cannot be blank or a null reference (Nothing in Visual Basic)");
            }
            bool   success  = false;
            BRoles myBRoles = new BRoles(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);

            try
            {
                success = myBRoles.UpdateAllAccountsForRole(roleId, securityEntitySeqId, accounts, accountId);
            }
            catch (DataAccessLayerException ex)
            {
                WebSupportException mEx = new WebSupportException("Could not save the information due to database error please have your administrator check the logs for details.");
                Logger mLog             = Logger.Instance();
                mLog.Error(ex);
                throw mEx;
            }
            return(success);
        }
Esempio n. 30
0
        /// <summary>
        /// Retrieves an account profile given the account
        /// </summary>
        /// <param name="account">String</param>
        /// <returns>a populated MAccountProfile</returns>
        public static MAccountProfile GetProfile(String account)
        {
            BAccounts       mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement);
            MAccountProfile mRetVal   = null;

            try
            {
                mRetVal = mBAccount.GetProfile(account);
            }
            catch (InvalidOperationException)
            {
                String mMSG = "Count not find account: " + account + " in the database";
                Logger mLog = Logger.Instance();
                mLog.Error(mMSG);
            }
            catch (IndexOutOfRangeException)
            {
                String mMSG = "Count not find account: " + account + " in the database";
                Logger mLog = Logger.Instance();
                mLog.Error(mMSG);
            }
            return(mRetVal);
        }