protected override void OnStart(string[] args)
 {
     // Debugger.Launch();
     SerializeDeserialize.DeserializeObject(_itineraryModels, ItineraryDumpPath);
     SerializeDeserialize.DeserializeQueue(_itineraryQueues, ItineraryQueueDumpPath);
     //for (int i = 0; i < 1; i++)
     //{
     //    ItineraryModel testItineraryModelodel = new ItineraryModel
     //    {
     //        BookingID = "NF2723228788846",
     //        AirlineCode = "6E",
     //        BookingDetails = new BookingDetails()
     //        {
     //            Email = "*****@*****.**",
     //            FirstName = "Dheeraj",
     //            LastName = "Kumar",
     //            MobileNo = "9310099421",
     //            LOBCode = "LOB02710"
     //        },
     //        DepartureDateTime = DateTime.Now,
     //        FlightNo = "522",
     //        FromCity = "DEL",
     //        ToCity = "LKO",
     //        LineNo = (10000 * (i + 1)).ToString(CultureInfo.InvariantCulture),
     //        PNR = "LER5RR" + i
     //    };
     //    _itineraryModels.Add(testItineraryModelodel);
     //}
     _objTimer.Enabled = true;
 }
Пример #2
0
        private ItineraryFlightStatus LogFlightStatus(flightStatusV2 status, ItineraryFlightStatus flightStatus)
        {
            using (MMTSqlLiveEntities entities = new MMTSqlLiveEntities(StaticHelperValues.MMTSqlEntitiesConnectionString))
            {
                tbl_FlightStatusLog flightStatusLog = new tbl_FlightStatusLog
                {
                    AirlineCode   = flightStatus.CarrierCode,
                    FlightNo      = flightStatus.FlightNumber,
                    Delays        = flightStatus.DepartureGateDelayMin,
                    DepartureDate = flightStatus.DepartureDate,

                    Status           = flightStatus.FlightStatus,
                    FromAirportCode  = _itineraryModel.FromCity,
                    ToAirportCode    = _itineraryModel.ToCity,
                    LastModifiedDate = DateTime.Now,
                    Response         = XElement.Parse(SerializeDeserialize.SerializeObject(status)).ToString(SaveOptions.DisableFormatting)
                };
                if (flightStatus.EstimatedGateDeparture != DateTime.MinValue)
                {
                    flightStatusLog.ExpectedDate = flightStatus.EstimatedGateDeparture;
                }
                try
                {
                    entities.tbl_FlightStatusLog.Add(flightStatusLog);
                    entities.SaveChanges();
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (
                        DbValidationError error in
                        dbEx.EntityValidationErrors.SelectMany(entityErr => entityErr.ValidationErrors))
                    {
                        string errorMessage = string.Format("Error Property Name {0} : Error Message: {1}",
                                                            error.PropertyName, error.ErrorMessage);
                        ErrorLog.WriteErrorLog(errorMessage, "", "MMT_WS_FlightWeather");
                    }
                }
                catch (Exception exception)
                {
                    ErrorLog.WriteErrorLog(exception, "", "MMT_WS_FlightWeather");
                }
            }
            return(flightStatus);
        }
Пример #3
0
        public static GlobalMarketView GetObject(string json, string curSymbol = "")
        {
            GlobalMarketView gmv = null;

            if (!string.IsNullOrEmpty(curSymbol))
            {
                string[] currencySymbols = new string[] { _totalMarketCapConvert + curSymbol.ToLower(), _Total24hVolumeConvert + curSymbol.ToLower() };

                json = json.Replace(currencySymbols[0], "total_market_cap_convert_currency");
                json = json.Replace(currencySymbols[1], "total_24h_volume_convert_currency");
            }
            try
            {
                gmv = SerializeDeserialize <GlobalMarketView> .FromJSONString(json);

                return(gmv);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #4
0
        public static List <CurrencyMarketView> GetObjects(string json, string curSymbol = "")
        {
            List <CurrencyMarketView> currencyList = null;

            if (!string.IsNullOrEmpty(curSymbol))
            {
                string[] currencySymbols = new string[] { _priceConvert + curSymbol.ToLower(), _volume24Convert + curSymbol.ToLower(), _marketCapConvert + curSymbol.ToLower() };

                json = json.Replace(currencySymbols[0], "price_convert_currency");
                json = json.Replace(currencySymbols[1], "volume_24_convert_currency");
                json = json.Replace(currencySymbols[2], "market_cap_convert_currency");
            }

            try
            {
                currencyList = SerializeDeserialize <List <CurrencyMarketView> > .FromJSONString(json);

                return(currencyList);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            #region Conditional

            /*
             * for (int i = 0; i < args.Length; i++)
             * {
             *  if(args[i] == "Friday")
             *  {
             *      if (3 < 5)
             *      {
             *          Console.WriteLine("5 is less than");
             *      }
             *      Console.WriteLine("we will work until 12am");
             *  }
             *  else if(args[i] == "Saturday")
             *  {
             *      Console.WriteLine("Sleep all day");
             *  }
             *  else
             *  {
             *      Console.WriteLine("No work");
             *  }
             *  switch (args[i])
             *  {
             *      case "Friday":
             *          Console.WriteLine("We will work until 12am");
             *          break;
             *      case "Saturday":
             *          Console.WriteLine("Sleep all day");
             *          break;
             *      default:
             *          Console.WriteLine("No Work");
             *          break;
             *  }
             *  int x = 0;
             *  while (args[i] != "Friday" && x == 0)
             *  {
             *
             *      Console.WriteLine("Today is not a friday");
             *      x++;
             *  }
             *  //do
             *  //{
             *  //    Console.WriteLine("Do first");
             *  //}
             *  //while (args[i] != "Friday");
             *  Console.WriteLine("arg:" + i + ",value:" + args[i]);
             * }
             */
            #endregion

            #region Variable & Datatypes
            Console.WriteLine("Hello World! - Today is friday");

            string dayoftheweek = "Friday";
            Console.WriteLine("Today is " + dayoftheweek);

            int dayofmonth = 31;
            Console.WriteLine("Day of the Month:" + dayofmonth);

            double amount = 10.5;
            Console.WriteLine("Amount:" + amount);

            bool valid;
            valid = true;
            Console.WriteLine("Is is Valid:" + valid);

            Address = "Test";
            Console.WriteLine("My address:" + Address);

            object sessions   = "Dot Net Session";
            string newsession = (string)sessions;
            int    a          = 5;
            int    b          = 4;
            int    sum        = Calculation.CalculateSum(a, b);
            Console.WriteLine("a+b=" + sum);
            #endregion

            #region Collection
            LearnCollection learnCollection = new LearnCollection("Python");
            learnCollection.LearnStringList();

            //learnCollection.Langauge = "Python";

            learnCollection.LearnDoubleArray();
            learnCollection.LearnStringArray();
            learnCollection.LearnStringList();


            foreach (string language in learnCollection.Langauages)
            {
                Console.WriteLine(language);
            }
            #endregion


            #region Extension

            Trainer trainer = new Trainer("Mithun");

            trainer.ShowDepartment();

            string mfn = trainer.IsPersonMaleOfFemale();

            Student student = new Student();
            student.IsPersonMaleOfFemale();

            SWeekOfDay sWeek = new SWeekOfDay();
            sWeek.Days   = "Monday";
            sWeek.DValue = 1;

            int x = 5;

            bool result = x.IsGreaterThan(6);

            #endregion

            #region System IO
            //SystemIO systemIO = new SystemIO();
            //systemIO.WriteToFile();
            //systemIO.WriteMultipleLineToFile(learnCollection.Langauages);
            //systemIO.ReadFileFromDirectory();
            //var path = systemIO.WriteToFile();
            //systemIO.ReadFile(path);
            #endregion

            #region Serialization & De

            SerializeDeserialize serializeDeserialize = new SerializeDeserialize();
            string json = serializeDeserialize.Serialization(learnCollection.Langauages);

            List <string> languages = serializeDeserialize.DeSerialization <List <string> >(json);


            List <Person> people = new List <Person>();
            people.Add(new Person()
            {
                FirstName = "Mithun", PhoneNumber = "1234"
            });
            people.Add(new Person()
            {
                FirstName = "Adil", PhoneNumber = "2345"
            });
            people.Add(new Person()
            {
                FirstName = "Minhaz", PhoneNumber = "3456"
            });

            string pjson = serializeDeserialize.Serialization(people);

            List <Person> dpeople = serializeDeserialize.DeSerialization <List <Person> >(pjson);

            #endregion

            #region Delegates
            DelegatesEx delegatesEx = new DelegatesEx();
            // Delegate instantiation
            operation obj = new operation(delegatesEx.Addition);
            int       i   = obj(5, 6);
            Console.WriteLine(i);
            #endregion

            #region Refelction

            System.Type type = learnCollection.GetType();
            System.Console.WriteLine(type);

            #endregion

            #region Tuples

            TupleEx             tuple = new TupleEx();
            Tuple <string, int> t     = tuple.GetTuple();
            Console.WriteLine("Name:" + t.Item1);
            Console.WriteLine("Id:" + t.Item2);

            #endregion

            Console.ReadLine();
        }
 protected override void OnStop()
 {
     SerializeDeserialize.SerializeObject(_itineraryModels, ItineraryDumpPath);
     SerializeDeserialize.SerializeQueue(_itineraryQueues, ItineraryQueueDumpPath);
 }
 private XElement getXElement(FlightWeatherResponse flightWeatherResponse)
 {
     return(XElement.Parse(SerializeDeserialize.SerializeObject(flightWeatherResponse)));
 }