Example #1
0
        private void SetEventDetails(SavedEvent @event)
        {
            DateAndTime currDate       = new DateAndTime(TimeAndDateUtility.GetCurrentDate(), TimeAndDateUtility.GetCurrentTime());
            DateAndTime eventStartDate = @event.ActivationDate;
            DateAndTime eventEndDate   = @event.DeactivationDate;

            Exp_Start_Date.SetText(TimeAndDateUtility.ConvertDate_String(@event.ActivationDate.Date, true));
            Exp_Start_Time.SetText(TimeAndDateUtility.ConvertTime_String(@event.ActivationDate.Time));
            Exp_End_Date.SetText(TimeAndDateUtility.ConvertDate_String(@event.DeactivationDate.Date, true));
            Exp_End_Time.SetText(TimeAndDateUtility.ConvertTime_String(@event.DeactivationDate.Time));
            Created_Date.SetText(
                $"{TimeAndDateUtility.ConvertDate_String(@event.CreatedDate.Date, true)} {TimeAndDateUtility.ConvertTime_String(@event.CreatedDate.Time)}");

            Completion_Date.SetText(
                @event.Completed && @event.CompletedDate != null && @event.CompletedDate.Date != null && @event.CompletedDate.Time != null ?
                $"{TimeAndDateUtility.ConvertDate_String(@event.CompletedDate.Date, true)} {TimeAndDateUtility.ConvertTime_String(@event.CompletedDate.Time)}"
                    : DASH);

            Event_Status.SetText(
                @event.Completed ? "Complete"
                    : TimeAndDateUtility.IsBeforeRange(eventStartDate, currDate) ?
                "Upcoming"
                        : TimeAndDateUtility.IsWithinRange(eventStartDate, currDate, eventEndDate) ?
                "In Progress" : "Overdue");
            Event_Status.SetBackColor(
                @event.Completed ? Color.DarkGreen
                    : TimeAndDateUtility.IsBeforeRange(eventStartDate, currDate) ?
                Color.DarkGray
                        : TimeAndDateUtility.IsWithinRange(eventStartDate, currDate, eventEndDate) ?
                Color.DarkBlue : Color.DarkRed);

            User_Title.SetText(@event.Title);

            User_Comment.SetText(!string.IsNullOrEmpty(@event.Comment) ? @event.Comment : NO_COMMENT);
        }
Example #2
0
        private void SetMessageDetails(AppMessage message)
        {
            Title.SetText(message.Title);
            MessageTB.SetText(message.Quote);
            AuthorsTB.SetText(string.IsNullOrEmpty(message.Author) ? NO_AUTHORS : message.Author);
            SourcesTB.SetText(string.IsNullOrEmpty(message.Source) ? NO_SOURCES : message.Source);

            Date_Created.SetText(TimeAndDateUtility.ConvertDate_String(message.CreatedDate.Date, true));
            Time_Created.SetText(TimeAndDateUtility.ConvertTime_String(message.CreatedDate.Time));

            bool fullLastDisplayedDate = message.LastDisplayedDate == null || message.LastDisplayedDate.Date == null || message.LastDisplayedDate.Time == null;

            Last_Displayed_Date.SetText(fullLastDisplayedDate ?
                                        DASH : TimeAndDateUtility.ConvertDate_String(message.LastDisplayedDate.Date, true));

            Last_Displayed_Time.SetText(fullLastDisplayedDate ?
                                        DASH : TimeAndDateUtility.ConvertTime_String(message.LastDisplayedDate.Time));

            Status.SetText(message.Show ? ENABLE : DISABLE);
            Status.SetBackColor(message.Show ? Color.DarkGreen : Color.DarkRed);
            Status.SetForeColor(Color.WhiteSmoke);

            string preview = $"\"{MessageTB.Text}\"\r\n\r\n    - {AuthorsTB.Text}\r\n\r\nSources:\r\n    {SourcesTB.Text}";

            PreviewTB.SetText(preview);
        }
Example #3
0
 public static string FormatDate(DateAndTime date)
 {
     return(date == null ? $"{PlusSign}" : $"{TimeAndDateUtility.ConvertDate_String(date.Date)}{PlusSign}{TimeAndDateUtility.ConvertTime_String(date.Time)}");
 }