示例#1
0
        public IEnumerable <CountryDTO> SelectAll()
        {
            CurrencyRepository currencyRepository = new CurrencyRepository(Connector);
            LanguageRepository languageRepository = new LanguageRepository(Connector);
            RegionRepository   regionRepository   = new RegionRepository(Connector);

            return(Connector.ExecuteReader(selectAllQuery, reader => ReadFromDataReader(reader, currencyRepository, languageRepository, regionRepository)));
        }
        public IEnumerable <PartnerInvoiceDTO> SelectByPartner(Guid partnerId)
        {
            CurrencyRepository             currencyRepository      = new CurrencyRepository(Connector);
            PartnerInvoiceDetailRepository invoiceDetailRepository = new PartnerInvoiceDetailRepository(Connector);

            return(Connector.ExecuteReader(selectByPartnerQuery, new Dictionary <string, object>()
            {
                { "Partner", partnerId }
            }, reader => ReadFromDataReader(reader, currencyRepository, invoiceDetailRepository)));;
        }
示例#3
0
 internal IEnumerable <CurrencyDTO> GetSupportedCurrencies(string id, CurrencyRepository currencyRepository)
 {
     return(Connector.ExecuteReader(getSupportedCurrenciesQuery, new Dictionary <string, object>()
     {
         { "Id", id }
     }, reader =>
     {
         string currencyId = reader["Id"] as string;
         return new CurrencyDTO()
         {
             Id = currencyId,
             DisplayName = new LocalizationDictionary(currencyRepository.GetDisplayName(currencyId))
         };
     }));
 }
示例#4
0
        private CountryDTO ReadFromDataReader(IDataReader reader, CurrencyRepository currencyRepository, LanguageRepository languageRepository, RegionRepository regionRepository)
        {
            string id = reader["Id"] as string;

            return(new CountryDTO()
            {
                Id = id,
                DisplayName = new LocalizationDictionary(GetDisplayName(id)),
                PredominantCurrency = new CurrencyDTO()
                {
                    Id = reader["PredominantCurrency"] as string
                },
                PredominantLanguage = new LanguageDTO()
                {
                    Id = reader["PredominantLanguage"] as string
                },
                Regions = regionRepository.ReadByCountry(id),
                SupportedCurrencies = GetSupportedCurrencies(id, currencyRepository),
                SupportedLanguages = GetSupportedLanguages(id, languageRepository)
            });
        }
        private PartnerInvoiceDTO ReadFromDataReader(IDataReader reader, CurrencyRepository currencyRepository, PartnerInvoiceDetailRepository invoiceDetailRepository)
        {
            string currencyId = reader["CurrencyId"] as string;
            Guid   invoiceId  = (Guid)reader["Id"];

            return(new PartnerInvoiceDTO()
            {
                Id = invoiceId,
                Partner = new PartnerDTO()
                {
                    Id = (Guid)reader["Partner"]
                },
                TimeStamp = (DateTime)reader["TimeStamp"],
                Currency = new CurrencyDTO()
                {
                    Id = currencyId,
                    DisplayName = new LocalizationDictionary(currencyRepository.GetDisplayName(currencyId)),
                    Symbol = reader["CurrencySymbol"] as string
                },
                StripeId = reader["StripeId"] as string,
                Details = invoiceDetailRepository.SelectByInvoice(invoiceId)
            });
        }
示例#6
0
        private PartnerDTO ReadFromDataReader(IDataReader reader, PartnerCardRepository cardRepository, CountryRepository countryRepository, CurrencyRepository currencyRepository,
                                              CustomerQuestionRepository customerQuestionRepository, DistrictRepository districtRepository, GenderRepository genderRepository, PartnerInvoiceRepository invoiceRepository,
                                              LanguageRepository languageRepository, PropertyRepository propertyRepository, ProvinceRepository provinceRepository, RegionRepository regionRepository)
        {
            string countryId = reader["Country"] as string, districtId = reader["District"] as string, genderId = reader["Gender"] as string,
                   preferredCurrencyId = reader["PreferredCurrencyId"] as string, preferredLanguageId = reader["PreferredLanguage"] as string, provinceId = reader["Province"] as string,
                   regionId    = reader["Region"] as string;
            CountryDTO country = new CountryDTO()
            {
                Id                  = countryId,
                DisplayName         = new LocalizationDictionary(countryRepository.GetDisplayName(countryId)),
                Regions             = regionRepository.ReadByCountry(countryId),
                SupportedCurrencies = countryRepository.GetSupportedCurrencies(countryId),
                SupportedLanguages  = countryRepository.GetSupportedLanguages(countryId)
            };
            Guid id = (Guid)reader["Id"];

            return(new PartnerDTO()
            {
                Id = id,
                Username = reader["Username"] as string,
                Password = reader["Password"] as byte[],
                FirstName = reader["FirstName"] as string,
                MiddleName = reader["MiddleName"] as string,
                LastName = reader["LastName"] as string,
                Gender = new GenderDTO()
                {
                    Id = genderId,
                    DisplayName = new LocalizationDictionary(genderRepository.GetDisplayName(genderId))
                },
                EmailAddress = reader["EmailAddress"] as string,
                MobileNumber = reader["MobileNumber"] as string,
                CompanyName = reader["CompanyName"] as string,
                Address = reader["Address"] as string,
                District = new DistrictDTO()
                {
                    Country = country,
                    Code = districtId,
                    DisplayName = new LocalizationDictionary(districtRepository.GetDisplayName(country.Id, districtId))
                },
                Province = new ProvinceDTO()
                {
                    Country = country,
                    Code = provinceId,
                    DisplayName = new LocalizationDictionary(provinceRepository.GetDisplayName(country.Id, provinceId)),
                    Districts = districtRepository.ReadByCountryAndRegionAndProvince(countryId, regionId, provinceId)
                },
                Region = new RegionDTO()
                {
                    Country = country,
                    Code = regionId,
                    DisplayName = new LocalizationDictionary(regionRepository.GetDisplayName(country.Id, regionId)),
                    Provinces = provinceRepository.ReadByCountryAndRegion(countryId, regionId)
                },
                Country = country,
                PhoneNumber = reader["PhoneNumber"] as string,
                Website = reader["Website"] as string,
                PreferredCurrency = new CurrencyDTO()
                {
                    Id = preferredCurrencyId,
                    DisplayName = new LocalizationDictionary(currencyRepository.GetDisplayName(preferredCurrencyId)),
                    Symbol = reader["PreferredCurrencySymbol"] as string
                },
                PreferredLanguage = new LanguageDTO()
                {
                    Id = preferredLanguageId,
                    DisplayName = new LocalizationDictionary(languageRepository.GetDisplayName(preferredLanguageId))
                },
                StripeId = reader["StripeId"] as string,
                HasEmailAddressBeenVerified = (bool)reader["HasEmailAddressBeenVerified"],
                IsLocked = (bool)reader["IsLocked"],
                IsActive = (bool)reader["IsActive"],
                Cards = cardRepository.SelectByPartner(id),
                CustomerQuestions = customerQuestionRepository.SelectByPartner(id),
                Invoices = invoiceRepository.SelectByPartner(id),
                Properties = propertyRepository.SelectByPartner(id)
            });
        }