예제 #1
0
        // Carbon emission calculator methodology from https://www.icao.int/environmental-protection/CarbonOffset/Documents/Methodology%20ICAO%20Carbon%20Calculator_v10-2017.pdf
        public List <FlightDetails> GetCarbonEmissions(FlightDetails flightDetails)
        {
            // Generate JSON input data for API call
            StringBuilder sb = new StringBuilder();

            using (JsonWriter writer = new JsonTextWriter(new StringWriter(sb)))
            {
                writer.Formatting = Formatting.Indented;
                writer.WriteStartObject();
                writer.WritePropertyName("from");
                writer.WriteValue(flightDetails.IcaoOriginAirportCode);
                writer.WritePropertyName("to");
                writer.WriteValue(flightDetails.IcaoDestinationAirportCode);
                writer.WritePropertyName("travelclass");
                writer.WriteValue(((char)flightDetails.ClassType).ToString());
                writer.WritePropertyName("indicator");
                writer.WriteValue((flightDetails.IsMetric) ? "m" : "s");
                writer.WriteEndObject();
                writer.Close();
            }

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "")
            {
                Content = new StringContent(sb.ToString(), Encoding.UTF8, "application/json")
            };

            string carbonEmissionJsonResult = _client.GetStringAsync(request.RequestUri).Result;

            return(JsonConvert.DeserializeObject <List <FlightDetails> >(carbonEmissionJsonResult));
        }
        public List <FlightDetails> SearchFlight(string source, string destination)
        {
            List <FlightDetails> flightlist = new List <FlightDetails>();
            SqlDataReader        reader;

            using (SqlConnection con = new SqlConnection(strcon))
            {
                da = new SqlDataAdapter("searchflight", con);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                con.Open();
                da.SelectCommand.Parameters.AddWithValue("@source", source);
                da.SelectCommand.Parameters.AddWithValue("@destination", destination);

                reader = da.SelectCommand.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        FlightDetails details = new FlightDetails();
                        details.FlightNo    = Convert.ToInt32(reader.GetValue(0));
                        details.FlightName  = reader.GetValue(1).ToString();
                        details.Source      = reader.GetValue(2).ToString();
                        details.Destination = reader.GetValue(3).ToString();
                        details.Departure   = Convert.ToDateTime(reader.GetValue(4));
                        details.Arrival     = Convert.ToDateTime(reader.GetValue(5));
                        details.Date        = Convert.ToDateTime(reader.GetValue(6));
                        details.SeatType    = reader.GetValue(7).ToString();
                        details.Price       = Convert.ToInt32(reader.GetValue(8));
                        details.NoOfSeats   = Convert.ToInt32(reader.GetValue(9));
                        flightlist.Add(details);
                    }
                }
            }
            return(flightlist);
        }
        public ActionResult Addlight(FlightDetails flightData)
        {
            FlightDetails objFlightDetails = flightData;

            _unitOfWork.flightDetailsRepository.Add(objFlightDetails);
            return(Ok());
        }
 public FlightDetails GetFlightDetails()
 {
     using (SqlConnection con = new SqlConnection(strcon))
     {
         SqlDataReader reader = null;
         da = new SqlDataAdapter("proc_get_flight", con);
         da.SelectCommand.CommandType = CommandType.StoredProcedure;
         con.Open();
         reader = da.SelectCommand.ExecuteReader();
         FlightDetails details = null;
         while (reader.Read())
         {
             details             = new FlightDetails();
             details.FlightNo    = Convert.ToInt32(reader.GetValue(0));
             details.FlightName  = reader.GetValue(1).ToString();
             details.Source      = reader.GetValue(2).ToString();
             details.Destination = reader.GetValue(3).ToString();
             details.Departure   = Convert.ToDateTime(reader.GetValue(4));
             details.Arrival     = Convert.ToDateTime(reader.GetValue(5));
             details.Date        = Convert.ToDateTime(reader.GetValue(6));
             details.SeatType    = reader.GetValue(7).ToString();
             details.Price       = Convert.ToInt32(reader.GetValue(8));
             details.NoOfSeats   = Convert.ToInt32(reader.GetValue(9));
         }
         return(details);
     }
 }
예제 #5
0
        /// <summary>
        /// Parse file line to create Flight details model
        /// </summary>
        /// <param name="line">string</param>
        /// <param name="split">split character</param>
        /// <returns></returns>
        private static IFlightDetails parseLineToFlightDetails(string line, char split)
        {
            IFlightDetails flightDetail = new FlightDetails();

            string[]       props  = line.Split(split);
            DateTimeStyles styles = DateTimeStyles.AdjustToUniversal;

            flightDetail.Origin      = props[0];
            flightDetail.Destination = props[2];
            flightDetail.Price       = Double.Parse(props[4], NumberStyles.Currency, CultureInfo.CurrentCulture);

            DateTime date;

            if (DateTime.TryParse(props[1], CultureInfo.InvariantCulture, styles, out date))
            {
                flightDetail.DepartureTime = date;
            }

            if (DateTime.TryParse(props[3], CultureInfo.InvariantCulture, styles, out date))
            {
                flightDetail.DestinationTime = date;
            }

            return(flightDetail);
        }
예제 #6
0
    public Flight(Location loc)
    {
        destLocation = loc;

        var currLoc = GetLocation();

        distance = 0;

        Vector2 sysDistVec = loc.sys.GlobalPos() - currLoc.sys.GlobalPos();

        distance += Mathf.Abs(sysDistVec.x) + Mathf.Abs(sysDistVec.y);  //System distance.

        distance += Mathf.Abs(currLoc.sysObj.orbit - loc.sysObj.orbit); //Sys. obj. distance.

        timeAcc = Ship.jumpTopSpeed / Ship.jumpAcceleration;
        float accDist = Ship.jumpTopSpeed / 2 / timeAcc;

        timeCru = (distance - accDist * 2) / Ship.jumpTopSpeed;

        timeTotal = timeAcc * 2 + timeCru;

        fuel = Ship.fuelEfficency * distance;

        if (distance > 0 && fuel <= Ship.fuel)
        {
            possible = true;
        }
        else
        {
            possible = false;
        }

        details = new FlightDetails(this.distance, timeTotal, fuel);
    }
예제 #7
0
        public async Task <FlightDetailsResponse> GetDetails(int flightId)
        {
            var temp = await repo.GetFlightAsync(flightId);

            if (temp != null)
            {
                var ret      = new FlightDetails();
                var airplane = await seatService.GetSeats(flightId);

                if (airplane.Success)
                {
                    ret.Airplane       = airplane.Resource;
                    ret.Extras         = temp.PaidExtras;
                    ret.LuggageOptions = temp.WeightPricings;
                    ret.Price          = temp.Price;
                    return(new FlightDetailsResponse(ret));
                }
                else
                {
                    return(new FlightDetailsResponse("Unable to retrieve flight details"));
                }
            }
            else
            {
                return(new FlightDetailsResponse("Flight with given id does not exist ."));
            }
        }
        private async Task <FlightDetails> GetFlightDetails(int planId)
        {
            var    parameters  = new { PlanId = planId };
            string commandText = "SELECT TOP 1 PK_FlightDetails as Id,[Blockhours]  as Blockhours,[FlightDepartueTime]  as FlightDepartueTime,[FlightArrivalTime]  as  FlightArrivalTime,[rest_hr]  as Rest_Hr, [trip_starttime_local]  as  FlightStartTime_Local,[trip_starttime_local_actual]  as FlightStartTime_Local_actual,[trip_crewcount]  as  CrewCount,cast([schd_dep_date] as date)  as   FlightStartDate,[flight_number]  as    SourceFlightCode, [TailNo]  as TailNo,[sub_fleet] as AcType,[SourceFlightCode]  asCode,[SourceCode]  as SourceCode,[DestinationCode]  as DestinationCode,[Port]  as Port,[dep_country]  as Source,[std_z_date]  as FlightStartDate_z,[std_ls_date]  as FlightStartDate_ls,[Z_FlightDepartueTime]  as FlightDepartueTime_z,[ls_FlightDepartueTime]  as  FlightDepartueTime_ls, [sta_z_date]  as   FlightArrDate_z, [Z_FlightArrivalTime]  as FlightArrivalTime_z, [ls_FlightArrivalTime]  as FlightArrivalTime_ls,[DepGateNumber]  as Dep_GateNumber,[ArrGateNumber]  as Arr_GateNumber FROM [HMS].[VW_FLIGHTDETAILS] where [PK_FlightDetails]= @PlanId ";
            //string sql = @"select top 1  Name,rank as Contact  from HMS.VW_PERSONALDETAILS where personal_id=@PersonalId";
            FlightDetails result = await adapter.Get <FlightDetails>(commandText, parameters);

            if (result.SourceCode != null && result.DestinationCode != null)
            {
                var iataCurrency = await GetIataCurrencies(result.SourceCode, result.DestinationCode);

                result.SourceCurrencyCode      = iataCurrency.Where(x => x.Iata == result.SourceCode).FirstOrDefault().CurrencyCode;
                result.DestinationCurrencyCode = iataCurrency.Where(x => x.Iata == result.DestinationCode).FirstOrDefault().CurrencyCode;
            }
            else if (result.SourceCode != null)
            {
                var iataCurrency = await GetIataCurrency(result.SourceCode);

                result.SourceCurrencyCode = iataCurrency != null ? iataCurrency.CurrencyCode : null;
            }
            else if (result.DestinationCode != null)
            {
                var iataCurrency = await GetIataCurrency(result.DestinationCode);

                result.DestinationCurrencyCode = iataCurrency != null ? iataCurrency.CurrencyCode : null;
            }
            return(result);
        }
예제 #9
0
        //public ActionResult FlightsPage()
        //{
        //    List<FlightDetails> flightDetails = bussines.GetAllFlightDetails();
        //    ViewBag.FlightDetails = flightDetails;
        //    return View();
        //}
        //[HttpPost]
        //public ActionResult FlightsPage(string flightNumber)
        //{
        //    Session["flightNumber"] = flightNumber;
        //    return RedirectToAction("TaskDetailsTest");
        //}
        //public ActionResult TaskDetails()
        //{
        //    string flightNumber = Session["flightNumber"].ToString();
        //    FlightDetails flightDetails = bussines.GetDetailsForOneFlight(flightNumber);
        //    ViewBag.FlightNumber = flightDetails.FlightNumber;
        //    ViewBag.Bay = flightDetails.Bay;
        //    ViewBag.CurrentStation = flightDetails.CurrentStation;
        //    List<TaskLists> taskLists = bussines.GetTasksForParticularFlight(flightNumber);
        //    ViewBag.TaskLists = taskLists;
        //    return View();
        //}
        //[HttpPost]
        //public ActionResult TaskDetails(string Start,string Complete)
        //{
        //    DateTime sheduledStartTime;
        //    int timeDifference;
        //    string flightNumber = Session["flightNumber"].ToString();
        //    if (string.IsNullOrEmpty(Start))
        //    {
        //        sheduledStartTime = bussines.GettingEndTime(flightNumber, Complete);
        //        timeDifference = (DateTime.Now - sheduledStartTime).Minutes;
        //        bussines.UpdateTaskEndStatus(flightNumber, Complete,"Completed", DateTime.Now,timeDifference);
        //        return RedirectToAction("TaskDetails");
        //    }
        //    else
        //    {
        //        bussines.UpdateTaskStartStatus(flightNumber, Start, "In Progress", DateTime.Now);
        //        return RedirectToAction("TaskDetails");
        //    }
        //}
        public ActionResult TaskDetailsTest()
        {
            string staffName = Session["StaffName"].ToString();

            //if (staffName== "RAMST2")
            //{
            //    Session["flightNumber"] = "343";
            //}
            //else
            //    Session["flightNumber"] = "121";
            Session["flightNumber"] = bussines.GettingFlightNumber(staffName);
            string flightNumber    = Session["flightNumber"].ToString();
            string staffDepartment = Session["StaffDepartment"].ToString();

            ViewBag.StaffName       = staffName;
            ViewBag.staffDepartment = staffDepartment;
            FlightDetails flightDetails = bussines.GetDetailsForOneFlight(flightNumber);

            ViewBag.FlightNumber   = flightDetails.FlightNumber;
            ViewBag.Bay            = flightDetails.Bay;
            ViewBag.CurrentStation = flightDetails.CurrentStation;
            ViewBag.Departure      = flightDetails.Departure;
            ViewBag.flightModel    = flightDetails.FlightModel;
            List <TaskLists> taskLists = bussines.GetTasksForParticularFlight(flightNumber, staffName, staffDepartment);

            ViewBag.TaskLists = taskLists;
            return(View());
        }
        public async Task <IHttpActionResult> PostFlightDetails(FlightDetails flightDetails)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.FlightDetails.Add(flightDetails);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (FlightDetailsExists(flightDetails.Flight_Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = flightDetails.Flight_Id }, flightDetails));
        }
예제 #11
0
        public void CustomScenarioTest()
        {
            var flight = new FlightDetails
            {
                DepartureAirport = "Kyiv - Zhulyany",
                ArrivalAirport = "Copenhagen",
                DepartureDate = null,
                ReturnDate = null
            };

            var passenger = new Passenger
            {
                FirstName = "Oleksandr",
                LastName = "Kovalenko",
                Gender = true
            };

            startPage.SetOriginAirPort(flight.DepartureAirport)
                .SetDestinationAirport(flight.ArrivalAirport)
                .SetDepartureDate(ref flight)
                .SetReturnDate(ref flight)
                .Search()
                .VerifySelectedFlightContent(flight)
                .ChoosePrice(ServiceLevel.WizzGo)
                .ContinueSelect()
                .FillInPassangerDetails(passenger)
                .VerifyRoute(flight)
                .PickLaggage()
                .Continue()
                .VerifySignInPage();

        }
예제 #12
0
        public JsonResult Get(string id)
        {
            FlightDetails fd = flightManager.GetEllement(id);

            if (fd == null)
            {
                Server server;
                Dictionary <string, Server> dic = ServerManager.dictionary;
                if (dic.TryGetValue(id, out server))
                {
                    string         strResult;
                    string         url     = server.ServerURL + "/api/FlightPlan/" + id;
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                        using (Stream stream = response.GetResponseStream())
                            using (StreamReader reader = new StreamReader(stream))
                            {
                                strResult = reader.ReadToEnd();
                                reader.Close();
                            }
                    FlightPlan flights = JsonConvert.DeserializeObject <FlightPlan>(strResult);
                    return(new JsonResult(flights));
                }
            }
            JsonResult jr = new JsonResult(fd.FlightPlan);

            return(jr);
        }
        public async Task <IHttpActionResult> PutFlightDetails(string id, FlightDetails flightDetails)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != flightDetails.Flight_Id)
            {
                return(BadRequest());
            }

            db.Entry(flightDetails).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #14
0
        public FlightDetails GetDetailsForOneFlight(string flightNumber)
        {
            FlightDetails flightDetails = new FlightDetails();
            SqlCommand    sda;
            SqlConnection con = new SqlConnection(GetConnectionString());

            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }
            sda = new SqlCommand(commonThings.getDetailsForOneFlight, con);
            SqlParameter p1 = new SqlParameter("@flightNumber", flightNumber);

            sda.Parameters.Add(p1);
            SqlDataReader dr = sda.ExecuteReader();

            if (dr.Read())
            {
                flightDetails.FlightNumber   = Convert.ToString(dr[0]);
                flightDetails.FlightModel    = Convert.ToString(dr[1]);
                flightDetails.CurrentStation = Convert.ToString(dr[2]);
                flightDetails.Bay            = Convert.ToInt32(dr[3]);
                flightDetails.TaskStartTime  = Convert.ToDateTime(dr[4]).ToString("HH:mm");
                flightDetails.Departure      = Convert.ToDateTime(dr[5]).ToString("HH:mm");
            }
            con.Close();
            return(flightDetails);
        }
예제 #15
0
        public IList <FlightDetails> MapFlightDetails(List <Itinerary> itineraries)
        {
            var flightDetails = new List <FlightDetails> ();

            foreach (var itinerary in itineraries)
            {
                var flightDetail = new FlightDetails();
                var price        = itinerary.PricingOptions.Min(option => option.Price);

                flightDetail.Price = price;

                flightDetail.OutboundDetails = string.Format("   outbound itinerary at {1} with {0} ({2}-{3})",
                                                             string.Join(", ",
                                                                         itinerary.OutboundLeg.OperatingCarriers.Select(c => c.Name)),
                                                             itinerary.OutboundLeg.DepartureTime.TimeOfDay,
                                                             itinerary.OutboundLeg.Origin.Code,
                                                             itinerary.OutboundLeg.Destination.Code);

                flightDetail.InboundDetails = string.Format("   inbound itinerary at {1} with {0} ({2}-{3})",
                                                            string.Join(", ",
                                                                        itinerary.InboundLeg.OperatingCarriers.Select(c => c.Name)),
                                                            itinerary.InboundLeg.DepartureTime.TimeOfDay,
                                                            itinerary.InboundLeg.Origin.Code,
                                                            itinerary.InboundLeg.Destination.Code);

                flightDetails.Add(flightDetail);
            }
            return(flightDetails);
        }
        public async Task <int> AddFlight(FlightDetails item)
        {
            int result = 0;

            using (SqlConnection con = new SqlConnection(strcon))
            {
                da = new SqlDataAdapter("proc_add_flight", con);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                da.SelectCommand.Parameters.AddWithValue("@flightno", item.FlightNo);
                da.SelectCommand.Parameters.AddWithValue("@flightname", item.FlightName);
                da.SelectCommand.Parameters.AddWithValue("@source", item.Source);
                da.SelectCommand.Parameters.AddWithValue("@destination", item.Destination);
                da.SelectCommand.Parameters.AddWithValue("@departure", item.Departure);
                da.SelectCommand.Parameters.AddWithValue("@arrival", item.Arrival);
                da.SelectCommand.Parameters.AddWithValue("@date", item.Date);
                da.SelectCommand.Parameters.AddWithValue("@seat_type", item.SeatType);
                da.SelectCommand.Parameters.AddWithValue("@price", item.Price);
                da.SelectCommand.Parameters.AddWithValue("@no_of_seats", item.NoOfSeats);
            }
            result = da.SelectCommand.ExecuteNonQuery();
            if (result > 0)
            {
                return(result);
            }
            else
            {
                return(0);
            }
        }
예제 #17
0
        public void Post(FlightPlan flightPlan)
        {
            FlightDetails fd = new FlightDetails();

            fd.FlightPlan = flightPlan;
            //build new flight for fd
            Flight temp_f = new Flight
            {
                Flight_id    = flightPlan.Company_name + flightManager.GetSize(),
                Longitude    = flightPlan.Initial_location.Longitude,
                Latitude     = flightPlan.Initial_location.Latitude,
                Passengers   = flightPlan.Passengers,
                Company_name = flightPlan.Company_name,
                Date_time    = flightPlan.Initial_location.Date_time,
                Is_external  = false
            };

            fd.Flight = temp_f;

            //build new dateTime for fd
            DateTime temp_d = fd.FlightPlan.Initial_location.Date_time;

            foreach (Segment seg in fd.FlightPlan.Segments)
            {
                temp_d = temp_d.AddSeconds(seg.Timespan_seconds);
            }

            fd.Landing_time = temp_d;

            flightManager.AddEllement(fd);
        }
예제 #18
0
        public ActionResult Index(FlightTime fp)
        {
            FlightDal     fd = new FlightDal();
            FlightDetails f  = new FlightDetails();

            f.Arrival_Airport = fp.ArrivalAirport;
            f.Depart_Airport  = fp.DepartureAirport;
            f.Depart_Time     = fp.FlightDate;
            List <FlightDetails> mylist = new List <FlightDetails>();
            List <FlightModel>   flist  = new List <FlightModel>();

            mylist = fd.FindFlights(f);

            foreach (var item in mylist)
            {
                FlightModel fm = new FlightModel();
                fm.Amount           = item.Amount;
                fm.Arrival_Airport  = item.Arrival_Airport;
                fm.Depart_Airport   = item.Depart_Airport;
                fm.Arrival_Time     = item.Arrival_Time;
                fm.Depart_Time      = item.Depart_Time;
                fm.Flightno         = item.Flightno;
                fm.Seating_Capacity = item.Seating_Capacity;
                fm.Availaible_Seat  = fd.FindSeat(item.Flightno);
                flist.Add(fm);
            }

            TempData["FP"] = flist;
            return(RedirectToAction("ShowFlights"));
        }
예제 #19
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (String.IsNullOrEmpty(DepartureAircraftName) ||
                String.IsNullOrEmpty(DepartureFlightNumber) ||
                String.IsNullOrEmpty(OriginAirport) ||
                String.IsNullOrEmpty(DestinationAirport))
            {
                return(RedirectToPage("/Index"));
            }

            Airports = await _siaDestinationApiService.GetAirports();

            _departureFlight = new FlightDetails()
            {
                AircraftName               = DepartureAircraftName,
                FlightNumber               = DepartureFlightNumber,
                Date                       = DepartureDate,
                ClassType                  = ClassType,
                CurrentCapacity            = Passengers,
                IataOriginAirportCode      = OriginAirport,
                IcaoOriginAirportCode      = _commonService.GetIataIcaoAirportCodes()[OriginAirport],
                IataDestinationAirportCode = DestinationAirport,
                IcaoDestinationAirportCode = _commonService.GetIataIcaoAirportCodes()[DestinationAirport]
            };
            PopulateCarbonEmissionDetails(ref _departureFlight);
            ViewData["CurrentCarbonEmission"] = _departureFlight.CurrentCarbonEmission;
            ViewData["TotalCarbonEmission"]   = _departureFlight.TotalCarbonEmission;
            ViewData["Distance"] = _departureFlight.Distance;
            ViewData["FuelBurn"] = _departureFlight.FuelBurn;
            ViewData["departureFlightDetailsJson"] = JsonConvert.SerializeObject(_departureFlight);

            if (!String.IsNullOrEmpty(ReturnFlightNumber))
            {
                _returnFlight = new FlightDetails()
                {
                    AircraftName               = ReturnAircraftName,
                    FlightNumber               = ReturnFlightNumber,
                    Date                       = ReturnDate,
                    ClassType                  = ClassType,
                    CurrentCapacity            = Passengers,
                    IataOriginAirportCode      = DestinationAirport,
                    IcaoOriginAirportCode      = _commonService.GetIataIcaoAirportCodes()[DestinationAirport],
                    IataDestinationAirportCode = OriginAirport,
                    IcaoDestinationAirportCode = _commonService.GetIataIcaoAirportCodes()[OriginAirport]
                };

                // Get carbon emission for round trip
                PopulateCarbonEmissionDetails(ref _returnFlight);
                ViewData["CurrentCarbonEmission"] = _departureFlight.CurrentCarbonEmission + _returnFlight.CurrentCarbonEmission;
                ViewData["TotalCarbonEmission"]   = _departureFlight.TotalCarbonEmission + _returnFlight.TotalCarbonEmission;
                ViewData["Distance"] = _departureFlight.Distance + _returnFlight.Distance;
                ViewData["FuelBurn"] = _departureFlight.FuelBurn + _returnFlight.FuelBurn;
                ViewData["returnFlightDetailsJson"] = JsonConvert.SerializeObject(_returnFlight);
            }

            GetCarbonProjects("SGD");
            return(Page());
        }
예제 #20
0
 public static void Main(string[] args)
 {
     var flightList = new List<FlightDetails>();
     var passengersList = new List<Passenger>();
     //Add passenger-objects to passengers-list
     
     var flightOne = new FlightDetails(12, "France", "Jumbo");
     flightOne.Passengers = passengersList;
     flightList.Add(a);
 }
예제 #21
0
        public void Example_BuildingWithACustomizedPipeline()
        {
            //arrange
            _fixture.Customizations.Add(new AirportCodeSpecimenBuilder());
            FlightDetails flightDetails = _fixture.Create <FlightDetails>();

            //assert
            flightDetails.ArrivalAirportCode.Should().BeOneOf("AAA", "BBB");
            flightDetails.DepartureAirportCode.Should().BeOneOf("AAA", "BBB");
        }
예제 #22
0
        public SelectFlightPage VerifySelectedFlightContent(FlightDetails expected)
        {
            Assert.That(DepartureDate, Is.EqualTo(expected.DepartureDate));
            Assert.That(RouteElem.Text, Does.Contain(expected.DepartureAirport)
                        .And.Contain(expected.ArrivalAirport));

            Assert.That(ReturnFlightBlock.Count, Is.EqualTo(0));
            WaitForBlocker();
            return(this);
        }
        public async Task <IHttpActionResult> GetFlightDetails(string id)
        {
            FlightDetails flightDetails = await db.FlightDetails.FindAsync(id);

            if (flightDetails == null)
            {
                return(NotFound());
            }

            return(Ok(flightDetails));
        }
예제 #24
0
        public static void TestFullDealGraph(TestContext context)
        {
            var expectedContent = System.IO.File.ReadAllText("FullResponse.json");

            var deal = JsonConvert.DeserializeObject <Deal>(expectedContent);

            OfferDetails = deal.OfferDetails;
            User         = deal.User;
            Package      = deal.OfferCollections.Packages[0];
            Flight       = deal.OfferCollections.Flights[0];
            Hotel        = deal.OfferCollections.Hotels[0];
        }
예제 #25
0
        public ActionResult DepartmentStatus()
        {
            ViewBag.ManagerName = Session["ManagerName"].ToString();
            string        flightNumber  = Session["SflightNumber"].ToString();
            FlightDetails flightDetails = bussines.GetDetailsForOneFlight(flightNumber);

            ViewBag.FlightNumber   = flightDetails.FlightNumber;
            ViewBag.Bay            = flightDetails.Bay;
            ViewBag.CurrentStation = flightDetails.CurrentStation;
            ViewBag.Departments    = bussines.GetAllDepartmentsStatus(flightNumber);
            return(View());
        }
예제 #26
0
        public void Example_BuildingWithoutSomeProperties()
        {
            //arrange
            FlightDetails flightDetails = _fixture.Build <FlightDetails>()
                                          .Without(fd => fd.ArrivalAirportCode)
                                          .Without(fd => fd.DepartureAirportCode)
                                          .Create();

            //assert
            flightDetails.ArrivalAirportCode.Should().BeNull();
            flightDetails.DepartureAirportCode.Should().BeNull();
        }
예제 #27
0
        public void Example_BuildingWithCustomProperties()
        {
            //arrange
            FlightDetails flightDetails = _fixture.Build <FlightDetails>()
                                          .With(fd => fd.ArrivalAirportCode, "LAX")
                                          .With(fd => fd.DepartureAirportCode, "LHR")
                                          .Create();

            //assert
            flightDetails.ArrivalAirportCode.Should().Be("LAX");
            flightDetails.DepartureAirportCode.Should().Be("LHR");
        }
예제 #28
0
        public PassengerPage VerifyRoute(FlightDetails flight)
        {
            string textRoute = Route.Text.ToLower();

            Assert.Multiple(() =>
            {
                StringAssert.Contains(flight.DepartureAirport.ToLower(), textRoute);
                StringAssert.Contains(flight.ArrivalAirport.ToLower(), textRoute);
            });

            return(this);
        }
예제 #29
0
        public void Example_InjectingAString()
        {
            //arrange
            string expectedValue = "LHR";

            _fixture.Inject(expectedValue);
            FlightDetails flightDetails = _fixture.Create <FlightDetails>();

            //assert
            flightDetails.AirlineName.Should().Be(expectedValue);
            flightDetails.ArrivalAirportCode.Should().Be(expectedValue);
            flightDetails.DepartureAirportCode.Should().Be(expectedValue);
        }
        public async Task <IHttpActionResult> DeleteFlightDetails(string id)
        {
            FlightDetails flightDetails = await db.FlightDetails.FindAsync(id);

            if (flightDetails == null)
            {
                return(NotFound());
            }

            db.FlightDetails.Remove(flightDetails);
            await db.SaveChangesAsync();

            return(Ok(flightDetails));
        }