Example #1
0
        public FlightType GetFlightTypeRecord(string recordID, string UserSNo)
        {
            SqlDataReader dr = null;

            try
            {
                FlightType     flightType = new FlightType();
                SqlParameter[] Parameters = { new SqlParameter("@SNo", Convert.ToInt32(recordID)), new SqlParameter("@UserID", Convert.ToInt32(UserSNo)) };
                dr = SqlHelper.ExecuteReader(ReadConnectionString.WebConfigConnectionString, CommandType.StoredProcedure, "GetRecordFlightType", Parameters);

                if (dr.Read())
                {
                    flightType.SNo            = Convert.ToInt32(dr["SNo"]);
                    flightType.FlightTypeName = dr["FlightTypeName"].ToString();
                    flightType.Priority       = Convert.ToDecimal(dr["Priority"].ToString());
                    flightType.IsActive       = Convert.ToBoolean(dr["IsActive"].ToString());
                    flightType.Active         = dr["Active"].ToString();
                    flightType.UpdatedBy      = dr["UpdatedUser"].ToString();
                    flightType.CreatedBy      = dr["CreatedUser"].ToString();
                }
                dr.Close();
                return(flightType);
            }
            catch (Exception ex)//
            {
                dr.Close();
                throw ex;
            }
        }
Example #2
0
        public IFlights Create(
            FlightType flightType)
        {
            IFlights flight = null;

            switch (flightType)
            {
            case FlightType.Cyclic:
            {
                flight = new CyclicFlight();
            }
            break;

            case FlightType.Normal:
            {
                flight = new NormalFlight();
            }
            break;

            default:
                return(new NullObjectFlight());
            }

            return(flight);
        }
        public IList <FlightModel> GetAllFlights(FlightType flightType)
        {
            using var dbContext = new LocalDatabaseContext();
            var flights = dbContext.Flights.Where(x => x.Type == flightType);

            return(this.mapper.ProjectTo <FlightModel>(flights).ToList());
        }
Example #4
0
        public IActionResult Edit(int id, [Bind("FLightTypeID,AirplaneID,Nr_Locuri,Plecare,Ora_plecare,Sosire,Ora_sosire")] FlightType flightType)
        {
            if (id != flightType.FLightTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _flighttypeService.UpdateFlightType(flightType);
                    _flighttypeService.Save();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlightTypeExists(flightType.FLightTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(flightType));
        }
Example #5
0
        public static string ToString(FlightType type, ApplicationElement appElement = ApplicationElement.SearchFlight)
        {
            if (appElement == ApplicationElement.SearchFlight)
            {
                switch (type)
                {
                case FlightType.OneWay: return("One-way");

                case FlightType.RoundTrip: return("Return journey");

                case FlightType.MultiCity: return("Multi-city");

                default:
                    throw new Exception("FlightTypeConverter. Cannot convert given FlightType: "
                                        + type.ToString() + " to string");
                }
            }
            else if (appElement == ApplicationElement.FlightSummary)
            {
                switch (type)
                {
                case FlightType.OneWay: return("One-way");

                case FlightType.RoundTrip: return("Round Trip");

                case FlightType.MultiCity: return("Multi-city");

                default:
                    throw new Exception("FlightTypeConverter. Cannot convert given FlightType: "
                                        + type.ToString() + " to string");
                }
            }

            return(null);
        }
        public Flight GetFlight(FlightType flightType)
        {
            switch (flightType)
            {
            case FlightType.Civil:
                return(new Flight("Civil", "k500", 6, "bulgarian"));

            case FlightType.Charter:
                return(new Flight("Charter", "e600", 4, "romanian"));

            case FlightType.Training:
                return(new Flight("Training", "b100", 1, "bulgarian"));

            case FlightType.Aircraft:
                return(new Flight("Aircraft", "c2", 3, "greek"));

            case FlightType.Irregular:
                return(new Flight("Irregular", "e250", 3, "italian"));

            case FlightType.International:
                return(new Flight("International", "g70", 6, "bulgarian"));

            case FlightType.State:
                return(new Flight("State", "gp60", 2, "english"));

            default:
                throw new ArgumentException();
            }
        }
Example #7
0
 public FlightType GetFlightType()
 {
     if (trips == null || trips.Count == 0)
     {
         throw new NullReferenceException("Trips should not be null or empty");
     }
     else
     {
         if (flightType != FlightType.None)
         {
             return(this.flightType);
         }
         var airportFrom = Airport.GetAirports().Where((port) => port.airportCode.ToLower().Equals(trips[0].destination.airportCode.ToLower())).FirstOrDefault();
         var airportTo   = Airport.GetAirports().Where((port) => port.airportCode.ToLower().Equals(trips[0].origin.airportCode.ToLower())).FirstOrDefault();
         if (airportFrom.countryName == airportTo.countryName)
         {
             this.flightType = FlightType.Local;
         }
         else
         {
             this.flightType = FlightType.International;
         }
         return(this.flightType);
     }
 }
Example #8
0
        public bool WithPets;    //Входит ли в билет перевозка животных

        //Билет на заданный рейс и со случайными параметрами
        public Ticket(int flightnumber, int number, FlightType type)
        {
            Number       = number;
            Type         = type;
            FlightNumber = flightnumber;
            WithBaggage  = Passenger.Coin();
            WithPets     = Passenger.Coin();
        }
        private void SetFlightType(FlightType flightType)
        {
            if (string.IsNullOrEmpty(flightType.ToString()))
            {
                throw new BeComfyDomainException($"{nameof(flightType)} cannot be null");
            }

            FlightType = flightType;
            SetUpdateDate();
        }
Example #10
0
        public IActionResult Create([Bind("FLightTypeID,AirplaneID,Nr_Locuri,Plecare,Ora_plecare,Sosire,Ora_sosire")] FlightType flightType)
        {
            if (ModelState.IsValid)
            {
                _flighttypeService.AddFlightType(flightType);
                _flighttypeService.Save();
                return(RedirectToAction(nameof(Index)));
            }

            return(View(flightType));
        }
Example #11
0
        private List <Ticket> Tickets;      // Билеты на самолет

        // Конструкторы
        public Flight()
        {
            Type           = FlightType.Transit;
            Number         = "XXXX";
            DepartureTime  = DateTime.Now;
            ArrivalTime    = DateTime.Now;
            DeparturePoint = new Airport();
            ArrivalPoint   = new Airport();
            Plane          = new Aircraft();
            Tickets        = new List <Ticket>();
        }
Example #12
0
 public Flight(int flightNumber, string city, string terminal, string gate, FlightType flightType, FlightStatus flightStatus,
               DateTime flightTime, int economyTicketPrice)
 {
     _flightNumber       = flightNumber;
     _city               = city;
     _terminal           = terminal;
     _gate               = gate;
     _flightType         = flightType;
     _flightStatus       = flightStatus;
     _flightTime         = flightTime;
     _economyTicketPrice = economyTicketPrice;
 }
        public void SetCorrectValue_WhenSetterAssigns()
        {
            // Arrange
            var sut      = new FlightType();
            var expected = "Arrivals";

            // Act
            sut.Name = expected;
            var actual = sut.Name;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Example #14
0
 public CreateFlight(Guid id, Guid planeId, IDictionary <SeatClass, int> availableSeats, Guid startAirport,
                     IEnumerable <Guid> transferAirports, Guid endAirport, FlightType flightType, DateTime flightDate, DateTime?returnDate)
 {
     Id               = id;
     PlaneId          = planeId;
     AvailableSeats   = availableSeats;
     StartAirport     = startAirport;
     TransferAirports = transferAirports;
     EndAirport       = endAirport;
     FlightType       = flightType;
     FlightDate       = flightDate;
     ReturnDate       = returnDate;
 }
Example #15
0
        private string MessageText(FlightType flightType, DateTime?outbound, DateTime?returning)
        {
            switch (flightType)
            {
            case FlightType.OneWay when outbound.HasValue:
                return($"You have booked a one-way flight on {outbound.Value.ToString("d")}.");

            case FlightType.Return when outbound.HasValue && returning.HasValue:
                return($"You have booked a return flight leaving on {outbound.Value.ToString("d")} and returning on {returning.Value.ToString("d")}.");

            default: return(string.Empty);
            }
        }
Example #16
0
        public Flight CreateFlight()
        {
            Random     rand         = new Random();
            Array      values       = Enum.GetValues(typeof(FlightType));
            FlightType type         = (FlightType)values.GetValue(rand.Next(values.Length));
            double     mins         = rand.Next(1, 2);
            string     flightNumber = GenerateFlightNumber(4);
            Flight     flight       = new Flight {
                FlightType = type, FlightTime = DateTime.Now.AddMinutes(mins), FlightNumber = flightNumber
            };

            return(flight);
        }
        public void ReturnCorrectValue_WhenGetterIsCalled()
        {
            // Arrange
            var sut      = new FlightType();
            var expected = "Arrivals";

            sut.Name = expected;

            // Act
            var actual = sut.Name;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        static void Main(string[] args)
        {
            FlightType flightType = FlightType.TypAdamowy;

            //=================================

            ProductFactory factory = new ProductFactory();

            IFlights flight = factory.Create(flightType);

            flight.ExampleMethod();

            Console.ReadKey();
        }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        FlightType data = new FlightType(int.Parse(txtFlightID.Value), txtFlightType.Value);

        if (btnSave.Value.Equals("Save"))
        {
            data.insert();
        }
        else if (btnSave.Value.Equals("Update"))
        {
            data.update();
        }

        Response.Write("<script>alert(Flight Type Inserted);</script>");
    }
Example #20
0
 public Flight(Guid id, Guid planeId, IDictionary <SeatClass, int> availableSeats,
               Guid startAirport, IEnumerable <Guid> transferAirports, Guid endAirport,
               FlightStatus flightStatus, FlightType flightType, DateTime flightDate, DateTime returnDate)
 {
     Id = id;
     SetPlaneId(planeId);
     SetAvailableSeats(availableSeats);
     SetStartAirport(startAirport);
     SetTransferAirports(transferAirports);
     SetEndAirport(endAirport);
     SetFlightStatus(flightStatus);
     SetFlightType(flightType);
     SetFlightDate(flightDate);
     SetReturnDate(returnDate);
     CreatedAt = DateTime.Now;
 }
    private IEnumerator ChangeDirection(float time)
    {
        yield return(new WaitForSeconds(time));

        if (Flight == FlightType.Horizontal)
        {
            SetFlightParameters(UFOMovementDirection.GetDiagonalDirection(FlightDirection));
            Flight = FlightType.Diagonal;
        }
        else if (Flight == FlightType.Diagonal)
        {
            SetFlightParameters(UFOMovementDirection.GetHorizontalDirection(FlightDirection));
            Flight = FlightType.Horizontal;
        }
        StartCoroutine(ChangeDirection(GetChangeDirectionTime()));
    }
Example #22
0
    // Constructors
    public Flight(string airport, DateTime time, FlightType direction)
    {
        m_Time       = time;
        m_Airport    = airport;
        m_flightType = direction;

        if (direction == FlightType.ARRIVAL)
        {
            m_Status = Status.ENROUTE;
        }
        else
        {
            m_Status = Status.SCHEDULED;
        }

        InitializeBaggages();
    }
 public async Task <FindFlightResponse> FindFlight(string origin,
                                                   string destination,
                                                   bool includeExData = false,
                                                   string filter      = null,
                                                   FlightType type    = FlightType.Auto,
                                                   int howMany        = 15,
                                                   int offset         = 0)
 {
     return(await client.HttpRequest <FindFlightResponse>("FindFlight", new {
         origin = origin,
         destination = destination,
         include_ex_data = includeExData,
         type = Enum.GetName(typeof(FlightType), type).ToLower(),
         filter = filter,
         howMany = howMany,
         offset = offset
     }));
 }
Example #24
0
        //Конструктор
        public Flight(int number,Random rand)
        {
            Number = number;
            //случайный тип рейса
            type = (FlightType)rand.Next(0, 2);
            //случайный город(в зависимости от типа)
            if(type==FlightType.Domestic)
            {
                destination = (FlightDestination)rand.Next(0,7);
            }
            else
            {
                destination = (FlightDestination)rand.Next(7, 14);
            }

            status=FlightStatus.NoRegistration;

        }
        // TODO: Add method changeArrivalAirport()

        // TODO: Add method recalculateEstimatedArrivalDateTime()

        public FlightPlan(
            Airport departureAirport,
            Airport arrivalAirport,
            DateTime departureDateTime,
            DateTime estimatedArrivalDateTime,
            int preplannedSpeed,
            FlightRoute preplannedRoute,
            int enRouteAltitude,
            FlightType type)
        {
            this.DepartureAirport         = departureAirport;
            this.ArrivalAirport           = arrivalAirport;
            this.DepartureDateTime        = departureDateTime;
            this.EstimatedArrivalDateTime = estimatedArrivalDateTime;
            this.PreplannedSpeed          = preplannedSpeed;
            this.PreplannedRoute          = preplannedRoute;
            this.EnRouteAltitude          = enRouteAltitude;
            this.Type = type;
        }
Example #26
0
        public static bool viewMatchedFlight(string origin, string dest, FlightSeatClass seat,
                                             FlightType type, DateTime dept, DateTime ret)
        {
            int           counter   = 1;
            List <Object> allFlight = FileHandler.GetAllObj(ObjectChoices.Flight);

            foreach (Object obj in allFlight)
            {
                Flight me = (Flight)obj;
                if (me.FlightState == FlightSatus.Scheduled && me.OriginCity.Equals(origin, StringComparison.OrdinalIgnoreCase) &&
                    me.DestinationCity.Equals(dest, StringComparison.OrdinalIgnoreCase) &&
                    me.DepartureDate == dept && me.Type == type)
                {
                    if (type == FlightType.Return && me.ReturnDate != ret)
                    {
                        continue;
                    }
                    if (seat == FlightSeatClass.Buisness && me.BuisnessClassSeat == me.getNumOfBookedSeats(seat))
                    {
                        continue;
                    }
                    if (seat == FlightSeatClass.First && me.FirstClassSeat == me.getNumOfBookedSeats(seat))
                    {
                        continue;
                    }
                    if (seat == FlightSeatClass.Economy && me.EconomyClassSeat == me.getNumOfBookedSeats(seat))
                    {
                        continue;
                    }
                    Console.WriteLine("#" + counter + " : ");
                    Console.WriteLine(me);
                    Console.WriteLine();
                    counter++;
                }
            }
            if (counter == 1)
            {
                Console.WriteLine("No matched flights");
                return(false);
            }
            return(true);
        }
Example #27
0
 public Flight(string org, string dest, FlightSatus state,
               double baseFare,
               int first, int buisness, int economy,
               FlightType type,
               DateTime dept, DateTime ret)
 {
     flightNumber           = int.Parse(DateTime.Now.Day + "" + DateTime.Now.Month + "" + DateTime.Now.Hour + "" + DateTime.Now.Second);
     origin                 = org;
     destination            = dest;
     flightState            = state;
     baseFlightFare         = baseFare;
     availSeatFirstClass    = first;
     availSeatBuisnessClass = buisness;
     availSeatEconomyClass  = economy;
     this.type              = type;
     departueDate           = dept;
     retDate                = ret;
     flightBookings         = new List <Eticket>();
     Console.WriteLine("Flight number is : " + flightNumber);
 }
Example #28
0
 public FlightPlan(
     string aircraft,
     string cruisingSpeed,
     Aerodrome departureAerodrome,
     string cruisingLevel,
     Aerodrome destinationAerodrome,
     int revision,
     FlightRules flightRules,
     int departureTime,
     int actualDepartureTime,
     int eetHours,
     int eetMinutes,
     int enduranceHours,
     int enduranceMinutes,
     Aerodrome alternateAerodrome,
     string otherInfo,
     string route,
     Aerodrome secondAlternateAerodrome,
     FlightType typeOfFlight,
     int personsOnBoard)
 {
     Aircraft             = aircraft ?? string.Empty;
     CruisingSpeed        = cruisingSpeed ?? string.Empty;
     DepartureAerodrome   = departureAerodrome;
     CruisingLevel        = cruisingLevel ?? string.Empty;
     DestinationAerodrome = destinationAerodrome;
     Revision             = revision;
     FlightRules          = flightRules;
     DepartureTime        = departureTime;
     ActualDepartureTime  = actualDepartureTime;
     EETHours             = eetHours;
     EETMinutess          = eetMinutes;
     EnduranceHours       = enduranceHours;
     EnduranceMinutes     = enduranceMinutes;
     AlternateAerodrome   = alternateAerodrome;
     OtherInfo            = otherInfo ?? string.Empty;
     Route = route ?? string.Empty;
     SecondAlternateAerodrome = secondAlternateAerodrome;
     TypeOfFlight             = typeOfFlight;
     PersonsOnBoard           = personsOnBoard;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        string delid = Request.QueryString["delid"];
        string upid  = Request.QueryString["upid"];

        if (delid != null)
        {
            FlightType data = new FlightType(delid);
            data.delete();
        }
        else if (upid != null)
        {
            FlightType data   = new FlightType(upid);
            object []  record = data.get();

            txtFlightID.Value   = record[0] + "";
            txtFlightType.Value = record[1] + "";

            btnSave.Value = "Update";
        }
    }
Example #30
0
        private long?CreateFlight(AirplaneWithCrewModel airplaneWithCrewModel, System.DateTime takeoffTime, string task, FlightType type)
        {
            if (airplaneWithCrewModel is null)
            {
                return(null);
            }

            var model = new CreateFlightModel
            {
                AirplaneId = this.CreateAirplane(airplaneWithCrewModel.Airplane),
                PilotId    = this.CreatePerson(airplaneWithCrewModel.Pilot) ?? throw new KeyNotFoundException("Pilot not found"),
                                   CopilotId   = this.CreatePerson(airplaneWithCrewModel.Copilot),
                                   Type        = type,
                                   TakeOffTime = takeoffTime,
                                   Task        = task
            };

            long towplaneFlightId = this.flightRepository.CreateFlight(model);

            return(towplaneFlightId);
        }
Example #31
0
        // Create a simple mission for autopilot
        private void CreateAutopilotMission(FlightType type, int time)
        {
            autopilot.ClearObjectives();

            if (droneClient.NavigationData.State.HasFlag(NavigationState.Flying))
            {
                Console.WriteLine($"Flight type: {type} in {time}ms");

                switch (type)
                {
                    case FlightType.Forward:
                        // Wykonaj lot w przód z pochyleniem 10° w ciągu zadanego czasu
                        autopilot.EnqueueObjective(Objective.Create(time, new SetPitch(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Back:
                        // Wykonaj lot do tyłu z pochyleniem 10° w ciągu zadanego czasu
                        autopilot.EnqueueObjective(Objective.Create(time, new SetPitch(SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Turn_Left:
                        // Wykonaj obrót 90° w lewo
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetYaw(-TURN_OF_NINETY_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Turn_Right:
                        // Wykonaj obrót 90° w prawo
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetYaw(TURN_OF_NINETY_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Lean_Left:
                        // Wykonaj lot w lewo z pochyleniem 10° w ciągu zadanego czasu
                        autopilot.EnqueueObjective(Objective.Create(time, new SetRoll(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Lean_Right:
                        // Wykonaj lot w prawo z pochyleniem 10° w ciągu zadanego czasu
                        autopilot.EnqueueObjective(Objective.Create(time, new SetRoll(SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(2000));
                        break;

                    case FlightType.Triangle:
                        // Do przodu z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(time, new SetPitch(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Obrót 300° w prawo
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetYaw(ROTATION_OF_THREE_HUNDRED_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Do przodu z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(time, new SetPitch(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Obrót 300° w prawo
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetYaw(ROTATION_OF_THREE_HUNDRED_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Do przodu z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(time, new SetPitch(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Obrót 300° w prawo
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetYaw(ROTATION_OF_THREE_HUNDRED_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));
                        break;

                    case FlightType.Square:
                        // Do przodu z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetPitch(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // W lewo z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetRoll(-SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // Do tyłu z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetPitch(SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));

                        // W prawo z nachyleniem 10°
                        autopilot.EnqueueObjective(Objective.Create(2000, new SetRoll(SLOPE_OF_TEN_DEGREES)));
                        autopilot.EnqueueObjective(new Hover(3000));
                        break;
                }
            }
            else // Just take off if the drone is on the ground
            {
                autopilot.EnqueueObjective(new FlatTrim(1000));
                autopilot.EnqueueObjective(new Takeoff(3500));
            }

            // One could use hover, but the method below, allows to gain/lose/maintain desired altitude
            autopilot.EnqueueObjective(
                Objective.Create(3000,
                    new VelocityX(0.0f),
                    new VelocityY(0.0f),
                    new Altitude(1.0f)
                )
            );

            autopilot.EnqueueObjective(new Land(5000));
        }