public async Task <ActionResult> EditTask(Guid taskId, string fromTab)
        {
            TaskDataEntity taskdataEntity = await _taskDataRepository.GetTaskDetailsByTaskIDAsync(taskId);

            TaskAttachementsEntity taskAttachementsEntity = await _taskAttachementsRepository.GetTaskAttachementDetailsByTaskIDAsync(taskId);

            List <TaskActivityEntity> taskActivityEntity = await _taskActivityRepository.GetTaskActivityDetailsByTaskIDAsync(taskId);

            var sortedActivityList = taskActivityEntity.OrderByDescending(x => x.Timestamp).ToList();
            var taskList           = (await DBHelper.GetPageLoadDataAsync(_configuration)).ListofTaskIDs;
            var userList           = await DBHelper.GetListOfUser(_configuration);

            var listofTasks = this.GetTaskListSelectItems(taskList);

            ViewBag.priority    = taskdataEntity.TaskPriority;
            ViewBag.assignedTo  = taskdataEntity.TaskAssignedTo;
            ViewBag.status      = taskdataEntity.TaskStatus;
            ViewBag.title       = taskdataEntity.TaskTitle;
            ViewBag.description = taskdataEntity.TaskDescription;
            ViewBag.subscribers = string.Join(",", taskdataEntity.Subscribers);
            ViewBag.dependetOn  = string.Join(",", taskdataEntity.Dependencies);
            ViewBag.blocks      = string.Join(",", taskdataEntity.Blocks);

            TaskInfo taskInfo = new TaskInfo
            {
                taskID          = taskId,
                taskNumber      = taskdataEntity.TaskName,
                taskAssignedTo  = taskdataEntity.TaskAssignedTo,
                assignedToList  = userList,
                status          = taskdataEntity.TaskStatus,
                statusList      = this.GetStatusList(),
                priority        = taskdataEntity.TaskPriority,
                priorityList    = this.GetPriorityList(),
                title           = taskdataEntity.TaskTitle,
                description     = taskdataEntity.TaskDescription,
                startDate       = taskdataEntity.TaskStartDate,
                dueDate         = taskdataEntity.TaskDueDate,
                attachementURL  = taskAttachementsEntity.AttachementURL,
                subscribers     = taskdataEntity.Subscribers.ToList(),
                subscribersList = userList,
                dependentOn     = taskdataEntity.Dependencies.ToList(),
                dependentOnList = listofTasks,
                blocks          = taskdataEntity.Blocks.ToList(),
                blocksList      = listofTasks,
                activity        = sortedActivityList,
            };

            if (fromTab != null)
            {
                ViewBag.callFromTab = fromTab;
            }
            return(View(taskInfo));
        }
Beispiel #2
0
        public static async Task SaveTaskInfo(TaskInfo taskInfo, IConfiguration configuration)
        {
            TaskDataRepository taskDataRepository = new TaskDataRepository(configuration);

            if (taskInfo != null)
            {
                var rowKey = Guid.NewGuid();

                if (taskInfo.action == "sendAdaptiveCard" || taskInfo.action == "Depends on" || taskInfo.action == "Blocks")
                {
                    taskInfo.taskID        = Guid.NewGuid();
                    taskInfo.attachementID = Guid.NewGuid();
                    taskInfo.subscriberID  = Guid.NewGuid();

                    TaskDataEntity taskDataEntity = new TaskDataEntity
                    {
                        PartitionKey       = PartitionKeyNames.TaskDetailsDataTable.TaskDataPartition,
                        RowKey             = rowKey.ToString(),
                        TaskName           = taskInfo.taskNumber, // change it to auto crated taskName
                        TaskId             = taskInfo.taskID,
                        TaskCreatedBy      = taskInfo.taskCreatedBy,
                        TaskAssignedTo     = taskInfo.taskAssignedTo,
                        TaskCreatedByEmail = taskInfo.taskCreatedByEmail,
                        TaskStatus         = taskInfo.status,
                        TaskPriority       = taskInfo.priority,
                        TaskTitle          = taskInfo.title,
                        TaskDescription    = taskInfo.description,
                        TaskStartDate      = taskInfo.startDate,
                        TaskDueDate        = taskInfo.dueDate,
                        AttachementID      = taskInfo.attachementID,
                        Subscribers        = taskInfo.subscribers,
                        Dependencies       = taskInfo.dependentOn,
                        Blocks             = taskInfo.blocks
                    };

                    await taskDataRepository.CreateOrUpdateAsync(taskDataEntity);
                }
                else if (taskInfo.action == "updateAdaptiveCard")
                {
                    TaskDataEntity taskData = await taskDataRepository.GetTaskDetailsByTaskIDAsync(taskInfo.taskID);

                    taskData.TaskAssignedTo  = taskInfo.taskAssignedTo;
                    taskData.TaskStatus      = taskInfo.status;
                    taskData.TaskPriority    = taskInfo.priority;
                    taskData.TaskTitle       = taskInfo.title;
                    taskData.TaskDescription = taskInfo.description;
                    taskData.TaskDueDate     = taskInfo.dueDate;
                    taskData.Subscribers     = taskInfo.subscribers;
                    taskData.Dependencies    = taskInfo.dependentOn;
                    taskData.Blocks          = taskInfo.blocks;

                    await taskDataRepository.CreateOrUpdateAsync(taskData);
                }

                //check required conditions before pushing data to below tables
                await DBHelper.SaveTaskAttachements(taskInfo, configuration);

                //await DBHelper.SaveSubscribersInfo(taskInfo, configuration);
                //await DBHelper.SaveDependency(taskInfo, configuration);
                if (!string.IsNullOrEmpty(taskInfo.activityComment))
                {
                    await DBHelper.SaveActivity(taskInfo, configuration);
                }
            }
            ;
        }