Beispiel #1
0
        private void btnRunwayAdd_Click(object sender, EventArgs e)
        {
            string runwayName = this.txtRunwayName.Text;
            string status     = this.cmbRunwayStatus.Text;

            if (runwayName != string.Empty && status != string.Empty)
            {
                int count = db.Runways.Where(r => r.Name.Trim() == runwayName).Count();
                if (count == 0)
                {
                    Runway rnwy = new Runway();
                    rnwy.Name   = runwayName;
                    rnwy.Status = this.chechStatus(status);
                    db.Runways.Add(rnwy);
                    db.SaveChanges();
                    this.clearRunwayText();
                }
                else
                {
                    this.lblRunwayErrors.Text = "Artiq movcuddur.";
                }
            }
            else
            {
                this.lblRunwayErrors.Text = "Boshlugu doldurun !..";
            }
        }
Beispiel #2
0
        private void btnAddTerminal_Click(object sender, EventArgs e)
        {
            string TerminalName = this.txtTerminalName.Text;
            string status       = this.cmbTerminalStatus.Text;

            if (TerminalName != string.Empty && status != string.Empty)
            {
                int count = db.Terminals.Where(t => t.Name.Trim() == TerminalName).Count();
                if (count == 0)
                {
                    Terminal trml = new Terminal();
                    trml.Name   = TerminalName;
                    trml.Status = this.checkStatus(status);
                    db.Terminals.Add(trml);
                    db.SaveChanges();
                    this.clearTerminalText();
                }
                else
                {
                    this.lblErrorsTerminal.Text = "Artiq movcuddur.";
                }
            }
            else
            {
                this.lblErrorsTerminal.Text = "Boshlugu doldurun !..";
            }
        }
Beispiel #3
0
        private void btnAddCity_Click(object sender, EventArgs e)
        {
            string cityName   = this.txtCityName.Text;
            string country_id = cmbCoutry_id.Text;

            if (cityName != string.Empty && country_id != string.Empty)
            {
                int count = db.Cities.Where(c => c.Name.Trim() == cityName).Count();
                if (count == 0)
                {
                    City cty = new City();
                    cty.Name       = cityName;
                    cty.Country_id = getCountrIdByName(country_id);
                    db.Cities.Add(cty);
                    db.SaveChanges();
                    this.fillCityData();
                    this.clearCityText();
                }
                else
                {
                    this.lblCityErrors.Text = "Artiq movcuddur.";
                }
            }
            else
            {
                this.lblCityErrors.Text = "Boshlugu doldurun !..";
            }
        }
Beispiel #4
0
        private void btnGateAdd_Click(object sender, EventArgs e)
        {
            string gateName = this.txtGateName.Text;
            string status   = this.cmbGateStatus.Text;

            if (gateName != string.Empty && status != string.Empty)
            {
                int count = db.Gates.Where(g => g.Name.Trim() == gateName).Count();
                if (count == 0)
                {
                    Gate gts = new Gate();
                    gts.Name   = gateName;
                    gts.Status = this.CheckStatus(status);
                    db.Gates.Add(gts);
                    db.SaveChanges();
                    this.ClearGateTxt();
                }
                else
                {
                    this.lblGateErrors.Text = "Artiq bu gate var !..";
                }
            }
            else
            {
                this.lblGateErrors.Text = "Butun melumatlari doldurun !..";
            }
        }
Beispiel #5
0
        private void btnCountryAdd_Click(object sender, EventArgs e)
        {
            string countryName = this.txtCountryName.Text;

            if (countryName != string.Empty)
            {
                int count = db.Countries.Where(c => c.Name.Trim() == countryName).Count();
                if (count == 0)
                {
                    Country cntr = new Country();
                    cntr.Name = countryName;
                    db.Countries.Add(cntr);
                    db.SaveChanges();
                    this.clearCountrytext();
                }
                else
                {
                    this.lblCoutryErrors.Text = "Artiq movcuddur.";
                }
            }
            else
            {
                this.lblCoutryErrors.Text = "Boshlugu doldurun.";
            }
        }
Beispiel #6
0
        private void btnAddCompany_Click(object sender, EventArgs e)
        {
            string companyName = this.txtCompanyName.Text;
            string status      = this.cmbCompanyStatus.Text;
            string country_id  = this.cmbCountryId.Text;

            if (companyName != string.Empty && status != string.Empty && country_id != string.Empty)
            {
                int count = db.Companies.Where(c => c.Name.Trim() == companyName).Count();
                if (count == 0)
                {
                    Company cmpny = new Company();
                    cmpny.Name       = companyName;
                    cmpny.Status     = this.checkStatus(status);
                    cmpny.Country_id = this.getcountryIdByName(country_id);
                    db.Companies.Add(cmpny);
                    db.SaveChanges();
                    this.clearCompanyTxt();
                }
                else
                {
                    this.lblCompanyErrors.Text = "Artiq movcuddur !..";
                }
            }
            else
            {
                this.lblCompanyErrors.Text = "Boshlugu doldurun !..";
            }
        }
Beispiel #7
0
        private void btnAddFlight_Click(object sender, EventArgs e)
        {
            string   cityName     = this.cmbCities.Text;
            string   companiyName = this.cmbCompanies.Text;
            string   gateName     = this.cmbGates.Text;
            string   runwayName   = this.cmbRunways.Text;
            string   terminalName = this.cmbTerminals.Text;
            string   status       = this.cmbStatus.Text;
            string   typeName     = this.cmbType.Text;
            DateTime dateTime     = this.dateTimeFlights.Value;


            void addFlightData()
            {
                Flight flight = new Flight();

                flight.City_id     = this.getCityIdByName(cityName);
                flight.Company_id  = this.getCompanyIdByName(companiyName);
                flight.Gate_id     = this.getGateIdByName(gateName);
                flight.Terminal_id = this.getTerminalIdByName(terminalName);
                flight.Runway_id   = this.getRunwayIdByName(runwayName);
                flight.Status      = this.checkStatus(status);
                flight.Type        = this.checkType(typeName);
                flight.Date        = dateTime;
                db.Flights.Add(flight);
                db.SaveChanges();
                this.clearText();
            }

            if (cityName != string.Empty && companiyName != string.Empty && gateName != string.Empty &&
                runwayName != string.Empty && terminalName != string.Empty && status != string.Empty && typeName != string.Empty)
            {
                Flight selectedFlight;
                bool   condition = true;
                for (int i = 1; i <= db.Flights.Count(); i++)
                {
                    selectedFlight = db.Flights.Find(i);
                    if (selectedFlight.Gate.Name.Trim() == gateName && selectedFlight.Runway.Name.Trim() == runwayName && selectedFlight.Date.Value > dateTime.AddMinutes(-45))
                    {
                        condition = false;
                        break;
                    }
                    else if (selectedFlight.Date <= dateTime.AddMinutes(-45))
                    {
                        if (selectedFlight.Gate.Name != gateName)
                        {
                            condition = true;
                        }
                        else if (selectedFlight.Runway.Name != runwayName)
                        {
                            condition = true;
                        }
                    }
                    else if (selectedFlight.Gate.Name.Trim() == gateName && selectedFlight.Runway.Name.Trim() == runwayName)
                    {
                        if (selectedFlight.Date <= dateTime.AddMinutes(-45))
                        {
                            condition = true;
                        }
                    }
                }
                if (condition == true)
                {
                    addFlightData();
                    this.fillDgwFlightsData();
                }
                else
                {
                    this.lblbErrors.Text = "Emeliyyet alinmadi !...";
                }
            }
            else
            {
                this.lblbErrors.Text = "Butun melumatlari doldurun !...";
            }
        }