Пример #1
0
        private async Task SendNotificationAfterApproveReply(EnquiryReply enquiryReply)
        {
            var           tender = enquiryReply.Enquiry.Tender;
            List <string> crs    = (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification) ? await _iDMAppService.QualificationToSendInvitation(tender.TenderId) : await _iDMAppService.GetAllSupplierOnTender(tender.TenderId);

            NotificationArguments NotificationArgument = new NotificationArguments();

            if (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification)
            {
                NotificationArgument.BodyEmailArgs = new object[] { "", tender.TenderName, tender.ReferenceNumber, tender?.LastEnqueriesDate, tender?.LastOfferPresentationDate };
            }
            else
            {
                NotificationArgument.BodyEmailArgs = new object[] { "", tender.TenderName, tender.ReferenceNumber, tender.Purpose, tender?.LastEnqueriesDate, tender?.LastOfferPresentationDate, tender.OffersOpeningDate, tender?.OffersOpeningDate?.Hour };
            }

            NotificationArgument.SubjectEmailArgs = new object[] { };
            NotificationArgument.PanelArgs        = new object[] { tender.ReferenceNumber };
            NotificationArgument.SMSArgs          = new object[] { tender.ReferenceNumber };

            MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArgument, $"Enquiry/SupplierEnquiriesOnTender?id={Util.Encrypt(tender.TenderId)}", NotificationEntityType.Tender, tender.TenderId.ToString(), 0, tender.TechnicalOrganizationId);

            if (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification)
            {
                await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.InquiriesAboutTender.publishfaqanswerforQualification, crs, mainNotificationTemplateModel);

                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.TechnicalCommitteeSecretary.InquiriesAboutTender.PublishfaqanswerforQualification, tender.TechnicalOrganizationId, mainNotificationTemplateModel);
            }
            else
            {
                await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.InquiriesAboutTender.publishfaqanswer, crs, mainNotificationTemplateModel);

                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.TechnicalCommitteeSecretary.InquiriesAboutTender.publishfaqanswerbackend, tender.TechnicalOrganizationId, mainNotificationTemplateModel);
            }

            enquiryReply.Enquiry.Tender.AddActionHistory(tender.TenderStatusId, TenderActions.ApproveFAQ, "", _httpContextAccessor.HttpContext.User.UserId());
            var comunicationRequest = await _enquiryQueries.GetEnquiryReplyWithCommunicationRequest(enquiryReply.EnquiryReplyId);

            AgencyCommunicationRequest agencyCommunicationRequest = await _enquiryDomain.GetEnquiryCommunicationRequestByRequestId(comunicationRequest.Enquiry.AgencyCommunicationRequest.AgencyRequestId);

            if (agencyCommunicationRequest.StatusId == (int)Enums.AgencyCommunicationRequestStatus.PendingEnquiryForReply && enquiryReply.EnquiryReplyStatusId == (int)Enums.EnquiryReplyStatus.Approved)
            {
                agencyCommunicationRequest.UpdateAgencyCommunicationRequestStatus((int)Enums.AgencyCommunicationRequestStatus.ReplyOnEnquiry);
                await _enquiryDomain.UpdateCommunicationRequest(agencyCommunicationRequest);
            }
        }