private void Schedule_ReminderFormActionChanged(object sender, ReminderFormActionChangedEventArgs e) { //To Get the action of schedule appointments. ReminderAction action = e.Action; //To Get list of appointments that are changed. var appointments = e.Appointments; //To Get the snooze time of action changed appointments. var timeSpan = e.SnoozeTime; }
private void GetReminderCollectionByDate(DateTime?dateTime) { this.ShowProgressBar = true; this.SearchDateTime = null; this.SearchDateTime = dateTime; Task.Factory.StartNew(() => { this.Entity = dateTime.HasValue ? ReminderAction.GetReminders(this.DBConnectionString, dateTime.Value) : ReminderAction.GetReminders(this.DBConnectionString); this.ShowProgressBar = false; }); }
//private void FindNextAvailableAppointmentTime() //{ // try // { // if (this.AppointmentCollection != null && // this.AppointmentCollection.InternalList.Any(x => x.BeginTime == this.Entity.BeginTime)) // { // this.Entity.BeginTime = this.Entity.BeginTime.AddMinutes(30); // FindNextAvailableAppointmentTime(); // } // } // catch (Exception exception) // { // NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured, // ExceptionResources.ExceptionOccuredLogDetail); // } //} private void GetReminders(DateTime dateTime) { try { Task.Factory.StartNew(() => { this.ReminderList = ReminderAction.GetReminders(this.DBConnectionString, dateTime); }); } catch (Exception exception) { NLogLogger.LogError(exception, TitleResources.Error, ExceptionResources.ExceptionOccured, ExceptionResources.ExceptionOccuredLogDetail); } }
private void DeleteReminder(DialogResult dialogResult) { if (dialogResult == DialogResult.Ok) { Task.Factory.StartNew(() => { ReminderAction.DeleteReminders(this.DBConnectionString, this.Entity.InternalList.Where(x => x.IsSelected)); GetReminderCollectionByDate(this.SearchDateTime); ShowProgressBar = false; }); } else { ShowProgressBar = false; } }
public static ICommandResult Reminders(DiscordUserMessageContext context, ReminderAction action = ReminderAction.List, int id = 0) { var reminders = context.Bot.Reminders.Reminders.Where(x => x.ReceiverId == context.Message.Author.Id).OrderBy(x => x.Timestamp); switch (action) { case ReminderAction.List: StringBuilder builder = new StringBuilder(); builder.AppendLine("```"); builder.AppendLine($"{"ID",-4}{"Date",-25}{"Sender",-20}Message"); if (!reminders.Any()) { return(new SuccessResult("No reminders!")); } int counter = 1; foreach (var reminder in reminders) { builder.AppendLine($"{counter++,-4}{(reminder.Timestamp - DateTimeOffset.Now).ToShortString(),-25}{context.Bot.Client.GetUser(reminder.SenderId).Username,-20}{reminder.Message}"); } builder.AppendLine("```"); return(new SuccessResult(builder.ToString())); case ReminderAction.Delete: if (id == 0) { return(new ErrorResult("Please enter a reminder ID")); } if (id < 1 || !reminders.Any()) { return(new ErrorResult("That reminder does not exist")); } var r = reminders.ToList()[id - 1]; context.Bot.Reminders.Reminders.Remove(r); context.Bot.Reminders.SaveConfig(); return(new SuccessResult($"Reminder '{r.Message}' deleted")); default: return(new ErrorResult(new NotImplementedException("This feature doesn't exist"))); } }
public async Task <bool> ActionReminderAsync(string userId, ReminderAction action) { // TODO: temp code pending db re-schema to store the action timestamp and notes action.ActionedAt = dateTimeService.GetCurrentDateTime(); if (String.IsNullOrWhiteSpace(action.Notes)) { action.Notes = null; } // get the next due date var reminder = await this.GetReminderByIdAsync(userId, action.ReminderId); if (reminder == null) { return(false); } // set it as the last-actioned date return(await this.remindersRepository.UpdateReminderLastActionedAsync(userId, reminder.Id, reminder.NextDueDate)); }
private void OnSaveCallLog() { var returnStatus = false; returnStatus = !IsInEditMode?ReminderAction.AddReminder(this.DBConnectionString, this.Entity) : ReminderAction.UpdateReminder(this.DBConnectionString, this.Entity); if (returnStatus) { if (RefreshReminders != null) { this.RefreshReminders(this.Entity.ReminderDate); } var messageDailog = new MessageDailog() { Caption = Resources.MessageResources.DataSavedSuccessfully, DialogButton = DialogButton.Ok, Title = Resources.TitleResources.Information }; MessengerInstance.Send(messageDailog); if (this.CloseWindow != null) { this.CloseWindow(); } } else { var messageDailog = new MessageDailog() { Caption = Resources.MessageResources.DataSavedFailed, DialogButton = DialogButton.Ok, Title = Resources.TitleResources.Error }; MessengerInstance.Send(messageDailog); } }