private void button3_Click(object sender, EventArgs e) { this.Hide(); cancel cc = new cancel(); cc.Show(); }
public void cancelhotel() { cancel cancel = Application.OpenForms.OfType <cancel>().FirstOrDefault(); if (cancel.cancelpp.Text.Length == 7) { string query = "Delete from hotel where ppnumber = " + cancel.cancelpp.Text + " "; SqlCommand command = new SqlCommand(query, connec); connec.Open(); command.ExecuteNonQuery(); connec.Close(); MessageBox.Show("Your Hotel Booking has been cancelled successfully", "Hotel Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void UDVisa() { cancel cancel = Application.OpenForms.OfType <cancel>().FirstOrDefault(); if (cancel.cancelpp.Text.Length == 7) { string query = "Delete from VISAAPPLICATIONS where ppnumber = '" + cancel.cancelpp.Text + "'"; SqlCommand command = new SqlCommand(query, connec); connec.Open(); command.ExecuteNonQuery(); connec.Close(); MessageBox.Show("Your Visa has been cancelled successfully", "Visa Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Please enter a passport number which has 7 digits", "Invalid Passport Number", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void UDVisa(string a) { connec.Open(); cancel update = Application.OpenForms.OfType <cancel>().FirstOrDefault(); if (update.updatepp.Text.Length == 7) { string query1 = "select * from VISAAPPLICATIONS ppnumber where ppnumber= '" + update.updatepp.Text + "'"; SqlDataAdapter adapter = new SqlDataAdapter(query1, connec); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count > 0) { int check = 0; if (Regex.IsMatch(update.updateemail.Text, @"\A[a-z0-9]+([-._][a-z0-9]+)*@([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,4}\z")) { check = 0; } else { check++; } if (update.updatefname.Text != "" && update.updatelname.Text != "" && update.updateage.Value != 0 && update.updateemail.Text != "" && update.updatevisatype.Text != "" && update.updatepp.Text.Length < 8 && update.updatepp.Text.Length > 6 && check == 0) { string query = "update VISAAPPLICATIONS set fname = '" + update.updatefname.Text + "' , lname = '" + update.updatelname.Text + "' ," + " age = '" + update.updateage.Value + "' , email = '" + update.updateemail.Text + "' , visatype = '" + update.updatevisatype.Text + "' where ppnumber = '" + update.updatepp.Text + "'"; SqlCommand command = new SqlCommand(query, connec); command.ExecuteNonQuery(); MessageBox.Show("Your Visa has been updated successfully", "Visa Information Updated", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (check != 0) { MessageBox.Show("Please enter a valid email address. ", "Invalid Email Entered", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (update.updatepp.TextLength != 7) { MessageBox.Show("Please enter a passport number which has 7 digits", "Invalid Passport Number", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (update.updatefname.Text == "" || update.updatelname.Text == "" || update.updateage.Value == 0 || update.updateemail.Text == "" || update.updatevisatype.Text == "") { MessageBox.Show("Please Fill in All the Fields ", "Fields Missing", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { MessageBox.Show("Your Passport is valid , but either youve cancelled your visa or havent applied yet ", "Passport Number not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please enter a passport number which has 7 digits", "Invalid Passport Number", MessageBoxButtons.OK, MessageBoxIcon.Error); } connec.Close(); }