Ejemplo n.º 1
0
        public async Task <SPSiteCreationDTO> SaveRequestData(SPSiteCreationDTO dto)
        {
            Mapper.Map(dto.MembersList, dto.DomainModel.ITSPSiteMember);
            bool IsAdminChecked = false;

            foreach (var item in dto.MembersList)
            {
                if (item.IsAdmin == true)
                {
                    dto.DomainModel.SiteOwnerEmail = item.MemberEmail;
                    IsAdminChecked = true;
                    break;
                }
            }
            if (IsAdminChecked == false)
            {
                dto.DomainModel.SiteOwnerEmail = dto.DomainModel.EmployeeEmail;
            }
            await AddNewRequest(dto.DomainModel);

            dto.DomainModel.JobId = await KtaService.CreateJobAsync(dto.SessionId, AppConfiguaraton.SPSiteCreationProcessIdID, dto.DomainModel.Id);
            await UpdateKtaJobID(dto.DomainModel.Id, dto.DomainModel.JobId);

            return(dto);
        }
        public async Task <IActionResult> ProcessRequest([FromBody] SPSiteCreationDTO dto)
        {
            dto.SessionId = await base.getUserSession();

            dto.Requester.Username = CurrentUser;

            await _serviceManager.ProcessRequest(dto);

            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <SPSiteCreationDTO> GetSPSiteCreation(RequestDataModel data)
        {
            //FindOneByJobId(jobId)
            //Inclufe other items so i need querable .include
            SPSiteCreationDTO dto = new SPSiteCreationDTO();

            dto.DomainModel = await GetQuerable().Where(x => x.JobId == data.JobId).DefaultIfEmpty().Include(x => x.ITSPSiteMember).FirstOrDefaultAsync();

            var ITSPSiteMembersItems = dto.DomainModel.ITSPSiteMember;

            dto.MembersList = Mapper.Map <List <SPSiteMember> >(ITSPSiteMembersItems);

            return(dto);
        }
        public async Task <IActionResult> PostRequest([FromBody] SPSiteCreationDTO dto)
        {
            dto.SessionId = await base.getUserSession();

            dto.DomainModel.EmployeeEmail = CurrentUserEmail;
            dto.Requester.Username        = CurrentUser;
            var employeedata = await EmployeeService.FindEmployeeWithEmailAsync(CurrentUserEmail);

            dto.DomainModel.DepartmentOfRequestor = employeedata.DepartmentEn;
            dto.DomainModel.SectorOfRequestor     = employeedata.SectionNameEn;

            await _serviceManager.SaveRequestData(dto);

            return(Ok());
        }
Ejemplo n.º 5
0
        public async Task <SPSiteCreationDTO> ProcessRequest(SPSiteCreationDTO dto)
        {
            if (dto.activity == null)
            {
                dto.activity = await KtaService.TakeActivityAsync(dto.SessionId, dto.DomainModel.JobId, dto.NodeID, dto.EPC);
            }
            if (dto.activity.Identity.NodeId == dto.NodeID && (dto.activity.Identity.NodeId == ConstantNodes.NodeId_SPAdminNodeId || dto.activity.Identity.NodeId == ConstantNodes.NodeId_SPAdminExecutionNodeId))
            {
                Mapper.Map(dto.MembersList, dto.DomainModel.ITSPSiteMember);
                Mapper.Map(dto.ListsAndLibraries, dto.DomainModel.ITSPSiteListsAndLibraries);
                var entity = FindOneById(dto.DomainModel.Id);
                Mapper.Map(dto.DomainModel, entity);

                await UpdateRequest();
            }

            await KtaService.CompleteActivityAsync(dto.SessionId, dto.Requester.Username, dto.ManagerDecision.Id, dto.ManagerDecision.Comment, dto.activity.Identity);

            return(dto);
        }