예제 #1
0
        async void DoneEdit(object ender, EventArgs e)
        {
            string           tobool = status_picker.SelectedItem.ToString();
            bool             val    = Boolean.Parse(tobool);
            SQLiteConnection conn   = new SQLiteConnection(App.DatabaseLocation);

            conn.Query <Reminders>("select * from Reminders where id=?", tempid);

            Reminders reminders = new Reminders()
            {
                id          = tempid,
                Title       = name_entry.Text,
                Description = description_entry.Text,
                Priority    = priority_picker.SelectedItem.ToString(),
                Date        = datePicker.Date + timePicker.Time,
                isActivated = val
            };

            conn.Update(reminders);
            conn.Close();


            await DisplayAlert("Success", "Pet reminder saved", "Ok");

            await Navigation.PopToRootAsync();
        }
        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");
        }
예제 #3
0
 public void DeleteReminder(Reminders reminder)
 {
     realm.Write(() =>
     {
         realm.Remove(reminder);
     });
 }
예제 #4
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Reminders reminder = new Reminders();

                reminder.note       = listMed.Text;
                reminder.dateStart  = DateTime.Parse(dateStart_box.Text);
                reminder.dateFinish = DateTime.Parse(dateFinish_box.Text);
                reminder.time       = DateTime.Parse(time_box.Text);

                reminder.UserId = MainClass.ID;

                using (DBToHealth db = new DBToHealth())
                {
                    db.Reminders.Add(reminder);
                    db.SaveChanges();
                }

                MessageBox.Show("Напоминание сохранено!");

                MainClass.MW.frame.NavigationService.Navigate(new Uri("Pages/Therapy.xaml", UriKind.Relative));
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is InvoicePaymentRequest other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((RequestMethod == null && other.RequestMethod == null) || (RequestMethod?.Equals(other.RequestMethod) == true)) &&
                   ((RequestType == null && other.RequestType == null) || (RequestType?.Equals(other.RequestType) == true)) &&
                   ((DueDate == null && other.DueDate == null) || (DueDate?.Equals(other.DueDate) == true)) &&
                   ((FixedAmountRequestedMoney == null && other.FixedAmountRequestedMoney == null) || (FixedAmountRequestedMoney?.Equals(other.FixedAmountRequestedMoney) == true)) &&
                   ((PercentageRequested == null && other.PercentageRequested == null) || (PercentageRequested?.Equals(other.PercentageRequested) == true)) &&
                   ((TippingEnabled == null && other.TippingEnabled == null) || (TippingEnabled?.Equals(other.TippingEnabled) == true)) &&
                   ((AutomaticPaymentSource == null && other.AutomaticPaymentSource == null) || (AutomaticPaymentSource?.Equals(other.AutomaticPaymentSource) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((Reminders == null && other.Reminders == null) || (Reminders?.Equals(other.Reminders) == true)) &&
                   ((ComputedAmountMoney == null && other.ComputedAmountMoney == null) || (ComputedAmountMoney?.Equals(other.ComputedAmountMoney) == true)) &&
                   ((TotalCompletedAmountMoney == null && other.TotalCompletedAmountMoney == null) || (TotalCompletedAmountMoney?.Equals(other.TotalCompletedAmountMoney) == true)) &&
                   ((RoundingAdjustmentIncludedMoney == null && other.RoundingAdjustmentIncludedMoney == null) || (RoundingAdjustmentIncludedMoney?.Equals(other.RoundingAdjustmentIncludedMoney) == true)));
        }
예제 #6
0
        public async Task <ActionResult <object> > UpdateAssetsAsync(
            Guid subscriptionId,
            int buildId,
            string sourceSha,
            List <Asset> assets)
        {
            (InProgressPullRequest pr, bool canUpdate) = await SynchronizeInProgressPullRequestAsync();

            var updateParameter = new UpdateAssetsParameters
            {
                SubscriptionId = subscriptionId,
                BuildId        = buildId,
                SourceSha      = sourceSha,
                Assets         = assets
            };

            if (pr != null && !canUpdate)
            {
                await StateManager.AddOrUpdateStateAsync(
                    PullRequestUpdate,
                    new List <UpdateAssetsParameters> {
                    updateParameter
                },
                    (n, old) =>
                {
                    old.Add(updateParameter);
                    return(old);
                });

                await Reminders.TryRegisterReminderAsync(
                    PullRequestUpdate,
                    Array.Empty <byte>(),
                    TimeSpan.FromMinutes(5),
                    TimeSpan.FromMinutes(5));

                return(ActionResult.Create <object>(
                           null,
                           $"Current Pull request '{pr.Url}' cannot be updated, update queued."));
            }

            if (pr != null)
            {
                await UpdatePullRequestAsync(pr, new List <UpdateAssetsParameters> {
                    updateParameter
                });

                return(ActionResult.Create <object>(null, $"Pull Request '{pr.Url}' updated."));
            }

            string prUrl = await CreatePullRequestAsync(new List <UpdateAssetsParameters> {
                updateParameter
            });

            if (prUrl == null)
            {
                return(ActionResult.Create <object>(null, "Updates require no changes, no pull request created."));
            }

            return(ActionResult.Create <object>(null, $"Pull request '{prUrl}' created."));
        }
예제 #7
0
        /// <summary>
        ///     Synchronizes an in progress pull request.
        ///     This will update current state if the pull request has been manually closed or merged.
        ///     This will evaluate merge policies on an in progress pull request and merge the pull request if policies allow.
        /// </summary>
        /// <returns>
        ///     A <see cref="ValueTuple{InProgressPullRequest, bool}" /> containing:
        ///     The current open pull request if one exists, and
        ///     <see langword="true" /> if the open pull request can be updated; <see langword="false" /> otherwise.
        /// </returns>
        public virtual async Task <(InProgressPullRequest pr, bool canUpdate)> SynchronizeInProgressPullRequestAsync()
        {
            ConditionalValue <InProgressPullRequest> maybePr =
                await StateManager.TryGetStateAsync <InProgressPullRequest>(PullRequest);

            if (maybePr.HasValue)
            {
                InProgressPullRequest pr = maybePr.Value;
                if (string.IsNullOrEmpty(pr.Url))
                {
                    // somehow a bad PR got in the collection, remove it
                    await StateManager.RemoveStateAsync(PullRequest);

                    return(null, false);
                }

                bool?result = await ActionRunner.ExecuteAction(() => SynchronizePullRequestAsync(pr.Url));

                if (result == true)
                {
                    return(pr, true);
                }

                if (result == false)
                {
                    return(pr, false);
                }
            }

            await Reminders.TryUnregisterReminderAsync(PullRequestCheck);

            return(null, false);
        }
예제 #8
0
        public ReminderProxy[] GetItemReminders(ReferenceType refType, int refID, int?userID)
        {
            Reminders reminders = new Reminders(TSAuthentication.GetLoginUser());

            reminders.LoadByItemAll(refType, refID, userID);
            return(reminders.GetReminderProxies());
        }
예제 #9
0
        async void Done(object ender, EventArgs e)
        {
            Reminders reminders = new Reminders()
            {
                Title       = reminder_entry.Text,
                Description = description_entry.Text,
                Priority    = priority_picker.SelectedItem.ToString(),
                Date        = datePicker.Date + timePicker.Time,
                isActivated = true
            };

            SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation);

            conn.CreateTable <Reminders>();
            int rows = conn.Insert(reminders);

            conn.Close();

            if (rows > 0)
            {
                await DisplayAlert("Success", "You have added a reminder", "Ok");
            }
            else
            {
                await DisplayAlert("Failure", "Your reminder was not added", "OK");
            }

            await Navigation.PopToRootAsync();
        }
예제 #10
0
        public ReminderProxy[] GetUserReminders(int userID)
        {
            Reminders reminders = new Reminders(TSAuthentication.GetLoginUser());

            reminders.LoadByUser(userID);
            return(reminders.GetReminderProxies());
        }
예제 #11
0
 protected internal override void Define()
 {
     On((HasBeenReminded x) => reminded);
     On((SetReminder x) => Reminders.Register("test", TimeSpan.Zero, x.Period));
     On((GetInstanceHashcode x) => RuntimeHelpers.GetHashCode(this));
     On((Deactivate x) => Activation.DeactivateOnIdle());
 }
예제 #12
0
        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;
            }
        }
예제 #13
0
        private static Notification CreateNotification(ESignEnvelopeInfo envelope)
        {
            var reminder = new Reminders();

            if (envelope.SendReminders != false)
            {
                reminder = new Reminders
                {
                    ReminderDelay     = envelope.FirstReminderDay.ToString(),
                    ReminderFrequency = envelope.ReminderFrequency.ToString(),
                    ReminderEnabled   = true.ToString()
                };
            }

            return(new Notification
            {
                UseAccountDefaults = false.ToString(),
                Reminders = reminder,
                Expirations = new Expirations
                {
                    ExpireAfter = envelope.ExpiredDays.ToString(),
                    ExpireWarn = envelope.WarnDays.ToString(),
                    ExpireEnabled = true.ToString()
                }
            });
        }
예제 #14
0
        public IHttpActionResult PutReminders(int id, Reminders reminders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reminders.Id)
            {
                return(BadRequest());
            }

            db.Entry(reminders).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RemindersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #15
0
        public void DeleteTask(int taskID)
        {
            Task task = Tasks.GetTask(UserSession.LoginUser, taskID);

            if (task.CreatorID != UserSession.CurrentUser.UserID && !UserSession.CurrentUser.IsSystemAdmin)
            {
                return;
            }

            TaskAssociations associations = new TaskAssociations(UserSession.LoginUser);

            associations.DeleteByReminderIDOnly(taskID);

            Tasks subtasks = new Tasks(UserSession.LoginUser);

            subtasks.LoadIncompleteByParentID(taskID);
            foreach (Task subtask in subtasks)
            {
                DeleteTask(subtask.TaskID);
            }

            if (task.ReminderID != null)
            {
                Data.Reminder reminder = Reminders.GetReminder(UserSession.LoginUser, (int)task.ReminderID);
                reminder.Delete();
                reminder.Collection.Save();
            }

            string description = String.Format("{0} deleted task {1} ", UserSession.CurrentUser.FirstLastName, task.Description);

            ActionLogs.AddActionLog(UserSession.LoginUser, ActionLogType.Delete, ReferenceType.Tasks, taskID, description);
            task.Delete();
            task.Collection.Save();
        }
예제 #16
0
        private Reminder CreateReminder(LoginUser loginUser, int taskID, string taskName, DateTime reminderDate, bool isDismissed, int userID)
        {
            Reminders reminderHelper = new Reminders(loginUser);
            Reminder  reminder       = reminderHelper.AddNewReminder();

            reminder.DateCreated = DateTime.UtcNow;
            reminder.Description = taskName;
            DateTime reminderDueDate = DateTime.Now;

            if (reminderDate != null)
            {
                reminderDueDate = (DateTime)reminderDate;
            }
            reminder.DueDate        = reminderDueDate;
            reminder.IsDismissed    = isDismissed;
            reminder.RefType        = ReferenceType.Tasks;
            reminder.RefID          = taskID;
            reminder.HasEmailSent   = false;
            reminder.UserID         = userID;
            reminder.CreatorID      = loginUser.UserID;
            reminder.OrganizationID = loginUser.OrganizationID;

            reminderHelper.Save();

            return(reminder);
        }
 // Token: 0x06001659 RID: 5721 RVA: 0x0007DEAC File Offset: 0x0007C0AC
 protected override void OnObjectModified(IMapiEvent mapiEvent, IMailboxSession itemStore, IStoreObject item, List <KeyValuePair <string, object> > customDataToLog)
 {
     ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified");
     if (item != null)
     {
         ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - item exists");
         IToDoItem toDoItem = (IToDoItem)item;
         Reminders <ModernReminder> reminders = toDoItem.ModernReminders;
         if (reminders != null)
         {
             ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - Reminders exist -> schedule reminder");
             int numRemindersScheduled = 0;
             customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemSchd.Latency", base.ExecuteAndMeasure(delegate
             {
                 numRemindersScheduled = this.ReminderMessageManager.ScheduleReminder(itemStore, toDoItem, reminders);
             }).ToString()));
             customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemSchd.Count", numRemindersScheduled));
             return;
         }
         ExTraceGlobals.GeneralTracer.TraceDebug((long)this.GetHashCode(), "ToDoModernReminderProcessor.OnObjectModified - Modern reminders don't exist -> clearing the reminder");
         customDataToLog.Add(new KeyValuePair <string, object>("ToDoRemClr.Latency", base.ExecuteAndMeasure(delegate
         {
             this.ReminderMessageManager.ClearReminder(itemStore, toDoItem);
         }).ToString()));
     }
 }
예제 #18
0
        public void TabSelectedChanged(int index)
        {
            if (TabIndex != index)
            {
                _searchtext = null;
                RaisePropertyChanged("SearchText");
            }

            TabIndex = index;

            if (!IsLoading)
            {
                if (AllReminders != null && AllReminders.Any())
                {
                    if (index == 0) // show only active reminders
                    {
                        Reminders = new ObservableCollection <RemindersModel>(AllReminders.Where((arg) => !arg.Reminder.DoneAt.HasValue));
                    }
                    else // Show terminated reminders
                    {
                        Reminders = new ObservableCollection <RemindersModel>(AllReminders.Where((arg) => arg.Reminder.DoneAt.HasValue));
                    }
                }
            }

            if (Reminders != null)
            {
                IsEmpty = !Reminders.Any();
            }
            else
            {
                IsEmpty = true;
            }
        }
        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;
            }
        }
        public async Task ScheduleReminders()
        {
            if (Device.RuntimePlatform == Device.iOS)
            {
                DependencyService.Get <ICancelNotification>()?.CancelAll();
            }
            else
            {
                await Notifications.CancelAll();
            }

            foreach (var reminder in Reminders)
            {
                var time = (reminder.Time);

                if (reminder.IsActive)
                {
                    DateTime startDate = DateTime.Now.Date;
                    DateTime endDate   = DateTime.Now.AddMonths(1);

                    startDate = startDate + time;

                    for (int i = 0; i < endDate.Date.Subtract(startDate.Date).Days; i++)
                    {
                        DateTime item = startDate.AddDays(i);

                        bool isMonday    = reminder.Monday.IsEnabled && item.DayOfWeek == reminder.Monday.Day;
                        bool isTuesday   = reminder.Tuesday.IsEnabled && item.DayOfWeek == reminder.Tuesday.Day;
                        bool isWednesday = reminder.Wednesday.IsEnabled && item.DayOfWeek == reminder.Wednesday.Day;
                        bool isThursday  = reminder.Thursday.IsEnabled && item.DayOfWeek == reminder.Thursday.Day;
                        bool isFriday    = reminder.Friday.IsEnabled && item.DayOfWeek == reminder.Friday.Day;
                        bool isSaturday  = reminder.Saturday.IsEnabled && item.DayOfWeek == reminder.Saturday.Day;
                        bool isSunday    = reminder.Sunday.IsEnabled && item.DayOfWeek == reminder.Sunday.Day;

                        if (isMonday || isTuesday || isWednesday || isThursday || isFriday || isSaturday || isSunday)
                        {
                            if (item.CompareTo(DateTime.Now) > 0)
                            {
                                var notification = new Notification()
                                {
                                    Id = GetUniqueID(item, Reminders.IndexOf(reminder)), Title = AppResources.NotificationHeader, Message = AppResources.NotificationContent, Date = item, Sound = "notification", Vibrate = false
                                };

                                if (Device.RuntimePlatform == Device.iOS)
                                {
                                    notification.Sound = "notification.caf";
                                }
                                else
                                {
                                    notification.When = TimeSpan.FromTicks(item.Subtract(DateTime.Now).Ticks);
                                }

                                await Notifications.Send(notification);
                            }
                        }
                    }
                }
            }
        }
        protected async override void ViewIsDisappearing(object sender, EventArgs e)
        {
            await ScheduleReminders();

            Settings.ReminderStorage = JsonConvert.SerializeObject(Reminders.ToList());

            base.ViewIsDisappearing(sender, e);
        }
        private void CompleteC(object obj)
        {
            int id = int.Parse(obj.ToString());

            this.reminderService.SetCompleted(id);
            Reminders.Remove(Reminders.Where(x => x.Id == id).FirstOrDefault());
            NotifyRemindersChanged();
        }
예제 #23
0
 public RemindersPage(AppUser user, Reminders reminders)
 {
     InitializeComponent();
     User                 = user;
     Reminder             = reminders;
     this.BindingContext  = new RemindersViewModel(User, Reminder);
     SendButton.IsEnabled = false;
     IsNew                = false;
 }
예제 #24
0
파일: Topic.cs 프로젝트: pkese/Orleankka
        public async Task Handle(CreateTopic cmd)
        {
            query = cmd.Query;

            foreach (var entry in cmd.Schedule)
            {
                await Reminders.Register(entry.Key.Path.Id, TimeSpan.Zero, entry.Value);
            }
        }
예제 #25
0
        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);
        }
예제 #26
0
        public void TimerEvent(object _)
        {
            //Don't allow multiple to run at the same time and generate possible race conditions
            if (TimerWait)
            {
                return;
            }

            TimerWait = true;

            //TODO: Check that bot is actually logged in before running
            try
            {
                foreach (var reminder in Reminders.ToList())
                {
                    if (reminder.TimeStamp + reminder.Length < DateTime.UtcNow)
                    {
                        if (!LocalManagementService.LastConfig.IsAcceptable(reminder.GuildId))
                        {
                            return;
                        }

                        var channel = Client.GetGuild(reminder.GuildId)?.GetTextChannel(reminder.ChannelId);
                        var user    = Client.GetUser(reminder.UserId);
                        if (user == null)
                        {
                            RemoveReminder(reminder);
                            continue;
                        }

                        if (channel == null)
                        {
                            //DM User if available.
                            var dmChannel = user.GetOrCreateDMChannelAsync().Result;
                            if (dmChannel != null)
                            {
                                //TODO: Pretty up the message
                                dmChannel.SendMessageAsync(reminder.ReminderMessage).ConfigureAwait(false);
                            }
                            RemoveReminder(reminder);
                            continue;
                        }

                        channel.SendMessageAsync($"{user.Mention}", false, new EmbedBuilder()
                        {
                            Description = $"{reminder.ReminderMessage}".FixLength(1024),
                            Color       = Color.Green
                        }.Build()).ConfigureAwait(false);
                        RemoveReminder(reminder);
                    }
                }
            }
            finally
            {
                TimerWait = false;
            }
        }
예제 #27
0
 public TaskExtra GetExtra(Wunderlist.TodoTask task)
 {
     return(new TaskExtra(
                Lists[task.ListId],
                Subtasks.TryGet(task.Id),
                Reminders.TryGet(task.Id),
                Notes.TryGet(task.Id),
                SubtaskPositions.TryGet(task.Id)));
 }
예제 #28
0
        public ReminderProxy GetReminder(int reminderID)
        {
            Reminder reminder = Reminders.GetReminder(TSAuthentication.GetLoginUser(), (int)reminderID);

            if (reminder.OrganizationID != TSAuthentication.OrganizationID)
            {
                return(null);
            }
            return(reminder.GetProxy());
        }
예제 #29
0
        public async void When_created()
        {
            await TopicCreated();

            IsTrue(() => Reminders.Count() == schedule.Count,
                   "Should schedule recurrent search reminder per each api");

            AssertReminderScheduled(facebook);
            AssertReminderScheduled(twitter);
        }
예제 #30
0
        public static string GetReminder(RestCommand command, int reminderID)
        {
            Reminder reminder = Reminders.GetReminder(command.LoginUser, reminderID);

            if (reminder.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(reminder.GetXml("Reminder", true));
        }