Пример #1
0
        void AddDepartment()
        {
            HouseholdAccounts a = new HouseholdAccounts();

            bool valid = true;

            do
            {
                Console.Write("Enter date (YYYYMMDD format) = ");
                a.Date = Console.ReadLine();
                if (string.IsNullOrEmpty(a.Date))
                {
                    valid = false;
                    Console.WriteLine("Empty input, please try again");
                }
                else if (a.Date.Length != 8 || Convert.ToInt32(a.Date) < 10000000 || Convert.ToInt32(a.Date) > 30000000)
                {
                    valid = false;
                    Console.WriteLine("Invalid Date input");
                }
                else
                {
                    valid = true;
                }
            } while (!valid);


            do
            {
                Console.Write("Enter Description = ");
                a.Description = Console.ReadLine();
                if (string.IsNullOrEmpty(a.Description))
                {
                    Console.WriteLine("Empty input, please try again");
                }
            } while (string.IsNullOrEmpty(a.Description));

            Console.Write("Enter Category = ");
            a.Category = Console.ReadLine();

            //do
            //{
            //    Console.Write("Enter amount (Must be integer) = ");
            //    a.Amount = Convert.ToInt32(Console.ReadLine());
            //    if (a.Amount.GetType() != typeof(int))
            //    {
            //        Console.WriteLine("Empty input, please try again");
            //    }
            //} while (a.Amount.GetType() != typeof(int));

            Console.Write("Enter amount (Must be integer) = ");
            a.Amount = Convert.ToInt32(Console.ReadLine());


            accRepository.Insert(a);
            Console.WriteLine("Account created successfully");
        }
Пример #2
0
        static void Main(string[] args)
        {
            HouseholdAccounts account = new HouseholdAccounts();

            account.AddExpense();
            account.Show();
            account.Search();
            account.Delete();
            account.Modify();
            account.Sort();
            account.Normalize();
        }
Пример #3
0
        void Update()
        {
            HouseholdAccounts d = new HouseholdAccounts();

            Console.Write("Enter date (YYYYMMDD format) = ");
            d.Date = Console.ReadLine();

            Console.Write("Enter new Description of expenditure or revenu = ");
            d.Description = Console.ReadLine();

            Console.Write("Enter Category = ");
            d.Category = Console.ReadLine();

            Console.Write("Enter amount  = ");
            d.Amount = Convert.ToInt32(Console.ReadLine());

            accRepository.Update(d);
            Console.WriteLine("Account updated successfully");
        }
Пример #4
0
        static void Main(string[] args)
        {
            HouseholdAccounts householdAccounts = new HouseholdAccounts();

            householdAccounts.Run();
        }