Ejemplo n.º 1
0
        private async Task SendNotificationFinishStoppingPeroiod(Tender tender, int?agencyCategoryId)
        {
            NotificationArguments NotificationArgument = new NotificationArguments
            {
                BodyEmailArgs = new object[] { "", tender.ReferenceNumber, tender.Purpose, tender.LastEnqueriesDate.Value.ToString("dd/MM/yyyy"), tender.LastOfferPresentationDate.Value.ToString("dd/MM/yyyy"), tender.OffersOpeningDate == null ? Resources.SharedResources.DisplayInputs.NotFound : tender.OffersOpeningDate?.ToString("dd/MM/yyyy"), tender.OffersOpeningDate == null ? Resources.SharedResources.DisplayInputs.NotFound : tender.OffersOpeningDate?.ToString("hh:mm tt") },
                PanelArgs     = new object[] { tender.ReferenceNumber },
                SMSArgs       = new object[] { tender.ReferenceNumber }
            };
            MainNotificationTemplateModel StopPeriod = new MainNotificationTemplateModel(NotificationArgument, $"Tender/Details?STenderId={Util.Encrypt(tender.TenderId)}", NotificationEntityType.Tender, tender.TenderId.ToString(), 0, tender.OffersCheckingCommitteeId);
            MainNotificationTemplateModel StopPeriodDirectPurchase = new MainNotificationTemplateModel(NotificationArgument, $"Tender/Details?STenderId={Util.Encrypt(tender.TenderId)}", NotificationEntityType.Tender, tender.TenderId.ToString(), 0, tender.DirectPurchaseCommitteeId);

            if (tender.TenderTypeId == (int)Enums.TenderType.NewDirectPurchase)
            {
                await _notificationJobAppService.SendNotifications(NotificationOperations.DirectPurchaseSecretary.OperationsOnTheTender.FinishStoppingPeriod, tender.AgencyCode, agencyCategoryId.Value, StopPeriodDirectPurchase, Enums.UserRole.NewMonafasat_SecretaryDirtectPurshasingCommittee.ToString(), (int)tender.DirectPurchaseCommitteeId);
            }
            else
            {
                await _notificationJobAppService.SendNotifications(NotificationOperations.OffersCheckSecretary.OperationsOnTheTender.FinishStoppingPeriod, tender.AgencyCode, agencyCategoryId.Value, StopPeriod, Enums.UserRole.NewMonafasat_OffersCheckSecretary.ToString(), (int)tender.OffersCheckingCommitteeId);
            }
        }
Ejemplo n.º 2
0
        public async Task FindTendersWithPlaintsAfterStoppingPeriodJob()
        {
            List <AgencyCommunicationRequest> agencyCommunications = await _communicationRequestJobQueries.FindTendersWithPlaintsAfterStoppingPeriodJob();

            var agencyCodeList = agencyCommunications.Select(d => d.Tender.AgencyCode).Distinct().ToList();
            var agencies       = await _communicationRequestJobQueries.FindAgenciesByAgencyCodes(agencyCodeList);

            int?agencyCategoryId = 0;

            foreach (var request in agencyCommunications)
            {
                if (request.PlaintNotification == null)
                {
                    continue;
                }
                PlaintRequestNotification obj = request.PlaintNotification;
                obj.Update(true);
                _genericCommandRepository.Update(obj);
                await _genericCommandRepository.SaveAsync();

                agencyCategoryId = agencies.Where(a => a.AgencyCode == request.Tender.AgencyCode).FirstOrDefault().CategoryId;

                NotificationArguments NotificationArguments = new NotificationArguments
                {
                    BodyEmailArgs    = new object[] { "", request.PlaintAcceptanceStatus.Name, request.Tender.ReferenceNumber },
                    SubjectEmailArgs = new object[] { },
                    PanelArgs        = new object[] { request.Tender.ReferenceNumber },
                    SMSArgs          = new object[] { request.Tender.ReferenceNumber }
                };
                MainNotificationTemplateModel approveTender = new MainNotificationTemplateModel(NotificationArguments, $"Tender/Details?STenderId{Util.Encrypt(request.Tender.TenderId)}", NotificationEntityType.Tender, request.Tender.TenderId.ToString(), request.Tender.BranchId);

                if (request.Tender.TenderTypeId == (int)Enums.TenderType.NewDirectPurchase)
                {
                    await _notificationJobAppService.SendNotifications(NotificationOperations.DirectPurchaseSecretary.AgencyCommunicationRequest.PlaintStoppingPeriodEnd, request.Tender.AgencyCode, agencyCategoryId.Value, approveTender, Enums.UserRole.NewMonafasat_SecretaryDirtectPurshasingCommittee.ToString(), (int)request.Tender.DirectPurchaseCommitteeId);
                }
                else
                {
                    await _notificationJobAppService.SendNotifications(NotificationOperations.OffersCheckSecretary.AgencyCommunicationRequest.PlaintStoppingPeriodEnd, request.Tender.AgencyCode, agencyCategoryId.Value, approveTender, Enums.UserRole.NewMonafasat_OffersCheckSecretary.ToString(), (int)request.Tender.OffersCheckingCommitteeId);
                }
            }
        }
Ejemplo n.º 3
0
        public async Task UpdateAllSecondNegotiationWaitingSupplierResponse()
        {
            var allNegotiations = await _negotiationQueries.FindAllSecondNegotiationWaitingSupplierResponse();

            foreach (var NEG in allNegotiations)
            {
                NEG.UpdateNegotiationStatus((int)Enums.enNegotiationStatus.SupplierNotAgreed);

                #region [Send Approval To Agency]
                int?   committeId = NEG.AgencyCommunicationRequest.Tender.OffersCheckingCommitteeId;
                string userRole   = Enums.UserRole.NewMonafasat_OffersCheckSecretary.ToString();
                int    codeId     = NotificationOperations.OffersCheckSecretary.AgencyCommunicationRequest.RecectSecondNegotiationSupplier;
                if (NEG.AgencyCommunicationRequest.Tender.TenderTypeId == (int)Enums.TenderType.CurrentDirectPurchase || NEG.AgencyCommunicationRequest.Tender.TenderTypeId == (int)Enums.TenderType.NewDirectPurchase)
                {
                    committeId = NEG.AgencyCommunicationRequest.Tender.DirectPurchaseCommitteeId;
                    userRole   = Enums.UserRole.NewMonafasat_SecretaryDirtectPurshasingCommittee.ToString();
                    codeId     = NotificationOperations.DirectPurchaseSecretary.AgencyCommunicationRequest.RecectSecondNegotiationSupplier;
                }
                await _negotiationQueries.UpdateNegotiationAsync(NEG);

                NotificationArguments NotificationArguments = new NotificationArguments
                {
                    BodyEmailArgs    = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber },
                    SubjectEmailArgs = new object[] { },
                    PanelArgs        = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber },
                    SMSArgs          = new object[] { "", NEG.AgencyCommunicationRequest.Tender.ReferenceNumber }
                };

                MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArguments,
                                                                                                                $"CommunicationRequest/CreateSecondNegotiation/{Util.Encrypt(NEG.NegotiationId)}",
                                                                                                                NotificationEntityType.Tender,
                                                                                                                NEG.AgencyCommunicationRequest.Tender.TenderId.ToString(), NEG.AgencyCommunicationRequest.Tender.BranchId, committeId);
                await _INotificationJobAppService.SendNotifications(codeId, NEG.AgencyCommunicationRequest.Tender.Agency.AgencyCode, NEG.AgencyCommunicationRequest.Tender.Agency.CategoryId.Value, mainNotificationTemplateModel, userRole, committeId.Value, 0);

                #endregion
                await _negotiationQueries.UpdateNegotiationSecondStageAsync(NEG);
            }

            await _negotiationQueries.SaveChanges();
        }