コード例 #1
0
        public FrmDoublePrice()
        {
            InitializeComponent();
            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");
            string item1Name = myDataset.Tables["Item"].Rows[12][1].ToString();
            //string item1Price = myDataset.Tables["Item"].Rows[8][2].ToString();
            double item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[13][2]);

            dp = new DoublePrice(item1Price, item1Name);


            item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[23][2].ToString());
            item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[24][2].ToString());
            item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[25][2].ToString());

            lblPrice1.Text       = dp.GetRealPrice().ToString();
            lblPrice2.Text       = dp.GetFakePrice().ToString();
            lblItemName.Text     = dp.GetName();
            lblCorrectPrice.Text = dp.GetRealPrice().ToString();

            pictureBox3.Image = ArrayPictureItems.GetItemPicture(7);
        }
コード例 #2
0
        public FrmMostExpensive()
        {
            InitializeComponent();
            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");
            string item1Name = myDataset.Tables["Item"].Rows[23][1].ToString();
            string item2Name = myDataset.Tables["Item"].Rows[24][1].ToString();
            string item3Name = myDataset.Tables["Item"].Rows[25][1].ToString();

            item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[23][2].ToString());
            item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[24][2].ToString());
            item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[25][2].ToString());

            rd1.Text = item1Name;
            rd2.Text = item2Name;
            rd3.Text = item3Name;

            pb2.Image = ArrayPictureItems.GetItemPicture(18);
            pb3.Image = ArrayPictureItems.GetItemPicture(19);
            pb4.Image = ArrayPictureItems.GetItemPicture(20);
        }
コード例 #3
0
        public FrmOneWrongPrice()
        {
            InitializeComponent();
            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");
            string item1Name = myDataset.Tables["Item"].Rows[27][1].ToString();
            string item2Name = myDataset.Tables["Item"].Rows[28][1].ToString();
            string item3Name = myDataset.Tables["Item"].Rows[29][1].ToString();

            lblItem1.Text = item1Name;
            lblItem2.Text = item2Name;
            lblItem3.Text = item3Name;

            int CorrectAnswer = ranNum.Next(1, 4);

            owp.priceWrong = CorrectAnswer;

            double item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[27][2].ToString());
            double item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[28][2].ToString());
            double item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[29][2].ToString());

            picItem1.Image = ArrayPictureItems.GetItemPicture(21);
            picItem2.Image = ArrayPictureItems.GetItemPicture(23);
            picItem3.Image = ArrayPictureItems.GetItemPicture(24);

            //rd1.Text = item1Price;
            //rd2.Text = item2Price;
            //rd3.Text = item3Price;

            owp      = new OneWrongPrice(item1Price, item2Price, item3Price);
            rd1.Text = owp.price1.ToString();
            rd2.Text = owp.price2.ToString();
            rd3.Text = owp.price3.ToString();
        }
コード例 #4
0
        public FrmGoldenRoad()
        {
            InitializeComponent();
            pbItem2.Visible = false;
            pbItem3.Visible = false;
            allItems.ReadItem();

            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");
            string item1 = myDataset.Tables["Item"].Rows[20][2].ToString();

            gd.actualprice = Convert.ToDouble(item1);

            gd.FirstItem(1, gd.actualprice);
            int CorrectAnswer = ranNum.Next(1, 3);

            if (CorrectAnswer == 1)
            {
                rd1.Text = gd.actualprice.ToString();
                rd2.Text = gd.fakeprice1.ToString();
            }
            else if (CorrectAnswer == 2)
            {
                rd2.Text = gd.actualprice.ToString();
                rd1.Text = gd.fakeprice1.ToString();
            }
            pbitem1.Image = ArrayPictureItems.GetItemPicture(15);
            pbItem2.Image = ArrayPictureItems.GetItemPicture(16);
            pbItem3.Image = ArrayPictureItems.GetItemPicture(17);

            lblNameItem.Text = myDataset.Tables["Item"].Rows[20][1].ToString();
        }
コード例 #5
0
        public FrmEasy123()
        {
            InitializeComponent();
            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");

            double item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[14][2]);
            double item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[15][2]);
            double item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[16][2]);

            String item1Name = myDataset.Tables["Item"].Rows[14][1].ToString();
            String item2Name = myDataset.Tables["Item"].Rows[15][1].ToString();
            String item3Name = myDataset.Tables["Item"].Rows[16][1].ToString();

            e123 = new Easy123(item1Price, item2Price, item3Price);


            //item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[23][2].ToString());
            //item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[24][2].ToString());
            // item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[25][2].ToString());

            lblItem1.Text = item1Name;
            lblItem2.Text = item2Name;
            lblItem3.Text = item3Name;
            //lblItemName.Text = dp.GetName();

            pictureBox2.Image = ArrayPictureItems.GetItemPicture(9);
            pictureBox3.Image = ArrayPictureItems.GetItemPicture(10);
            pictureBox4.Image = ArrayPictureItems.GetItemPicture(11);
        }
コード例 #6
0
        public FrmCheckOut()
        {
            InitializeComponent();
            string strConnect = "provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=DatabaseProject.accdb";
            string           SQL           = "SELECT ID, Item_Name, Item_Price FROM item";
            OleDbConnection  myConnection  = new OleDbConnection(strConnect);
            OleDbCommand     myCommand     = new OleDbCommand(SQL, myConnection);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(SQL, myConnection);

            myDataAdapter.Fill(myDataset, "Item");

            double item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[0][2]);
            double item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[1][2]);
            double item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[2][2]);
            double item4Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[3][2]);
            double item5Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[4][2]);


            String item1Name = myDataset.Tables["Item"].Rows[0][1].ToString();
            String item2Name = myDataset.Tables["Item"].Rows[1][1].ToString();
            String item3Name = myDataset.Tables["Item"].Rows[2][1].ToString();
            String item4Name = myDataset.Tables["Item"].Rows[3][1].ToString();
            String item5Name = myDataset.Tables["Item"].Rows[4][1].ToString();

            checkOut = new CheckOut(item1Name, item2Name, item3Name, item4Name, item5Name, item1Price,
                                    item2Price, item3Price, item4Price, item5Price);



            //item1Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[23][2].ToString());
            //item2Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[24][2].ToString());
            // item3Price = Convert.ToDouble(myDataset.Tables["Item"].Rows[25][2].ToString());

            lblItem1.Text = checkOut.GetItemName1();
            lblItem2.Text = checkOut.GetItemName2();
            lblItem3.Text = checkOut.GetItemName3();
            lblItem4.Text = checkOut.GetItemName4();
            lblItem5.Text = checkOut.GetItemName5();

            lblActualPrice1.Text    = item1Price.ToString();
            lblActualPrice2.Text    = item2Price.ToString();
            lblActualPrice3.Text    = item3Price.ToString();
            lblActualPrice4.Text    = item4Price.ToString();
            lblActualPrice5.Text    = item5Price.ToString();
            lblActualPrice1.Visible = false;
            lblActualPrice2.Visible = false;
            lblActualPrice3.Visible = false;
            lblActualPrice4.Visible = false;
            lblActualPrice5.Visible = false;

            lblTotalPrice.Text    = checkOut.GetTotalPrice().ToString();
            lblTotalPrice.Visible = false;
            lblTotalGuess.Visible = false;

            pictureBox1.Image = ArrayPictureItems.GetItemPicture(0);
            pictureBox2.Image = ArrayPictureItems.GetItemPicture(1);
            pictureBox3.Image = ArrayPictureItems.GetItemPicture(2);
            pictureBox4.Image = ArrayPictureItems.GetItemPicture(3);
            pictureBox5.Image = ArrayPictureItems.GetItemPicture(4);
        }