Ejemplo n.º 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("-----");
 }
Ejemplo n.º 2
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();
     }
 }
Ejemplo n.º 3
0
        public Query Create(string queryOuterXml)
        {
            var query = new Query();

            var html = new HtmlDocument();
            html.LoadHtml(queryOuterXml);

            query.MinPrice = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/minprice", 0);
            query.MaxPrice = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/maxprice", 10000);
            query.MinNights = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/minnights", 9);
            query.MaxNights = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/maxnights", 14);
            query.NumberOfAdults = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/numberofadults", 2);
            query.MealType = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/mealtype", 0); //UserDefaultMealType()
            query.OriginId = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/originid", 0);
            if (query.OriginId == 0) query.OriginId = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/originıd", 0);
            query.ChildrenAges = XmlParse.GetIntegerListNodeValue(html.DocumentNode, "/query/childrenages/int32");
            var stopValue = XmlParse.GetStringNodeValue(html.DocumentNode, "/query/stop", "false");
            query.Stop = stopValue.ToLower() == "true";

            var startDateDay = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/startdateday", 0);
            var startDateMonth = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/startdatemonth", 0);
            var startDateYear = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/startdateyear", 0);

            var endDateDay = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/enddateday", 0);
            var endDateMonth = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/enddatemonth", 0);
            var endDateYear = XmlParse.GetIntegerNodeValue(html.DocumentNode, "/query/enddateyear", 0);

            query.StartDate = new DateTime(startDateYear, startDateMonth, startDateDay);
            query.EndDate = new DateTime(endDateYear, endDateMonth, endDateDay);

            query.Operators = XmlParse.GetStringListNodeValue(html.DocumentNode, "/query/operators/string");
            query.HotelCategories = XmlParse.GetIntegerListNodeValue(html.DocumentNode, "/query/hotelcategories/int32");
            query.Destination = XmlParse.GetStringNodeValue(html.DocumentNode, "/query/destination", "");
            query.Hotels = XmlParse.GetStringListNodeValue(html.DocumentNode, "/query/hotels/string");
            return query;
        }
Ejemplo n.º 4
0
 public Query Clone()
 {
     var query = new Query
         {
             NumberOfAdults = this.NumberOfAdults,
             ChildrenAges = this.ChildrenAges,
             _cultureInfo = this._cultureInfo,
             MealType = this.MealType,
             HotelCategories = this.HotelCategories,
             OriginId = this.OriginId,
             Destination = this.Destination,
             ExtraInfo = this.ExtraInfo,
             MinPrice = this.MinPrice,
             MaxPrice = this.MaxPrice,
             MinNights = this.MinNights,
             MaxNights = this.MaxNights,
             StartDate = this.StartDate,
             EndDate = this.EndDate,
             Currency = this.Currency
         };
     return query;
 }