Ejemplo n.º 1
0
        private void AP_Cancel_FS_Click(object sender, EventArgs e)
        {
            //Air_Reservation_DBDataContext aPD = new Air_Reservation_DBDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\documents\visual studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Air_Reservation.mdf;Integrated Security=True;Connect Timeout=30");
            Airline_Reservation_SystemDBCDataContext aPD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");

            if (currentGridView == "Flight Details")
            {
                var x = from a in aPD.Flight_Details
                        where a.Flight_ID == flightListNo
                        select a;

                foreach (Flight_Detail p in x)
                {
                    aPD.Flight_Details.DeleteOnSubmit(p);
                }

                aPD.SubmitChanges();
                AP_Gridview_Display.DataSource    = aPD.Flight_Details;
                AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            }
            else
            {
                MessageBox.Show("Currently Displaying " + currentGridView + " Table!!");
            }
        }
Ejemplo n.º 2
0
        private void UI_Cancel_Reservation_Click(object sender, EventArgs e)
        {
            Airline_Reservation_SystemDBCDataContext uHCD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");

            var y = from b in uHCD.TicketBooked_Infos
                    where b.CID == userID
                    select b;

            //y.First().Flight_ID

            foreach (TicketBooked_Info p in y)
            {
                uHCD.TicketBooked_Infos.DeleteOnSubmit(p);
            }

            uHCD.SubmitChanges();

            MessageBox.Show("Reservation Canceled");

            var z = from c in uHCD.Flight_Details
                    where c.Flight_ID == fID
                    select c;

            z.First().Available_Seat_E_ = addES + esT;
            z.First().Available_Seat_B_ = addBS + bsT;

            uHCD.SubmitChanges();

            UH_Flight_Name_TB.Text    = "";
            UH_Flight_Name_TB.Enabled = false;
            EconomySeatBox.Text       = "";
            EconomySeatBox.Enabled    = false;
            Business_SeatBox.Text     = "";
            Business_SeatBox.Enabled  = false;

            UH_Destination_TB.Text    = "";
            UH_Destination_TB.Enabled = false;
            UH_Departure_TB.Text      = "";
            UH_Departure_TB.Enabled   = false;
            Time_Schedule_Box.Text    = "";
            Time_Schedule_Box.Enabled = false;
            Date_Schedule_Box.Text    = "";
            Date_Schedule_Box.Enabled = false;

            UI_Cancel_Reservation.Visible = false;
        }
Ejemplo n.º 3
0
        private void AP_CancelReservation_Click(object sender, EventArgs e)
        {
            Airline_Reservation_SystemDBCDataContext aPD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");

            if (currentGridView == "Ticket Booking Details")
            {
                var x = from a in aPD.TicketBooked_Infos
                        where a.CID == flightListNo
                        select a;

                foreach (TicketBooked_Info p in x)
                {
                    aPD.TicketBooked_Infos.DeleteOnSubmit(p);
                }

                aPD.SubmitChanges();
                AP_Gridview_Display.DataSource    = aPD.TicketBooked_Infos;
                AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            }
        }
Ejemplo n.º 4
0
        private void CCI_Pay_Click(object sender, EventArgs e)
        {
            int warning = 0;

            cHName = CardHolderNameTB.Text;
            cCNo   = CreditCardNoTB.Text;
            cCPc   = CardPinNoTB.Text;
            cCEd   = CCIEXD.Value.ToString("dd-MM-yyyy");

            bool allDigitCCN = cCNo.All(char.IsDigit);
            bool allDigitCPC = cCPc.All(char.IsDigit);

            if ((cHName == "") || (cCNo == "") || (cCPc == "") || (cCEd == ""))
            {
                MessageBox.Show("Can't skip any field!!! Fill up all to proceed!");
            }
            else
            {
                if (allDigitCCN == false)
                {
                    MessageBox.Show("Invalid Credit Card Number");
                    warning = 3;
                }

                if (allDigitCPC == false)
                {
                    MessageBox.Show("Invalid Pin Code Number");
                    warning = 2;
                }

                if (Regex.IsMatch(cHName, @"^[a-zA-Z ]{2,30}$") == true)
                {
                    //MessageBox.Show("valid name no number upto 30!");
                    //nameV = 1;
                }
                else
                {
                    MessageBox.Show("Invalid Card Holder name");
                    warning = 1;
                }

                if (warning == 0)
                {
                    int cusID = Convert.ToInt32(cID);
                    //string path=Path.GetRandomFileName();
                    //path=path.Replace(".","");
                    //cCount++;
                    string        path = "12345" + cName;
                    Customer_Info ciT  = new Customer_Info
                    {
                        CID              = cusID,
                        CName            = cName,
                        CGender          = cGender,
                        CDOB             = cDOB,
                        CPhone_Num       = cPN,
                        CEmail           = cEID,
                        CPassport_No     = cPPNo,
                        CNationality     = cNationality,
                        Card_Holder_Name = cHName,
                        Credit_Card_No   = Convert.ToInt32(cCNo),
                        Card_Expire_Date = cCEd,
                        CPassword        = path
                    };

                    ciD.Customer_Infos.InsertOnSubmit(ciT);
                    ciD.SubmitChanges();

                    var x = from a in ciD.Flight_Details
                            where a.Flight_ID == flightListNo
                            select a;

                    string fN = x.First().Flight_Name;
                    x.First().Available_Seat_E_ = sEAvail;
                    x.First().Available_Seat_B_ = sBAvail;

                    ciD.SubmitChanges();

                    var y = from b in ciD.Flight_Details
                            //where a.Flight_Name == APSearchBox.Text
                            where b.Available_Seat_B_ == 0 &&
                            b.Available_Seat_E_ == 0
                            select b;

                    foreach (Flight_Detail p in y)
                    {
                        ciD.Flight_Details.DeleteOnSubmit(p);
                    }

                    ciD.SubmitChanges();

                    TicketBooked_Info tbT = new TicketBooked_Info
                    {
                        CID                 = cusID,
                        CName               = cName,
                        Flight_ID           = flightListNo,
                        Flight_Name         = fN,
                        Business_Seat_Taken = intoB,
                        Economy_Seat_Taken  = intoE
                    };

                    ciD.TicketBooked_Infos.InsertOnSubmit(tbT);
                    ciD.SubmitChanges();

                    MessageBox.Show("Ticket Confirmation is Successfull!! :)\n\nYour User Password is : " + path + "\n\nyou can login with your user name using this password from login panel! ");
                    this.Hide();
                    AIRRMainFrame mF = new AIRRMainFrame();
                    mF.Show();
                }
            }
        }
Ejemplo n.º 5
0
        private void AFP_Add_Flight_Button_Click(object sender, EventArgs e)
        {
            int    warning = 0;
            int    nameV   = 0;
            string fids    = "";

            fids     = AFP_FIDTB.Text;
            fName    = AFP_Flight_Name_Box.Text;
            des      = AFP_DestinationBox.Text;
            dep      = AFP_DepertureBox.Text;
            date     = AFP_Date.Value.ToString("dd-MM-yyyy");
            time     = AFP_Time.Value.ToString("H:mm");
            availES  = AFP_AvailESB.Text;
            availBS  = AFP_AvailBSB.Text;
            ecoCost  = AFP_EcoCostBox.Text;
            bsnsCost = AFP_BsnsCostBox.Text;

            bool allDigitAES = availES.All(char.IsDigit);
            bool allDigitABS = availBS.All(char.IsDigit);
            bool allDigitEC  = ecoCost.All(char.IsDigit);
            bool allDigitBC  = bsnsCost.All(char.IsDigit);
            bool allDigitFID = fids.All(char.IsDigit);
            int  availES2I   = 0;
            int  availBS2I   = 0;
            int  ecoCost2I   = 0;
            int  bsnsCost2I  = 0;

            if ((fName == "") || (des == "") || (dep == "") || (date == "") || (time == "") || (availES == "") || (availBS == "") || (ecoCost == "") || (bsnsCost == "") || (fids == ""))
            {
                MessageBox.Show("Can't skip any field!!! Fill up all to proceed!");
            }
            else
            {
                if (allDigitAES == false)
                {
                    MessageBox.Show("Number of Economy seat is invalid");
                    warning = 1;
                }
                else
                {
                    availES2I = Convert.ToInt32(availES);
                }

                if (allDigitFID == false)
                {
                    MessageBox.Show("Number of Economy seat is invalid");
                    warning = 1;
                }
                else
                {
                    fID = Convert.ToInt32(fids);
                }

                if (allDigitABS == false)
                {
                    MessageBox.Show("Number of Business seat is invalid");
                    warning = 2;
                }
                else
                {
                    availBS2I = Convert.ToInt32(availBS);
                }

                if (allDigitEC == false)
                {
                    MessageBox.Show("Economy Seeat Amount is invalid");
                    warning = 3;
                }
                else
                {
                    ecoCost2I = Convert.ToInt32(ecoCost);
                }

                if (allDigitBC == false)
                {
                    MessageBox.Show("Business Seat Amount is invalid");
                    warning = 4;
                }
                else
                {
                    bsnsCost2I = Convert.ToInt32(bsnsCost);
                }

                if (Regex.IsMatch(des, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Destination!");
                    warning = 5;
                }

                if (Regex.IsMatch(dep, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Departure!");
                    warning = 6;
                }

                if (Regex.IsMatch(fName, @"^[a-zA-Z ]{2,30}$") == true)
                {
                    //MessageBox.Show("valid name no number upto 30!");
                    nameV = 1;
                }
                else
                {
                    //MessageBox.Show("Invalid name");
                    warning = 1;
                }

                if (nameV == 0)
                {
                    if (Regex.IsMatch(fName, @"^[a-zA-Z ]{2,26}[0-9]{1,4}$") == true)
                    {
                        //MessageBox.Show("at first letter then number up to 5");
                        warning = 0;
                    }
                    else
                    {
                        MessageBox.Show("Invalid name");
                        warning = 1;
                    }
                }
            }

            if (status == "Add")
            {
                if (warning == 0)
                {
                    Flight_Detail fdT = new Flight_Detail
                    {
                        Flight_ID          = fID,
                        Flight_Name        = fName,
                        Destination        = des,
                        Departure          = dep,
                        Date               = date,
                        Time               = time,
                        Available_Seat_E_  = availES2I,
                        Available_Seat_B_  = availBS2I,
                        Economy_Cost_BDT_  = ecoCost2I,
                        Business_Cost_BDT_ = bsnsCost2I
                    };

                    aFPD.Flight_Details.InsertOnSubmit(fdT);
                    aFPD.SubmitChanges();

                    this.Hide();
                    apDGV.DataSource = aFPD.Flight_Details;

                    MessageBox.Show("Flight Added Successfully");
                }
            }
            else if (status == "Update")
            {
                var x = from a in aFPD.Flight_Details
                        where a.Flight_ID == flightListNo
                        select a;
                if (warning == 0)
                {
                    x.First().Flight_Name        = fName;
                    x.First().Destination        = des;
                    x.First().Departure          = dep;
                    x.First().Date               = date;
                    x.First().Time               = time;
                    x.First().Available_Seat_E_  = availES2I;
                    x.First().Available_Seat_B_  = availBS2I;
                    x.First().Economy_Cost_BDT_  = ecoCost2I;
                    x.First().Business_Cost_BDT_ = bsnsCost2I;

                    aFPD.SubmitChanges();

                    apDGV.DataSource = aFPD.Flight_Details;

                    MessageBox.Show("Flight Updated Successfully");

                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Something wnt wrong");
                }
            }
        }
        private void Cash_Payment_Click(object sender, EventArgs e)
        {
            int warning = 0;

            amount = Cash_Amount_TB.Text;
            bool allDigitCSH = amount.All(char.IsDigit);

            if (amount == "")
            {
                MessageBox.Show("Please Enter the Amount");
            }
            else
            {
                if (allDigitCSH == false)
                {
                    MessageBox.Show("Invalid Amount!!!");
                    warning = 3;
                }
                else
                {
                    payment = Convert.ToInt32(amount);
                }
                if (warning == 0)
                {
                    if (payment >= totalAmount)
                    {
                        int cusID = Convert.ToInt32(cID);
                        //string path=Path.GetRandomFileName();
                        //path=path.Replace(".","");
                        //cCount++;
                        string        path = "12345" + cName;
                        Customer_Info ciT  = new Customer_Info
                        {
                            CID          = cusID,
                            CName        = cName,
                            CGender      = cGender,
                            CDOB         = cDOB,
                            CPhone_Num   = cPN,
                            CEmail       = cEID,
                            CPassport_No = cPPNo,
                            CNationality = cNationality,
                            //Card_Holder_Name=cHName,
                            //Credit_Card_No=Convert.ToInt32(cCNo),
                            //Card_Expire_Date=cCEd,
                            CPassword = path
                        };

                        cpD.Customer_Infos.InsertOnSubmit(ciT);
                        cpD.SubmitChanges();

                        var x = from a in cpD.Flight_Details
                                where a.Flight_ID == flightListNo
                                select a;

                        string fN = x.First().Flight_Name;
                        x.First().Available_Seat_E_ = sEAvail;
                        x.First().Available_Seat_B_ = sBAvail;

                        cpD.SubmitChanges();


                        var y = from b in cpD.Flight_Details
                                //where a.Flight_Name == APSearchBox.Text
                                where b.Available_Seat_B_ == 0 &&
                                b.Available_Seat_E_ == 0
                                select b;

                        foreach (Flight_Detail p in y)
                        {
                            cpD.Flight_Details.DeleteOnSubmit(p);
                        }

                        cpD.SubmitChanges();


                        TicketBooked_Info tbT = new TicketBooked_Info
                        {
                            CID                 = cusID,
                            CName               = cName,
                            Flight_ID           = flightListNo,
                            Flight_Name         = fN,
                            Business_Seat_Taken = intoB,
                            Economy_Seat_Taken  = intoE
                        };

                        cpD.TicketBooked_Infos.InsertOnSubmit(tbT);
                        cpD.SubmitChanges();

                        if (payment > totalAmount)
                        {
                            payment = payment - totalAmount;
                            MessageBox.Show("Your return back amount is : " + payment + " BDT");
                        }

                        MessageBox.Show("Ticket Confirmation is Successfull!! :)\n\nYour User Password is : " + path + "\n\nyou can login with your user name using this password from login panel! ");
                        this.Hide();
                        AIRRMainFrame mF = new AIRRMainFrame();
                        mF.Show();
                    }
                    else if (payment < totalAmount)
                    {
                        MessageBox.Show("Your amount is Insufficient!!");
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void UI_Update_IB_Click(object sender, EventArgs e)
        {
            Airline_Reservation_SystemDBCDataContext uHLD = new Airline_Reservation_SystemDBCDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mzs Munna\Documents\Visual Studio 2013\Projects\Air_Reservation_System\Air_Reservation_System\Airline_Reservation_System.mdf;Integrated Security=True;Connect Timeout=30");

            //string cID = "";
            string cName        = "";
            string cGender      = "";
            string cDOB         = "";
            string cPN          = "";
            string cEID         = "";
            string cPPNo        = "";
            string cNationality = "";
            string cHName       = "";
            string cCrdN        = "";
            string cPass        = "";

            //x.First().CID = Convert.ToInt32(CIDTB.Text);
            cName        = CustomerName.Text;
            cGender      = CustomerGender.SelectedItem.ToString();
            cDOB         = CustomerDOB.Text;
            cPN          = CustomerPN.Text;
            cEID         = CustomerEID.Text;
            cPPNo        = CustomerPassportNo.Text;
            cNationality = CustomerNationality.Text;
            cHName       = CardHolderNameTB.Text;
            cCrdN        = CreditCardNoTB.Text;
            cPass        = User_Pass_TB.Text;

            bool allDigitPP   = cPPNo.All(char.IsDigit);
            bool allDigitPN   = cPN.All(char.IsDigit);
            bool allDigitCCNo = cCrdN.All(char.IsDigit);
            int  warning      = 0;
            int  nameV        = 0;

            if ((cName == "") || (cGender == "") || (cDOB == "") || (cPN == "") || (cEID == "") || (cNationality == "") || (cPPNo == ""))
            {
                MessageBox.Show("Can't keep any field blank!!! Fill up all to proceed!");
            }
            else
            {
                if (allDigitPP == false)
                {
                    MessageBox.Show("Invalid Passport Number");
                    warning = 3;
                }

                if (allDigitPN == false)
                {
                    MessageBox.Show("Invalid Phone Number");
                    warning = 4;
                }

                if (allDigitCCNo == false)
                {
                    MessageBox.Show("Invalid ID Number");
                    warning = 5;
                }

                if (Regex.IsMatch(cNationality, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Nation!");
                    warning = 6;
                }

                if (Regex.IsMatch(cHName, @"^[a-zA-Z]+$") == true) //all character
                {
                    //MessageBox.Show("All are letters");
                }
                else
                {
                    MessageBox.Show("Not a valid Card Holder Name!");
                    warning = 7;
                }

                if (Regex.IsMatch(cName, @"^[a-zA-Z ]{2,30}$") == true)
                {
                    //MessageBox.Show("valid name no number upto 30!");
                    nameV = 1;
                }
                else
                {
                    //MessageBox.Show("Invalid name");
                    warning = 1;
                }

                if (nameV == 0)
                {
                    if (Regex.IsMatch(cName, @"^[a-zA-Z ]{2,26}[0-9]{1,4}$") == true)
                    {
                        //MessageBox.Show("at first letter then number up to 5");
                        warning = 0;
                    }
                    else
                    {
                        MessageBox.Show("Invalid name");
                        warning = 1;
                    }
                }

                if (Regex.IsMatch(cEID, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$") == true)
                {
                    //MessageBox.Show("VALID EMAIL ID");
                    //warning = 0;
                }
                else
                {
                    MessageBox.Show("Invalid email id");
                    warning = 2;
                }

                if (warning == 0)
                {
                    //MessageBox.Show("Go to next form! :) "+warning);
                    //PaymentMethodPanel pMF=new PaymentMethodPanel(this, flightListNo, totalAmount, cID, cName, cGender, cDOB, cPN, cEID, cPPNo, cNationality,intoE,intoB,sEAvail,sBAvail);
                    //pMF.Show();
                    //this.Hide();
                    var x = from a in uHLD.Customer_Infos
                            where a.CID == userID
                            select a;

                    x.First().CID              = Convert.ToInt32(CIDTB.Text);
                    x.First().CName            = CustomerName.Text;
                    x.First().CGender          = CustomerGender.Text;
                    x.First().CDOB             = CustomerDOB.Text;
                    x.First().CPhone_Num       = CustomerPN.Text;
                    x.First().CEmail           = CustomerEID.Text;
                    x.First().CPassport_No     = CustomerPassportNo.Text;
                    x.First().CNationality     = CustomerNationality.Text;
                    x.First().Card_Holder_Name = CardHolderNameTB.Text;
                    x.First().Credit_Card_No   = Convert.ToInt32(CreditCardNoTB.Text);
                    x.First().CPassword        = User_Pass_TB.Text;

                    uHLD.SubmitChanges();

                    MessageBox.Show("Update Successfull!");
                    UserHome uH2 = new UserHome(cLF, userID);
                    this.Hide();
                    uH2.Show();
                }
            }
        }