Esempio n. 1
0
        public override void PrepereSynchronizeSubjectRemindingUserTask(SynchronizeSubjectRemindingUserTask userTask, Guid contact, DateTime remindTime, bool active, Guid source)
        {
            base.PrepereSynchronizeSubjectRemindingUserTask(userTask, contact, remindTime, active, source);
            bool isFeatureEnabled = FeatureUtilities.GetIsFeatureEnabled(UserConnection, "NotificationV2");

            if (isFeatureEnabled)
            {
                IRemindingTextFormer textFormer = ClassFactory.Get <ActivityRemindingTextFormer>(
                    new ConstructorArgument("userConnection", UserConnection));
                string accountName = GetLookupDisplayColumnValue(Entity, "Account");
                string contactName = GetLookupDisplayColumnValue(Entity, "Contact");
                string title       = Entity.GetTypedColumnValue <string>("Title");
                userTask.SubjectCaption = textFormer.GetBody(new Dictionary <string, object> {
                    { "AccountName", accountName },
                    { "ContactName", contactName },
                    { "Title", title }
                });
                userTask.PopupTitle = textFormer.GetTitle(new Dictionary <string, object>());
            }
        }
Esempio n. 2
0
        private Reminding GetReminding(IDataReader reader)
        {
            var contactId                   = reader.GetColumnValue <Guid>("ReceiverId");
            var entityId                    = reader.GetColumnValue <Guid>("Id");
            var entityName                  = reader.GetColumnValue <string>("Name");
            var sysEntitySchemaId           = reader.GetColumnValue <Guid>("SubjectId");
            var schema                      = UserConnection.EntitySchemaManager.GetItemByUId(sysEntitySchemaId);
            var dateString                  = reader.GetColumnValue <string>("SubjectCaption");
            var anniversaryBaseDate         = reader.GetColumnValue <DateTime>("AnniversaryBaseDate");
            IRemindingTextFormer textFormer = ClassFactory.Get <AnniversaryRemindingTextFormer>(
                new ConstructorArgument("userConnection", UserConnection));
            var title = textFormer.GetTitle(new Dictionary <string, object> {
                { "SchemaName", schema.Name }
            });
            var body = textFormer.GetBody(new Dictionary <string, object> {
                { "SchemaName", schema.Name },
                { "EntityId", entityId },
                { "EntityName", entityName },
                { "Date", dateString }
            });
            var reminding = new Reminding(_userConnection);

            reminding.SetDefColumnValues();
            reminding.RemindTime         = reader.GetColumnValue <DateTime>("RemindTime");
            reminding.Description        = title;
            reminding.PopupTitle         = title;
            reminding.ContactId          = contactId;
            reminding.SubjectCaption     = body;
            reminding.SubjectId          = entityId;
            reminding.SourceId           = SourceId;
            reminding.SenderId           = sysEntitySchemaId;
            reminding.SysEntitySchemaId  = sysEntitySchemaId;
            reminding.NotificationTypeId = RemindingConsts.NotificationTypeAnniversaryId;
            reminding.TypeCaption        = dateString;
            reminding.AnniversaryDate    = new DateTime(DateTime.Today.Year, anniversaryBaseDate.Month, anniversaryBaseDate.Day);
            return(reminding);
        }