Ejemplo n.º 1
0
 internal IEnumerable <LanguageDTO> GetSupportedLanguages(string id, LanguageRepository languageRepository)
 {
     return(Connector.ExecuteReader(getSupportedLanguagesQuery, new Dictionary <string, object>()
     {
         { "Id", id }
     }, reader =>
     {
         string languageId = reader["Id"] as string;
         return new LanguageDTO()
         {
             Id = languageId,
             DisplayName = new LocalizationDictionary(languageRepository.GetDisplayName(languageId))
         };
     }));
 }
Ejemplo n.º 2
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)
            });
        }