Esempio n. 1
0
 /// <summary>
 /// method to add user to be updated into updatetrigger queue
 /// </summary>
 /// <param name="updateTriggeringMessage">takes message object as input</param>
 public void AddUpdateTriggerMessageToQueue(UpdateTriggeringMessage updateTriggeringMessage)
 {
     try
     {
         string message = JsonConvert.SerializeObject(updateTriggeringMessage);
         //call dataprovider method to add message to azure queue
         DataProvider.AddMessagetoQueue(CoreConstants.AzureQueues.UpdateTriggerVIPQueueName, message);
     }
     catch (Exception exception)
     {
         LoggerHelper.WriteToLog(exception + " - Error while adding message to updatetriggering queue in DAL : "
                                 + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
         throw new DataAccessException();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// method to add message to queue to trigger userbackend update
        /// </summary>
        /// <param name="userbackend">takes userbackend as input</param>
        public void TriggerUserBackendUpdate(UserBackendEntity userbackend, bool isForceUpdate)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UpdateTriggeringMessage updateTriggerMessage = new UpdateTriggeringMessage();
                UserUpdateMsg           usermsg = new UserUpdateMsg();
                usermsg.UserID = userbackend.UserID;
                List <UpdateTriggerBackend> updatetriggerbackendlist = new List <UpdateTriggerBackend>();
                //adding backend to message object
                UpdateTriggerBackend triggerbackend = new UpdateTriggerBackend();
                triggerbackend.BackendID         = userbackend.BackendID;
                updateTriggerMessage.ChangeAfter = userbackend.LastUpdate;
                updatetriggerbackendlist.Add(triggerbackend);
                usermsg.Backends = updatetriggerbackendlist;
                //creating list to add users
                List <UserUpdateMsg> usermsglist = new List <UserUpdateMsg>();
                usermsglist.Add(usermsg);
                updateTriggerMessage.Users = usermsglist;
                //calling data access layer method to add message to queue
                PersonalizationDAL personalizationdal = new PersonalizationDAL();
                if (isForceUpdate)
                {
                    personalizationdal.ForceUpdate_AddUpdateTriggerMessageToQueue(updateTriggerMessage);
                }
                else
                {
                    personalizationdal.AddUpdateTriggerMessageToQueue(updateTriggerMessage);
                }
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while formatting updatetriggering message : "
                //+ exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// method to add user to be updated into vip queue
        /// </summary>
        /// <param name="updateTriggeringMessage"></param>
        public void ForceUpdate_AddUpdateTriggerMessageToQueue(UpdateTriggeringMessage updateTriggeringMessage)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                string message = JsonConvert.SerializeObject(updateTriggeringMessage);
                //call dataprovider method to add message to azure queue
                DataProvider.AddMessagetoQueue(forceupdatequeue, message);
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error while adding message to updatetriggering queue in DAL : "
                //+ exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new DataAccessException();
            }
        }
Esempio n. 4
0
        //// <summary>
        /// method to trigger user requsets update
        /// </summary>
        /// <param name="UserID">takes userid as input</param>
        /// <param name="userbackendslist">takes userbackends list as input</param>
        public void TriggerUserRequests(string userID, IEnumerable <UserBackendDTO> userbackendslist)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UpdateTriggeringMessage updateTriggerMessage = new UpdateTriggeringMessage();
                UserUpdateMsg           usermsg = new UserUpdateMsg();
                usermsg.UserID = userID;
                List <UpdateTriggerBackend> updatetriggerbackendlist = new List <UpdateTriggerBackend>();
                //adding each user backend details to list for adding to message
                foreach (UserBackendDTO userbackend in userbackendslist)
                {
                    UpdateTriggerBackend triggerbackend = new UpdateTriggerBackend();
                    triggerbackend.BackendID = userbackend.backend.BackendID;
                    updatetriggerbackendlist.Add(triggerbackend);
                }
                usermsg.Backends = updatetriggerbackendlist;
                //creating list to add users
                List <UserUpdateMsg> usermsglist = new List <UserUpdateMsg>();
                usermsglist.Add(usermsg);
                updateTriggerMessage.Users   = usermsglist;
                updateTriggerMessage.GetPDFs = Convert.ToBoolean(ConfigurationManager.AppSettings[CoreConstants.Config.GetPDFs]);
                //calling data access layer method to add message to queue
                PersonalizationDAL personalizationdal = new PersonalizationDAL();
                personalizationdal.AddUpdateTriggerMessageToQueue(updateTriggerMessage);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while formatting updatetriggering message : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// method to add message to queue to trigger request update
        /// </summary>
        /// <param name="request">takes request as input</param>
        public void TriggerRequestUpdate(RequestEntity request, string UserID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UpdateTriggeringMessage updateTriggerMessage     = new UpdateTriggeringMessage();
                List <RequestUpdateMsg> updatetriggerrequestlist = new List <RequestUpdateMsg>();
                RequestUpdateMsg        triggerrequset           = new RequestUpdateMsg();
                //adding request to message object
                Request requestobj = new Request();
                requestobj.ID          = request.ID;
                requestobj.UserID      = UserID;
                triggerrequset.request = requestobj;

                //adding backend to queue message
                UpdateTriggerBackend backendobj = new UpdateTriggerBackend();
                backendobj.BackendID           = request.BackendID;
                triggerrequset.request.Backend = backendobj;
                //add requests to list which will be added to message
                updatetriggerrequestlist.Add(triggerrequset);
                updateTriggerMessage.Requests = updatetriggerrequestlist;
                updateTriggerMessage.GetPDFs  = Convert.ToBoolean(ConfigurationManager.AppSettings[CoreConstants.Config.GetPDFs]);
                //calling data access layer method to add message to queue
                PersonalizationDAL personalizationdal = new PersonalizationDAL();
                personalizationdal.AddUpdateTriggerMessageToQueue(updateTriggerMessage);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while formatting updatetriggering message : "
                //+ exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
Esempio n. 6
0
 /// <summary>
 /// method to add message to queue to trigger request update
 /// </summary>
 /// <param name="requestID">takes requestid as input</param>
 /// <param name="UserID">takes userid as input</param>
 /// <param name="BackendID">takes backendid as input</param>
 public void RequestUpdateTrigger(string requestID, string UserID, string BackendID)
 {
     try
     {
         UpdateTriggeringMessage updateTriggerMessage     = new UpdateTriggeringMessage();
         List <RequestUpdateMsg> updatetriggerrequestlist = new List <RequestUpdateMsg>();
         RequestUpdateMsg        triggerrequset           = new RequestUpdateMsg();
         //adding request to message object
         RequestMsg requestobj = new RequestMsg();
         requestobj.ID          = requestID;
         requestobj.UserID      = UserID;
         triggerrequset.request = requestobj;
         //adding backend to queue message
         UpdateTriggerBackend backendobj = new UpdateTriggerBackend();
         backendobj.BackendID           = BackendID;
         triggerrequset.request.Backend = backendobj;
         //add requests to list which will be added to message
         updatetriggerrequestlist.Add(triggerrequset);
         updateTriggerMessage.Requests = updatetriggerrequestlist;
         //set VIP message flag to true
         updateTriggerMessage.VIP = true;
         //calling DAL method to update backend entity
         RequestUpdateDAL requestupdatedal = new RequestUpdateDAL();
         requestupdatedal.AddUpdateTriggerMessageToQueue(updateTriggerMessage);
     }
     catch (DataAccessException DALexception)
     {
         throw DALexception;
     }
     catch (Exception exception)
     {
         LoggerHelper.WriteToLog(exception + " - Error in BL while formatting updatetriggering message : "
                                 + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
         throw new BusinessLogicException();
     }
 }