コード例 #1
0
        //method to increment row details by one
        public void incrementByOne(String billRowId, String price)
        {
            billrow = billrowList.Find(x => x.billrowID == billRowId);//getting the bill row from the list
            //modifying the bill row
            double unitprice = Double.Parse(billrow.unitPrice);
            double total;

            bool res = Double.TryParse(billrow.total, out total);

            if (res == false)
            {
                MessageBox.Show("Cannot increment");
            }
            else
            {
                total = total + unitprice;
                //assign it to text field again
                billrow.total = total.ToString();
            }
            int qty = Int32.Parse(billrow.Quantity);

            qty = qty + 1;
            billrow.Quantity = qty.ToString();
            //adding again to the list
            billrowList.Add(billrow);
            setAmountToPay();
            loadBilllist(); //load the bill list again
        }
コード例 #2
0
        }//end of filtering method

        //method to add bill row
        public void addToBillList(String id, String name, String price)
        {
            billrow           = new BillRow();
            billrow.billrowID = id;
            billrow.FoodName  = name;
            billrow.Quantity  = 1.ToString();; //this should be changed
            billrow.total     = price;
            billrow.unitPrice = price;         //price of a one food ite
            billrowList.Add(billrow);
            loadBilllist();
        }