コード例 #1
0
ファイル: IntegrationRepository.cs プロジェクト: MartinBG/Gva
        public PersonDataDO ConvertAppWithFlightCrewDataToPersonData(FlightCrewPersonalData FlightCrewlData, GvaCaseType caseType)
        {
            PersonDataDO personData = new PersonDataDO();

            if (!string.IsNullOrEmpty(FlightCrewlData.CAAPersonalIdentificationNumber))
            {
                int lin = 0;
                if (int.TryParse(FlightCrewlData.CAAPersonalIdentificationNumber, out lin))
                {
                    personData.Lin = lin;
                    personData.LinTypeId = this.nomRepository.GetNomValues("linTypes").Where(l => l.Code == "none").Single().NomValueId;
                }
            }

            string countryName = FlightCrewlData.Citizenship.CountryName;
            string countryCode = FlightCrewlData.Citizenship.CountryGRAOCode;
            if (!string.IsNullOrEmpty(countryName))
            {
                NomValue country = this.nomRepository.GetNomValues("countries").Where(c => c.Name == countryName).FirstOrDefault();
                personData.CountryId = country != null ? country.NomValueId : (int?)null;
            }

            if (countryCode == "BG")
            {
                personData.CountryId = this.nomRepository.GetNomValue("countries", "BG").NomValueId;
                personData.FirstName = FlightCrewlData.BulgarianCitizen.PersonNames.First;
                personData.MiddleName = FlightCrewlData.BulgarianCitizen.PersonNames.Middle;
                personData.LastName = FlightCrewlData.BulgarianCitizen.PersonNames.Last;
                personData.DateOfBirth = FlightCrewlData.BulgarianCitizen.BirthDate;
            }
            else
            {
                personData.FirstName = FlightCrewlData.ForeignCitizen.ForeignCitizenNames.FirstCyrillic;
                personData.LastName = FlightCrewlData.ForeignCitizen.ForeignCitizenNames.LastCyrillic;
                personData.DateOfBirth = FlightCrewlData.ForeignCitizen.BirthDate;
            }

            personData.FirstNameAlt = FlightCrewlData.PersonNamesLatin.PersonFirstNameLatin;
            personData.MiddleNameAlt = FlightCrewlData.PersonNamesLatin.PersonMiddleNameLatin;
            personData.LastNameAlt = FlightCrewlData.PersonNamesLatin.PersonLastNameLatin;

            personData.Email = FlightCrewlData.ContactData.EmailAddress;

            personData.CaseTypes = new List<int>() { caseType.GvaCaseTypeId };

            return personData;
        }
コード例 #2
0
ファイル: CabinCrewLicence.cs プロジェクト: MartinBG/Gva
        private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress)
        {
            NomValue placeOfBirth = null;
            NomValue country = null;
            NomValue nationality = null;
            if (personData.PlaceOfBirthId.HasValue)
            {
                placeOfBirth = this.nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value);
                country = this.nomRepository.GetNomValue("countries", placeOfBirth.ParentValueId.Value);
                nationality = this.nomRepository.GetNomValue("countries", personData.CountryId.Value);
            }

            var address = Utils.GetAddress(personAddress, this.nomRepository);

            return new
            {
                FAMILY_BG = personData.LastName.ToUpper(),
                FAMILY_TRANS = personData.LastNameAlt.ToUpper(),
                FIRST_NAME_BG = personData.FirstName.ToUpper(),
                FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(),
                SURNAME_BG = personData.MiddleName.ToUpper(),
                SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(),
                DATEPLACE_OF_BIRTH = new
                {
                    DATE_OF_BIRTH = personData.DateOfBirth,
                    PLACE_OF_BIRTH = new
                    {
                        COUNTRY_NAME = country != null ? country.Name : null,
                        TOWN_VILLAGE_NAME = placeOfBirth != null? placeOfBirth.Name : null
                    },
                    PLACEBIRTH_TRANS = new
                    {
                        COUNTRY_NAME = country != null ? country.NameAlt : null,
                        TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.NameAlt : null
                    }
                },
                ADDRESS_BG = address.Item2,
                ADDRESS_TRANS = address.Item1,
                NATIONALITY = new
                {
                    COUNTRY_NAME_BG = nationality != null? nationality.Name : null,
                    COUNTRY_CODE = nationality != null? nationality.TextContent.Get<string>("nationalityCodeCA") : null
                }
            };
        }
コード例 #3
0
ファイル: CabinCrewLicence.cs プロジェクト: MartinBG/Gva
        private List<object> GetMedCerts(IEnumerable<PersonMedicalDO> includedMedicals, PersonDataDO personData)
        {
            var medicals = includedMedicals.Select(m =>
                new
                {
                    NO = string.Format(
                        "{0}-{1}-{2}-{3}",
                        m.DocumentNumberPrefix,
                        m.DocumentNumber,
                        personData.Lin,
                        m.DocumentNumberSuffix),
                    ISSUE_DATE = m.DocumentDateValidFrom,
                    VALID_DATE = m.DocumentDateValidTo,
                    CLASS = m.MedClassId.HasValue ? nomRepository.GetNomValue("medClasses", m.MedClassId.Value).Name.ToUpper() : null,
                    PUBLISHER = m.DocumentPublisherId.HasValue ? nomRepository.GetNomValue("medDocPublishers", m.DocumentPublisherId.Value).Name : null,
                    LIMITATION = m.Limitations.Count > 0 ? string.Join(",", nomRepository.GetNomValues("medLimitation", m.Limitations.ToArray()).Select(l => l.Name)) : null
                }).ToList<object>();

            return Utils.FillBlankData(medicals, 1);
        }
コード例 #4
0
ファイル: Pilot142year2013.cs プロジェクト: MartinBG/Gva
        private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress)
        {
            var address = Utils.GetAddress(personAddress, this.nomRepository);
            var placeOfBirth = Utils.GetPlaceOfBirth(personData, nomRepository);

            return new
            {
                FAMILY_BG = personData.LastName.ToUpper(),
                FAMILY_TRANS = personData.LastNameAlt.ToUpper(),
                FIRST_NAME_BG = personData.FirstName.ToUpper(),
                FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(),
                SURNAME_BG = personData.MiddleName.ToUpper(),
                SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(),
                DATE_OF_BIRTH = personData.DateOfBirth,
                PLACE_OF_BIRTH = placeOfBirth.Item2,
                PLACE_OF_BIRTH_TRAN = placeOfBirth.Item1,
                ADDRESS = address.Item2,
                ADDRESS_TRANS = address.Item1
            };
        }
コード例 #5
0
ファイル: ForeignLicence.cs プロジェクト: MartinBG/Gva
 private object GetLicenceHolder(PersonDataDO personData)
 {
     return new
     {
         NAME = string.Format(
             "{0} {1}",
             personData.FirstNameAlt,
             personData.MiddleNameAlt
         ).ToUpper(),
         FAMILY = personData.LastNameAlt.ToUpper()
     };
 }
コード例 #6
0
ファイル: RVD_Licence.cs プロジェクト: MartinBG/Gva
        private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress)
        {
            NomValue placeOfBirth = null;
            NomValue country = null;
            NomValue nationality = null;
            if (personData.PlaceOfBirthId.HasValue)
            {
                placeOfBirth = this.nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value);
                country = this.nomRepository.GetNomValue("countries", placeOfBirth.ParentValueId.Value);
                nationality = this.nomRepository.GetNomValue("countries", personData.CountryId.Value);
            }

            NomValue settlement = null;
            if (personAddress.SettlementId.HasValue)
            {
                settlement = this.nomRepository.GetNomValue("cities", personAddress.SettlementId.Value);
            }

            return new
            {
                FAMILY_BG = personData.LastName.ToUpper(),
                FAMILY_TRANS = personData.LastNameAlt.ToUpper(),
                FIRST_NAME_BG = personData.FirstName.ToUpper(),
                FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(),
                SURNAME_BG = personData.MiddleName.ToUpper(),
                SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(),
                DATE_PLACE_OF_BIRTH = new
                {
                    DATE_OF_BIRTH = personData.DateOfBirth,
                    PLACE_OF_BIRTH = new
                    {
                        COUNTRY_NAME = country != null ? country.Name : null,
                        TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.Name : null,
                    },
                    PLACE_OF_BIRTH_TRANS = new
                    {
                        COUNTRY_NAME = country != null ? country.NameAlt : null,
                        TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.NameAlt : null,
                    }
                },
                ADDRESS = string.Format(
                    "{0}, {1}",
                    settlement != null ? settlement.Name : null,
                    personAddress.Address),
                ADDRESS_TRANS = string.Format(
                    "{0}, {1}",
                    personAddress.AddressAlt,
                    settlement != null ? settlement.NameAlt : null),
                NATIONALITY = new
                {
                    COUNTRY_NAME_BG = country.Name,
                    COUNTRY_CODE = nationality.TextContent.Get<string>("nationalityCodeCA"),
                }
            };
        }
コード例 #7
0
ファイル: Utils.cs プロジェクト: MartinBG/Gva
        internal static Tuple<string, string> GetPlaceOfBirth(PersonDataDO personData, INomRepository nomRepository)
        {
            string placeOfBirth = null;
            string placeOfBirthAlt = null;
            if(personData.PlaceOfBirthId.HasValue)
            {
                NomValue city = nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value);
                NomValue country = nomRepository.GetNomValue("countries", city.ParentValueId.Value);
                placeOfBirth = string.Format("{0}, {1}", country.Name, city.Name);
                placeOfBirthAlt = string.Format("{0}, {1}", country.NameAlt, city.NameAlt);
            }

            return new Tuple<string, string>(placeOfBirthAlt, placeOfBirth);
        }
コード例 #8
0
ファイル: Utils.cs プロジェクト: MartinBG/Gva
 internal static string GetPhonesString(PersonDataDO personData)
 {
     string[] phones = {
         personData.Phone5,
         personData.Phone1,
         personData.Phone2,
         personData.Phone3,
         personData.Phone4
     };
     phones = phones.Where(p => !String.IsNullOrEmpty(p)).ToArray();
     return String.Join(", ", phones);
 }
コード例 #9
0
ファイル: Utils.cs プロジェクト: MartinBG/Gva
        internal static List<object> GetMedCerts(
            int orderNumber, IEnumerable<PersonMedicalDO> includedMedicals,
            PersonDataDO personData,
            INomRepository nomRepository)
        {
            var medicals = includedMedicals.Select(m =>
                new
                {
                    ORDER_NO = orderNumber,
                    NO = string.Format(
                        "{0}-{1}-{2}-{3}",
                        m.DocumentNumberPrefix,
                        m.DocumentNumber,
                        personData.Lin,
                        m.DocumentNumberSuffix),
                    ISSUE_DATE = m.DocumentDateValidFrom,
                    VALID_DATE = m.DocumentDateValidTo,
                    CLASS = m.MedClassId.HasValue ? nomRepository.GetNomValue("medClasses", m.MedClassId.Value).Name.ToUpper() : null,
                    PUBLISHER = m.DocumentPublisherId.HasValue ? nomRepository.GetNomValue("medDocPublishers", m.DocumentPublisherId.Value).Name : null,
                    LIMITATION = m.Limitations.Count > 0 ? string.Join(",",nomRepository.GetNomValues("medLimitation", m.Limitations.ToArray()).Select(l => l.Name)) : null
                }).ToList<object>();

            if (medicals.Count() == 0)
            {
                medicals.Add(new
                {
                    ORDER_NO = orderNumber
                });
            }

            return medicals;
        }
コード例 #10
0
ファイル: Utils.cs プロジェクト: MartinBG/Gva
 internal static object GetLicenceHolder(PersonDataDO personData, PersonAddressDO personAddress, INomRepository nomRepository)
 {
     var address = GetAddress(personAddress, nomRepository).Item2;
     return new
     {
         NAME = string.Format(
             "{0} {1} {2}",
             personData.FirstName,
             personData.MiddleName,
             personData.LastName).ToUpper(),
         LIN = personData.Lin,
         EGN = personData.Uin,
         ADDRESS = address,
         TELEPHONE = GetPhonesString(personData)
     };
 }
コード例 #11
0
ファイル: Utils.cs プロジェクト: MartinBG/Gva
        internal static NomValue GetCountry(PersonDataDO personData, INomRepository nomRepository)
        {
            NomValue placeOfBirth = personData.PlaceOfBirthId.HasValue ? nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value) : null;
            int? countryId = placeOfBirth != null ? placeOfBirth.ParentValueId : (int?)null;
            NomValue country = countryId.HasValue ?
                nomRepository.GetNomValue("countries", countryId.Value) :
                new NomValue
                {
                    Name = null,
                    TextContentString = string.Empty
                };

            return country;
        }
コード例 #12
0
ファイル: IntegrationRepository.cs プロジェクト: MartinBG/Gva
        public CorrespondentDO ConvertPersonDataToCorrespondent(PersonDataDO personData)
        {
            CorrespondentDO correspondent = this.correspondentRepository.GetNewCorrespondent();
            CorrespondentType correspondentType = null;
            ;
            if (personData.CountryId == this.nomRepository.GetNomValue("countries", "BG").NomValueId)
            {
                correspondent.BgCitizenFirstName = personData.FirstName;
                correspondent.BgCitizenLastName = personData.LastName;
                correspondent.BgCitizenUIN = personData.Uin;
                correspondentType = this.unitOfWork.DbContext.Set<CorrespondentType>()
                    .SingleOrDefault(e => e.Alias.ToLower() == "BulgarianCitizen".ToLower());
            }
            else
            {
                correspondent.ForeignerFirstName = personData.FirstName;
                correspondent.ForeignerLastName = personData.LastName;
                correspondent.ForeignerBirthDate = personData.DateOfBirth;

                correspondentType = this.unitOfWork.DbContext.Set<CorrespondentType>()
                    .SingleOrDefault(e => e.Alias.ToLower() == "Foreigner".ToLower());

                if (personData.CountryId.HasValue)
                {
                    string countryCode = this.nomRepository.GetNomValue("countries", personData.CountryId.Value).Code;
                    Country country = this.unitOfWork.DbContext.Set<Country>()
                        .Where(s => s.Code == countryCode)
                        .FirstOrDefault();

                    correspondent.ForeignerCountryId = country != null ? country.CountryId : (int?)null;
                }
            }

            correspondent.CorrespondentTypeAlias = correspondentType.Alias;
            correspondent.CorrespondentTypeId = correspondentType.CorrespondentTypeId;
            correspondent.CorrespondentTypeName = correspondentType.Name;

            correspondent.ContactPhone = personData.Phone1;
            correspondent.Email = personData.Email;
            correspondent.ContactFax = personData.Fax;

            GvaViewPerson person = this.personRepository.GetPersons(
                lin: personData.Lin,
                uin: personData.Uin,
                names: string.Format("{0} {1}", personData.FirstName, personData.LastName))
                .FirstOrDefault();

            if (person != null)
            {
                int lotId = person.LotId;
                int validTrueId = this.nomRepository.GetNomValue("boolean", "yes").NomValueId;
                var addressPart = this.lotRepository.GetLotIndex(lotId).Index.GetParts<PersonAddressDO>("personAddresses")
                    .OrderByDescending(a => a.CreateDate)
                    .Where(a => a.Content.ValidId == validTrueId)
                    .FirstOrDefault();
                if (addressPart != null)
                {
                    correspondent.ContactAddress = addressPart.Content.Address;
                    correspondent.ContactPostCode = addressPart.Content.PostalCode;

                    Dictionary<string, string> settlementTypes = new Dictionary<string, string>(){
                    {"T", "гр."},
                    {"V", "с."},
                    {"М", "ман."},
                };

                    NomValue settlement = null;
                    Settlement settlementResult = null;
                    if (addressPart.Content.SettlementId.HasValue)
                    {
                        settlement = this.nomRepository.GetNomValue("cities", addressPart.Content.SettlementId.Value);
                    }
                    string type = settlement.TextContent.Get<string>("type");
                    var settlementType = settlementTypes.ContainsKey(type) ? settlementTypes[type] : "";

                    if(settlement != null)
                    {
                        settlementResult = this.unitOfWork.DbContext.Set<Settlement>()
                            .Where(s => s.SettlementName == settlement.Name && s.TypeName == settlementType)
                            .FirstOrDefault();
                    }

                    correspondent.ContactSettlementId = settlementResult != null ? settlementResult.SettlementId : (int?)null;
                }
            }

            return correspondent;
        }
コード例 #13
0
ファイル: IntegrationRepository.cs プロジェクト: MartinBG/Gva
        public PersonDataDO ConvertAppWithPersonAndForeignCitizenBasicDataToPersonData(
            string caaPersonIdentificator,
            string email,
            PersonBasicData personBasicData,
            ForeignCitizenBasicData foreignCitizenBasicData,
            GvaCaseType caseType)
        {
            PersonDataDO personData = new PersonDataDO();

            if (!string.IsNullOrEmpty(caaPersonIdentificator))
            {
                int lin = -1;
                if (int.TryParse(caaPersonIdentificator, out lin))
                {
                    personData.Lin = lin;
                    personData.LinTypeId = this.nomRepository.GetNomValues("linTypes").Where(l => l.Code == "none").Single().NomValueId;
                }
            }

            if (personBasicData != null)
            {
                personData.CountryId = this.nomRepository.GetNomValue("countries", "BG").NomValueId;
                personData.FirstName = personBasicData.Names.First;
                personData.MiddleName = personBasicData.Names.Middle;
                personData.LastName = personBasicData.Names.Last;
                personData.FirstNameAlt = personBasicData.Names.First;
                personData.MiddleNameAlt = personBasicData.Names.Middle;
                personData.LastNameAlt = personBasicData.Names.Last;
                personData.Uin = personBasicData.Identifier.EGN;
            }
            else if (foreignCitizenBasicData != null)
            {
                personData.FirstName = foreignCitizenBasicData.Names.FirstCyrillic;
                personData.LastName = foreignCitizenBasicData.Names.LastCyrillic;
                personData.DateOfBirth = foreignCitizenBasicData.BirthDate;
                personData.FirstNameAlt = foreignCitizenBasicData.Names.FirstLatin;
                personData.LastNameAlt = foreignCitizenBasicData.Names.LastLatin;
                if (!string.IsNullOrEmpty(foreignCitizenBasicData.IdentityDocument.CountryCode))
                {
                    var country = this.nomRepository.GetNomValues("countries").Where(c => c.Code == foreignCitizenBasicData.IdentityDocument.CountryCode).FirstOrDefault();
                    personData.CountryId = country != null ? country.NomValueId : (int?)null;
                }
            }

            personData.Email = email;

            personData.CaseTypes = new List<int>() { caseType.GvaCaseTypeId };

            return personData;
        }