private void Refresh_Display_Click(object sender, EventArgs e) { Airline_Reservation_SystemDBCDataContext fdt = 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"); FlightDetailsGridView.DataSource = fdt.Flight_Details; FlightDetailsGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
private void FDB_Search_Button_Click(object sender, EventArgs e) { Airline_Reservation_SystemDBCDataContext fDD = 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 searchS = Flight_Booking_SearchBox.Text; var x = from a in fDD.Flight_Details //where a.Flight_Name == APSearchBox.Text where a.Flight_Name.Contains(Flight_Booking_SearchBox.Text) //|| a.Destination == APSearchBox.Text || a.Destination.Contains(Flight_Booking_SearchBox.Text) //|| a.Departure == APSearchBox.Text || a.Departure.Contains(Flight_Booking_SearchBox.Text) //|| a.Date == APSearchBox.Text || a.Date.Contains(Flight_Booking_SearchBox.Text) //|| a.Time == APSearchBox.Text || a.Time.Contains(Flight_Booking_SearchBox.Text) select a; if (x.Any()) { FlightDetailsGridView.DataSource = x.ToList(); FlightDetailsGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } else { MessageBox.Show("No such result available!! :/"); } }
private void USR_Login_Button_Click(object sender, EventArgs e) { Airline_Reservation_SystemDBCDataContext uLD = 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 x = from a in uLD.Customer_Infos where a.CName == USR_UNBox.Text //|| a.CEmail == USR_UNBox.Text && a.CPassword == USR_PassBox.Text select a; if (x.Any()) { userID = x.First().CID; MessageBox.Show("Login Success!"); UserHome uHP = new UserHome(this, userID); uHP.Show(); this.Hide(); //AdminPanel alp = new AdminPanel(this); //this.Hide(); //alp.Show(); } else { MessageBox.Show("Login Failed!"); } }
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!!"); } }
private void AP_Add_Flight_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"); AddFlightPanel aFF = new AddFlightPanel("Add", AP_Gridview_Display, flightListNo); aFF.Show(); }
private void AP_Seat_Booking_Click(object sender, EventArgs e) { currentGridView = "Ticket Booking Details"; //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"); AP_Gridview_Display.DataSource = aPD.TicketBooked_Infos; AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
private void AP_Gridview_Display_CellClick(object sender, DataGridViewCellEventArgs 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"); int index = e.RowIndex; selectedRow = AP_Gridview_Display.Rows[index]; flightListNo = Convert.ToInt32(selectedRow.Cells[0].Value.ToString()); }
private void AP_UpdateF_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") { AddFlightPanel aFF = new AddFlightPanel("Update", AP_Gridview_Display, flightListNo); aFF.Show(); } else { MessageBox.Show("Currently Displaying " + currentGridView + " Table!!"); } }
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; }
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; } }
private void UserHome_Load(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"); var x = from a in uHLD.Customer_Infos where a.CID == userID select a; CIDTB.Text = x.First().CID.ToString(); CIDTB.Enabled = false; CustomerName.Text = x.First().CName; string cG = x.First().CGender; CustomerDOB.Text = x.First().CDOB; CustomerPN.Text = x.First().CPhone_Num; CustomerEID.Text = x.First().CEmail; CustomerPassportNo.Text = x.First().CPassport_No; CustomerNationality.Text = x.First().CNationality; CardHolderNameTB.Text = x.First().Card_Holder_Name; CreditCardNoTB.Text = x.First().Credit_Card_No.ToString(); User_Pass_TB.Text = x.First().CPassword; CustomerGender.Items.AddRange(new string[] { "Male", "Female" }); if (cG == "Male") { CustomerGender.SelectedIndex = 0; } else if (cG == "Female") { CustomerGender.SelectedIndex = 1; } int carryON = 0; var y = from b in uHLD.TicketBooked_Infos where b.CID == userID select b; if (y.Any()) { fID = y.First().Flight_ID; UH_Flight_Name_TB.Text = y.First().Flight_ID.ToString(); UH_Flight_Name_TB.Enabled = false; esT = y.First().Economy_Seat_Taken; EconomySeatBox.Text = y.First().Economy_Seat_Taken.ToString(); EconomySeatBox.Enabled = false; bsT = y.First().Business_Seat_Taken; Business_SeatBox.Text = y.First().Business_Seat_Taken.ToString(); Business_SeatBox.Enabled = false; //addES = y.First().Economy_Seat_Taken; //addBS = y.First().Business_Seat_Taken; carryON = 1; } if (carryON == 1) { var z = from c in uHLD.Flight_Details where c.Flight_ID == fID select c; UH_Destination_TB.Text = z.First().Destination; UH_Destination_TB.Enabled = false; UH_Departure_TB.Text = z.First().Departure; UH_Departure_TB.Enabled = false; Time_Schedule_Box.Text = z.First().Time; Time_Schedule_Box.Enabled = false; Date_Schedule_Box.Text = z.First().Date; Date_Schedule_Box.Enabled = false; addES = Convert.ToInt32(z.First().Available_Seat_E_); addBS = Convert.ToInt32(z.First().Available_Seat_B_); } else { 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; } }
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(); } } }
private void AP_Search_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"); string searchS = APSearchBox.Text; if (currentGridView == "Flight Details") { var x = from a in aPD.Flight_Details //where a.Flight_Name == APSearchBox.Text where a.Flight_Name.Contains(APSearchBox.Text) //|| a.Destination == APSearchBox.Text || a.Destination.Contains(APSearchBox.Text) //|| a.Departure == APSearchBox.Text || a.Departure.Contains(APSearchBox.Text) //|| a.Date == APSearchBox.Text || a.Date.Contains(APSearchBox.Text) //|| a.Time == APSearchBox.Text || a.Time.Contains(APSearchBox.Text) select a; if (x.Any()) { AP_Gridview_Display.DataSource = x.ToList(); AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } else { MessageBox.Show("No such information stored in our database :/!"); } } else if (currentGridView == "Ticket Booking Details") { var x = from a in aPD.TicketBooked_Infos //where a.Flight_Name == APSearchBox.Text where a.Flight_Name.Contains(APSearchBox.Text) //|| a.Destination == APSearchBox.Text || a.CName.Contains(APSearchBox.Text) //|| a.Departure == APSearchBox.Text || a.CID == Convert.ToInt32(APSearchBox.Text) //|| a.Date == APSearchBox.Text || a.Flight_ID.ToString() == APSearchBox.Text select a; if (x.Any()) { AP_Gridview_Display.DataSource = x.ToList(); AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } else { MessageBox.Show("No such information stored in our database :/!"); } } else if (currentGridView == "Customer Information") { var x = from a in aPD.Customer_Infos //where a.Flight_Name == APSearchBox.Text where a.CName.Contains(APSearchBox.Text) //|| a.Destination == APSearchBox.Text || a.CNationality.Contains(APSearchBox.Text) //|| a.Departure == APSearchBox.Text || a.CPhone_Num.Contains(APSearchBox.Text) //|| a.Date == APSearchBox.Text || a.Card_Holder_Name.Contains(APSearchBox.Text) //|| a.Time == APSearchBox.Text || a.CEmail.Contains(APSearchBox.Text) || a.CID.ToString() == APSearchBox.Text select a; if (x.Any()) { AP_Gridview_Display.DataSource = x.ToList(); AP_Gridview_Display.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } else { MessageBox.Show("No such information stored in our database :/!"); } } }