public string OneWayRegister(string from, string to, DateTime departDate,
            string departFlightNo, string firstName, string lastName, string tel, string email)
        {
            FlightRegisterParameters parameters = new FlightRegisterParameters();
            parameters.BookingType = "oneway";
            parameters.From = from;
            parameters.To = to;
            parameters.DepartDay = departDate.Day.ToString();
            parameters.DepartMonth = departDate.Month.ToString();
            parameters.DepartYear = departDate.Year.ToString();
            parameters.DepartFlightNo = departFlightNo;
            parameters.FirstName = firstName;
            parameters.LastName = lastName;
            parameters.Phone = tel;
            parameters.Email = email;

            RegisterResultFactory registerResultFactory = new RegisterResultFactory();
            string json = registerResultFactory.GenerateJsonResult(parameters);
            return json;
        }
예제 #2
0
        static void Main(string[] args)
        {
            //Parameters parameters = new Parameters();
            //parameters.From = "SGN";
            //parameters.To = "HAN";
            //parameters.DepartDay = "20";
            //parameters.DepartMonth = "12";
            //parameters.DepartYear = "2012";
            //parameters.ReturnDay = "30";
            //parameters.ReturnMonth = "12";
            //parameters.ReturnYear = "2012";
            //parameters.BookingType = "roundtrip";
            ////parameters.BookingType = "oneway";

            //AirlineInfoFactory airlineInfoFactory = new AirlineInfoFactory();
            //string json = airlineInfoFactory.GenerateJsonResult(parameters);
            //StreamWriter writer = new StreamWriter(new FileStream("d:\\result.txt", FileMode.Create));
            //writer.Write(json);
            //writer.Close();

            FlightRegisterParameters parameters = new FlightRegisterParameters();
            parameters.From = "SGN";
            parameters.To = "HAN";
            parameters.DepartDay = "5";
            parameters.DepartMonth = "1";
            parameters.DepartYear = "2013";
            //parameters.ReturnDay = "12";
            //parameters.ReturnMonth = "1";
            //parameters.ReturnYear = "2013";
            parameters.DepartFlightNo = "P8-928";
            //parameters.ReturnFlightNo = "P8-553 P8-565";
            //parameters.BookingType = "roundtrip";
            parameters.BookingType = "oneway";
            //VN Airline ko cho nhap ten co dau
            parameters.FirstName = "Nguyen";
            parameters.LastName = "Van Quy";
            parameters.Phone = "0998 43353";
            parameters.Email = "*****@*****.**";

            RegisterResultFactory registerResultFactory = new RegisterResultFactory();
            string json = registerResultFactory.GenerateJsonResult(parameters);

            StreamWriter writer = new StreamWriter(new FileStream("d:\\result.txt", FileMode.Create));
            writer.Write(json);
            writer.Close();

            Console.WriteLine("OK");
        }