private void button2_Click(object sender, EventArgs e)
        {
            Passengers_Info_Employee ad = new Passengers_Info_Employee(empno, (int)quantity.Value);

            ad.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void next_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;
                int p2 = controllerObj.InsertPassengerEmp(pass_no, nametextbox.Text, (int)agebox.Value, p_sex);

                int p1 = controllerObj.InsertTicketfromEmp(ticket_no, t_price, ticket_type, resrve_date, (int)SelTimeCB.SelectedValue,
                                                           emp_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!");
                }

                Passengers_Info_Employee v = new Passengers_Info_Employee(emp_no, counter);
                v.Show();
                this.Hide();
            }
        }