Ejemplo n.º 1
0
        public async Task RejectTenderByUnitManagerAsync(string tenderIdString, string comment)
        {
            int    tenderId = Util.Decrypt(tenderIdString);
            Tender tender   = await _tenderQueries.FindTenderWithUnitHistoryById(tenderId);

            _tenderDomainService.IsValidToUpdateRejectTenderByUnitManager(tender, comment);
            TenderUnitStatusesHistory tenderUnitStatusesHistory = new TenderUnitStatusesHistory(comment: comment, tenderUnitStatusId: (int)Enums.TenderUnitStatus.RejectedByManager, estimatedValue: tender.EstimatedValue);

            tender.TenderUnitStatusesHistories.Add(tenderUnitStatusesHistory);
            tender.SetUnitStatus(Enums.TenderUnitStatus.RejectedByManager);
            tender.ResetUnitSecretaryAction();
            #region [Send Notification]
            NotificationArguments NotificationArguments = new NotificationArguments
            {
                BodyEmailArgs    = new object[] { tender.ReferenceNumber },
                SubjectEmailArgs = new object[] { },
                PanelArgs        = new object[] { tender.ReferenceNumber },
                SMSArgs          = new object[] { tender.ReferenceNumber }
            };
            MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArguments,
                                                                                                            $"Tender/TenderDetailsForUnitSecretary?tenderIdString={Util.Encrypt(tender.TenderId)}",
                                                                                                            NotificationEntityType.Tender, tender.TenderId.ToString(), tender.BranchId);
            if (tender.TenderUnitAssigns.OrderByDescending(a => a.TenderUnitAssignId).Last(a => a.IsCurrentlyAssigned).UnitSpecialistLevel == (int)UnitSpecialistLevel.UnitSpecialistLevelOne)
            {
                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.UnitSecrtaryLevel1.OperationsOnTheTender.rejectTenderFromUnitManager, null, mainNotificationTemplateModel);
            }
            else
            {
                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.UnitSecrtaryLevel2.OperationsOnTheTender.rejectTenderFromUnitManager, null, mainNotificationTemplateModel);
            }
            #endregion
            await _tenderCommands.UpdateAsync(tender);
        }
Ejemplo n.º 2
0
        public async Task ReOpenTenderByUnitSecertaryLevelAsync(string tenderIdString)
        {
            int    tenderId = Util.Decrypt(tenderIdString);
            Tender tender   = await _tenderQueries.FindTenderWithUnitHistoryById(tenderId);

            _tenderDomainService.IsValidToReOpenTenderByUnitSecretary(tender);
            TenderUnitStatusesHistory tenderUnitStatusesHistory = new TenderUnitStatusesHistory(comment: "", tenderUnitStatusId: (int)Enums.TenderUnitStatus.UnderUnitReviewLevelTwo, estimatedValue: tender.EstimatedValue);

            tender.TenderUnitStatusesHistories.Add(tenderUnitStatusesHistory);
            tender.SetUnitStatus(Enums.TenderUnitStatus.UnderUnitReviewLevelTwo);
            TenderUnitAssign tenderUnitAssign = new TenderUnitAssign(_httpContextAccessor.HttpContext.User.UserId(), tenderId, true, (int)UnitSpecialistLevel.UnitSpecialistLevelTwo);

            tender.TenderUnitStatusesHistories.Add(tenderUnitStatusesHistory);
            tender.ResetUnitSecretaryAction();
            _genericCommandRepository.Update(tender);
            await _genericCommandRepository.CreateAsync(tenderUnitAssign);

            await _genericCommandRepository.SaveAsync();
        }