private void IsValidToAddEditPreparingOffersTemplate(Tender tender, EditConditionTemplateThridSectionModel model, bool ValidatationFromNextStep = false) { if (!(tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.PreparteOffers || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.EvaluateOffers || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.ContractingRequirments || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.TechnicalDeclerations || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.Specifications || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.LocalContent )) { throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.MustFillPreviousInformation); } if ((!ValidatationFromNextStep && (model?.MaxTimeToAnswerQuestions ?? 0) <= 0) || (ValidatationFromNextStep && (tender.TenderConditionsTemplate?.MaxTimeToAnswerQuestions ?? 0) <= 0)) { var value = Resources.TenderResources.DisplayInputs.MaxTimeToAnswerQuestions; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } if ((!ValidatationFromNextStep && !(model?.HideTechnicalDocumentSections ?? true)) || (ValidatationFromNextStep && !(tender.TenderConditionsTemplate?.HideTechnicalDocumentSections ?? true))) { if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.TechnicalOfferDocuments)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.TechnicalOfferDocuments))) { var value = Resources.OfferResources.DisplayInputs.TechnicalDocuments; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } } // 63138 uncomment below if you want the finance documents be mandatory if (!ValidatationFromNextStep && tender.TenderTypeId != (int)Enums.TenderType.Competition && tender.TenderTypeId != (int)Enums.TenderType.FirstStageTender && tender.TenderTypeId != (int)Enums.TenderType.ReverseBidding) { if (string.IsNullOrEmpty(model?.FinancialOfferDocuments)) { var value = Resources.OfferResources.DisplayInputs.FinancialDocuments; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } } if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.AlternativeEmailForCommuncation)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.AlternativeEmailForCommuncation))) { var value = Resources.TenderResources.DisplayInputs.AlternativeEmailForCommuncation; throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.PleaseCheckTheValueOf + value); } if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.DocumentStyle)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.DocumentStyle))) { var value = Resources.TenderResources.DisplayInputs.DocumentStyle; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } }
public async Task AddEditPreparingOffersTemplate(EditConditionTemplateThridSectionModel model, int branchId) { Tender tender = await _tenderQueries.FindTenderWithConditionsTemplateIntroductionById(Util.Decrypt(model.EncryptedTenderId), branchId); if (tender == null) { throw new UnHandledAccessException(Resources.SharedResources.ErrorMessages.YouHaveNoAccess); } IsValidToAddEditPreparingOffersTemplate(tender, model); UpdateTenderConditionTemplateStatusId(tender, Enums.TenderConditoinsStatus.PreparteOffers); tender.TenderConditionsTemplate.UpdatePreparingOffersStep(model.FinancialOfferDocuments, model.HideTechnicalDocumentSections, model.TechnicalOfferDocuments, model.MaxTimeToAnswerQuestions, model.AlternativeEmailForCommuncation, model.DocumentStyle, model.AllowancePeriodToAddOffersIfNotAddedBeofre, model.AllowedOfferSiningDays, model.WritePrice, model.ConfirimJoiningTheTender, model.OffersChecking, model.OffersEvaluationCriteria); if (model.VersionId >= (int)Enums.ActivityVersions.Sprint7Activities) { tender.TenderDates.UpdateTenderConfirmationLetterDate(model?.ParticipationConfirmationLetterDate); } _genericCommandRepository.Update(tender); await _genericCommandRepository.SaveAsync(); }
public void IsValidToUpdateConditionsTemplateThirdStep(Tender tender, EditConditionTemplateThridSectionModel model, bool ValidatationFromNextStep = false) { IsValidToUpdateConditionsTemplateSecondStep(tender, null, true); if (!(tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.PreparteOffers || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.EvaluateOffers || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.ContractingRequirments || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.TechnicalDeclerations || tender.ConditionTemplateStageStatusId == (int)Enums.TenderConditoinsStatus.Specifications)) { throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.MustFillPreviousInformation); } if ((!ValidatationFromNextStep && (model?.MaxTimeToAnswerQuestions ?? 0) <= 0) || (ValidatationFromNextStep && (tender.TenderConditionsTemplate?.MaxTimeToAnswerQuestions ?? 0) <= 0)) { var value = Resources.TenderResources.DisplayInputs.MaxTimeToAnswerQuestions; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } if ((!ValidatationFromNextStep && !(model?.HideTechnicalDocumentSections ?? true)) || (ValidatationFromNextStep && !(tender.TenderConditionsTemplate?.HideTechnicalDocumentSections ?? true))) { if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.TechnicalOfferDocuments)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.TechnicalOfferDocuments))) { var value = Resources.OfferResources.DisplayInputs.TechnicalDocuments; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } } if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.AlternativeEmailForCommuncation)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.AlternativeEmailForCommuncation))) { var value = Resources.TenderResources.DisplayInputs.AlternativeEmailForCommuncation; throw new BusinessRuleException(Resources.TenderResources.ErrorMessages.PleaseCheckTheValueOf + value); } if ((!ValidatationFromNextStep && string.IsNullOrEmpty(model?.DocumentStyle)) || (ValidatationFromNextStep && string.IsNullOrEmpty(tender.TenderConditionsTemplate?.DocumentStyle))) { var value = Resources.TenderResources.DisplayInputs.DocumentStyle; throw new BusinessRuleException(Resources.TenderResources.DisplayInputs.PleaseEnterValueOf + value); } }