示例#1
0
 public static bool IsOverdue(Task_V01 task)
 {
     //todo: validate logic
     //note: checking status has to be happen here, don't remove it
     //this method is used on two pages as well.
     return(task.Status.Key !=
            HL.DistributorCRM.ValueObjects.Task.TaskStatusType.COMPLE.Key &&
            task.DueTime.HasValue &&
            task.DueTime < DateTime.UtcNow);
 }
示例#2
0
        private void SaveTask()
        {
            Task_V01 Task = new Task_V01()
            {
                Subject  = SubjectTextBox.Text,
                Notes    = NotesTextBox.Text,
                Status   = TaskStatusType.NOTSTA,
                Priority = TaskPriorityType.M
            };

            //todo: error handling
            SchedulerDataProvider.SaveTask(DistributorID, Task, true);
        }
示例#3
0
        public static int Compare(Task_V01 p, Task_V01 q)
        {
            //note sorting is only based on Overrdue status and havind due date
            //. Sorting is not based on status at all.
            int sortOrder = 1;
            int result    = 0;

            if (!p.DueTime.HasValue && !q.DueTime.HasValue)
            {
                result = -DateTime.Compare(p.LastUpdateTime, q.LastUpdateTime);
            }

            else if (p.DueTime.HasValue && !q.DueTime.HasValue)
            {
                result = -1;
            }

            else if (!p.DueTime.HasValue && q.DueTime.HasValue)
            {
                result = 1;
            }
            else//both have due time,
            {
                if (IsOverdue(p) && IsOverdue(q))
                {
                    result = DateTime.Compare(p.DueTime.Value, q.DueTime.Value);
                }
                else if (!IsOverdue(p) && !IsOverdue(q))
                {
                    result = DateTime.Compare(p.DueTime.Value, q.DueTime.Value);
                }
                else if (IsOverdue(p) && !IsOverdue(q))
                {
                    result = -1;
                }
                else if (!IsOverdue(p) && IsOverdue(q))
                {
                    result = 1;
                }
            }

            return(sortOrder * result);
        }
示例#4
0
 public static int SaveTask(string distributorID, Task_V01 task, bool isNew)
 {
     using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy())
     {
         try
         {
             SaveTaskRequest_V01 request01 = new SaveTaskRequest_V01()
             {
                 DistributorID = distributorID,
                 Task          = task,
                 IsNew         = isNew,
             };
             SaveTaskResponse_V01 responseV01 =
                 proxy.SaveTask(new SaveTaskRequest1(request01)).SaveTaskResult as SaveTaskResponse_V01;
             //todo: validate response, handle errors.
             return(responseV01.TaskID);
         }
         catch (Exception ex)
         {
             Log(ex, proxy);
             throw ex;
         }
     }
 }