예제 #1
0
        private DicCustomer GetCustomer(JurInfo customerInfo)
        {
            var        customerTypeJurId = _context.DicCustomerTypes.First(c => c.Code == DicCustomerTypeCodes.Juridical).Id;
            DicCountry countryKz         = null;
            int?       countryKzId       = null;

            if (string.Equals(customerInfo.JurAddress.Country, "КАЗАХСТАН", StringComparison.OrdinalIgnoreCase))
            {
                countryKz   = _context.DicCountries.First(c => c.Code == DicCountryCodes.Kazakhstan);
                countryKzId = countryKz.Id;
            }

            return(new DicCustomer
            {
                TypeId = GetCustomerTypeId(customerInfo.OrgFormCode) ?? customerTypeJurId,
                Xin = customerInfo.BIN,
                DateCreate = DateTimeOffset.Now,
                Address = GetFullAddress(customerInfo.JurAddress, LanguageType.Ru),
                AddressEn = GetFullAddress(customerInfo.JurAddress, LanguageType.En),
                AddressKz = GetFullAddress(customerInfo.JurAddress, LanguageType.Kz),
                City = GetCityName(customerInfo.JurAddress, LanguageType.Ru),
                Region = GetRegionName(customerInfo.JurAddress, LanguageType.Ru),
                Oblast = GetDistrictName(customerInfo.JurAddress, LanguageType.Ru),
                Republic = GetCountryName(customerInfo.JurAddress, LanguageType.Ru),
                Street = GetStreetName(customerInfo.JurAddress, LanguageType.Ru),
                Apartment = customerInfo.JurAddress.Apartment,
                ShortAddress = GetFullAddress(customerInfo.JurAddress, LanguageType.Ru),
                CertificateNumber = customerInfo.CertNumber,
                CertificateSeries = customerInfo.CertSeries,
                NameRuLong = customerInfo.JurName?.NameRu,
                NameKzLong = customerInfo.JurName?.NameKz,
                NameEnLong = customerInfo.JurName?.NameEn,
                NameRu = customerInfo.JurName?.ShortNameRu ?? customerInfo.JurName?.NameRu,
                NameKz = customerInfo.JurName?.ShortNameKz ?? customerInfo.JurName?.NameKz,
                NameEn = customerInfo.JurName?.ShortNameEn ?? customerInfo.JurName?.NameEn,
                Rnn = customerInfo.RNN,
                RegDate = customerInfo.RegDate,
                ContactName = GetCompanyContactName(customerInfo, LanguageType.Ru),
                Country = countryKz,
                CountryId = countryKzId
            });
        }
예제 #2
0
 /// <summary>
 /// Получает имя контактного лица компании.
 /// </summary>
 /// <param name="jurInfo">Информация о компании.</param>
 /// <param name="languageType">Тип языка.</param>
 /// <returns>Имя контактного лица компании.</returns>
 private string GetCompanyContactName(JurInfo jurInfo, LanguageType languageType)
 {
     return(jurInfo.HeadJur != null?GetHeadJurName(jurInfo.HeadJur.Name, languageType) : jurInfo.HeadFiz.FullName);
 }