Пример #1
0
        ///<summary>Context menu right-click and select the "Mark Read" with TaskNewTrackedByUser preference turned on.</summary>
        public void UserControlTasks_MarkRead_TasksNewTrackedByUser()
        {
            Prefs.UpdateBool(PrefName.TasksNewTrackedByUser, true);        //TaskNewTrackedByUser=true;
            TaskUnreads.SetUnread(Security.CurUser.UserNum, _task);        //Set the task to unread for our user.
            _userControlTasksAccessor.Invoke("MarkRead", _task);           //TaskNewTrackedByUser=false;
            List <Signalod> listSignals = SignalodT.GetAllSignalods();

            Assert.AreEqual(1, listSignals.Count);
            Assert.IsTrue(listSignals.Exists(x => x.IType == InvalidType.Task && x.FKeyType == KeyType.Task &&
                                             x.FKey == _task.TaskNum));//Signal for _task.
            Assert.IsFalse(_task.IsUnread);
        }
Пример #2
0
        ///<summary>Creates an Appointment Task and a Patient Task using pat and clinic, and adds them to _listTasks.</summary>
        private void CreateTasks(string suffix, Patient pat, Userod user, long taskListNum, bool isRepeating = false)
        {
            Appointment appt     = AppointmentT.CreateAppointment(pat.PatNum, DateTime.Today, 0, 0, clinicNum: pat.ClinicNum);
            Task        taskAppt = TaskT.CreateTask(taskListNum, appt.AptNum, suffix, isRepeating: isRepeating, dateType: TaskDateType.None, objectType: TaskObjectType.Appointment, userNum: user.UserNum);
            Task        taskPat  = TaskT.CreateTask(taskListNum, pat.PatNum, suffix, isRepeating: isRepeating, dateType: TaskDateType.None, objectType: TaskObjectType.Patient, userNum: user.UserNum);
            Task        taskNone = TaskT.CreateTask(taskListNum, 0, suffix, isRepeating: isRepeating, dateType: TaskDateType.None, objectType: TaskObjectType.None, userNum: user.UserNum);

            //Manage test lists of "subscribed" tasks so we don't have to do database logic to determine if a user is subscribed to a task.
            if (OpenDental.UserControlTasks.GetSubscribedTaskLists(_userA.UserNum).Exists(x => x.TaskListNum == taskListNum))
            {
                TaskUnreads.SetUnread(_userA.UserNum, taskAppt);
                TaskUnreads.SetUnread(_userA.UserNum, taskPat);
                TaskUnreads.SetUnread(_userA.UserNum, taskNone);
            }
            if (OpenDental.UserControlTasks.GetSubscribedTaskLists(_userNW.UserNum).Exists(x => x.TaskListNum == taskListNum))
            {
                TaskUnreads.SetUnread(_userNW.UserNum, taskAppt);
                TaskUnreads.SetUnread(_userNW.UserNum, taskPat);
                TaskUnreads.SetUnread(_userNW.UserNum, taskNone);
            }
        }
 public void TaskSubscriptions_TrySubscList_MarkOldRemindersRead()
 {
     TaskSubscriptionT.CreateTaskSubscription(_userNum, taskListChild.TaskListNum);           //Subscribed to TaskListChild (and by extension, TaskListGrandchild).
     #region Create Unread Past Due Reminders
     OpenDentBusiness.Task taskParent = TaskT.CreateTask(taskListParent.TaskListNum, descript: "ParentReminder", isUnread: true, reminderGroupId: "1"
                                                         , dateTimeEntry: DateTime.Now.AddSeconds(-1), reminderType: TaskReminderType.Once);
     OpenDentBusiness.Task taskChild = TaskT.CreateTask(taskListChild.TaskListNum, descript: "ChildReminder", isUnread: true, reminderGroupId: "1"
                                                        , dateTimeEntry: DateTime.Now.AddSeconds(-1), reminderType: TaskReminderType.Once);
     OpenDentBusiness.Task taskGrandchild = TaskT.CreateTask(taskListGrandchild.TaskListNum, descript: "GrandchildReminder", isUnread: true
                                                             , dateTimeEntry: DateTime.Now.AddSeconds(-1), reminderGroupId: "1", reminderType: TaskReminderType.Once);
     TaskAncestors.SynchAll();
     TaskUnreads.SetUnread(_userNum, taskParent);
     TaskUnreads.SetUnread(_userNum, taskChild);
     TaskUnreads.SetUnread(_userNum, taskGrandchild);
     #endregion
     bool isSuccess = TaskSubscriptions.TrySubscList(taskListParent.TaskListNum, _userNum);
     OpenDentBusiness.Task taskParentDb     = Tasks.GetOne(taskParent.TaskNum);
     OpenDentBusiness.Task taskChildDb      = Tasks.GetOne(taskChild.TaskNum);
     OpenDentBusiness.Task taskGrandchildDb = Tasks.GetOne(taskGrandchild.TaskNum);
     Assert.IsTrue(isSuccess);
     Assert.IsFalse(TaskUnreads.IsUnread(_userNum, taskParentDb));         //Only the task in taskListParent should be Read.
     Assert.IsTrue(TaskUnreads.IsUnread(_userNum, taskChildDb));           //The task in taskListChild should still be Unread.
     Assert.IsTrue(TaskUnreads.IsUnread(_userNum, taskGrandchildDb));      //The task in taskListGrandchild should still be Unread.
 }