Exemple #1
0
 public static void InitialLogging(Query query, IList<string> operators, IList<string> hotels)
 {
     CreateLogFolder();
     ResetLogFile();
     LogProcess("App Version:"+Helper.GetVersion());
     query.SetCultureInfo(new CultureInfo("tr-TR"));
     var xmlSerializer = new XmlSerializer();
     var serializedQuery = xmlSerializer.Serialize(query);
     LogProcess("Query:");
     LogProcess(serializedQuery);
     LogProcess("-----");
 }
Exemple #2
0
 public static void SaveSites(Dictionary<string, ProgramOptions> sitesSettings)
 {
     var files = Directory.GetFiles(ProgramSettingsFolder, "*.xml");
     foreach (var file in files)
     {
         File.Delete(file);
     }
     foreach (KeyValuePair<string, ProgramOptions> siteSetting in sitesSettings)
     {
         var fileName = ProgramSettingsFolder + "/" + siteSetting.Key + ".xml";
         var xmlSerializer = new XmlSerializer();
         xmlSerializer.Serialize(fileName, siteSetting.Value);
     }
 }
Exemple #3
0
 public void BuildQueries(Query query)
 {
     //serialize query object
     var xmlSerializer= new XmlSerializer();
     var xsltTransformer = new DefaultXslTransformer();
     var fileReaderWriter = new FileReaderWriter();
     var tourInfoFactory = new TourInfoFactory();
     //transform serialized object with accompanying xsl template and set to operator.query
     foreach (var op in _operatorFactory.Operators)
     {
         query.SetCultureInfo(op.CultureInfo);
         var serializedQuery = xmlSerializer.Serialize(query);
         op.SerializedTourDataRequests = xsltTransformer.Transform(serializedQuery, op.QueryTemplateFile, false);
         op.SerializedHotelListRequests = xsltTransformer.Transform(serializedQuery, op.AllHotelsTemplateFile, false);
         if (!string.IsNullOrEmpty(op.TourInfoFile) && File.Exists(op.TourInfoFile))
         {
             op.TourInfo = tourInfoFactory.Deserialize(fileReaderWriter.ReadFile(op.TourInfoFile, true));
         }
         op.QueryObject = query.Clone();
     }
 }
Exemple #4
0
        private void saveSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveSettings.Filter = "Xml files (*.xml)|*.xml|All files (*.*)|*.*";
            saveSettings.FilterIndex = 1;
            saveSettings.RestoreDirectory = true;
            saveSettings.FileName = "";

            if (saveSettings.ShowDialog() != DialogResult.OK) return;
            if (string.IsNullOrEmpty(saveSettings.FileName)) return;

            var options = GetOptionsFromControls();

            var xmlSerializer = new XmlSerializer();
            xmlSerializer.Serialize(saveSettings.FileName, options);
        }