internal static Nation GetNation(int?keyNa)
        {
            Nation nation       = new Nation();
            string strIdentCode = "";

            if (keyNa != null)
            {
                strIdentCode = IndirizzoDB.LoadNazione(keyNa, string.Empty).PROV;
            }

            nation.IdentificationCode = string.IsNullOrEmpty(strIdentCode) ? "" : strIdentCode;
            return(nation);
        }
        internal static City GetCity(int?keyCom, int?keyLoc)
        {
            City city = new City();

            if (keyCom != null)
            {
                Comuni comuni = IndirizzoDB.LoadComuni(keyCom);

                city.Name     = comuni.COMUNE == null ? "" : comuni.COMUNE;
                city.Zip      = comuni.CAP == null ? "" : comuni.CAP;
                city.District = IndirizzoDB.LoadLocalita(keyLoc).LOCALITA;
            }
            else
            {
                city.Name     = "";
                city.Zip      = "";
                city.District = "";
            }
            return(city);
        }
        public static PASSPORTSCAN Save(PASSPORTSCAN entity)
        {
            if (entity == null)
            {
                return(null);
            }

            try
            {
                var righeReservation = new List <RESERVATION>();
                var righeGuests      = new List <Guests>();
                var righeUsers       = new List <Users>();

                foreach (var datiReservation in entity.RESERVATION)
                {
                    righeReservation.Add(datiReservation);
                }
                SaveReservation(righeReservation);

                foreach (var datiGuest in entity.Guests)
                {
                    righeGuests.Add(datiGuest);
                    Users utente = new Users();
                    utente.NOME        = datiGuest.FirstName;
                    utente.COGNOME     = datiGuest.LastName;
                    utente.DTINS       = DateTime.Now;
                    utente.MAIL        = datiGuest.EMail;
                    utente.STRADA      = datiGuest.Address1;
                    utente.DTNAS       = DateTime.ParseExact(datiGuest.BirthDate, "yyyyMMdd", CultureInfo.InvariantCulture);
                    utente.KEY_NAZ_NAS = IndirizzoDB.LoadNazione(null, (datiGuest.BirthNation + "*")).ID;
                    righeUsers.Add(utente);
                }
                SaveGuest(righeGuests);
                UsersDB.SaveListUsers(righeUsers);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(entity);
        }