Example #1
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");
            }
        }
Example #2
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();
            }
        }
Example #3
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");
            }
        }