Пример #1
0
 public void AddNewBill()
 {
     AddBill addBill = new AddBill(this);
 }
Пример #2
0
        private static void AddNewBill(ExpenseManager inEM, GeneralExpense ge)
        {
            ExpenseManager em = inEM;
            Bill bill = new Bill();
            string bIssuer = string.Empty;
            string bRefNo = string.Empty;
            string invalid = "\t\tInvalid Value.";
            bool isValid = false;

            // Get Issuer
            while (!isValid)
            {
                Console.Write("Bill Isssuer: ");
                bIssuer = Console.ReadLine();
                if (string.IsNullOrEmpty(bIssuer))
                {
                    Console.WriteLine(invalid);
                    Console.ReadLine();
                }
                else
                {
                    if (bIssuer.Equals(_cancelChar))
                        return;
                    isValid = true;
                }
            }

            isValid = false;

            // Get bill reference number
            while (!isValid)
            {
                Console.Write("Bill Reference No: ");
                bRefNo = Console.ReadLine();
                if (string.IsNullOrEmpty(bRefNo))
                {
                    Console.WriteLine(invalid);
                    Console.ReadLine();
                }
                else
                {
                    if (bRefNo.Equals(_cancelChar))
                        return;
                    isValid = true;
                }
            }

            bill.Name = ge.Name;
            bill.Description = ge.Description;
            bill.Value = ge.Value;
            bill.DateReceived = ge.DateReceived;
            bill.IsPaid = ge.IsPaid;
            bill.DatePaid = ge.DatePaid;
            bill.IsOutstanding = ge.IsOutstanding;
            bill.Issuer = bIssuer;
            bill.ReferenceNo = bRefNo;

            AddBill addBill = new AddBill(em);
            addBill.InsertValues(bill);
        }