public static string ToNotice(
            this Attachments self,
            Context context,
            string saved,
            Column column,
            NotificationColumnFormat notificationColumnFormat,
            bool updated,
            bool update)
        {
            var body = new StringBuilder();

            body.Append("\n");
            self.ForEach(attachment =>
            {
                if (attachment.Added == true)
                {
                    body.Append("  {0} - {1}\n".Params(
                                    Displays.Add(context: context),
                                    attachment.Name));
                }
                else if (attachment.Deleted == true)
                {
                    body.Append("  {0} - {1}\n".Params(
                                    Displays.Delete(context: context),
                                    attachment.Name));
                }
            });
            return(notificationColumnFormat.DisplayText(
                       self: body.ToString(),
                       saved: null,
                       column: column,
                       updated: updated && !body.ToString().IsNullOrEmpty(),
                       update: update));
        }
 public static string ToNotice(
     this string self,
     Context context,
     string saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     if (column.HasChoices())
     {
         var selfChoiceParts = column.ChoiceParts(
             context: context,
             selectedValues: self,
             type: ExportColumn.Types.Text);
         var savedChoiceParts = column.ChoiceParts(
             context: context,
             selectedValues: saved,
             type: ExportColumn.Types.Text);
         return(notificationColumnFormat.DisplayText(
                    self: column.MultipleSelections == true
                 ? selfChoiceParts.Join(", ")
                 : selfChoiceParts.FirstOrDefault(),
                    saved: column.MultipleSelections == true
                 ? savedChoiceParts.Join(", ")
                 : savedChoiceParts.FirstOrDefault(),
                    column: column,
                    updated: updated,
                    update: update));
     }
     else
     {
         return(notificationColumnFormat.DisplayText(
                    self: self,
                    saved: saved,
                    column: column,
                    updated: updated,
                    update: update));
     }
 }
示例#3
0
        public string ToNotice(
            Context context,
            string saved,
            Column column,
            NotificationColumnFormat notificationColumnFormat,
            bool updated,
            bool update)
        {
            var body = string.Empty;

            if (context.Action == "deletecomment")
            {
                body = Displays.CommentDeleted(context: context) + "\n";
            }
            if (this.Any())
            {
                var created = this.FirstOrDefault(o => o.Created)?.Body;
                if (created != null)
                {
                    body += notificationColumnFormat.DisplayText(
                        self: created,
                        saved: string.Empty,
                        column: column,
                        updated: updated,
                        update: update);
                }
                this.Where(o => o.Updated).ForEach(comment =>
                                                   body += notificationColumnFormat.DisplayText(
                                                       self: comment.Body,
                                                       saved: string.Empty,
                                                       column: column,
                                                       updated: updated,
                                                       update: update));
                return(body);
            }
            else
            {
                return(string.Empty);
            }
        }
示例#4
0
 public static string ToNotice(
     this string self,
     Context context,
     string saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(column.HasChoices()
         ? notificationColumnFormat.DisplayText(
                self: column.Choice(self).Text,
                saved: column.Choice(saved).Text,
                column: column,
                updated: updated,
                update: update)
         : notificationColumnFormat.DisplayText(
                self: self,
                saved: saved,
                column: column,
                updated: updated,
                update: update));
 }
示例#5
0
 public string ToNotice(
     Context context,
     int saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: column.Choice(Value.ToString()).Text,
                saved: column.Choice(saved.ToString()).Text,
                column: column,
                updated: updated,
                update: update));
 }
示例#6
0
 public string ToNotice(
     Context context,
     string saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: Value,
                saved: saved,
                column: column,
                updated: updated,
                update: update));
 }
 public static string ToNotice(
     this long self,
     Context context,
     long saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: self.ToString(),
                saved: saved.ToString(),
                column: column,
                updated: updated,
                update: update));
 }
示例#8
0
 public string ToNotice(
     Context context,
     int saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: Name,
                saved: SiteInfo.User(
                    context: context,
                    userId: saved).Name,
                column: column,
                updated: updated,
                update: update));
 }
示例#9
0
 public virtual string ToNotice(
     Context context,
     DateTime saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: column.DisplayControl(
                    context: context,
                    value: DisplayValue),
                saved: column.DisplayControl(
                    context: context,
                    value: saved.ToLocal(context: context)),
                column: column,
                updated: updated,
                update: update));
 }
示例#10
0
 public string ToNotice(
     Context context,
     decimal?saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: column.Display(
                    context: context,
                    value: Value,
                    unit: true),
                saved: column.Display(
                    context: context,
                    value: saved.ToDecimal(),
                    unit: true),
                column: column,
                updated: updated,
                update: update));
 }
 public override string ToNotice(
     Context context,
     DateTime saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: column.DisplayControl(
                    context: context,
                    value: DisplayValue),
                saved: column.DisplayControl(
                    context: context,
                    value: saved
                    .ToLocal(context: context)
                    .AddDifferenceOfDates(column.EditorFormat, minus: true)),
                column: column,
                updated: updated,
                update: update));
 }
示例#12
0
        public static string ToNotice(
            this string self,
            Context context,
            string saved,
            Column column,
            NotificationColumnFormat notificationColumnFormat,
            bool updated,
            bool update)
        {
            if (column.HasChoices())
            {
                switch (column.Type)
                {
                case Column.Types.Dept:
                    return(notificationColumnFormat.DisplayText(
                               self: SiteInfo.Dept(
                                   tenantId: context.TenantId,
                                   deptId: self.ToInt()).Name,
                               saved: SiteInfo.Dept(
                                   tenantId: context.TenantId,
                                   deptId: saved.ToInt()).Name,
                               column: column,
                               updated: updated,
                               update: update));

                case Column.Types.Group:
                    return(notificationColumnFormat.DisplayText(
                               self: SiteInfo.Group(
                                   tenantId: context.TenantId,
                                   groupId: self.ToInt()).Name,
                               saved: SiteInfo.Group(
                                   tenantId: context.TenantId,
                                   groupId: saved.ToInt()).Name,
                               column: column,
                               updated: updated,
                               update: update));

                case Column.Types.User:
                    return(notificationColumnFormat.DisplayText(
                               self: SiteInfo.UserName(
                                   context: context,
                                   userId: self.ToInt()),
                               saved: SiteInfo.UserName(
                                   context: context,
                                   userId: saved.ToInt()),
                               column: column,
                               updated: updated,
                               update: update));

                default:
                    return(notificationColumnFormat.DisplayText(
                               self: column.Choice(self).Text,
                               saved: column.Choice(saved).Text,
                               column: column,
                               updated: updated,
                               update: update));
                }
            }
            else
            {
                return(notificationColumnFormat.DisplayText(
                           self: self,
                           saved: saved,
                           column: column,
                           updated: updated,
                           update: update));
            }
        }