示例#1
0
        public void CreateProject(string name, long?parentId = null, int?colour = null, bool favourite = false)
        {
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("name", name);
            if (parentId != null)
            {
                parameters.Add("parent_id", parentId);
            }
            if (colour != null)
            {
                parameters.Add("color", colour);
            }
            parameters.Add("favorite", favourite.ToString().ToLower());

            IRestResponse response = ProjectCreateCallManager.CreateProject(parameters);

            SetStatus(response);

            string content = response.Content;

            if (StatusMessage.Equals("OK"))
            {
                ProjectDTO.DeserialiseProject(content);
                ProjectJson = JsonConvert.DeserializeObject <JObject>(content);
            }
        }
        public void CreateTaskDueDateString(string taskContent, long?projectId = null, long?sectionId = null, long?parentId = null,
                                            int?order = null, string dueDate = null, int?priority = null, string dueLang = null)
        {
            JObject parameters = new JObject();

            parameters.Add("content", taskContent);
            if (projectId != null)
            {
                parameters.Add("project_id", projectId);
            }
            if (sectionId != null)
            {
                parameters.Add("section_id", sectionId);
            }
            if (parentId != null)
            {
                parameters.Add("parent_id", parentId);
            }
            if (order != null)
            {
                parameters.Add("order", order);
            }
            if (priority != null)
            {
                parameters.Add("priority", priority);
            }
            if (dueDate != null)
            {
                parameters.Add("due_string", dueDate);
            }
            if (dueLang != null)
            {
                parameters.Add("due_lang", dueLang);
            }

            IRestResponse response = TaskCreateCallManager.CreateTask(parameters);

            SetStatus(response);

            string content = response.Content;

            if (StatusMessage.Equals("OK"))
            {
                TaskDTO.DeserialiseTask(content);
                TaskJson = JsonConvert.DeserializeObject <JObject>(content);
            }
        }