コード例 #1
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);
        }
コード例 #2
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();
        }
コード例 #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));
        }
コード例 #4
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)));
        }
コード例 #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"));
        }
コード例 #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);
        }
コード例 #7
0
        /// <summary>
        /// AutoCreateAccount will automatically create an account based on infomration found both in the web.config file
        /// and the database.
        /// </summary>
        /// <returns>MAccountProfile</returns>
        public static MAccountProfile AutoCreateAccount()
        {
            MAccountProfile mCurrentAccountProfile = AccountUtility.GetProfile("System");
            MAccountProfile mAccountProfileToSave  = new MAccountProfile();
            Logger          mLog = Logger.Instance();

            mAccountProfileToSave.Id = -1;
            bool   mSaveGroups = true;
            bool   mSaveRoles  = true;
            string mGroups     = ConfigSettings.RegistrationGroups;
            string mRoles      = ConfigSettings.RegistrationRoles;

            if (string.IsNullOrEmpty(mGroups))
            {
                mSaveGroups = false;
            }
            if (string.IsNullOrEmpty(mRoles))
            {
                mSaveRoles = false;
            }
            mAccountProfileToSave.Account       = AccountUtility.HttpContextUserName();
            mAccountProfileToSave.FirstName     = "Auto created";
            mAccountProfileToSave.MiddleName    = "";
            mAccountProfileToSave.LastName      = "Auto created";
            mAccountProfileToSave.PreferredName = "Auto created";
            mAccountProfileToSave.Email         = "*****@*****.**";
            mAccountProfileToSave.Location      = "Hawaii";
            mAccountProfileToSave.TimeZone      = -8;
            mAccountProfileToSave.AddedBy       = mCurrentAccountProfile.Id;
            mAccountProfileToSave.AddedDate     = DateTime.Now;
            mAccountProfileToSave.SetGroups(mGroups);
            mAccountProfileToSave.SetRoles(mRoles);
            mAccountProfileToSave.PasswordLastSet = DateTime.Now;
            mAccountProfileToSave.LastLogOn       = DateTime.Now;
            mAccountProfileToSave.Password        = CryptoUtility.Encrypt(ConfigSettings.RegistrationPassword, ConfigSettings.EncryptionType);
            mAccountProfileToSave.Status          = (int)SystemStatus.SetAccountDetails;
            MClientChoicesState    mClientChoiceState     = ClientChoicesUtility.GetClientChoicesState(ConfigSettings.RegistrationAccountChoicesAccount, true);
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.GetProfile(ConfigSettings.RegistrationSecurityEntityId);

            mClientChoiceState.IsDirty = false;
            mClientChoiceState[MClientChoices.AccountName]        = mAccountProfileToSave.Account;
            mClientChoiceState[MClientChoices.SecurityEntityId]   = mSecurityEntityProfile.Id.ToString(CultureInfo.InvariantCulture);
            mClientChoiceState[MClientChoices.SecurityEntityName] = mSecurityEntityProfile.Name;
            try
            {
                AccountUtility.Save(mAccountProfileToSave, mSaveRoles, mSaveGroups, mSecurityEntityProfile);
                ClientChoicesUtility.Save(mClientChoiceState, false);
                AccountUtility.SetPrincipal(mAccountProfileToSave);
            }
            catch (Exception ex)
            {
                mLog.Error(ex);
                throw;
            }
            return(mAccountProfileToSave);
        }
コード例 #8
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);
        }
コード例 #9
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));
        }
コード例 #10
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);
        }
コード例 #11
0
        /// <summary>
        /// Removes all fucntion cache for each Security Entity
        /// </summary>
        public static void RemoveCachedFunctions()
        {
            String mCacheName = string.Empty;
            Collection <MSecurityEntityProfile> mSecurityProfiles = SecurityEntityUtility.Profiles();

            foreach (MSecurityEntityProfile mProfile in mSecurityProfiles)
            {
                mCacheName = mProfile.Id.ToString(CultureInfo.InvariantCulture) + "_Functions";
                CacheController.RemoveFromCache(mCacheName);
            }
        }
コード例 #12
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));
        }
コード例 #13
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);
     }
 }
コード例 #14
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);
     }
 }
コード例 #15
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);
        }
コード例 #16
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();
        }
コード例 #17
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));
        }
コード例 #18
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);
     }
 }
コード例 #19
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);
     }
 }
コード例 #20
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);
        }
コード例 #21
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);
        }
コード例 #22
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);
        }
コード例 #23
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);
        }
コード例 #24
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);
        }
コード例 #25
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);
        }
コード例 #26
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);
        }
コード例 #27
0
        /// <summary>
        /// Save the client choices to the database.
        /// </summary>
        /// <param name="clientChoicesState">MClientChoicesState</param>
        /// <param name="updateContext">bool</param>
        /// <remarks></remarks>
        public static void Save(MClientChoicesState clientChoicesState, bool updateContext)
        {
            if (clientChoicesState == null)
            {
                throw new ArgumentNullException("clientChoicesState", "clientChoicesState cannot be a null reference (Nothing in Visual Basic)! (Nothing in VB)!");
            }
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.DefaultProfile();
            BClientChoices         mBClientChoices        = new BClientChoices(mSecurityEntityProfile, ConfigSettings.CentralManagement);

            mBClientChoices.Save(clientChoicesState);
            if (updateContext)
            {
                if (HttpContext.Current.Cache != null)
                {
                    HttpContext.Current.Cache[MClientChoices.SessionName] = clientChoicesState;
                }
            }
        }
コード例 #28
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);
        }
コード例 #29
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();
            }
        }
コード例 #30
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();
            }
        }