コード例 #1
0
ファイル: Data.cs プロジェクト: andreszb/Point
        public void DeleteFromSalesByDayAsDebt()
        {
            SalesByDay today = SalesByDay.Today();

            string[] AllItems = today.ItemsString.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < AllItems.Length; i++)
            {
                if (AllItems[i].Contains(Description))
                {
                    AllItems[i]       = AllItems[i].DecreaseByOne();
                    today.ItemsString = string.Join("\n", AllItems);
                    today.TotalOwed  -= Price;
                    today.UpdateInTable();
                    return;
                }
            }
            today.ItemsString += "\n1\t" + Price + "\t" + Description;
            today.TotalOwed   -= Price;
            today.UpdateInTable();
        }
コード例 #2
0
ファイル: Data.cs プロジェクト: andreszb/Point
        //Adds the current item to today's row from SalesByDay table.
        public void AddToSalesByDay()
        {
            //Get today's row
            SalesByDay today = SalesByDay.Today();

            //Separate items
            string[] AllItems = today.ItemsString.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < AllItems.Length; i++)
            {
                //Look for this item in array of items. If found, increase current item by one, rejoin and update table.
                if (AllItems[i].Contains(Description))
                {
                    AllItems[i]       = AllItems[i].IncreaseByOne();
                    today.ItemsString = string.Join("\n", AllItems);
                    today.Total      += Price;
                    today.UpdateInTable();
                    return;
                }
            }
            //If not found, set the value to this item's info and update.
            today.ItemsString += "\n1\t" + Price + "\t" + Description;
            today.Total       += Price;
            today.UpdateInTable();
        }