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(); } } }
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!!"); } } } }