/// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='owner'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <ToDoItem> > GetByOwnerAsync(this IToDoList operations, string owner, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetByOwnerWithHttpMessagesAsync(owner, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemple #2
0
 public IndexModel(ILogger <IndexModel> logger, IConfiguration configuration, IToDoList ToDoService, ICustomerService customerService)
 {
     _logger          = logger;
     _configuration   = configuration;
     _ToDoService     = ToDoService;
     _customerService = customerService;
 }
Exemple #3
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     this.ToDoList         = new ToDoList(this);
     this.BaseUri          = new Uri("https://todolistdataapi000.azurewebsites.net:443");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Formatting.Indented,
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
 /// <param name='operations'>
 /// Reference to the ToDoListAPI.IToDoList.
 /// </param>
 /// <param name='todo'>
 /// Required.
 /// </param>
 public static object Put(this IToDoList operations, ToDoItem todo)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IToDoList)s).PutAsync(todo);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <param name='operations'>
 /// Reference to the ToDoListAPI.IToDoList.
 /// </param>
 /// <param name='owner'>
 /// Required.
 /// </param>
 /// <param name='id'>
 /// Required.
 /// </param>
 public static ToDoItem GetById(this IToDoList operations, string owner, int id)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IToDoList)s).GetByIdAsync(owner, id);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #6
0
 public DataController(IWeather weather, IToDoList toDoList, IEngWord engword, ITranslate translate, INews news)
 {
     _Weather   = weather;
     _ToDoList  = toDoList;
     _EngWord   = engword;
     _Translate = translate;
     _News      = news;
 }
Exemple #7
0
        public ToDoListPresenter(IToDoList view, IToDoListRepository repository)
        {
            this.view       = view;
            this.repository = repository;

            view.Add    += AddItem;
            view.Remove += DeleteItem;

            view.UpdateList(repository.GetAllTasks());
        }
Exemple #8
0
 public void Setup()
 {
     _toDoListRepository = new Mock <IToDoListRepo>();
     _toDoListService    = new ToDoListService(_toDoListRepository.Object, Mapper);
     _toDoListRepository.Setup(p => p.Add(It.IsAny <CreateToDoListDto>())).Returns(Task.FromResult(_toDoListDto));
     _toDoListRepository.Setup(p => p.Update(It.IsAny <UpdateToDoListDto>())).Returns(Task.FromResult(_toDoListDto));
     _toDoListRepository.Setup(p => p.Delete(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(1));
     _toDoListRepository.Setup(p => p.GetById(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(_toDoListDto));
     _toDoListRepository.Setup(p => p.GetAllByUser(It.IsAny <PaginationParameters>(), It.IsAny <int>())).Returns(Task.FromResult(_toDoListDtos));
 }
Exemple #9
0
        public void ApagarProjeto(TipoRepository tipoRepository, IToDoList toDo)
        {
            if (toDo == null)
            {
                toDo = ToDoListFactory.CriarTodo(TipoToDo.Projeto, tipoRepository, new List <IToDoList>(), string.Empty);
            }

            GerenciadorTarefa gerenciadorTarefas = new GerenciadorTarefa(new AdicionarTarefa(RepositoryFactory.CriarRepository(tipoRepository), toDo), new RemoverTarefa(RepositoryFactory.CriarRepository(tipoRepository), toDo));

            gerenciadorTarefas.Remover();
        }
Exemple #10
0
        private static void CriarProjetoTarefas(IToDoList toDo = null)
        {
            Console.WriteLine("Digite 1 para criar um projeto.");
            Console.WriteLine("Digite 2 para criar uma tarefa.");
            Console.WriteLine("Digite 3 para consultar seus projetos e suas tarefas.");
            Console.WriteLine("Digite 4 para apagar o projeto.");
            Console.WriteLine("Digite 5 pra sair.");

            if (int.TryParse(Console.ReadLine().ToString(), out int opcao))
            {
                switch (opcao)
                {
                case 1:

                    toDo = CadastrarProjeto();

                    break;

                case 2:

                    toDo = CadastrarTarefa();

                    break;

                case 3:

                    ConsultarProjeto(toDo);

                    break;

                case 4:

                    ApagarProjeto(toDo);

                    break;

                case 5:
                    return;

                default:

                    Console.WriteLine("Opção inválida!");

                    break;
                }
            }
            else
            {
                Console.WriteLine("Opção inválida!");
            }

            CriarProjetoTarefas(toDo);
        }
        private void SaveTasks(IToDoList todoList)
        {
            var projectEngine = _engineFactory.GetProjectEngine();
            var taskEngine    = _engineFactory.GetTaskEngine();

            foreach (var task in todoList.Items.Where(x => _withClosed ? true : !x.Completed))
            {
                try
                {
                    var newTask = new Task()
                    {
                        Title        = ReplaceLineSeparator(task.Content),
                        Status       = task.Completed ? TaskStatus.Closed : TaskStatus.Open,
                        Project      = projectEngine.GetByID(FindProject(todoList.ProjectID)),
                        CreateOn     = task.CreatedOn.ToUniversalTime(),
                        CreateBy     = FindUser(task.CreatorID),
                        Responsibles = new HashSet <Guid>(),
                        Description  = string.Empty
                    };
                    if ("Person".Equals(task.ResponsiblePartyType, StringComparison.OrdinalIgnoreCase))
                    {
                        var user = FindUser(task.ResponsiblePartyID);
                        newTask.Responsible = user;
                        newTask.Responsibles.Add(user);
                    }

                    if (todoList.MilestoneID != -1)
                    {
                        var foundMilestone = FindMilestone(todoList.MilestoneID);
                        if (foundMilestone != -1)
                        {
                            newTask.Milestone = foundMilestone;
                        }
                    }

                    //if (newTask.Responsible.Equals(Guid.Empty)) newTask.Status = TaskStatus.Unclassified;
                    //if (newTask.Responsibles.Count == 0) newTask.Status = TaskStatus.Unclassified;

                    newTask = taskEngine.SaveOrUpdate(newTask, null, true, true);
                    NewTasksID.Add(new TaskIDWrapper {
                        inBasecamp = task.ID, inProjects = newTask.ID
                    });
                    SaveTaskComments(task.RecentComments, task.ID);
                }
                catch (Exception e)
                {
                    Status.LogError(string.Format(SettingsResource.FailedToSaveTask, task.Content), e);
                    LogError(string.Format("task '{0}' failed", task.Content), e);
                    NewTasksID.RemoveAll(x => x.inBasecamp == task.ID);
                }
            }
        }
Exemple #12
0
        private void SaveTasks(IToDoList todoList, int projectID)
        {
            var projectEngine = _engineFactory.ProjectEngine;
            var taskEngine    = _engineFactory.TaskEngine;

            foreach (var task in todoList.Items.Where(x => _withClosed || !x.Completed))
            {
                try
                {
                    var newTask = new Task
                    {
                        Title       = ReplaceLineSeparator(task.Content),
                        Status      = task.Completed ? TaskStatus.Closed : TaskStatus.Open,
                        Project     = projectEngine.GetByID(FindProject(projectID)),
                        CreateOn    = task.CreatedOn.ToUniversalTime(),
                        CreateBy    = FindUser(task.CreatorID),
                        Description = string.Empty,
                        Deadline    = task.Deadline
                    };

                    newTask.Deadline = DateTime.SpecifyKind(newTask.Deadline, DateTimeKind.Local);

                    if (task.ResponsibleID != -1)
                    {
                        var user = FindUser(task.ResponsibleID);
                        newTask.Responsibles.Add(user);
                    }

                    if (todoList.MilestoneID != -1)
                    {
                        var foundMilestone = FindMilestone(todoList.MilestoneID);
                        if (foundMilestone != -1)
                        {
                            newTask.Milestone = foundMilestone;
                        }
                    }

                    newTask = taskEngine.SaveOrUpdate(newTask, null, true, true);
                    _newTasksID.Add(new TaskIDWrapper {
                        InBasecamp = task.ID, InProjects = newTask.ID
                    });
                    SaveTaskComments(task.RecentComments, task.ID);
                }
                catch (Exception e)
                {
                    StatusState.StatusLogError(string.Format(ImportResource.FailedToSaveTask, task.Content), e);
                    LogError(string.Format("task '{0}' failed", task.Content), e);
                    _newTasksID.RemoveAll(x => x.InBasecamp == task.ID);
                }
            }
        }
Exemple #13
0
        public IToDoList CadastrarProjeto(TipoRepository tipoRepository, string tituloProjeto, int quantidadeTarefas, List <string> textosTarefas)
        {
            var tarefas = new List <IToDoList>();

            foreach (var textoTarefa in textosTarefas)
            {
                IToDoList toDo = ToDoListFactory.CriarTodo(TipoToDo.Todo, tipoRepository, null, null, textoTarefa);
                tarefas.Add(toDo);
            }

            var projeto = ToDoListFactory.CriarTodo(TipoToDo.Projeto, tipoRepository, tarefas, tituloProjeto);

            GerenciadorTarefa gerenciadorTarefas = new GerenciadorTarefa(new AdicionarTarefa(RepositoryFactory.CriarRepository(tipoRepository), projeto), new RemoverTarefa(RepositoryFactory.CriarRepository(tipoRepository), projeto));

            gerenciadorTarefas.Adicionar();

            return(projeto);
        }
Exemple #14
0
        public string ConsultarProjeto(IToDoList toDo)
        {
            if (toDo == null)
            {
                return("Não existe projeto criado.");
            }

            var textoTarefas = toDo.ConsultarTarefas();

            if (string.IsNullOrEmpty(textoTarefas))
            {
                return("Não existe projeto criado.");
            }

            StringBuilder textoProjeto = new StringBuilder();

            textoProjeto.AppendLine("Esse são os seus projetos:");
            textoProjeto.AppendLine(textoTarefas);

            return(textoProjeto.ToString());
        }
 /// <summary>
 /// Initializes a new instance of the ToDoListDataAPI class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public ToDoListDataAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("http://localhost:45914");
 }
 /// <summary>
 /// Initializes a new instance of the ToDoListDataAPI class.
 /// </summary>
 public ToDoListDataAPI()
     : base()
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("http://localhost:45914");
 }
Exemple #17
0
 public void SetUp()
 {
     list = new ToDoList();
 }
Exemple #18
0
 public ToDoListController(IToDoList toDoList, ToDoListContext toDoListContext)
 {
     _toDoList        = toDoList;
     _toDoListContext = toDoListContext;
 }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the ToDoListDataAPI class.
 /// </summary>
 public ToDoListDataAPI()
     : base()
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("https://todolistdataapi-mc.azurewebsites.net:443");
 }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the Bobjacsilkroadapi class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public Bobjacsilkroadapi(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("https://bobjacsilkroadapi.azurewebsites.net:443");
 }
        private void SaveTasks(IToDoList todoList)
        {
            var projectEngine = _engineFactory.GetProjectEngine();
            var taskEngine = _engineFactory.GetTaskEngine();
            foreach (var task in todoList.Items.Where(x => _withClosed ? true : !x.Completed))
            {
                try
                {

                    var newTask = new Task()
                    {
                        Title = ReplaceLineSeparator(task.Content),
                        Status = task.Completed ? TaskStatus.Closed : TaskStatus.Open,
                        Project = projectEngine.GetByID(FindProject(todoList.ProjectID)),
                        CreateOn = task.CreatedOn.ToUniversalTime(),
                        CreateBy = FindUser(task.CreatorID),
                        Responsibles = new HashSet<Guid>(),
                        Description = string.Empty
                    };
                    if ("Person".Equals(task.ResponsiblePartyType,StringComparison.OrdinalIgnoreCase) )
                    {
                        var user = FindUser(task.ResponsiblePartyID);
                        newTask.Responsible = user;
                        newTask.Responsibles.Add(user);
                    }

                    if (todoList.MilestoneID != -1)
                    {
                        var foundMilestone = FindMilestone(todoList.MilestoneID);
                        if (foundMilestone != -1)
                        {
                            newTask.Milestone = foundMilestone;
                        }
                    }

                    //if (newTask.Responsible.Equals(Guid.Empty)) newTask.Status = TaskStatus.Unclassified;
                    //if (newTask.Responsibles.Count == 0) newTask.Status = TaskStatus.Unclassified;

                    newTask = taskEngine.SaveOrUpdate(newTask, null, true, true);
                    NewTasksID.Add(new TaskIDWrapper { inBasecamp = task.ID, inProjects = newTask.ID });
                    SaveTaskComments(task.RecentComments, task.ID);
                }
                catch (Exception e)
                {
                    Status.LogError(string.Format(SettingsResource.FailedToSaveTask, task.Content), e);
                    LogError(string.Format("task '{0}' failed", task.Content), e);
                    NewTasksID.RemoveAll(x => x.inBasecamp == task.ID);
                }
            }
        }
Exemple #22
0
 public RazorVue(IToDoList toDoList)
 {
     List = toDoList;
 }
Exemple #23
0
 public ToDoController(IToDoList toDoList)
 {
     _toDoList = toDoList;
 }
Exemple #24
0
        /// <param name='operations'>
        /// Reference to the ToDoListAPI.IToDoList.
        /// </param>
        /// <param name='owner'>
        /// Required.
        /// </param>
        /// <param name='id'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <ToDoItem> GetByIdByOwnerAndIdAsync(this IToDoList operations, string owner, int id, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ToDoListAPI.Models.ToDoItem> result = await operations.GetByIdByOwnerAndIdWithOperationResponseAsync(owner, id, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemple #25
0
        /// <param name='operations'>
        /// Reference to the ToDoListAPI.IToDoList.
        /// </param>
        /// <param name='todo'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <object> PostByTodoAsync(this IToDoList operations, ToDoItem todo, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <object> result = await operations.PostByTodoWithOperationResponseAsync(todo, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        private void SaveTasks(IToDoList todoList, int projectID)
        {
            var projectEngine = _engineFactory.GetProjectEngine();
            var taskEngine = _engineFactory.GetTaskEngine();
            foreach (var task in todoList.Items.Where(x => _withClosed || !x.Completed))
            {
                try
                {
                    var newTask = new Task
                        {
                            Title = ReplaceLineSeparator(task.Content),
                            Status = task.Completed ? TaskStatus.Closed : TaskStatus.Open,
                            Project = projectEngine.GetByID(FindProject(projectID)),
                            CreateOn = task.CreatedOn.ToUniversalTime(),
                            CreateBy = FindUser(task.CreatorID),
                            Description = string.Empty,
                            Deadline = task.Deadline
                        };

                    newTask.Deadline = DateTime.SpecifyKind(newTask.Deadline, DateTimeKind.Local);

                    if (task.ResponsibleID != -1)
                    {
                        var user = FindUser(task.ResponsibleID);
                        newTask.Responsibles.Add(user);
                    }

                    if (todoList.MilestoneID != -1)
                    {
                        var foundMilestone = FindMilestone(todoList.MilestoneID);
                        if (foundMilestone != -1)
                        {
                            newTask.Milestone = foundMilestone;
                        }
                    }

                    newTask = taskEngine.SaveOrUpdate(newTask, null, true, true);
                    _newTasksID.Add(new TaskIDWrapper {InBasecamp = task.ID, InProjects = newTask.ID});
                    SaveTaskComments(task.RecentComments, task.ID);
                }
                catch(Exception e)
                {
                    Status.LogError(string.Format(ImportResource.FailedToSaveTask, task.Content), e);
                    LogError(string.Format("task '{0}' failed", task.Content), e);
                    _newTasksID.RemoveAll(x => x.InBasecamp == task.ID);
                }
            }
        }
Exemple #27
0
 /// <summary>
 /// Initializes a new instance of the Bobjacsilkroadapi class.
 /// </summary>
 public Bobjacsilkroadapi()
     : base()
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("https://bobjacsilkroadapi.azurewebsites.net:443");
 }
        /// <param name='operations'>
        /// Reference to the ToDoListAPI.IToDoList.
        /// </param>
        /// <param name='todo'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <object> PutAsync(this IToDoList operations, ToDoItem todo, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            var result = await operations.PutWithOperationResponseAsync(todo, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemple #29
0
 public RemoverTarefa(IToDoListRepository todoListRepository, IToDoList todoList)
 {
     _todoList           = todoList;
     _todoListRepository = todoListRepository;
 }
        /// <param name='operations'>
        /// Reference to the ToDoListAPI.IToDoList.
        /// </param>
        /// <param name='owner'>
        /// Required.
        /// </param>
        /// <param name='id'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <object> DeleteAsync(this IToDoList operations, string owner, int id, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            var result = await operations.DeleteWithOperationResponseAsync(owner, id, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemple #31
0
 /// <summary>
 /// Initializes a new instance of the ToDoListDataAPI class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public ToDoListDataAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._toDoList = new ToDoList(this);
     this._baseUri  = new Uri("https://todolistdataapi-mc.azurewebsites.net:443");
 }
        /// <param name='operations'>
        /// Reference to the ToDoListAPI.IToDoList.
        /// </param>
        /// <param name='owner'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <ToDoItem> > GetAsync(this IToDoList operations, string owner, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            var result = await operations.GetWithOperationResponseAsync(owner, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }