예제 #1
0
        private void GoToCreate(object sender, System.EventArgs e)
        {
            try
            {
                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.CreateAirline);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong view.");
            }
        }
예제 #2
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio = (RadioButton)panelChild.Controls[12];

                Airport airport = new Airport
                {
                    Name      = panelChild.Controls[1].Controls[0].Text,
                    Operator  = panelChild.Controls[2].Controls[0].Text,
                    Owner     = panelChild.Controls[3].Controls[0].Text,
                    ICAO      = panelChild.Controls[4].Controls[0].Text,
                    IATA      = panelChild.Controls[5].Controls[0].Text,
                    Type      = panelChild.Controls[6].Controls[0].Text,
                    Address   = panelChild.Controls[7].Controls[0].Text,
                    Serves    = panelChild.Controls[8].Controls[0].Text,
                    Large     = int.Parse(panelChild.Controls[9].Controls[0].Text),
                    Elevation = int.Parse(panelChild.Controls[10].Controls[0].Text),
                    Status    = (myRadio.Checked) ? 1 : 0,
                };


                AirportDAO dao = new AirportDAO(Server.MariaDB);
                dao.Save(airport);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airports);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #3
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio = (RadioButton)panelChild.Controls[9];
                ComboBox    myCombo = (ComboBox)panelChild.Controls[7];

                int airlaineID = new AirlineDAO(Enums.Server.MariaDB).GetID(myCombo.SelectedItem.ToString());

                Airplane avion = new Airplane
                {
                    Model     = panelChild.Controls[1].Controls[0].Text,
                    ICAO      = panelChild.Controls[2].Controls[0].Text,
                    IATA      = panelChild.Controls[3].Controls[0].Text,
                    MaxPASS   = int.Parse(panelChild.Controls[4].Controls[0].Text),
                    MaxCargo  = int.Parse(panelChild.Controls[5].Controls[0].Text),
                    Aircraft  = panelChild.Controls[6].Controls[0].Text,
                    AirlineID = airlaineID,
                    Enabled   = (myRadio.Checked) ? 1 : 0,
                };

                AirplaneDAO dao = new AirplaneDAO(Enums.Server.MariaDB);
                dao.Save(avion);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airplanes);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #4
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio    = (RadioButton)panelChild.Controls[5];
                ComboBox    myCombo    = (ComboBox)panelChild.Controls[3];
                int         airlaineID = new AirlineDAO(Enums.Server.MariaDB).GetID(myCombo.SelectedItem.ToString());

                Pilot piloto = new Pilot
                {
                    Name        = panelChild.Controls[1].Controls[0].Text,
                    Sex         = panelChild.Controls[2].Controls[0].Text,
                    PilotStatus = (myRadio.Checked) ? 1 : 0,
                    AirlineID   = airlaineID
                };

                PilotDAO dao = new PilotDAO(Enums.Server.MariaDB);
                dao.Save(piloto);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Pilots);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #5
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                RadioButton myRadio = (RadioButton)panelChild.Controls[7];

                Airline aerolinea = new Airline
                {
                    Name          = panelChild.Controls[1].Controls[0].Text,
                    ICAO          = panelChild.Controls[2].Controls[0].Text,
                    IATA          = panelChild.Controls[3].Controls[0].Text,
                    Country       = panelChild.Controls[4].Controls[0].Text,
                    Region        = panelChild.Controls[5].Controls[0].Text,
                    AirlineStatus = (myRadio.Checked) ? 1 : 0,
                    AircraftList  = ""
                };

                AirlineDAO dao = new AirlineDAO(Enums.Server.MariaDB);
                dao.Save(aerolinea);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airlines);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #6
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio = (RadioButton)panelChild.Controls[3];

                Pist pist = new Pist
                {
                    Description = panelChild.Controls[1].Controls[0].Text,
                    Status      = (myRadio.Checked) ? 1 : 0,
                };

                PistDAO dao = new PistDAO(Server.MariaDB);
                dao.Save(pist);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Pists);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #7
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                ComboBox myCombo  = (ComboBox)panelChild.Controls[2];
                ComboBox myCombo2 = (ComboBox)panelChild.Controls[12];
                ComboBox myCombo3 = (ComboBox)panelChild.Controls[13];

                ComboBox myCombo4 = (ComboBox)panelChild.Controls[16];
                ComboBox myCombo5 = (ComboBox)panelChild.Controls[18];
                ComboBox myCombo6 = (ComboBox)panelChild.Controls[20];

                DateTime departureDate  = DateTime.Parse(panelChild.Controls[6].Text);
                DateTime arrivalDate    = DateTime.Parse(panelChild.Controls[9].Text);
                TimeSpan twentyFourHour = new TimeSpan(24, 0, 0);
                TimeSpan departureHour  = TimeSpan.Parse(panelChild.Controls[7].Controls[0].Text);
                TimeSpan arrivalHour    = TimeSpan.Parse(panelChild.Controls[10].Controls[0].Text);
                TimeSpan flightHour     = (departureHour > arrivalHour) ? (twentyFourHour - departureHour) + arrivalHour : arrivalHour - departureHour;

                AirlineDAO  airlineDAO  = new AirlineDAO(Server.MariaDB);
                AirplaneDAO airplaneDAO = new AirplaneDAO(Server.MariaDB);
                PilotDAO    pilotDAO    = new PilotDAO(Server.MariaDB);

                Flight flight = new Flight
                {
                    Type          = myCombo.SelectedItem.ToString(),
                    Origin        = panelChild.Controls[3].Controls[0].Text,
                    Destiny       = panelChild.Controls[4].Controls[0].Text,
                    DepartureDate = departureDate.ToString(),
                    DepartureHour = departureHour.ToString(),
                    ArrivalDate   = arrivalDate.ToString(),
                    ArrivalHour   = arrivalHour.ToString(),
                    FlightTime    = flightHour.ToString(),
                    Pist          = int.Parse(myCombo2.SelectedItem.ToString()),
                    FlightStatus  = myCombo3.SelectedItem.ToString(),
                    AirlineID     = airlineDAO.GetID(myCombo4.SelectedItem.ToString()),
                    AirplaneID    = airplaneDAO.GetID(myCombo5.SelectedItem.ToString()),
                    PilotID       = pilotDAO.GetID(myCombo6.SelectedItem.ToString()),
                };

                FlightDAO dao = new FlightDAO(Enums.Server.MariaDB);
                dao.Save(flight);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Flight);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
예제 #8
0
        protected override void InitializeComponent()
        {
            PortraitForm portraitForm = new PortraitForm("Management");

            form           = portraitForm;
            form.Width     = 1500;
            form.Height    = 900;
            form.Padding   = new Padding(20);
            form.BackColor = colors.White1;

            // Main panel
            FlatPanel mainPanel = new FlatPanel("Main");

            form.Controls.Add(mainPanel);
            mainPanel.Dock = DockStyle.Fill;


            Toolbar   toolbarController = new FlujoAereo.Logic.UI.Layouts.Toolbar();
            FlatPanel toolbar           = toolbarController.GetPanel("Toolbar");

            mainPanel.Controls.Add(toolbar);
            toolbar.Controls[0].Dock   = DockStyle.None;
            toolbar.Controls[0].Height = 70;
            toolbarController.AlignElementsRight(toolbar.Controls[0].Controls);
            toolbar.Controls[0].Controls[1].Click += new EventHandler(SetLogout);

            FlatPanel   menuWrapper    = new FlatPanel("MenuWrapper");
            MenuSection menuController = new MenuSection(200);
            FlatPanel   menu           = menuController.GetPanel("Menu");

            menuWrapper.Controls.Add(menu);
            menuWrapper.Dock = DockStyle.Left;
            menuWrapper.Left = 0;


            menu.Controls[0].Controls[0].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Airplanes);
                PanelAdjustment();
            }
                );

            menu.Controls[0].Controls[1].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Airlines);
                PanelAdjustment();
            }
                );

            menu.Controls[0].Controls[2].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Pilots);
                PanelAdjustment();
            }
                );

            menu.Controls[0].Controls[3].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Pists);
                PanelAdjustment();
            }
                );

            menu.Controls[0].Controls[4].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Airports);
                PanelAdjustment();
            }
                );

            menu.Controls[0].Controls[5].Click += new EventHandler(
                (object sender, EventArgs e) =>
            {
                menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Flight);
                PanelAdjustment();
            }
                );

            form.Controls.Add(menuWrapper);
            menuController.SetMenuItemsWidth(menuWrapper.Width);

            // Default panel
            menuController.ShowPanel(ref mainPanel, Enums.ItemMenuType.Airplanes);
            PanelAdjustment();

            //TimeSpan timeSpan = new TimeSpan(0, 2, 0,0);
            //TimeSpan timeSpan2 = TimeSpan.Parse("20:00");
            //MessageBox.Show(timeSpan2.ToString());

            void PanelAdjustment()
            {
                mainPanel.Controls[1].Dock   = DockStyle.None;
                mainPanel.Width              = form.Width - menu.Width;
                toolbar.Controls[0].Width    = mainPanel.Width;
                mainPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                mainPanel.Controls[1].Width  = mainPanel.Width;
                mainPanel.Controls[1].Height = mainPanel.Height - toolbar.Height;
            }
        }