Exemplo n.º 1
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            if (CLocalDestinationSelection.Checked)
            {
                try
                {
                    if (string.IsNullOrEmpty(CPassportNumberBox.Text) || string.IsNullOrEmpty(COriginSelectionBox.Text) || string.IsNullOrEmpty(CLocalDestinationSelectionBox.Text))
                    {
                        throw new ArgumentNullException();
                    }
                    LOCAL_FLIGHT l2 = new LOCAL_FLIGHT();
                    d = l2.location_check(COriginSelectionBox.Text, CLocalDestinationSelectionBox.Text);
                    if (d)
                    {
                        throw new InvalidLocationException("Origin and destination location cannot be same");
                    }
                    FLIGHT l3 = new LOCAL_FLIGHT();
                    if (l3.cancel(CPassportNumberBox.Text, COriginSelectionBox.Text, CLocalDestinationSelectionBox.Text, Ccabinclass.Text))
                    {
                        MessageBox.Show("Cancel Successfully");
                    }
                    else
                    {
                        MessageBox.Show("Record not fount");
                    }

                    CPassportNumberBox.Clear();
                    COriginSelectionBox.ResetText();
                    CLocalDestinationSelectionBox.ResetText();
                    CLocalDestinationSelection.Checked = false;
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Kindly Fill All The Fields");
                }
                catch (InvalidLocationException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            if (CInternationalDestinationSelection.Checked)
            {
                try
                {
                    if (string.IsNullOrEmpty(CPassportNumberBox.Text) || string.IsNullOrEmpty(COriginSelectionBox.Text) || string.IsNullOrEmpty(CInternationalDestinationSelectionBox.Text))
                    {
                        throw new ArgumentNullException();
                    }
                    FLIGHT l4 = new INTERNATIONAL_FLIGHT();



                    if (l4.cancel(CPassportNumberBox.Text, COriginSelectionBox.Text, CInternationalDestinationSelectionBox.Text, Ccabinclass.Text))
                    {
                        MessageBox.Show("Cancel Successfully");
                    }
                    else
                    {
                        MessageBox.Show("Record not found");
                    }

                    CPassportNumberBox.Clear();
                    COriginSelectionBox.ResetText();
                    CLocalDestinationSelectionBox.ResetText();
                    CLocalDestinationSelection.Checked = false;
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Kindly Fill All The Fields");
                }
            }
        }
        private void showdetail_Click(object sender, EventArgs e)
        {
            if (Rinternational.Checked == true || Rlocal.Checked == true)
            {
                if (Rlocal.Checked == true)
                {
                    try
                    {
                        if (string.IsNullOrEmpty(origin.Text) || string.IsNullOrEmpty(LocalDestination.Text) || string.IsNullOrEmpty(cabinclass.Text))
                        {
                            throw new ArgumentNullException();
                        }

                        LOCAL_FLIGHT l3 = new LOCAL_FLIGHT();
                        c = l3.location_check(origin.Text, LocalDestination.Text);

                        if (c)
                        {
                            throw new InvalidLocationException("Origin and destination location cannot be same");
                        }
                        FLIGHT f3 = new LOCAL_FLIGHT();

                        if (f3.reader(origin.Text, LocalDestination.Text, cabinclass.Text, enterpass.Text))
                        {
                            MessageBox.Show(f3.First_name + f3.Last_name + f3.Address + f3.Mobile_no + f3.Cnic + f3.Passport_no + f3.Origin + f3.Destination + f3.Cabin_class + f3.Way + f3.SeatNo);
                        }
                        else
                        {
                            MessageBox.Show("Record Not Found");
                        }
                    }

                    catch (ArgumentNullException)
                    {
                        MessageBox.Show("Kindly Fill All The Fields");
                    }
                    catch (InvalidLocationException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }


                if (Rinternational.Checked == true)
                {
                    try
                    {
                        if (string.IsNullOrEmpty(origin.Text) || string.IsNullOrEmpty(International.Text) || string.IsNullOrEmpty(cabinclass.Text))
                        {
                            throw new ArgumentNullException();
                        }
                        LOCAL_FLIGHT l3 = new LOCAL_FLIGHT();
                        c = l3.location_check(origin.Text, LocalDestination.Text);

                        if (c)
                        {
                            throw new InvalidLocationException("Origin and destination location cannot be same");
                        }
                        FLIGHT f3 = new INTERNATIONAL_FLIGHT();

                        if (f3.reader(origin.Text, International.Text, cabinclass.Text, enterpass.Text))
                        {
                            MessageBox.Show(f3.First_name + f3.Last_name + f3.Address + f3.Mobile_no + f3.Cnic + f3.Passport_no + f3.Origin + f3.Destination + f3.Cabin_class + f3.Way + f3.SeatNo);
                        }
                        else
                        {
                            MessageBox.Show("Record Not Found");
                        }
                    }

                    catch (ArgumentNullException)
                    {
                        MessageBox.Show("Kindly Fill All The Fields");
                    }
                    catch (InvalidLocationException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Select Flight Type");
            }
        }
Exemplo n.º 3
0
        private void RegistrationFinishButton_Click(object sender, EventArgs e)
        {
            if (LocalDestinationSelection.Checked)
            {
                try
                {
                    if (string.IsNullOrEmpty(FirstnameBox.Text) || string.IsNullOrEmpty(LastnameBox.Text) || string.IsNullOrEmpty(AddressBox.Text) || string.IsNullOrEmpty(MobileNumberBox.Text) || string.IsNullOrEmpty(NICNumberBox.Text) || string.IsNullOrEmpty(PassportNumberBox.Text) || string.IsNullOrEmpty(OriginSelectionBox.Text) || string.IsNullOrEmpty(CabinClassSelectionBox.Text) || string.IsNullOrEmpty(LocalDestinationSelectionBox.Text) || string.IsNullOrEmpty(rdio))
                    {
                        throw new ArgumentNullException();
                    }
                    LOCAL_FLIGHT l1 = new LOCAL_FLIGHT();
                    c = l1.location_check(OriginSelectionBox.Text, LocalDestinationSelectionBox.Text);

                    if (c)
                    {
                        throw new InvalidLocationException("Origin and destination location cannot be same");
                    }
                    FLIGHT f1 = new LOCAL_FLIGHT(FirstnameBox.Text, LastnameBox.Text, AddressBox.Text, MobileNumberBox.Text, NICNumberBox.Text, PassportNumberBox.Text, OriginSelectionBox.Text, LocalDestinationSelectionBox.Text, CabinClassSelectionBox.Text, rdio);
                    if (f1.register())
                    {
                        f1.reader();

                        MessageBox.Show(f1.First_name + f1.Last_name + f1.Address + f1.Mobile_no + f1.Cnic + f1.Passport_no + f1.Origin + f1.Destination + f1.Cabin_class + f1.Way + f1.SeatNo);
                        FLIGHT f3 = new LOCAL_FLIGHT();
                    }
                    else
                    {
                        MessageBox.Show(CabinClassSelectionBox.Text + " SEATS FULL");
                    }
                    FirstnameBox.Clear();
                    LastnameBox.Clear();
                    AddressBox.Clear();
                    MobileNumberBox.Clear();
                    NICNumberBox.Clear();
                    PassportNumberBox.Clear();

                    LocalDestinationSelection.Checked         = false;
                    InternationalDestinationSelection.Checked = false;
                    OriginSelectionBox.ResetText();
                    LocalDestinationSelectionBox.ResetText();
                    InternationalDestinationSelectionBox.ResetText();
                    CabinClassSelectionBox.ResetText();
                    OneWay.Checked = false;
                    Return.Checked = false;
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Kindly Fill All The Fields");
                }
                catch (InvalidLocationException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (DirectoryNotFoundException)
                {
                    MessageBox.Show("Directory not found reserve seat  ");
                }
                catch (PathTooLongException)
                {
                    MessageBox.Show("INVALID PASSPORT NUMBER");
                }
            }
            if (InternationalDestinationSelection.Checked)
            {
                try
                {
                    if (string.IsNullOrEmpty(FirstnameBox.Text) || string.IsNullOrEmpty(LastnameBox.Text) || string.IsNullOrEmpty(AddressBox.Text) || string.IsNullOrEmpty(MobileNumberBox.Text) || string.IsNullOrEmpty(NICNumberBox.Text) || string.IsNullOrEmpty(PassportNumberBox.Text) || string.IsNullOrEmpty(OriginSelectionBox.Text) || string.IsNullOrEmpty(CabinClassSelectionBox.Text) || string.IsNullOrEmpty(InternationalDestinationSelectionBox.Text) || string.IsNullOrEmpty(rdio))
                    {
                        throw new ArgumentNullException();
                    }


                    FLIGHT f2 = new INTERNATIONAL_FLIGHT(FirstnameBox.Text, LastnameBox.Text, AddressBox.Text, MobileNumberBox.Text, NICNumberBox.Text, PassportNumberBox.Text, OriginSelectionBox.Text, InternationalDestinationSelectionBox.Text, CabinClassSelectionBox.Text, rdio);

                    if (f2.register())
                    {
                        f2.reader();
                        MessageBox.Show(f2.First_name + f2.Last_name + f2.Address + f2.Mobile_no + f2.Cnic + f2.Passport_no + f2.Origin + f2.Destination + f2.Cabin_class + f2.Way + f2.SeatNo);
                    }
                    else
                    {
                        MessageBox.Show(CabinClassSelectionBox.Text + " SEATS FULL");
                    }
                    FirstnameBox.Clear();
                    LastnameBox.Clear();
                    AddressBox.Clear();
                    MobileNumberBox.Clear();
                    NICNumberBox.Clear();
                    PassportNumberBox.Clear();

                    LocalDestinationSelection.Checked         = false;
                    InternationalDestinationSelection.Checked = false;
                    OriginSelectionBox.ResetText();
                    LocalDestinationSelectionBox.ResetText();
                    InternationalDestinationSelectionBox.ResetText();
                    CabinClassSelectionBox.ResetText();
                    OneWay.Checked = false;
                    Return.Checked = false;
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Kindly Fill All The Fields");
                }
                catch (DirectoryNotFoundException)
                {
                    MessageBox.Show("Directory not found cannot reserve seat ");
                }
                catch (PathTooLongException)
                {
                    MessageBox.Show("INVALID PASSPORT NUMBER");
                }
            }
        }