Exemplo n.º 1
0
        public static ProjectTask[] GetTasks(string authToken, int projectId)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("ProjectId", projectId.ToString());

            var responseResult = ((dynamic)TaskManagerAPI.SendRequest(Enumeration.RequestType.GET, "/api/task/gettasks", parameters, authToken));

            List <ProjectTask> results = new List <ProjectTask>();

            foreach (var item in responseResult)
            {
                // Should be a list of tasks...
                ProjectTask task = new ProjectTask()
                {
                    Completed     = item.Completed,
                    CompletedWhen = item.CompletedWhen,
                    CreatedBy     = item.CreatedBy,
                    CreatedWhen   = item.CreatedWhen,
                    Description   = item.Description,
                    ProjectId     = item.ProjectId,
                    ProjectTaskId = item.ProjectTaskId
                };

                results.Add(task);
            }

            return(results.ToArray());
        }
Exemplo n.º 2
0
        public static void DeleteProject(string authToken, int projectId)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("ProjectId", projectId.ToString());

            TaskManagerAPI.SendRequest(Enumeration.RequestType.POST, "/api/project/deleteproject", parameters, authToken);
        }
Exemplo n.º 3
0
        public static void UpdateTaskCompletedStatus(string authToken, int taskId, bool completed)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("TaskId", taskId.ToString());
            parameters.Add("Completed", completed.ToString());

            TaskManagerAPI.SendRequest(Enumeration.RequestType.POST, "/api/task/UpdateTaskCompletedStatus", parameters, authToken);
        }
Exemplo n.º 4
0
        public static int CreateProject(string authToken, string projectName)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("name", projectName);

            dynamic requestResult = TaskManagerAPI.SendRequest(Enumeration.RequestType.POST, "/api/project/createproject", parameters, authToken);

            return(0);
        }
Exemplo n.º 5
0
        public static int CreateTask(string authToken, int projectId, string description)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("ProjectId", projectId.ToString());
            parameters.Add("Description", description);

            object result = TaskManagerAPI.SendRequest(Enumeration.RequestType.POST, "/api/task/createtask", parameters, authToken);

            return(0);
        }
Exemplo n.º 6
0
        public static Project GetProject(string authToken, int projectId)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("ProjectId", projectId.ToString());

            dynamic requestResult = TaskManagerAPI.SendRequest(Enumeration.RequestType.GET, "/api/project/getproject", parameters, authToken);
            Project project       = new Project()
            {
                CreatedBy   = requestResult.CreatedBy,
                CreatedWhen = requestResult.CreatedWhen,
                Name        = requestResult.Name,
                ProjectId   = requestResult.ProjectId
            };

            return(project);
        }
Exemplo n.º 7
0
        public static Project[] GetProjects(string authToken)
        {
            dynamic requestResult = TaskManagerAPI.SendRequest(Enumeration.RequestType.GET, "/api/project/getprojects", null, authToken);

            List <Project> results = new List <Project>();

            foreach (var item in requestResult)
            {
                Project proj = new Project()
                {
                    CreatedBy   = item.CreatedBy,
                    CreatedWhen = item.CreatedWhen,
                    Name        = item.Name,
                    ProjectId   = item.ProjectId
                };

                results.Add(proj);
            }

            return(results.ToArray());
        }
Exemplo n.º 8
0
        /// <summary>
        /// Calls the API and returns the email of the currently authenticated user
        /// </summary>
        public static string WhoAmI(string authToken)
        {
            object result = TaskManagerAPI.SendRequest(Enumeration.RequestType.GET, "/API/Account/WhoAmI", null, authToken);

            return(result.ToString());
        }