Example #1
0
 public void SetupTest()
 {
     TaskListT.ClearTaskListTable();
     TaskT.ClearTaskTable();
     TaskSubscriptionT.ClearTaskSubscriptionTable();
     SignalodT.ClearSignalodTable();
     _taskListParent     = TaskListT.CreateTaskList(descript: "TaskListParent");
     _taskListChild      = TaskListT.CreateTaskList(descript: "TaskListChild", parent: _taskListParent.TaskListNum, parentDesc: _taskListParent.Descript);
     _taskListGrandchild = TaskListT.CreateTaskList(descript: "TaskListGrandchild", parent: _taskListChild.TaskListNum,
                                                    parentDesc: _taskListChild.Descript);
     _task = TaskT.CreateTask(_taskListGrandchild.TaskListNum, descript: "Test Task", fromNum: Security.CurUser.UserNum); //Starts in _taskListGrandchild
     Security.CurUser.TaskListInBox = _taskListParent.TaskListNum;                                                        //Set inbox for current user to _taskListParent.
     try {
         Userods.Update(Security.CurUser);
     }
     catch {
         Assert.Fail("Failed to update current user task list inbox.");                //Error updating user.
     }
     _userControlTasksInstance = new UserControlTasks();
     _userControlTasksAccessor = new PrivateObject(_userControlTasksInstance);
     //Artificially set that we are viewing _listTaskListParent.
     _userControlTasksAccessor.SetField("_listTaskListTreeHistory", new List <TaskList>()
     {
         _taskListParent
     });
     _userControlTasksAccessor.SetField("_dictTaskLists", new Dictionary <long, TaskList>());
 }
Example #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 SetupTest()
 {
     TaskListT.ClearTaskListTable();
     TaskT.ClearTaskTable();
     TaskSubscriptionT.ClearTaskSubscriptionTable();
     SignalodT.ClearSignalodTable();
     _taskListParent     = TaskListT.CreateTaskList(descript: "TaskListParent");
     _taskListChild      = TaskListT.CreateTaskList(descript: "TaskListChild", parent: _taskListParent.TaskListNum, parentDesc: _taskListParent.Descript);
     _taskListGrandchild = TaskListT.CreateTaskList(descript: "TaskListGrandchild", parent: _taskListChild.TaskListNum,
                                                    parentDesc: _taskListChild.Descript);
     _task = TaskT.CreateTask(_taskListGrandchild.TaskListNum, descript: "Test Task", fromNum: Security.CurUser.UserNum, priorityDefNum: 1); //Starts in _taskListGrandchild
     TaskSubscriptionT.CreateTaskSubscription(Security.CurUser.UserNum, _taskListParent.TaskListNum);                                        //current user subscribes to top level tasklist.
     Security.CurUser.TaskListInBox = _taskListParent.TaskListNum;                                                                           //Set inbox for current user to _taskListParent.
     try {
         Userods.Update(Security.CurUser);
         Userods.RefreshCache();
     }
     catch {
         Assert.Fail("Failed to update current user task list inbox.");                //Error updating user.
     }
     _formTaskEditInstance = new FormTaskEdit(_task);
     _formTaskEditAccessor = new PrivateObject(_formTaskEditInstance);
     _formTaskEditAccessor.Invoke("LoadTask");
 }
 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.
 }