Exemplo n.º 1
0
        /// <summary>
        /// Method to associate all existing backends in the system to user
        /// </summary>
        /// <param name="userid">takes userid as input</param>
        public void AddAllBackends(string userid)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserBackendDAL userbackenddal = new UserBackendDAL();
                //method to get all backends available in system
                List <BackendEntity>     backends         = userbackenddal.GetBackends();
                List <UserBackendEntity> userbackendslist = new List <UserBackendEntity>();
                //preparing userbackend obj for each backend obj
                foreach (BackendEntity backend in backends)
                {
                    UserBackendEntity userbackend = new UserBackendEntity();
                    userbackend.PartitionKey           = string.Concat(CoreConstants.AzureTables.UserBackendPK, userid);
                    userbackend.RowKey                 = backend.BackendID;
                    userbackend.BackendID              = backend.BackendID;
                    userbackend.UserID                 = userid;
                    userbackend.DefaultUpdateFrequency = Convert.ToInt32(ConfigurationManager.AppSettings[CoreConstants.Config.UpdateFrequency]);
                    userbackendslist.Add(userbackend);
                }
                //calling data access layer method to add backends
                userbackenddal.AddBackends(userbackendslist);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while adding userbackends : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///method to add userbackends
        /// </summary>
        /// <param name="Backendtouser">takes list of user backends as input</param>
        public void AddBackends(List <UserBackendEntity> Backendtouser)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserBackendDAL userbackenddal = new UserBackendDAL();
                //calling data access layer method
                userbackenddal.AddBackends(Backendtouser);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while adding userbackends : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }