public static void GetXML(Users user)
        {
            string strFilePath = FileService.CreateFolder(ConfigDB.LoadConfig(Config.ParamValues.DIRECTORY_XML).CONF_VALUE);

            //deve essere creata una nuova cartella dentro la quale andare a salvare il file chiamato sempre guest
            //string strFilePath = CaricaFileService.GetXMLPathFileToSave();
            if (string.IsNullOrEmpty(strFilePath))
            {
                return;
            }

            strFilePath = strFilePath + "\\Guest.xml";

            FileStream fileStream = new FileStream(strFilePath, FileMode.Create, FileAccess.Write);

            try
            {
                XmlSerializer     serializer = new XmlSerializer(typeof(EricsoftGuestData));
                EricsoftGuestData ericsofts  = LoadEricsoft(user);

                using (fileStream)
                {
                    XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
                    ns.Add("", "");
                    serializer.Serialize(fileStream, ericsofts, ns);

                    if (serializer == null)
                    {
                        throw new SerializationException();
                    }
                }
                if (!File.Exists(strFilePath))
                {
                    throw new ApplicationException(" File non esistente. ");
                }

                MessageBox.Show("File è stato correttamente salvato nella directory: " + strFilePath, "Export File", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (ApplicationException e)
            {
                MessageBox.Show("Impossibile trovare il file nella posizione indicata. " + e.Message, "File non trovato", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (SerializationException e)
            {
                MessageBox.Show("Serializzazione fallita. Motivo: " + e.Message, "Export File", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                fileStream.Close();
            }
        }
        public static EricsoftGuestData LoadEricsoft(Users user)
        {
            try
            {
                if (!GestioneMySql.OpenConnection())
                {
                    throw new Exception("Errore nell'apertura della connessione.");
                }

                EricsoftGuestData ericsoft = new EricsoftGuestData();

                Header header = new Header();
                header.SourceGenerator = "Riferimento programma";
                header.Date            = DateTime.Now.ToString("yyyy-MM-dd");

                Body body = new Body();
                body.Name             = user.NOME;
                body.Surname          = user.COGNOME;
                body.Gender           = user.SEX;
                body.Residence        = GetResidence(user.SST, user.STRADA, user.NCN);
                body.Residence.City   = GetCity(user.KEY_COM, user.KEY_LOC);
                body.Residence.Nation = GetNation(user.KEY_NAZ);

                body.BirthData        = GetBirthDate(user.DTNAS);
                body.BirthData.City   = GetCity(user.KEY_COM_NAS, user.KEY_LOC_NAS);
                body.BirthData.Nation = GetNation(user.KEY_NAZ_NAS);

                body.Nationality            = GetNationality(user.KEY_NAZ_NAS);
                body.IdentificationDocument = GetIdentificationDocument(user.KEY_DOC);
                body.Authorization          = GetAuthorization();

                ericsoft.Header = header;
                ericsoft.Body   = body;

                if (!GestioneMySql.CloseConnection())
                {
                    throw new Exception("Errore nella chiusura della connessione.");
                }

                return(ericsoft);
            }
            catch (Exception ex)
            {
                GestioneMySql.CloseConnection();
                MessageBox.Show("Errore: " + ex.Message);
                return(null);
            }
        }