示例#1
0
        private void districtComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            seatComboBox.Items.Clear();
            List <ViewAbleSeats> viewSeat = SeatHandler.GetViewAbleSeats(districtComboBox.SelectedItem.ToString());

            foreach (ViewAbleSeats vseat in viewSeat)
            {
                seatComboBox.Items.Add(vseat.SeatName);
            }
        }
示例#2
0
 private void showSeatsButton_Click(object sender, EventArgs e)
 {
     if (selectDistrictComboBox.SelectedItem != null)
     {
         seatGrid.DataSource = SeatHandler.GetViewAbleSeats(selectDistrictComboBox.SelectedItem.ToString());
     }
     else
     {
         MessageBox.Show("Select district first.");
     }
 }
示例#3
0
 private void selectDistrcitComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectSeatComboBox.Items.Clear();
     if (selectDistrcitComboBox.SelectedItem != null)
     {
         List <ViewAbleSeats> viewSeat = SeatHandler.GetViewAbleSeats(selectDistrcitComboBox.SelectedItem.ToString());
         foreach (ViewAbleSeats vSeat in viewSeat)
         {
             selectSeatComboBox.Items.Add(vSeat.SeatName);
         }
     }
 }
示例#4
0
 private void deleteSeatButton_Click(object sender, EventArgs e)
 {
     if (seatGrid.DataSource != null)
     {
         int          rowIndex = seatGrid.CurrentRow.Index;
         string       sname    = seatGrid.Rows[rowIndex].Cells[0].Value.ToString();
         DialogResult dr       = MessageBox.Show(string.Format("Are you sure to delete seat '{0}' from the database?", sname), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             SeatHandler.DeleteSeat(sname);
             MessageBox.Show("Deleted");
             seatGrid.DataSource = SeatHandler.GetViewAbleSeats(selectDistrictComboBox.SelectedItem.ToString());
         }
     }
 }
示例#5
0
 private void addSeatButton_Click(object sender, EventArgs e)
 {
     if (addSeatTextBox.Text != "" && addSeatComboBox.SelectedItem != null)
     {
         DialogResult dr = MessageBox.Show(string.Format("Are you sure to add seat '{0}' under district '{1}' to the database?", addSeatTextBox.Text, addSeatComboBox.SelectedItem), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             if (SeatHandler.AddSeat(addSeatTextBox.Text, addSeatComboBox.SelectedItem.ToString()))
             {
                 MessageBox.Show("Successfully added seat.");
             }
             else
             {
                 MessageBox.Show("Seat name already present.");
             }
             addSeatTextBox.Text = "";
             seatGrid.DataSource = SeatHandler.GetViewAbleSeats(addSeatComboBox.SelectedItem.ToString());
         }
     }
     else
     {
         MessageBox.Show("Enter a seat name and select a district.");
     }
 }