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);
        }
        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);
        }