private void button1_Click(object sender, EventArgs e)
        {
            User1 ad = new User1(userno);

            ad.Show();
            this.Close();
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            int prvg = controllerObj.CheckPassword(TxtBx_username.Text, TxtBx_pass.Text);

            if (prvg > 0)
            {
                if (prvg == 1)
                {
                    if (controllerObj.checkEmpid((int)id.Value))
                    {
                        Employees2 adm = new Employees2(TxtBx_pass.Text, (int)id.Value, prvg);
                        adm.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }
                else if (prvg == 2)
                {
                    if (controllerObj.checkUserid((int)id.Value))
                    {
                        User1 usr = new User1((int)id.Value);
                        usr.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }

                else if (prvg == 3)
                {
                    if (controllerObj.checkSuperid((int)id.Value))
                    {
                        Admin usr = new Admin((int)id.Value);
                        usr.Show(this);
                        TxtBx_username.Clear();
                        TxtBx_pass.Clear();
                        id.Refresh();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorrect ID");
                    }
                }
            }
            else
            {
                MessageBox.Show("Incorrect Password or Email or ID");
            }
        }
예제 #3
0
 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();
            }
        }
예제 #5
0
        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();
            }
        }