private void CreateReminding()
        {
            var          remindingUtilities    = ClassFactory.Get <RemindingUtilities>();
            EntitySchema entitySchema          = UserConnection.EntitySchemaManager.FindInstanceByName("ForecastSheet");
            var          _currentUserContactId = UserConnection.CurrentUser.ContactId;
            var          config = new RemindingConfig(entitySchema.UId)
            {
                AuthorId    = _currentUserContactId,
                ContactId   = _currentUserContactId,
                SubjectId   = ForecastSheet.Id,
                Description = GetLocalizableString("RemindingDescription"),
                PopupTitle  = string.Format(GetLocalizableString("RemindingPopupTitle"), ForecastSheet.Name)
            };

            remindingUtilities.CreateReminding(UserConnection, config);
        }
        /// <summary>
        /// Notifies the model owners.
        /// </summary>
        /// <param name="message">The message for notification.</param>
        public virtual void NotifyModelEventRecipients(string message)
        {
            if (!_userConnection.GetIsFeatureEnabled("MLNotifications"))
            {
                return;
            }
            var remindingUtilities = ClassFactory.Get <RemindingUtilities>();

            foreach (Guid contactId in GetTargetContacts())
            {
                var config = new RemindingConfig(_contactSchemaUId)
                {
                    AuthorId    = _userConnection.CurrentUser.ContactId,
                    ContactId   = contactId,
                    SubjectId   = contactId,
                    Description = message
                };
                remindingUtilities.CreateReminding(_userConnection, config);
            }
        }
Esempio n. 3
0
        private void CreateReminding(UserConnection userConnection, Guid forecastId)
        {
            var remindingUtilities = ClassFactory.Get <RemindingUtilities>();
            var sheetRepository    = ClassFactory.Get <IForecastSheetRepository>(
                new ConstructorArgument("userConnection", userConnection));
            var  sheet                 = sheetRepository.GetSheet(forecastId);
            Guid entitySchemaUId       = userConnection.EntitySchemaManager.GetItemByName("ForecastSheet").UId;
            var  _currentUserContactId = userConnection.CurrentUser.ContactId;
            var  config                = new RemindingConfig(entitySchemaUId)
            {
                AuthorId    = _currentUserContactId,
                ContactId   = _currentUserContactId,
                SubjectId   = forecastId,
                Description = GetLocalizableString(userConnection, "RemindingDescription"),
                PopupTitle  = string.Format(GetLocalizableString(userConnection, "RemindingPopupTitle"),
                                            sheet.Name)
            };
            var message = new {
                forecastId
            };

            MsgChannelUtilities.PostMessage(userConnection, "UpdateForecasts", JsonConvert.SerializeObject(message));
            remindingUtilities.CreateReminding(userConnection, config);
        }