예제 #1
0
        public string UpdateTaskInOutlook(TaskEntity taskEntity)
        {
            Trace.TraceInformation("Update task in outlook");

            if (!InitializeHelpers())
            {
                return("Initialize helpers fail");
            }
            string outlookTaskId = crmHelper.GetOutlookId(taskEntity);

            if (taskEntity.NewTaskOwnerId == Guid.Empty)
            {
                taskEntity.OutlookId = outlookTaskId;
                exchangeHelper.UpdateOutlookTask(taskEntity);
                //if(crmHelper.IsTaskNeedUpdate(taskEntity))
                //crmHelper.UpdateCrmTask(taskEntity);
            }
            else
            {
                string newOwnerMail          = crmHelper.GetUserMailByGuid(taskEntity.NewTaskOwnerId);
                string newOutlookTaskId      = exchangeHelper.CreateNewOutlookTask(taskEntity, newOwnerMail);
                string oldOutlookIdForDelete = outlookTaskId;
                taskEntity.OutlookId = newOutlookTaskId;
                //if(crmHelper.IsTaskNeedUpdate(taskEntity))
                //crmHelper.UpdateCrmTask(taskEntity);
                exchangeHelper.DeleteOutlookTaskById(oldOutlookIdForDelete);
            }
            return("Update success");
        }