public MarketCommonApiController(IRequestorMarketProcessor marketProcessor, ISubscriptionRepository subscriptionRepository, IProposalRepository proposalRepository, IAgreementRepository agreementRepository, MarketRequestorEventMapper requestorEventMapper, DemandMapper demandMapper, OfferMapper offerMapper, AgreementMapper agreementMapper) { this.MarketProcessor = marketProcessor; this.SubscriptionRepository = subscriptionRepository; this.ProposalRepository = proposalRepository; this.AgreementRepository = agreementRepository; this.RequestorEventMapper = requestorEventMapper; this.DemandMapper = demandMapper; this.OfferMapper = offerMapper; this.AgreementMapper = agreementMapper; }
public void PushtoDatabase(int columns, int rows, Worksheet worksheet) { Dictionary <string, int> columnNamesWithIndex = new Dictionary <string, int>(); for (int i = 1; i <= columns; i++) { columnNamesWithIndex.Add(worksheet.Cells[i][1].Value.ToString(), i); } var addressMapper = new AddressMapper(); var addressRepository = new AddressRepository(); var personMapper = new PersonMapper(); var personRepository = new PersonRepository(); var financialStateMapper = new FinancialStateMapper(); var financialStateRepository = new FinancialStateRepository(); var agrementMapper = new AgreementMapper(); var agreementRepository = new AgreementRepository(); var peselVerifier = new PeselVerifier(); for (int i = 2; i <= rows; i++) { var addressObject = addressMapper.MapAdress(worksheet, i, columnNamesWithIndex); var addressId = addressRepository.PushAddressesToDb(addressObject); var personObject = personMapper.MapPerson(worksheet, i, columnNamesWithIndex, addressId); var validPesel = peselVerifier.VerifyPesel(personObject.NationalIdentificationNumber); // validPesel -tutaj mam wartosc true albo false dla kazdego z peseli // dla ktorego robie walidacje w osobnej metodzie var personId = personRepository.PushPeopleToDb(personObject); var financialStateObject = financialStateMapper.MapFinancialState(worksheet, i, columnNamesWithIndex); var financialStateId = financialStateRepository.PushFinancialStatesToDb(financialStateObject); var agreementObject = agrementMapper.MapAgreement(worksheet, i, columnNamesWithIndex, personId, financialStateId); agreementRepository.PushAgreementsToDb(agreementObject); } }
public AgreementCrud() { Mapper = new AgreementMapper(); Dao = SqlDao.GetInstance(); }