Beispiel #1
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,
                    unit: true),
                column: column,
                updated: updated,
                update: update));
 }
Beispiel #2
0
 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));
 }
 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));
     }
 }
Beispiel #4
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);
            }
        }
Beispiel #5
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));
 }
Beispiel #6
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));
            }
        }