コード例 #1
0
 public async Task CheckMasterWeightForQualification(PreQualificationSavingModel model)
 {
     if (model.TechnicalAdministrativeCapacity == 0 || model.FinancialCapacity == 0)
     {
         throw new BusinessRuleException(Resources.QualificationResources.ErrorMessages.pleaseCheckItemWeight);
     }
 }
コード例 #2
0
        public async Task CheckMasterWeightForQualification_WithZeroTechnicalCapacity_ThrowsBusinessException()
        {
            PreQualificationSavingModel preQualificationSavingModel = new PreQualificationSavingModel()
            {
                TechnicalAdministrativeCapacity = 0
            };

            var e = Assert.ThrowsAsync <BusinessRuleException>(async() =>
                                                               await _Sut.CheckMasterWeightForQualification(preQualificationSavingModel));

            Assert.Equal(Resources.QualificationResources.ErrorMessages.pleaseCheckItemWeight, e.Result.Message);
        }
コード例 #3
0
        public PreQualificationSavingModel GetPreQualificationSavingModel()
        {
            PreQualificationSavingModel qualificationSavingModel = new PreQualificationSavingModel()
            {
                TenderTypeId                = (int)Enums.TenderType.PostQualification,
                TenderStatusId              = 4,
                TenderName                  = "Tender Name",
                TechnicalOrganizationId     = 1,
                OffersCheckingCommitteeId   = 1,
                PreQualificationCommitteeId = 1,
                LastEnqueriesDate           = DateTime.Now.Date,
                LastOfferPresentationDate   = DateTime.Now.Date,
                OffersCheckingDate          = DateTime.Now.Date,
            };

            return(qualificationSavingModel);
        }
コード例 #4
0
        public async Task IsValidToCreate(PreQualificationSavingModel tender)
        {
            if (tender == null)
            {
                throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.TenderNotExist);
            }
            if (tender.TenderStatusId == 0)
            {
                tender.TenderStatusId = (int)Enums.TenderStatus.Established;
            }

            if (tender.InsideKSA)
            {
                if (tender.TenderAreaIDs == null || tender.TenderAreaIDs.Count() == 0)
                {
                    throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.EnterTenderAreas);
                }
            }
            else
            {
                if (tender.TenderCountriesIDs == null || tender.TenderCountriesIDs.Count() == 0)
                {
                    throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.EnterTenderCountries);
                }
            }

            if (tender.TechnicalOrganizationId == null && tender.IsAgancyHasTechnicalCommittee && _httpContextAccessor.HttpContext.User.UserRole() != RoleNames.PreQualificationCommitteeSecretary)
            {
                throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.EnterTechnicalCommittee);
            }
            if (tender.PreQualificationCommitteeId == 0)
            {
                tender.PreQualificationCommitteeId = null;
            }
            if (tender.LastOfferPresentationDate == null || tender.LastEnqueriesDate == null || string.IsNullOrEmpty(tender.LastOfferPresentationTime))
            {
                throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.EnterAllQualificationDates);
            }

            if (tender.LastOfferPresentationDate <= tender.LastEnqueriesDate)
            {
                throw new BusinessRuleException(Resources.QualificationResources.ErrorMessages.InvalidLastEnqueriesDate);
            }

            string message = "";
            int    flag    = 1;

            if (tender.LastEnqueriesDate < DateTime.Now)
            {
                flag   *= 0;
                message = Resources.SharedResources.ErrorMessages.DateLessThanToday + "\n";
                throw new BusinessRuleException(message);
            }
            if (tender.OffersCheckingDate.HasValue && tender.OffersCheckingDate <= tender.LastEnqueriesDate)
            {
                flag   *= 0;
                message = Resources.TenderResources.ErrorMessages.CheckingDateLessThanEnquiriesDate + "\n";
                throw new BusinessRuleException(message);
            }

            Util.DetermineTimesForDates(tender.LastOfferPresentationDate.Value, (int)Enums.TimeMessagesType.Qualification, _rootConfiguration);
        }
コード例 #5
0
        public async Task SaveDraftTest()
        {
            _claims = new Claim[2] {
                new Claim(IdentityConfigs.Claims.SelectedGovAgency, "022001000000,022001000000"),
                new Claim(IdentityConfigs.Claims.BranchId, "1")
            };
            _qualificationController = _qualificationController.WithIdentity(_claims);
            PreQualificationSavingModel model = new PreQualificationSavingModel()
            {
                ActivityDescription = "وصف النشاط",
                AttachmentReference = ",idd_2CE19608-84B1-C336-8521-6875EB300000030257:EmployeeReport 1.pdf",
                Attachments         = new List <TenderAttachmentModel>()
                {
                    new TenderAttachmentModel()
                    {
                        AttachmentTypeId   = 16,
                        FileNetReferenceId = "idd_2CE19608-84B1-C336-8521-6875EB300000030257",
                        Name = "EmployeeReport 1.pdf"
                    }
                },
                Details = "التفاصيل",
                IsAgancyHasTechnicalCommittee = true,
                LastEnqueriesDate             = DateTime.Now.AddDays(10),
                OffersCheckingDate            = DateTime.Now.AddDays(25),
                LastOfferPresentationDate     = DateTime.Now.AddDays(10),
                LastOfferPresentationTime     = DateTime.Now.TimeOfDay.ToString(),
                OffersCheckingTime            = DateTime.Now.TimeOfDay.ToString(),
                PreQualificationCommitteeId   = 7,
                TechnicalOrganizationId       = 3,
                TenderActivitieIDs            = new List <int>()
                {
                    201
                },
                TenderAreaIDs = new List <int>()
                {
                    1
                },
                TenderConstructionWorkIDs = new List <int>()
                {
                    17
                },
                TenderMentainanceRunnigWorkIDs = new List <int>()
                {
                    7
                },
                TenderName = "Test Qualification API" + new Random().Next(1, 5000).ToString()
            };


            var result = await _qualificationController.SaveDraft(model);

            Assert.NotNull(result);
            Assert.Equal("022001000000", result.AgencyCode);
            Assert.NotEmpty(result.Attachments);
            Assert.Equal("idd_2CE19608-84B1-C336-8521-6875EB300000030257", result.Attachments[0].FileNetReferenceId);
            Assert.Equal(7, result.PreQualificationCommitteeId);
            Assert.True(result.InsideKSA);
            Assert.Equal(3, result.TechnicalOrganizationId);
            Assert.Equal((int)TenderStatus.UnderEstablishing, result.TenderStatusId);
            Assert.Equal((int)TenderType.PreQualification, result.TenderTypeId);
            Assert.Equal(1, result.branchId);
            Assert.Contains("Test Qualification API", result.TenderName);
        }