Esempio n. 1
0
 public void addItem(FsysLogItem toAdd)
 {
     this.logContent.Add(toAdd);
 }
Esempio n. 2
0
        public void addItem(
            DateTime inputDate,
            float inputAmount,
            string inputDescription,
            string inputType,
            bool Receipt,
            bool income)
        {
            bool typeExist = false;
            foreach (string iType in itemTypes)
            {
                if (iType == inputType)
                {
                    typeExist = true;
                    break;
                }

            }
            if (typeExist == false)
            {
                itemTypes.Add(inputType);
            }

            //gets highest ID number
            int highestID = 0;
            int highestReceiptID = 0;

            for (int i = 0; i < this.logContent.Count; i++)
            {
                FsysLogItem thisItem = logContent[i];
                if (thisItem.getItemNumber() > highestID)
                {
                    highestID = thisItem.getItemNumber();
                }
                if (thisItem.getReceiptNumber() > highestReceiptID)
                {
                    highestReceiptID = thisItem.getReceiptNumber();
                }
            }
            int newItemNumber = highestID + 1;
            int inputReceiptID = -1;
            if (Receipt)
            {
                inputReceiptID = highestReceiptID + 1;
            }

            FsysLogItem toAdd = new FsysLogItem(newItemNumber, inputDate, inputAmount, inputDescription, inputType, inputReceiptID, income);
            this.logContent.Add(toAdd);
        }
Esempio n. 3
0
        public FsysLogItem getItemByID(int ID)
        {
            FsysLogItem item = new FsysLogItem();

            foreach (FsysLogItem current in logContent)
            {
                if (current.getItemNumber() == ID)
                {
                    item = current;
                    break;
                }

            }
            return item;
        }