Beispiel #1
0
        private void Finish_Click(object sender, EventArgs e)
        {
            //calculate the price
            int total    = 0;
            int ticketno = 0;

            if (vipButton.Checked == true)
            {
                total    += (200 * int.Parse(vipticketBox.Text));
                ticketno += int.Parse(vipticketBox.Text);
            }
            if (normalButton.Checked == true)
            {
                total    += (100 * int.Parse(normalticketBox.Text));
                ticketno += int.Parse(normalticketBox.Text);
            }
            //generate random number for serial number
            Random        rnd = new Random();
            int           ser = rnd.Next(200000000, 300000000);
            General       g   = new General();
            filing_orders f   = new filing_orders();
            //get available tickets
            login l = new login();
            int   t = int.Parse(File.ReadAllText("lco.txt"));

            //check the limit of tickets
            if (g.limit_Ticket(ticketno))
            {
                //check if the available tickets coverd the requried tickets
                if (ticketno <= t)
                {
                    //store the order
                    f.save_orders(l.activeid, ser, "Concert", total);
                    f.allorders(l.activeid, ser, "Concert", total);
                    //reduce avaiable tickets
                    File.WriteAllText("lco.txt", Convert.ToString(t - ticketno));
                    //show the bill
                    MessageBox.Show("Your Concert is : " + concertBox.Text + "\nNumber of Tickets : " + ticketno + "\n Total Price : " + Convert.ToString(total) + "\nYour Ticket Serial Number Is : " + ser);
                    this.Hide();
                }
                //if the tickets sold out then the order added to waiting list
                else
                {
                    f.watinglist(l.activeid, ser, "Concert", total);
                    MessageBox.Show("All Tickets Sold out But you are in watting list now");
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("You can Book Only 7 Tickets");
            }
        }
Beispiel #2
0
        private void finish_Click(object sender, EventArgs e)
        {
            //calculate the price
            int price = 0;

            if (onewayButton.Checked == true)
            {
                price += 4000;
            }
            else if (returnButton.Checked == true)
            {
                price += 6000;
            }
            if (adultButton.Checked == true)
            {
                price += 3000;
            }
            else if (childButton.Checked == true)
            {
                price += 1000;
            }
            //generate random number for serial number
            Random        rnd = new Random();
            int           ser = rnd.Next(200000000, 300000000);
            General       g   = new General();
            filing_orders f   = new filing_orders();
            //get available tickets
            login l = new login();
            int   t = int.Parse(File.ReadAllText("la.txt"));

            //if there are available tickets store the data
            if (t > 0)
            {
                f.save_orders(l.activeid, ser, "Air Flight", price);
                f.allorders(l.activeid, ser, "Air Flight", price);
                //reduce avaiable tickets
                File.WriteAllText("la.txt", Convert.ToString(t - 1));
                //show the bill
                MessageBox.Show("Your Flight \nFrom : " + originBox.Text + " To : " + destinationBox.Text + "\nYour Ticket Cost : " + price + "\nYour Ticket Serial Number Is : " + ser);
                this.Hide();
            }
            //if the tickets sold out then the order added to waiting list
            else
            {
                f.watinglist(l.activeid, ser, "Air Flight", price);
                MessageBox.Show("All Tickets Sold out But you are in watting list now");
                this.Hide();
            }
        }
Beispiel #3
0
        private void done_Click(object sender, EventArgs e)
        {
            //calculate the price
            int    price = 0;
            int    day   = 0;
            string item  = "";
            string food  = "";

            day = int.Parse(daysBox.Text);
            if (bsingle.Checked == true)
            {
                item   = "Single";
                price += (day * 200);
            }
            if (bdouble.Checked == true)
            {
                item   = "Double";
                price += (day * 400);
            }
            if (bmulti.Checked == true)
            {
                item   = "Multiple";
                price += (day * 600);
            }
            if (bfamily.Checked == true)
            {
                item   = "Family";
                price += (day * 800);
            }
            if (fullra.Checked)
            {
                price = price + 500;
                food  = fullra.Text;
            }
            else if (halfra.Checked)
            {
                price = price + 250;
                food  = halfra.Text;
            }
            else
            {
                price = price + 100;
                food  = snacksra.Text;
            }
            //generate random number for serial number
            Random        rnd = new Random();
            int           ser = rnd.Next(200000000, 300000000);
            General       g   = new General();
            filing_orders f   = new filing_orders();
            //get available rooms
            login l = new login();
            int   t = int.Parse(File.ReadAllText("lh.txt"));

            //if there are available tickets store the data
            if (t > 0)
            {
                f.save_orders(l.activeid, ser, "Hotel", price);
                f.allorders(l.activeid, ser, "Hotel", price);
                //reduce avaiable tickets
                File.WriteAllText("lh.txt", Convert.ToString(t - 1));
                //show the bill
                MessageBox.Show("Num of Days : " + day + "\nSelected room : " + item + "\nSelected Meals : " + food + "\nPrice : " + price + "\nYour Ticket Serial Number Is : " + ser);
                this.Hide();
            }
            //if the tickets sold out then the order added to waiting list
            else
            {
                f.watinglist(l.activeid, ser, "Hotel", price);
                MessageBox.Show("All Rooms Booked But you are in watting list now");
                this.Hide();
            }
        }
Beispiel #4
0
        private void Finish_register_Click(object sender, EventArgs e)
        {
            cregister re = new cregister();

            //make sure that all data is vaild
            if (!re.name(bname.Text))
            {
                checkname.Visible = true;
            }
            else
            {
                checkname.Visible = false;
            }
            if (!re.age(int.Parse(bage.Text)))
            {
                checkage.Visible = true;
            }
            else
            {
                checkage.Visible = false;
            }
            if (!re.mobile_num(bmobnum.Text))
            {
                checkmob.Visible = true;
            }
            else
            {
                checkmob.Visible = false;
            }
            if (!re.national_Id(bnationalid.Text))
            {
                checknationalid.Visible = true;
            }
            else
            {
                checknationalid.Visible = false;
            }
            if (!re.password(bpassword.Text))
            {
                checkpassword.Visible = true;
            }
            else
            {
                checkpassword.Visible = false;
            }
            //if all data is valid then starts to store them
            if (re.name(bname.Text) && re.password(bpassword.Text) && re.national_Id(bnationalid.Text) && re.mobile_num(bmobnum.Text) && re.age(int.Parse(bage.Text)))
            {
                checkname.Visible       = false;
                checkage.Visible        = false;
                checkmob.Visible        = false;
                checknationalid.Visible = false;
                checkpassword.Visible   = false;
                filing_data   savedata = new filing_data();
                filing_orders s        = new filing_orders();
                savedata.save(bname.Text, bpassword.Text, bnationalid.Text);
                //generate id for the new user
                s.creat(savedata.countlines("id.txt"));
                //show the login information
                MessageBox.Show("Your ID to login is : " + savedata.countlines("id.txt") + "\n" + "Your Password Is : " + bpassword.Text);

                this.Hide();
            }
        }
Beispiel #5
0
        private void finish_Click(object sender, EventArgs e)
        {
            //calculate the price
            int    price  = 0;
            int    ticket = 0;
            string match  = "";

            if (firstmatch.Checked)
            {
                match = firstmatch.Text;
            }
            else if (secondmatch.Checked)
            {
                match = secondmatch.Text;
            }
            else if (thirdmatch.Checked)
            {
                match = thirdmatch.Text;
            }
            if (vvipbutton.Checked == true)
            {
                price  += (300 * int.Parse(ticket1Box.Text));
                ticket += int.Parse(ticket1Box.Text);
            }
            if (vipbutton.Checked == true)
            {
                price  += (200 * int.Parse(ticket2Box.Text));
                ticket += int.Parse(ticket2Box.Text);
            }
            if (cat1rbutton.Checked == true)
            {
                price  += (100 * int.Parse(ticket3Box.Text));
                ticket += int.Parse(ticket3Box.Text);
            }
            if (cat1lbutton.Checked == true)
            {
                price  += (100 * int.Parse(ticket4Box.Text));
                ticket += int.Parse(ticket4Box.Text);
            }
            if (cat2button.Checked == true)
            {
                price  += (75 * int.Parse(ticket5Box.Text));
                ticket += int.Parse(ticket5Box.Text);
            }
            if (cat3button.Checked == true)
            {
                price  += (50 * int.Parse(ticket6Box.Text));
                ticket += int.Parse(ticket6Box.Text);
            }
            if (cat3lbutton.Checked == true)
            {
                price  += (50 * int.Parse(ticket7Box.Text));
                ticket += int.Parse(ticket7Box.Text);
            }
            //generate random number for serial number
            Random        rnd = new Random();
            int           ser = rnd.Next(200000000, 300000000);
            General       g   = new General();
            filing_orders f   = new filing_orders();
            //get available tickets
            login l = new login();
            int   t = int.Parse(File.ReadAllText("lf.txt"));

            //check the limit of tickets
            if (g.limit_Ticket(ticket))
            {
                //check if the available tickets coverd the requried tickets
                if (ticket <= t)
                {
                    //show the bill
                    MessageBox.Show("Selected Match : " + match + "\n Num of Tickets : " + ticket + "  \n price : " + price + "\nYour Ticket Serial Number Is : " + ser);
                    //store the order
                    f.save_orders(l.activeid, ser, "Foot Ball", price);
                    f.allorders(l.activeid, ser, "Foot Ball", price);
                    //reduce avaiable tickets
                    File.WriteAllText("lf.txt", Convert.ToString(t - ticket));
                    this.Hide();
                }
                //if the tickets sold out then the order added to waiting list
                else
                {
                    f.watinglist(l.activeid, ser, "Foot Ball", price);
                    MessageBox.Show("All Tickets Sold out But you are in watting list now");
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("You can Book Only 7 Tickets");
            }
        }
Beispiel #6
0
        private void result_Click(object sender, EventArgs e)
        {
            //calculate the price
            int    price = 0;
            int    x     = 0;
            string tx    = tm2.Text;

            if (vip.Checked == true)
            {
                price += (100 * int.Parse(vipTicketsBox.Text));
                x     += int.Parse(vipTicketsBox.Text);
            }
            if (normal.Checked == true)
            {
                price += (65 * int.Parse(normalTicketsBox.Text));
                x     += int.Parse(normalTicketsBox.Text);
            }

            // get the time
            if (tm3.Checked == true)
            {
                tx = tm3.Text;
            }
            else if (tm4.Checked == true)
            {
                tx = tm4.Text;
            }
            else if (tm1.Checked == true)
            {
                tx = tm1.Text;
            }
            else if (tm2.Checked == true)
            {
                tx = tm2.Text;
            }

            //generate random number for serial number
            Random        rnd = new Random();
            int           ser = rnd.Next(200000000, 300000000);
            General       g   = new General();
            filing_orders f   = new filing_orders();
            //get available tickets
            login l = new login();
            int   t = int.Parse(File.ReadAllText("lci.txt"));

            //check the limit of tickets
            if (g.limit_Ticket(x))
            {
                //check if the available tickets coverd the requried tickets
                if (x <= t)
                {
                    //show the bill
                    MessageBox.Show("Total price is: " + price + "\n time : " + tx + "\n number of tickets : " + x + "\nYour Ticket Serial Number Is : " + ser);
                    //store the order
                    f.save_orders(l.activeid, ser, "Cinema", price);
                    f.allorders(l.activeid, ser, "Cinema", price);
                    //reduce avaiable tickets
                    File.WriteAllText("lci.txt", Convert.ToString(t - x));
                    this.Hide();
                }
                //if the tickets sold out then the order added to waiting list
                else
                {
                    f.watinglist(l.activeid, ser, "Cinema", price);
                    MessageBox.Show("All Tickets Sold out But you are in watting list now");
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("You can Book Only 7 Tickets");
            }
        }