public void setCurrentState(State newState)
 {
     currentState = newState;
     setStateImage(newState);
     AirportManager.getInstance().refreshButtonPanelIfSelected(this);
     AirportManager.getInstance().refreshInformationPanelIfSelected(this);
 }
Exemple #2
0
        public IHttpActionResult Post(AirportManager manager)
        {
            try
            {
                var CorreoElectronico = manager.Email;
                var pass = manager.Password;
                mng.Create(manager);
                string Mensaje = "Estimado " + manager.FirstName + "  " + manager.LastName + " <br/><br/> " + "Su contraseña de inicio es: " + pass;
                ToolsHelper.SendMail(CorreoElectronico, "Confirmación de cuenta", Mensaje);
                apiResp = new ApiResponse
                {
                    Message = "Action was executed"
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Exemple #3
0
        /// <summary>
        /// Returns a string represents the PMDG .rte file.
        /// SIDs, STARs are not included.
        /// </summary>
        public static string GetExportText(Route route, AirportManager airports)
        {
            int numWpts = route.Count;

            // Including dep/arr airports
            string icaoOrig = route.FirstWaypoint.ID.Substring(0, 4);
            string icaoDest = route.LastWaypoint.ID.Substring(0, 4);

            var result = new StringBuilder();

            AppendOrigAirportPart(numWpts, icaoOrig, result, airports);

            var node = route.First.Next;

            while (node != route.Last)
            {
                var airway = node.Value.AirwayToNext.Airway;
                var wpt    = node.Value.Waypoint;

                if (airway == "DCT" || node.Next == route.Last)
                {
                    airway = "DIRECT";
                }

                result.Append(wpt.ID + "\n5\n" + airway + "\n1 ");
                result.AppendLine(PmdgLatLonFormat(wpt.Lat, wpt.Lon) +
                                  " 0\n0\n0\n0");
                result.AppendLine();
                node = node.Next;
            }

            AppendDestAirportPart(icaoDest, result, airports);
            return(result.ToString());
        }
        public AirwayNetwork(WaypointList wptList, AirportManager airportList)
        {
            this.WptList     = wptList;
            this.AirportList = airportList;

            SetTrackData();
        }
        public BaseEntity BuildObject(Dictionary <string, object> row)
        {
            AirportCrudFactory acf = new AirportCrudFactory();
            var entity             = new Airport
            {
                ID = GetStringValue(row, DB_COL_ID_AIRPORT)
            };

            Airport airport = acf.Retrieve <Airport>(entity);

            var AirportManager = new AirportManager
            {
                ID             = GetStringValue(row, DB_COL_ID),
                FirstName      = GetStringValue(row, DB_COL_FIRST_NAME),
                SecondName     = GetStringValue(row, DB_COL_SECOND_NAME),
                LastName       = GetStringValue(row, DB_COL_FIRST_LAST_NAME),
                SecondLastName = GetStringValue(row, DB_COL_SECOND_LAST_NAME),
                BirthDate      = GetDateValue(row, DB_COL_BIRTHDATE),
                Genre          = GetStringValue(row, DB_COL_GENRE),
                Email          = GetStringValue(row, DB_COL_EMAIL),
                Password       = GetStringValue(row, DB_COL_PASSWORD),
                Phone          = GetStringValue(row, DB_COL_PHONE),
                CivilStatus    = GetStringValue(row, DB_COL_CIVIL_STATUS),
                Status         = Convert.ToBoolean(GetIntValue(row, DB_COL_STATUS)),
                Rol            = GetStringValue(row, DB_COL_ID_ROL),
                AirportID      = GetStringValue(row, DB_COL_ID_AIRPORT),
                AirportName    = airport.Name
            };

            return(AirportManager);
        }
    private void Awake()
    {
        gameController = GetComponent <GameController>();
        airportManager = GetComponent <AirportManager>();

        endTurnText = endTurnButton.GetComponentInChildren <Text>();
    }
Exemple #7
0
 private void btnCancelOperation_click(object sender, EventArgs e)
 {
     if (AirportManager.getInstance().getSelectedPlane() is Plane)
     {
         OperationManager.getInstance().stopOperation((Plane)AirportManager.getInstance().getSelectedPlane());
     }
 }
Exemple #8
0
        public void Init(
            AcConfigManager aircrafts,
            List <PerfTable> tables,
            AirportManager airports,
            Func <AircraftRequest> acRequestGetter)
        {
            airportInfoControl.Init();

            // Create the reference to the UI controls.
            InitializeElements();

            // Set default values for the controls.
            InitializeControls();

            SetWeatherBtnHandlers();

            requestBtn.SetToolTip("Use aircraft and weights calculated from 'Fuel' page.");

            // Automatically update weather
            airportInfoControl.IcaoChanged += (s, e) => wxSetter.GetMetarAndFillWeather();

            this.aircrafts = aircrafts;
            this.tables    = tables;
            UpdateAircraftList();
            this.Airports        = airports;
            this.acRequestGetter = acRequestGetter;
        }
Exemple #9
0
        public IHttpActionResult Get(string id)
        {
            try
            {
                var airportManager = new AirportManager
                {
                    ID = id
                };

                airportManager = mng.RetrieveById(airportManager);
                apiResp.Data   = airportManager;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Exemple #10
0
        public AirportModel SeedAirport(AirportPostOptions options)
        {
            var model = AirportManager.Post(options);

            AirportManager.SaveChanges();
            return(model);
        }
Exemple #11
0
        public List <AirportManager> GetManagers()
        {
            List <AirportManager> managers = new List <AirportManager>();
            string        conString        = ConfigurationManager.ConnectionStrings["dataConnection"].ConnectionString;
            SqlConnection connection       = new SqlConnection(conString);

            try
            {
                connection.Open();
            }
            catch (Exception ex)
            {
                Response.Write("error" + ex.ToString());
                connection.Close();
                return(null);
            }

            string        cmdString = "SELECT * FROM Manager";
            SqlCommand    cmd       = new SqlCommand(cmdString, connection);
            SqlDataReader nwReader  = cmd.ExecuteReader();

            while (nwReader.Read())
            {
                AirportManager manager = new AirportManager();
                manager.ManagerEmployeeID = (int)nwReader["ManagerEmployeeID"];
                manager.Department        = (string)nwReader["Department"];
                manager.Password          = (string)nwReader["ManagerPassword"];
                managers.Add(manager);
            }

            return(managers);
        }
Exemple #12
0
        public static void ExportRouteFiles(
            IMessageDisplay view,
            RouteGroup Route,
            IEnumerable <ExportCommand> cmds,
            MultiMap <string, Navaid> Navaids,
            AirportManager airportList,
            ExportMenu menu)
        {
            if (Route == null)
            {
                view.ShowMessage("Please find or analyze a route first.", MessageLevel.Info);
                return;
            }

            using (var frm = GetForm(new Size(1, 1)))
            {
                menu.Location    = new Point(0, 0);
                menu.Route       = Route;
                menu.Navaids     = Navaids;
                menu.AirportList = airportList;

                frm.AutoSizeMode    = AutoSizeMode.GrowAndShrink;
                frm.AutoSize        = true;
                frm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                frm.Controls.Add(menu);
                frm.ShowDialog();
                frm.Controls.Remove(menu);
            }
        }
Exemple #13
0
        public static LoadResult Load(IEnumerable <string> allLines)
        {
            var errors      = new List <ReadFileError>();
            var airportList = new AirportManager();

            Airport        airport = null;
            List <RwyData> rwys    = null;

            allLines.ForEach((line, index) =>
            {
                var lineNum = index + 1;
                var words   = line.Split(',').Select(s => s.Trim()).ToList();

                if (words.Count > 0)
                {
                    if (words[0] == "A")
                    {
                        // Add the previously read airport.
                        if (airport != null)
                        {
                            airportList.Add(airport);
                        }

                        var a = ReadAirport(words);
                        if (a != null)
                        {
                            airport = a;
                            rwys    = (List <RwyData>)a.Rwys;
                        }
                        else
                        {
                            errors.Add(new ReadFileError(lineNum, line));
                        }
                    }
                    else if (words[0] == "R")
                    {
                        var r = ReadRwy(words);
                        if (r != null)
                        {
                            rwys.Add(ReadRwy(words));
                        }
                        else
                        {
                            errors.Add(new ReadFileError(lineNum, line));
                        }
                    }
                }
            });

            // Add the last airport.
            if (airport != null)
            {
                airportList.Add(airport);
            }

            return(new LoadResult()
            {
                Airports = airportList, Errors = errors
            });
        }
Exemple #14
0
        public ActionResult LogIn(AirportManager manager)
        {
            string        conString  = ConfigurationManager.ConnectionStrings["dataConnection"].ConnectionString;
            SqlConnection connection = new SqlConnection(conString);

            try
            {
                connection.Open();
            }
            catch (Exception ex)
            {
                Response.Write("error" + ex.ToString());
                connection.Close();
                return(null);
            }
            DataSet       ds        = new DataSet();
            string        cmdString = "SELECT * FROM Manager WHERE ManagerEmployeeID = " + manager.ManagerEmployeeID;
            SqlCommand    cmd       = new SqlCommand(cmdString, connection);
            SqlDataReader nwReader1 = cmd.ExecuteReader();

            if (nwReader1.Read())
            {
                if (manager.Password == nwReader1["ManagerPassword"].ToString())
                {
                    return(RedirectToAction("ManagerPage", "ManagerPage", new { managerID = manager.ManagerEmployeeID }));
                }
            }
            return(View());
        }
        /// <summary>
        /// Use this method when wptList and airportList are entirely changed (probably
        /// due to loading a different nav data). The downloaded tracks will be reparsed
        /// and added to the wptList if the specific track system was enabled.
        /// </summary>
        public async Task Update(WaypointList wptList, AirportManager airportList,
                                 NetworkUpdateAction action)
        {
            await queues.WaitForTasks();

            var messages = Handlers.Select(h => h.Message).ToList();

            this.WptList     = wptList;
            this.AirportList = airportList;

            SetTrackData();

            var newHandlers = Handlers;

            for (int i = 0; i < messages.Count; i++)
            {
                var h    = newHandlers[i];
                var type = (TrackType)i;
                var msg  = messages[i];

                if (msg != null)
                {
                    // Because the task queue is empty now, we can run everything in
                    // this synchronously.
                    h.GetAllTracks(new TrackMessageProvider(msg), StatusRecorder);
                    h.AddToWaypointList(StatusRecorder);
                    action.SyncTrackEnabled(type);

                    InvokeStatusChanged(type);
                    InvokeTrackMessageUpdated();
                }
            }

            NavDataChanged?.Invoke(this, EventArgs.Empty);
        }
        public static void ExportRouteFiles(
            IMessageDisplay view,
            RouteGroup Route,
            IEnumerable <ExportCommand> cmds,
            AirportManager airportList)
        {
            if (Route == null)
            {
                view.ShowMessage("Please find or analyze a route first.", MessageLevel.Info);
                return;
            }

            var writer = new FileExporter(Route.Expanded, airportList, cmds);
            IEnumerable <FileExporter.Status> reports = null;

            try
            {
                reports = writer.Export();
            }
            catch (Exception ex)
            {
                view.ShowMessage(ex.Message, MessageLevel.Warning);
                return;
            }

            ShowReports(view, reports.ToList());
        }
Exemple #17
0
 public void Init(string icao, AirportManager airportList)
 {
     icaoTxtbox.Text  = icao;
     this.airportList = airportList;
     lengthUnitComboBox.SelectedIndex = 0;
     minRwyLengthTxtbox.Text          = "2500";
 }
        private AirportManager TestCollection()
        {
            var col = new AirportManager();

            col.Add(TestAirport());
            return(col);
        }
Exemple #19
0
        public override bool execute()
        {
            if (plane.getCurrentState() != State.Takeoff)
            {
                return(false);
            }

            if (++fuelUsageIntervalTimer >= fuelUsageInterval)
            {
                plane.setCurrentFuelLevel(plane.getCurrentFuelLevel() - 1);
                fuelUsageIntervalTimer = 0;
            }

            if (plane.getCurrentFuelLevel() <= 0)
            {
                NotificationManager.getInstance().addNotification("Samolot " + plane.getModelID() + " rozbił się przy próbie startu z pasa startowego nr. " + runway.getID() + ".", NotificationType.Negative);
                plane.setCurrentState(State.Destroyed);
                return(false);
            }

            if (runway.tick())
            {
                return(true);
            }
            else
            {
                AirportManager.getInstance().getAirspace().addToAirspace(plane);

                NotificationManager.getInstance().addNotification("Samolot " + plane.getModelID() + " wzniósł się w powietrze. Teraz znajduje się w przestrzeni powietrznej nad lotniskiem", NotificationType.Positive);
            }
            return(false);
        }
Exemple #20
0
        public IHttpActionResult RemoveAirportManager(AirportManager manager)
        {
            try
            {
                mng.Delete(manager);
                apiResp = new ApiResponse
                {
                    Message = "Action was exectued."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Exemple #21
0
        private void InitObjects2()
        {
            airportList = new AirportManager();
            var list = airportList;

            list.Add(GetAirport("ABCD", GetRwyData("05L", 25.0, 120.0)));
            list.Add(GetAirport("EFGH", GetRwyData("07L", 43.0, 107.0)));
        }
        public void WhenCannotFindRwysShouldReturnNull()
        {
            var col = new AirportManager();

            Assert.IsNull(col["ABCD"]);
            Assert.IsNull(col.FindRwy("ABCD", "01"));
            Assert.IsNull(col.RwyIdents("ABCD"));
        }
Exemple #23
0
        public FlightFixture() : base("TUI-Test-Flight")
        {
            var telemetryClient = new TelemetryClient();

            FlightManager   = new FlightManager(Context, telemetryClient);
            AirportManager  = new AirportManager(Context, telemetryClient);
            AircraftManager = new AircraftManager(Context, telemetryClient);
        }
Exemple #24
0
        public async Task Update(WaypointList wptList, AirportManager airportList)
        {
            var action = new NetworkUpdateAction(
                (t) => SetTrackEnabled(t),
                (t) => DownloadAndEnableTracks(t));

            await airwayNetwork.Update(wptList, airportList, action);
        }
Exemple #25
0
 private void Awake()
 {
     _airportManager   = GetComponent <AirportManager>();
     _planeManager     = GetComponent <PlaneManager>();
     _uiManager        = GetComponent <UiManager>();
     _daytimeManager   = GetComponent <DaytimeManager>();
     _passengerManager = GetComponent <PassengerManager>();
     _upgradeManager   = GetComponent <UpgradeManager>();
 }
Exemple #26
0
 public AusotsParser(
     ITrackMessage data,
     StatusRecorder statusRecorder,
     AirportManager airportList)
 {
     allTxt = ((AusotsMessage)data).AllText;
     this.statusRecorder = statusRecorder;
     this.airportList    = airportList;
 }
Exemple #27
0
        public AirwayNetwork(WaypointList wptList, AirportManager airportList,
                             MultiMap <string, Navaid> Navaids)
        {
            this.WptList     = wptList;
            this.AirportList = airportList;
            this.Navaids     = Navaids;

            SetTrackData();
        }
Exemple #28
0
 public FileExporter(
     Route route,
     AirportManager airports,
     IEnumerable <ExportCommand> commands)
 {
     this.route    = route;
     this.airports = airports;
     this.commands = commands;
 }
        /// <exception cref="ReadAirportFileException"></exception>
        public AirportManager LoadFromFile()
        {
            var airportDB = new AirportManager();

            string[] allLines = null;
            var      path     = folderpath + @"\airports.csv";

            try
            {
                allLines = File.ReadAllLines(path);
            }
            catch (Exception ex)
            {
                throw new ReadAirportFileException("Unable to read from " + path + ".", ex);
            }

            MultiMap <string, RwyData> rwyList;

            try
            {
                rwyList = LoadRwys();
            }
            catch (Exception ex)
            {
                throw new ReadAirportFileException("Unable to read runways.csv.", ex);
            }

            for (int i = 1; i < allLines.Length; i++)
            {
                try
                {
                    var words = allLines[i].Split(',');

                    string icao = words[1].Trim('"');
                    string name = words[3].Trim('"');

                    var rwys = rwyList.FindAll(icao);

                    if (rwys.Count == 0 ||
                        !double.TryParse(words[4], out var lat) ||
                        !double.TryParse(words[5], out var lon) ||
                        !double.TryParse(words[6], out var elevation))
                    {
                        continue;
                    }

                    int longestRwyLength = rwys.Max(x => x.LengthFt);

                    airportDB.Add(new Airport(icao, name, lat, lon, RoundToInt(elevation),
                                              false, 0, 0, longestRwyLength, rwys));
                }
                catch { }
            }

            return(airportDB);
        }
Exemple #30
0
        public FsxProvider(Route route, AirportManager airports)
        {
            if (route.Count < 2)
            {
                throw new ArgumentException();
            }

            this.route    = route;
            this.airports = airports;
        }