private void button1_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");
                        }

                        DirectoryInfo d1 = new DirectoryInfo(location + "\\Local\\" + origin.Text + "\\" + LocalDestination.Text + "\\" + cabinclass.Text + "\\");
                        FileInfo[]    f1 = d1.GetFiles();
                        label4.ResetText();
                        foreach (FileInfo f in f1)
                        {
                            string a1 = Path.GetFileNameWithoutExtension(f.Name);

                            label4.Text = label4.Text + a1 + "\n";
                        }
                        ori_local.ResetText();
                        lbs.Text       = "Business Class";
                        lec.Text       = "Economic Class";
                        lpec.Text      = "Premium Economy Class";
                        lfc.Text       = "First Class";
                        ori_local.Text = origin.Text + " to " + LocalDestination.Text;
                        lbs.Text       = lbs.Text + " " + Directory.GetFiles(location + "\\Local\\" + origin.Text + "\\" + LocalDestination.Text + "\\Business Class\\").Length.ToString() + "/3";
                        lec.Text       = lec.Text + " " + Directory.GetFiles(location + "\\Local\\" + origin.Text + "\\" + LocalDestination.Text + "\\Economy Class\\").Length.ToString() + "/6";
                        lpec.Text      = lpec.Text + " " + Directory.GetFiles(location + "\\Local\\" + origin.Text + "\\" + LocalDestination.Text + "\\Premium Economy Class\\").Length.ToString() + "/9";
                        lfc.Text       = lfc.Text + " " + Directory.GetFiles(location + "\\Local\\" + origin.Text + "\\" + LocalDestination.Text + "\\First Class\\").Length.ToString() + "/2";
                    }

                    catch (ArgumentNullException)
                    {
                        MessageBox.Show("Kindly Fill All The Fields");
                    }
                    catch (InvalidLocationException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    catch (DirectoryNotFoundException)
                    {
                        MessageBox.Show("Record not found cannot access data files");
                    }
                }


                if (Rinternational.Checked == true)
                {
                    try{
                        if (string.IsNullOrEmpty(origin.Text) || string.IsNullOrEmpty(International.Text) || string.IsNullOrEmpty(cabinclass.Text))
                        {
                            throw  new ArgumentNullException();
                        }

                        DirectoryInfo d1 = new DirectoryInfo(location + "\\International\\" + origin.Text + "\\" + International.Text + "\\" + cabinclass.Text + "\\");
                        FileInfo[]    f1 = d1.GetFiles();
                        label4.ResetText();
                        foreach (FileInfo f in f1)
                        {
                            string a1 = Path.GetFileNameWithoutExtension(f.Name);
                            label4.Text = label4.Text + a1 + "\n";
                        }

                        int_ori.ResetText();

                        bs.Text      = "Business Class";
                        ec.Text      = "Economic Class";
                        ecppr.Text   = "Premium Economy Class";
                        fc.Text      = "First Class";
                        int_ori.Text = origin.Text + " to " + International.Text;
                        bs.Text      = bs.Text + " " + Directory.GetFiles(location + "\\International\\" + origin.Text + "\\" + International.Text + "\\Business Class\\").Length.ToString() + "/7";
                        ec.Text      = ec.Text + " " + Directory.GetFiles(location + "\\International\\" + origin.Text + "\\" + International.Text + "\\Economy Class\\").Length.ToString() + "/9";
                        ecppr.Text   = ecppr.Text + " " + Directory.GetFiles(location + "\\International\\" + origin.Text + "\\" + International.Text + "\\Premium Economy Class\\").Length.ToString() + "/10";
                        fc.Text      = fc.Text + " " + Directory.GetFiles(location + "\\International\\" + origin.Text + "\\" + International.Text + "\\First Class\\").Length.ToString() + "/4";
                    }

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

                    catch (DirectoryNotFoundException)
                    {
                        MessageBox.Show("Record not found cannot access data files");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Select Flight Type");
            }
        }
示例#2
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");
            }
        }
示例#4
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");
                }
            }
        }