public void Should_updateAttachmentsList() { SupplierCombinedDetail supplierCombinedDetail = new SupplierCombinedDetail(); supplierCombinedDetail.updateAttachmentsList(new List <SupplierSpecificationDetail>() { new SupplierSpecificationDetail() }); supplierCombinedDetail.ShouldNotBeNull(); }
private async Task <SupplierCombinedDetail> SaveDirectPurchaseAttachment(OfferDetailModel model, SupplierCombinedDetail details /*, Offer offer*/) { var statuses = GetOfferDirectPurchaseStatuses(details.Combined.Offer); bool isOneFile = statuses.Item1, isTechnical = statuses.Item2, isFinancial = statuses.Item3; List <SupplierSpecificationDetail> SpecificationsLst = new List <SupplierSpecificationDetail>(); if ((isOneFile || isTechnical) && model.CombinedOwner) { details.Combined.Offer.UpdateOfferAttachments(model.IsOfferCopyAttached, model.IsOfferLetterAttached, model.OfferLetterNumber, model.OfferLetterDate, model.IsVisitationAttached, model.IsPurchaseBillAttached, model.IsBankGuaranteeAttached); } if ((isOneFile || isFinancial) && model.CombinedOwner) { List <SupplierBankGuaranteeDetail> GuaranteesLst = new List <SupplierBankGuaranteeDetail>(); foreach (var item in model.BankGuaranteeFiles) { var BankGuarantee = new SupplierBankGuaranteeDetail(item.BankGuaranteeId, details.Combined.Offer.OfferId, item.IsBankGuaranteeValid, item.GuaranteeNumber, item.BankId.Value, item.Amount, item.GuaranteeStartDate, item.GuaranteeEndDate, item.GuaranteeDays); GuaranteesLst.Add(BankGuarantee); } details.Combined.Offer.UpdateBankGurnteesDetails(GuaranteesLst); details.Combined.Offer.UpdateOfferFinantialCheckingDetails(model.IsFinaintialOfferLetterAttached, model.FinantialOfferLetterNumber, model.FinantialOfferLetterDate, model.IsFinantialOfferLetterCopyAttached, model.IsBankGuaranteeAttached); } if (isOneFile || isTechnical) { foreach (var item in model.SpecificationsFiles) { var Specification = new SupplierSpecificationDetail(item.SpecificationId, Util.Decrypt(model.CombinedIdString), item.IsForApplier, item.Degree, item.ConstructionWorkId, item.MaintenanceRunningWorkId); SpecificationsLst.Add(Specification); } details.updateAttachmentsList(SpecificationsLst); details.UpdateAttachmentDetails(details.CombinedDetailId, Util.Decrypt(model.CombinedIdString), model.IsChamberJoiningAttached, model.IsChamberJoiningValid, model.IsCommercialRegisterAttached, model.IsCommercialRegisterValid, model.IsSaudizationAttached, model.IsSaudizationValidDate, model.IsSocialInsuranceAttached, model.IsSocialInsuranceValidDate, model.IsZakatAttached, model.IsZakatValidDate, model.IsSpecificationAttached, model.IsSpecificationValidDate); if (details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersChecking) { details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersChecking); } } if (isFinancial && details.Combined.Offer.Tender.TenderStatusId != (int)Enums.TenderStatus.OffersFinancialChecking) { details.Combined.Offer.Tender.UpdateTenderStatus(Enums.TenderStatus.OffersFinancialChecking); } return(details); }