コード例 #1
0
ファイル: Synch.cs プロジェクト: mkbiltek2019/MyProjs
        /// <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();
            }
        }
コード例 #2
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();
            }
        }