Ejemplo n.º 1
0
        private void btnCalc_Click(object sender, EventArgs e)
        {
            decimal temp;

            temp             = Krusty.CalculateSubTotal(kCart);
            lblSubtotal.Text = temp.ToString("C");

            temp        = Krusty.CalculateTax(kCart);
            lblTax.Text = temp.ToString("C");

            totalAmtDue   = Krusty.CalculateTotal(kCart);
            lblTotal.Text = totalAmtDue.ToString("C");
        }
Ejemplo n.º 2
0
        private void ProcessInputLine(string kInItem, int kIndex)
        {
            //split the line into our fields
            string[] fields = kInItem.Split(',');
            //get each field from the split array
            //convert as necessary
            int     itemNo   = Convert.ToInt32(fields[0]);
            string  prodName = fields[1];
            int     qty      = Convert.ToInt32(fields[2]);
            decimal price    = Convert.ToDecimal(fields[3]);

            //create a Krusty inventory object with the data
            kItems[kIndex] = new Krusty(itemNo, prodName, qty, price);
            //add the Krusty inventory object to the list box on our form
            lstBxInventory.Items.Add(kItems[kIndex]);
        }
Ejemplo n.º 3
0
        }//btnAdd

        private void UpdateInventory(int index, int numWanted)
        {
            //declare our variables
            int itemNo,
                qty;
            string  prodName;
            decimal price;

            //update the quantity of the inventory item
            kItems[index].Qty = kItems[index].Qty - numWanted;
            itemNo            = kItems[index].ItemNo;
            prodName          = kItems[index].ProdName;
            price             = kItems[index].Price;

            for (int i = 0; i < numWanted; i++)
            {
                kCart[lastCartItem] = new Krusty(itemNo, prodName,
                                                 1, price);
                lstBxCart.Items.Add(kCart[lastCartItem]);

                //update item number for next item
                lastCartItem++;
            }
        }