private void SortTaskLists(TaskListSortType sortType)
        {
            if (TaskLists is null || TaskLists.Count == 0)
            {
                return;
            }

            _isSelectionInProgress = true;
            switch (sortType)
            {
            case TaskListSortType.BY_NAME_ASC:
                TaskLists.SortBy(tl => tl.Title);
                break;

            case TaskListSortType.BY_NAME_DESC:
                TaskLists.SortByDescending(tl => tl.Title);
                break;

            case TaskListSortType.BY_UPDATED_DATE_ASC:
                TaskLists.SortBy(tl => tl.UpdatedAt);
                break;

            case TaskListSortType.BY_UPDATED_DATE_DESC:
                TaskLists.SortByDescending(tl => tl.UpdatedAt);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(sortType), sortType,
                                                      "The provided task list sort type does not exists");
            }

            _isSelectionInProgress = false;
        }
 private void SetTaskListViewModel(List <CaseInfo> caseInfos)
 {
     foreach (CaseInfo item in caseInfos)
     {
         TaskViewModel task = new TaskViewModel
         {
             AttorneySeries       = item.AttorneySeries,
             CaseName             = item.CasedocumentName,
             CustomerName         = item.ClientName,
             FirstVersionDeadline = item.taskInfos[0].FirstVirsionDeadlineInternal,
             ProcessStage         = item.taskInfos[0].ProcessStage,
             TaskName             = item.taskInfos[0].TaskName,
             TaskAttribute        = item.taskInfos[0].TaskAttribute,
             Proc_id         = item.taskInfos[0].TaskID,
             Attorney        = item.taskInfos[0].Attorney,
             OfficalDeadline = item.taskInfos[0].OfficalDeadline,
         };
         TimeSpan ts = item.taskInfos[0].FirstVirsionDeadlineInternal.Date - DateTime.Now.Date;
         task.DaysLeft = ts.Days;
         if (task.Attorney == "")
         {
             task.Attorney = userInfo.UserName;
         }
         TaskLists.Add(task);
     }
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            // Display the header and initialize the sample.
            CommandLine.EnableExceptionHandling();
            CommandLine.DisplayGoogleSampleHeader("Tasks API");

            // Register the authenticator.
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
            FullClientCredentials credentials = PromptingClientCredentials.EnsureFullClientCredentials();

            provider.ClientIdentifier = credentials.ClientId;
            provider.ClientSecret     = credentials.ClientSecret;
            var auth = new OAuth2Authenticator <NativeApplicationClient>(provider, GetAuthorization);

            // Create the service.
            var       service = new TasksService(auth);
            TaskLists results = service.Tasklists.List().Fetch();

            CommandLine.WriteLine("   ^1Lists:");
            foreach (TaskList list in results.Items)
            {
                CommandLine.WriteLine("     ^2" + list.Title);
            }
            CommandLine.PressAnyKeyToExit();
        }
        private void ShowTaskslists(TaskLists response)
        {
            if (response.Items == null)
            {
                output.Text += "You have no task lists!<br/>";
                return;
            }

            output.Text += "Showing task lists...<br/>";
            foreach (TaskList list in response.Items)
            {
                Panel listPanel = new Panel()
                {
                    BorderWidth = Unit.Pixel(1), BorderColor = Color.Black
                };
                listPanel.Controls.Add(new Label {
                    Text = list.Title
                });
                listPanel.Controls.Add(new Label {
                    Text = "<hr/>"
                });
                listPanel.Controls.Add(new Label {
                    Text = GetTasks(list)
                });
                lists.Controls.Add(listPanel);
            }
        }
Beispiel #5
0
        public OAuth2()
        {
            // Create the Tasks-Service if it is null.
            if (_service == null)
            {
                _service = new TasksService(_authenticator = CreateAuthenticator());
            }
            else
            {
                try
                {
                    // Fetch all TasksLists of the user asynchronously.
                    TaskLists response = _service.Tasklists.List().Fetch();
                }
                catch (ThreadAbortException)
                {
                    // User was not yet authenticated and is being forwarded to the authorization page.
                    throw;
                }
                catch (Exception ex)
                {
                }
            }

            // Check if we received OAuth2 credentials with this request; if yes: parse it.
            if (HttpContext.Current.Request["code"] != null)
            {
                _authenticator.LoadAccessToken();
            }

            //This needs to be a redirect to the edit or proxy function depending on what the
            //user wants to do.
            HttpContext.Current.Response.Write("Did it");
        }
Beispiel #6
0
        // copy the task list into an observable collection of list names
        private void UpdateView(int newSelection = 0)
        {
            Log.Instance.LogDebug(string.Format("MainViewModel.UpdateView {0}", newSelection));

            TaskLists.Clear();
            ContextMenuItems.Clear();

            if (TaskListGroup != null)
            {
                for (int i = 0; i < TaskListGroup.NumLists; i++)
                {
                    Log.Instance.LogDebug(string.Format("MainViewModel.Adding Task List {0}", TaskListGroup.ListName(i)));

                    TaskLists.Add(new TaskListView(TaskListGroup.ListName(i)));
                    ContextMenuItems.Add(new ContextMenuItem(TaskListGroup.ListName(i), new CustomCommandHandler(i, OnMoveItem)));
                }
            }
            else
            {
                Log.Instance.LogDebug(string.Format("MainViewModel.UpdateView - TaskListGroup is null, skipping"));
            }

            RaisePropertyChanged("TaskLists");
            RaisePropertyChanged("ContextMenuItems");

            SelectedTaskList = newSelection;

            PropertyDataGridViewModel = new DataGridViewModel(TaskListGroup, SelectedTaskList);
        }
        private async Task GetAllTaskListAsync()
        {
            ShowTaskProgressRing = true;

            var dbResponse = await _dataService
                             .TaskListService
                             .GetAsNoTrackingAsync(
                tl => tl.LocalStatus != LocalStatus.DELETED &&
                tl.User.IsActive,
                tl => tl.OrderBy(t => t.Title));

            if (!dbResponse.Succeed)
            {
                ShowTaskProgressRing = false;
                await _dialogService.ShowMessageDialogAsync(
                    "Error",
                    $"An error occurred while trying to retrieve all the task lists. Error = {dbResponse.Message}");

                return;
            }

            TaskLists = _mapper.Map <ObservableCollection <TaskListItemViewModel> >(dbResponse.Result);

            SelectedTaskList = TaskLists
                               .FirstOrDefault(t => t.TaskListID == _currentTaskList.TaskListID);
            ShowTaskProgressRing = false;
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            // Display the header and initialize the sample.
            CommandLine.EnableExceptionHandling();
            CommandLine.DisplayGoogleSampleHeader("Tasks API");

            // Register the authenticator.
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description)
            {
                ClientIdentifier = "<client_id>",
                ClientSecret     = "<client_secret>"
            };
            var auth = new OAuth2Authenticator <NativeApplicationClient>(provider, GetAuthorization);

            // Create the service.
            var service = new TasksService(new BaseClientService.Initializer()
            {
                Authenticator   = auth,
                ApplicationName = "Tasks API Sample",
            });
            TaskLists results = service.Tasklists.List().Fetch();

            Console.WriteLine("Lists:");
            foreach (TaskList list in results.Items)
            {
                Console.WriteLine("- " + list.Title);
            }
            Console.ReadKey();
        }
Beispiel #9
0
 private void AddList()
 {
     _realm.Write(() =>
     {
         TaskLists.Insert(0, new TaskList());
     });
 }
Beispiel #10
0
        public void Authentication(Ctx ctx)
        {
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);

            provider.ClientIdentifier = ClientCredentials.ClientID;
            provider.ClientSecret     = ClientCredentials.ClientSecret;
            // Create the service. This will automatically call the authenticator.

            if (isTask)
            {
                var service = new TasksService(new OAuth2Authenticator <NativeApplicationClient>(provider, GetAuthentication));
                Google.Apis.Tasks.v1.TasklistsResource.ListRequest clrq = service.Tasklists.List();
                clrq.MaxResults = "1000";

                TaskLists taskslist = clrq.Fetch();


                FetchingTasks(service, taskslist, ctx);
            }
            else
            {
                var service = new CalendarService(new OAuth2Authenticator <NativeApplicationClient>(provider, GetAuthentication));
                Google.Apis.Calendar.v3.CalendarListResource.ListRequest clrq = service.CalendarList.List();
                var result = clrq.Fetch();
                FetchingCalendar(result, service, ctx);
            }
        }
Beispiel #11
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Tasks OAuth2 Sample");
            Console.WriteLine("===================");

            UserCredential credential;

            using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
            {
                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    new[] { TasksService.Scope.Tasks },
                    "user", CancellationToken.None, new FileDataStore("Tasks.Auth.Store")).Result;
            }

            // Create the service.
            var service = new TasksService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = "Tasks API Sample",
            });

            TaskLists results = service.Tasklists.List().Execute();

            Console.WriteLine("\tLists:");

            foreach (TaskList list in results.Items)
            {
                Console.WriteLine("\t\t" + list.Title);
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Beispiel #12
0
 public void OnTaskListAutoSuggestBoxQuerySubmitted(ItemModel selectedItem)
 {
     if (selectedItem == null)
     {
         return;
     }
     SelectedItem = TaskLists.FirstOrDefault(t => t.TaskListID == selectedItem.ItemId);
 }
Beispiel #13
0
 private void DeleteTaskListCommandHandler(IEnumerable <TaskList> list)
 {
     // Using a foreach loop would cause some side effects, so let's just use a decrementing for loop.
     for (int i = list.Count() - 1; i >= 0; i--)
     {
         TaskLists.Remove(list.ElementAt(i));
     }
 }
Beispiel #14
0
 public void FetchingTasks(TasksService service, TaskLists taskslist, Ctx ctx)
 {
     //StringBuilder sql = new StringBuilder();
     //for (int i = 0; i < taskslist.Items.Count; i++)
     //{
     //    FetchTasks(service, taskslist.Items[i]);
     //}
     FetchTasks(service, "@default", ctx);
 }
 public IActionResult Create(string taskList)
 {
     if (taskList != null)
     {
         TaskLists.Add(taskList, null);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(taskList));
 }
Beispiel #16
0
 /* Retrieves tasklists that are not deleted or hidden*/
 private void RetrieveVisibleLists()
 {
     foreach (Model.TaskList origTaskList in TaskLists.Where(l => !l.Deleted))
     {
         Model.TaskList visibleTaskList = Model.TaskList.Clone(origTaskList);
         visibleTaskList.Tasks = new ObservableCollection <Model.Task>(origTaskList.Tasks.Where(t => IsNotHiddenOrDeleted(t)));
         VisibleTaskLists.Add(visibleTaskList);
     }
 }
Beispiel #17
0
        public static void GetTaskList()
        {
            TaskLists results = tasks.Tasklists.List().Execute();
            int       i       = 0;

            foreach (TaskList list in results.Items)
            {
                i++;
            }
        }
        public IActionResult Edit(string list)
        {
            if (list == null)
            {
                return(NotFound());
            }
            var item = TaskLists.Where(a => a.Key == list);

            ViewBag.Key = list;
            return(View());
        }
Beispiel #19
0
        protected override async Task OnInitializedAsync()
        {
            var json = await HttpClient.GetStringAsync("http://taskboard.api/TaskList");

            TaskLists = JsonSerializer.Deserialize <IEnumerable <Model.TaskList> >(json, new JsonSerializerOptions {
                PropertyNameCaseInsensitive = true
            });
            SelectedTaskListId = TaskLists.First().Id;

            await base.OnInitializedAsync();
        }
Beispiel #20
0
 private Model.TaskList GetTaskListObjectFromTaskLists(Model.TaskList list)
 {
     foreach (Model.TaskList taskList in TaskLists.Where(l => !l.Deleted))
     {
         if ((list.Id != null && list.Id == taskList.Id) || list.Title == taskList.Title)
         {
             return(taskList);
         }
     }
     return(null);
 }
Beispiel #21
0
        private void ApplyTaskListChangesCommandHandler()
        {
            // For the tasklist being edited : replace the original by the modified clone
            var taskListToRemove = TaskLists.Single(o => o.ListId == CurrentTaskList.ListId);

            TaskLists.Remove(taskListToRemove);
            TaskLists.Add(CurrentTaskList);

            IsEditing       = false;
            CurrentTaskList = new TaskList();
        }
Beispiel #22
0
        public void TaskLists_RefreshMainTrunk_NoFilter()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patN, _userA, _taskListMainNoFilter.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshMainTrunk(_userA.UserNum, TaskType.All, _clinicN.ClinicNum, _clinicN.Region);
            TaskList        taskListMain        = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == _taskListMainNoFilter.TaskListNum);

            Assert.IsTrue(taskListMain != null && taskListMain.NewTaskCount == 3);
        }
Beispiel #23
0
        public void TaskLists_RefreshUserTrunk_RegionFilterClinicRestriction()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patN, _userA, _taskListRegion.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshUserTrunk(_userNW.UserNum, _clinicNW.ClinicNum, _clinicNW.Region);
            TaskList        taskList            = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == _taskListRegion.TaskListNum);

            Assert.IsTrue(taskList != null && taskList.NewTaskCount == 1);
        }
Beispiel #24
0
        private async Task <string> TestGoogleTaskConnection(OptionsModel options, StringBuilder errorMessageBuilder, OlItemType outlookFolderType, string url)
        {
            var service = await GoogleHttpClientFactory.LoginToGoogleTasksService(options.EmailAddress, options.GetProxyIfConfigured());

            string connectionTestUrl;

            if (string.IsNullOrEmpty(url))
            {
                TaskLists taskLists = await service.Tasklists.List().ExecuteAsync();

                if (taskLists.Items.Any())
                {
                    var selectedTaskList = SelectTaskList(taskLists.Items.Select(i => new TaskListData(i.Id, i.Title, AccessPrivileges.All)).ToArray());
                    if (selectedTaskList != null)
                    {
                        connectionTestUrl = selectedTaskList.Id;
                    }
                    else
                    {
                        return(url);
                    }
                }
                else
                {
                    connectionTestUrl = url;
                }
            }
            else
            {
                connectionTestUrl = url;
            }

            try
            {
                await service.Tasklists.Get(connectionTestUrl).ExecuteAsync();
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
                errorMessageBuilder.AppendFormat(Strings.Get($"The tasklist with id '{connectionTestUrl}' is invalid."));
                MessageBox.Show(errorMessageBuilder.ToString(), Strings.Get($"The tasklist is invalid"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(url);
            }

            TestResult result = new TestResult(ResourceType.TaskList, CalendarProperties.None, AddressBookProperties.None, AccessPrivileges.None, false, null);

            DisplayTestReport(
                result,
                options.SynchronizationMode,
                _enumDisplayNameProvider.Get(options.SynchronizationMode),
                outlookFolderType);
            return(connectionTestUrl);
        }
Beispiel #25
0
        public void TaskLists_RefreshDatedTrunk_ClinicFilter()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patS, _userA, _taskListClinic.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshDatedTrunk(DateTime.Today, TaskDateType.None, _userA.UserNum
                                                                              , _clinicN.ClinicNum, _clinicN.Region);
            TaskList taskListUserA = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == _taskListClinic.TaskListNum);

            Assert.IsTrue(taskListUserA != null && taskListUserA.NewTaskCount == 1);
        }
Beispiel #26
0
        public void DeleteList(int taskListIndex)
        {
            Log.Instance.LogDebug(string.Format("TaskListGroup.DeleteList {0}", taskListIndex));

            if (taskListIndex >= TaskLists.Count)
            {
                throw new IndexOutOfRangeException();
            }

            TaskLists.RemoveAt(taskListIndex);

            Persist();
        }
Beispiel #27
0
        public void TaskLists_RefreshDatedTrunk_NoFilter()
        {
            string   suffix           = MethodBase.GetCurrentMethod().Name;
            TaskList taskListNoFilter = TaskListT.CreateTaskList(descript: "No Filter", parent: _taskListMainNoFilter.TaskListNum, globalTaskFilterType: GlobalTaskFilterType.None);

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patN, _userA, taskListNoFilter.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshDatedTrunk(DateTime.Today, TaskDateType.None, _userA.UserNum
                                                                              , _clinicN.ClinicNum, _clinicN.Region);
            TaskList taskList = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == taskListNoFilter.TaskListNum);

            Assert.IsTrue(taskList != null && taskList.NewTaskCount == 3);
        }
Beispiel #28
0
        public void TaskLists_RefreshChildren_RegionFilter()
        {
            string suffix    = MethodBase.GetCurrentMethod().Name;
            long   userInbox = TaskLists.GetMailboxUserNum(_taskListMainNoFilter.TaskListNum);

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patS, _userA, _taskListRegion.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshChildren(_taskListMainNoFilter.TaskListNum, _userA.UserNum, userInbox, TaskType.All
                                                                            , _clinicN.ClinicNum, _clinicN.Region);
            TaskList taskList = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == _taskListRegion.TaskListNum);

            Assert.IsTrue(taskList != null && taskList.NewTaskCount == 1);
        }
Beispiel #29
0
        public void TaskLists_RefreshRepeating_RegionFilterClinicRestriction()
        {
            string   suffix         = MethodBase.GetCurrentMethod().Name;
            TaskList taskListRegion = TaskListT.CreateTaskList(descript: "Region Filter", parent: _taskListMainNoFilter.TaskListNum, globalTaskFilterType: GlobalTaskFilterType.Region
                                                               , isRepeating: true);

            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patN, _userA, taskListRegion.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshRepeating(TaskDateType.None, _userNW.UserNum, _clinicNW.ClinicNum, _clinicNW.Region);
            TaskList        taskList            = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == taskListRegion.TaskListNum);

            Assert.IsTrue(taskList != null && taskList.NewTaskCount == 1);
        }
Beispiel #30
0
        public void TaskLists_RefreshMainTrunk_ClinicFilter()
        {
            string   suffix = MethodBase.GetCurrentMethod().Name;
            TaskList taskListMainClinicFilter = TaskListT.CreateTaskList(descript: "Main Clinic Filter", parent: 0, globalTaskFilterType: GlobalTaskFilterType.Clinic);

            TaskSubscriptions.TrySubscList(taskListMainClinicFilter.TaskListNum, _userA.UserNum);
            //Add clinicS appointment and patient Tasks.
            CreateTasks(suffix, _patS, _userA, taskListMainClinicFilter.TaskListNum);
            //Hashtag No filter
            List <TaskList> listTaskListsActual = TaskLists.RefreshMainTrunk(_userA.UserNum, TaskType.All, _clinicN.ClinicNum, _clinicN.Region);
            TaskList        taskListMain        = listTaskListsActual.FirstOrDefault(x => x.TaskListNum == taskListMainClinicFilter.TaskListNum);

            Assert.IsTrue(taskListMain != null && taskListMain.NewTaskCount == 1);
        }
        private void ShowTaskslists(TaskLists response)
        {
            if (response.Items == null)
            {
                output.Text += "You have no task lists!<br/>";
                return;
            }

            output.Text += "Showing task lists...<br/>";
            foreach (TaskList list in response.Items)
            {
                Panel listPanel = new Panel() { BorderWidth = Unit.Pixel(1), BorderColor = Color.Black };
                listPanel.Controls.Add(new Label { Text = list.Title });
                listPanel.Controls.Add(new Label { Text = "<hr/>" });
                listPanel.Controls.Add(new Label { Text = GetTasks(list) });
                lists.Controls.Add(listPanel);
            }
        }