private void button2_Click(object sender, EventArgs e) { if (userno < 111111) { User1 ad = new User1(userno); ad.Show(); this.Close(); } else { Employees2 ad = new Employees2(userno); ad.Show(); this.Close(); } }
private void button2_Click(object sender, EventArgs e) { int p2 = controllerObj.InsertNewPassenger(pass_no, user_no); int p1 = controllerObj.InsertTicketfromUser(ticket_no, t_price, ticket_type, resrve_date, (int)SelTimeCB.SelectedValue, user_no, pass_no, from_station, to_station, track_no); if (p1 == -1 || p2 == -1) { MessageBox.Show("Error! Invalid Data!"); } else { MessageBox.Show("Reservation done Successfully!"); User1 ad = new User1(user_no); ad.Show(); this.Close(); } }
private void finish_Click(object sender, EventArgs e) { int price = 0; if ((textBox1.Text != "VIP" && textBox1.Text != "Normal") || Date.Text == "yyyy-mm-dd" || (int)FromStCB.SelectedValue == 0 || (int)ToStCB.SelectedValue == 0) { MessageBox.Show("Invalid Data! Fill all fields with Correct Data!"); } else { if (textBox1.Text == "VIP" && TrackVal == 1) { price = 100; } if (textBox1.Text == "Normal" && TrackVal == 1) { price = 50; } if (textBox1.Text == "VIP" && TrackVal == 2) { price = 120; } if (textBox1.Text == "Normal" && TrackVal == 2) { price = 60; } if (textBox1.Text == "VIP" && TrackVal == 3) { price = 140; } if (textBox1.Text == "Normal" && TrackVal == 3) { price = 70; } if (textBox1.Text == "VIP" && TrackVal == 4) { price = 180; } if (textBox1.Text == "Normal" && TrackVal == 4) { price = 90; } ticket_no = controllerObj.MaxTicketID() + 1; pass_no = controllerObj.MaxPasstID() + 1; t_price = price; if (sexbox.SelectedIndex == 0) { p_sex = "M"; } else { p_sex = "F"; } ticket_type = textBox1.Text; resrve_date = Date.Text; from_station = (int)FromStCB.SelectedValue; to_station = (int)ToStCB.SelectedValue; track_no = (int)TrackCB.SelectedValue; user_no = userno; int p2 = controllerObj.InsertPassenger(pass_no, nametextbox.Text, (int)agebox.Value, p_sex, user_no); int p1 = controllerObj.InsertTicketfromUser(ticket_no, t_price, ticket_type, resrve_date, (int)SelTimeCB.SelectedValue, user_no, pass_no, from_station, to_station, track_no); if (p1 == 0 || p2 == 0) { MessageBox.Show("Error! Invalid Data!"); } else { MessageBox.Show("Reservation done Successfully!"); } User1 ad = new User1(userno); ad.Show(); this.Close(); } }