public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Reminders.Clear(); if (MongoRepo.LoggedUser != null) { var pills = await MongoRepo.GetAllRemindersAsync(MongoRepo.LoggedUser.Username); foreach (var pill in pills) { Reminders.Add(pill); } } else { await Application.Current.MainPage.DisplayAlert("Reminders", "You should login to see reminders!", "OK"); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async Task ExecuteLoadRemindersCommand() { if (IsBusy) { return; } IsBusy = true; try { Reminders.Clear(); var parameters = new Dictionary <Constants.Parameter, object>(); parameters[Constants.Parameter.ReminderListId] = ReminderList.Id; var reminders = await ReminderDataStore.GetModelsAsync(true, parameters); reminders = reminders.OrderBy(r => r.Completed).ThenByDescending(r => r.DueDate); foreach (var reminder in reminders) { Reminders.Add(reminder); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async void AddReminderExecute(object o) { LoaderManager.Instance.ShowLoader(); await Task.Run(() => { Reminder reminder; int hourNow = DateTime.Now.Hour; var today = DateTime.Today.Date; if (hourNow != 23) { reminder = new Reminder(today, hourNow + 1, DateTime.Now.Minute, "", StationManager.CurrentUser); } else { reminder = new Reminder(today.AddDays(1), 00, DateTime.Now.Minute, "", StationManager.CurrentUser); } Reminders.Add(reminder); SelectedReminder = reminder; DBManager.AddReminder(reminder); RunReminderExecute(reminder.Guid); return(true); }); LoaderManager.Instance.HideLoader(); OnPropertyChanged(); Logger.Log("Created new reminder"); }
public void AddStandardReminder() { double hoursBeforeRaid = 0.5; string message = $"The raid starts in {hoursBeforeRaid * 60} minutes."; RaidReminder reminder = new RaidReminder(RaidReminder.ReminderType.User, message, hoursBeforeRaid, 0); StandardReminderId = Guid.NewGuid(); Reminders.Add(StandardReminderId, reminder); }
public Reminders GetReminders(int projectId) { var tblReminders = m_db.Query <TableReminders>("select * from dbo.Reminders where project_id = @0 ", projectId); Reminders rt = new Reminders(); foreach (var r in tblReminders) { Reminder reminder = new Reminder(r); reminder = Decrypt(reminder); rt.Add(reminder); } return(rt); }
private void SetReminders() { Reminders.Clear(); ObservableCollection <Reminder> reminders = GetAll(); if (reminders != null) { foreach (Reminder reminder in reminders) { Reminders.Add(reminder); } } }
public Reminders GetUser(string info) { string sql = @"select a.userid,a.userName,w.Name,w.company,w.department,email,cellPhone from chineseAbs.dbo.aspnet_users a left outer join chineseabs.web.accountapplication w on a.username = w.username where a.username = @0 or w.email= @0 or w.cellPhone = @0 "; var tblReminders = m_db.Query <TableReminders>(sql, info); Reminders rt = new Reminders(); foreach (var r in tblReminders) { Reminder reminder = new Reminder(r); rt.Add(reminder); } return(rt); }
private void AddToReminders(ReminderModel model) { try { ReminderModel temp = new ReminderModel(); temp.GuiD = model.GuiD; temp.Content = model.Content; temp.ReminderTime = model.ReminderTime; temp.Contact = model.Contact; temp.Record = model.Record; temp.RecordPath = model.RecordPath; temp.Ring = model.Ring; Reminders.Add(temp); } catch (Exception e) { LogWriter.Instance.Error(e); } }
/// <summary> /// Notification will look like "(popup|email)=(time period)". E.g., /// "email=2 days" or "popup=3 hours" /// </summary> /// <param name="Notification"></param> public void AddReminder(string Notification) { Match match; match = Regex.Match(Notification, @"^(email|popup)=(.*)$"); if (match.Success) { DateTime now = DateTime.Now; DateTime future = YellowLab.FuzzyDateParser.Parse(match.Groups[2].Value, now)[0]; TimeSpan Span = future - now; Reminders.Add(new EventReminder() { Method = match.Groups[1].Value, Minutes = (int)Span.TotalMinutes }); } else { Console.WriteLine("Couldn't parse reminder {0}", Notification); } }
public JsonResult SearchUser(string userInfo) { Reminders reminders = new Reminders(); var user = UserService.GetUserByName(userInfo); if (user != null) { Reminder r = new Reminder { UserId = user.Id, UserName = user.UserName, Name = user.Name, Company = "", Department = "", Email = user.Email, CellPhone = user.PhoneNumber }; reminders.Add(r); } var result = new SAFS.Utility.Web.JsonResultDataEntity <Reminders>(); result.Data = reminders; return(Json(result)); }
public void Insert(Reminder reminder) { Reminders.Add(reminder); }
//NOTE: Reminder ID is discarded and re-set here public void AddReminder(Reminder reminder) { reminder.ReminderNumber = Reminders.Any() ? Reminders.Max(x => x.ReminderNumber) + 1 : 1; Reminders.Add(reminder); Database.Store(reminder, Reminder.DocumentName(reminder.GuildId, reminder.ReminderNumber)); }