예제 #1
0
        private void Button_AddLocation_Click(object sender, EventArgs e)
        {
            // Add location to the database.
            var lc = new LocationDialog();

            if (lc.ShowDialog() == DialogResult.OK)
            {
                // save the location to the database.
                Database.SaveLocation(new Location(0, lc.textBox_City.Text, lc.textBox_Province.Text, lc.textBox_Country.Text, lc.textBox_AirportName.Text));
                LoadFormData();
            }
        }
예제 #2
0
        private void EditLocationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // edit a specific location.
            ComboBox control  = (ComboBox)((ContextMenuStrip)((ToolStripItem)sender).Owner).SourceControl;
            Location location = Database.GetLocations().Find(x => x.ToString() == control.Text);
            var      lc       = new LocationDialog(location.ID);

            if (lc.ShowDialog() == DialogResult.OK)
            {
                // save location to the database.
                location = new Location(location.ID, lc.textBox_City.Text, lc.textBox_Province.Text, lc.textBox_Country.Text, lc.textBox_AirportName.Text);
                Database.SaveLocation(location);
                LoadFormData();
                control.Text = location.ToString();
            }
        }