public static DTOTask MapAPITaskToTask(DTOAPITask objTask, DTOAPITaskDetail objTaskDetail)
        {
            DTOTask paramTask = new DTOTask();

            paramTask.assignedRoleId      = objTask.assignedRoleId ?? -1;
            paramTask.assignedRoleName    = objTask.assignedRoleName ?? "";
            paramTask.createdDate         = objTask.createdDate ?? "";
            paramTask.description         = objTask.description ?? "";
            paramTask.dueDate             = objTask.dueDate ?? "";
            paramTask.estimatedCompletion = objTask.estimatedCompletion ?? "";
            paramTask.estimatedHours      = objTask.estimatedHours;
            paramTask.estimatedStart      = objTask.estimatedStart ?? "";
            paramTask.portalId            = objTask.portalId ?? -1;
            paramTask.priority            = objTask.priority ?? "";
            paramTask.requesterEmail      = objTask.requesterEmail ?? "";
            paramTask.requesterName       = objTask.requesterName ?? "";
            paramTask.requesterPhone      = objTask.requesterPhone ?? "";
            paramTask.requesterUserId     = objTask.requesterUserId ?? -1;
            paramTask.selectedTreeNodes   = objTask.selectedTreeNodes;
            paramTask.sendEmails          = objTask.sendEmails ?? true;
            paramTask.status         = objTask.status ?? "";
            paramTask.taskId         = objTask.taskId ?? -1;
            paramTask.ticketPassword = objTask.ticketPassword ?? "";

            if (objTaskDetail != null)
            {
                DTOTaskDetail paramDTOTaskDetail = new DTOTaskDetail();
                paramDTOTaskDetail.colDTOAttachment = new List <DTOAttachment>();
                paramDTOTaskDetail.contentType      = objTaskDetail.contentType ?? "";
                paramDTOTaskDetail.description      = objTaskDetail.taskDetailDescription ?? "";
                paramDTOTaskDetail.detailId         = objTaskDetail.detailId ?? -1;
                paramDTOTaskDetail.detailType       = objTaskDetail.detailType ?? "";
                paramDTOTaskDetail.emailDescription = objTaskDetail.emailDescription ?? "";
                paramDTOTaskDetail.insertDate       = objTaskDetail.insertDate ?? "";
                paramDTOTaskDetail.sendEmails       = objTaskDetail.sendTaskDetailEmails ?? false;
                paramDTOTaskDetail.startTime        = objTaskDetail.startTime ?? "";
                paramDTOTaskDetail.stopTime         = objTaskDetail.stopTime ?? "";
                paramDTOTaskDetail.userId           = objTaskDetail.userId ?? -1;
                paramDTOTaskDetail.userName         = objTaskDetail.userName ?? "";

                paramTask.colDTOTaskDetail = new List <DTOTaskDetail>();
                paramTask.colDTOTaskDetail.Add(paramDTOTaskDetail);
            }

            return(paramTask);
        }
Exemplo n.º 2
0
        public DTOTaskDetailResponse CreateUpdateTaskDetail(DTOAPITask objTask, DTOAPITaskDetail objTaskDetail, IFormFile objFile)
        {
            DTOTaskDetailResponse objDTOStatus = new DTOTaskDetailResponse();

            objDTOStatus.isSuccess  = true;
            objDTOStatus.message    = "";
            objDTOStatus.taskDetail = new DTOTaskDetail();

            // Get Settings
            string CurrentHostLocation = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
            string ContentRootPath     = _hostEnvironment.ContentRootPath;
            string strCurrentUser      = this.User.Claims.FirstOrDefault().Value;
            string strConnectionString = GetConnectionString();
            int    intUserId           = -1;
            bool   IsSuperUser         = true;
            bool   IsAdministrator     = true;
            bool   IsAuthenticated     = true;

            try
            {
                DTOTask paramTask = ExternalAPIUtility.MapAPITaskToTask(objTask, objTaskDetail);

                objDTOStatus = UploadTaskController.InsertUpdateTaskDetailMethod(
                    strConnectionString,
                    CurrentHostLocation,
                    ContentRootPath,
                    paramTask,
                    objFile,
                    strCurrentUser,
                    intUserId,
                    IsSuperUser,
                    IsAdministrator,
                    strCurrentUser,
                    IsAuthenticated);
            }
            catch (Exception ex)
            {
                objDTOStatus.isSuccess = false;
                objDTOStatus.message   = ex.GetBaseException().Message;
            }

            return(objDTOStatus);
        }