Ejemplo n.º 1
0
        public async Task <ApiResponse> CreateMANewApplicationAsync([FromBody] MABusinessModel maNewApp)
        {
            if (ModelState.IsValid)
            {
                return(new ApiResponse {
                    StatusCode = StatusCodes.Status400BadRequest, IsSuccess = false, Message = "Model is not valid."
                });
            }
            var result = await _maService.CreateMANewApplicationAsync(maNewApp);

            var ma = await _maService.GetAsync(m => m.RowGuid == maNewApp.MA.RowGuid, true);

            if (ma?.MAStatus?.MAStatusCode == "RQST")
            {
                await _generateDocument.GenerateRegistrationPDFDocument(_nodeServices, ma.ID, ma.MAStatus.MAStatusCode, ma.CreatedByUserID);
            }
            return(result);
        }
Ejemplo n.º 2
0
        private async Task Notify(MAAssignment maAssignment)
        {
            var ma = await _maService.GetAsync(maAssignment.MAID);

            var assignedUser = await _userService.GetAsync(maAssignment.AssignedToUserID);

            var users = new List <User> ()
            {
                assignedUser
            };
            var pushNotifier = _notificationFactory.GetNotification(NotificationType.PUSHNOTIFICATION);
            await pushNotifier.Notify(users, new { body = string.Format("Market Authorization with number of {0} has been assigned to you.", ma.MANumber), subject = "Market Authorization Assigned" }, "IPSC");
        }
Ejemplo n.º 3
0
        public async Task <bool> CreateOrUpdateAsync([FromBody] MAReview maReview, bool?changeStatus = false)
        {
            var result = await _maReviewService.MAReviewCreateOrUpdateAsync(maReview, changeStatus);

            if ((bool)changeStatus)
            {
                await _generateDocument.GenerateRegistrationPDFDocument(_nodeServices, maReview.MAID, maReview.SuggestedStatusCode, maReview.ResponderID);

                var roleTeamLeader = (await _roleService.GetRolesByUserAsync(maReview.ResponderID)).FirstOrDefault(r => r.RoleCode == "ROLE_MODERATOR");
                var ma             = await _maService.GetAsync(maReview.MAID);

                if (maReview.SuggestedStatusCode == "SFA" && roleTeamLeader != null && !ma.IsPremarketLabRequest)
                {
                    await _generateDocument.GenerateRegistrationPDFDocument(_nodeServices, maReview.MAID, "CONL", maReview.ResponderID);
                }
            }
            return(result);
        }