Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string allItems = comboBoxAllItems.SelectedItem.ToString();

            db_classesDataContext db = new db_classesDataContext();



            var allPricess = from b in db.StoreItems
                             where b.ItemName == allItems
                             select b.ItemPrice;

            foreach (decimal gdec in allPricess)
            {
                List <PriceCheck> prods = new List <PriceCheck>()
                {
                    new PriceCheck()
                    {
                        price = gdec
                    }
                };

                decimal pricess = gdec;//allPricess.ToString();

                progressBar1.Value = 0;
                for (int i = 99; i < 100; i++)
                {
                    int b = 100 - i;
                    MessageBox.Show("Please press the key enter " + b + " time(s) to scann the item");
                    progressBar1.Value = i;
                    if (i > 100)
                    {
                        break;
                    }

                    //i += 2;
                }


                if (radioButtonBuy.Checked && allItems != null)
                {
                    MessageBox.Show("You Scanned Item " + allItems + " for purchase");
                }


                if (radioButtonCredit.Checked && allItems != null)
                {
                    MessageBox.Show("You Scanned Item " + allItems + " for refound or credit of " + pricess + " dollars(s)");
                }
                if (radioButtonPriceCheck.Checked && allItems != null)
                {
                    MessageBox.Show("You Scanned Item " + allItems + " to check the price. The price is " + pricess + " dollar(s)");
                }
            }
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            //make instance of the database to use tables

            db_classesDataContext db = new db_classesDataContext();

            //create a list of food

            var ProdsInStore = from p in db.StoreItems
                               where p.ItemType == "Food"
                               select p.ItemName;
            var FoodPrice = from p in db.StoreItems
                            where p.ItemType == "Food"
                            select p.ItemPrice;


            foreach (string ffood in ProdsInStore)
            {
                foreach (decimal fdec in FoodPrice)
                {
                    List <Food> prods = new List <Food>()
                    {
                        new Food()
                        {
                            ItemName = ffood, price = fdec
                        }
                    };
                }
                ;


                // comboBoxFood.Items.Add(ffood);
                comboBoxAllItems.Items.Add(ffood);
            }



            //create a list of beverages

            var Bevs = from a in db.StoreItems
                       where a.ItemType == "Beverages"
                       select a.ItemName;
            var BevsPrice = from a in db.StoreItems
                            where a.ItemType == "Beverages"
                            select a.ItemPrice;

            foreach (string bbevs in Bevs)
            {
                foreach (decimal dec in BevsPrice)
                {
                    List <Beverages> prods = new List <Beverages>()
                    {
                        new Beverages()
                        {
                            ItemName = bbevs, price = dec
                        }
                    };
                }
                ;
                //comboBoxBev.Items.Add(bbevs);
                comboBoxAllItems.Items.Add(bbevs);
            }

            //create a list of giftcards

            var Gift = from b in db.StoreItems
                       where b.ItemType == "GiftCard"
                       select b.ItemName;
            var GiftPrice = from b in db.StoreItems
                            where b.ItemType == "GiftCard"
                            select b.ItemPrice;

            foreach (string ggift in Gift)
            {
                foreach (decimal gdec in GiftPrice)
                {
                    List <GiftCards> prods = new List <GiftCards>()
                    {
                        new GiftCards()
                        {
                            ItemName = ggift, price = gdec
                        }
                    };
                }
                ;

                //comboBoxGiftCard.Items.Add(ggift);
                comboBoxAllItems.Items.Add(ggift);
            }
        }