Beispiel #1
0
        void task_Write(ref bool Cancel)
        {
            var  taskExtensionForm = this.formsManager.Items[TASK_EXTENSION_FORM_INDEX].GetCurrentForm() as TaskExtensionForm;
            string projectId = string.Empty;

            if (taskExtensionForm != null)
            {
                projectId = taskExtensionForm.GetFormData();
            }

            var task = new TaskItem
            {
                Subject = this.task.Subject,
                StartDate = this.task.StartDate,
                DueDate = this.task.DueDate,
                Status = (int)this.task.Status,
                SchedulePlusPriority = this.task.SchedulePlusPriority,
                PercentComplete = this.task.PercentComplete,
                Body = this.task.Body,
                ProjectId = projectId
            };
            this.CreateTaskOnServer(task);
        }
Beispiel #2
0
        private async void CreateTaskOnServer(TaskItem task)
        {
            try
            {
                var result = await BackendServiceProxy.CreateTask(task);

                if (result.Success)
                {
                    //this.Project.Id = result.ProjectId;
                    //if (shouldClose)
                    //{
                    //    this.Invoke((MethodInvoker)delegate
                    //    {
                    //        this.Close();
                    //    });
                    //}
                }
                else
                {
                    //this.Invoke((MethodInvoker)delegate
                    //{
                    MessageBox.Show(result.Msg);
                    //});
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An error occured while creating task");
            }
        }
Beispiel #3
0
        public static async Task<CreateTaskResult> CreateTask(TaskItem task)
        {
            var handler = SessionStore.GetInstance().GetHttpClientHandlerWithSID();
            using (var client = new HttpClient(handler))
            {
                client.BaseAddress = new Uri(serviceUrl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var response = await client.PutAsJsonAsync("/api/task", new {task = task});
                response.EnsureSuccessStatusCode();

                return await response.Content.ReadAsAsync<CreateTaskResult>();
            }
        }