Example #1
0
        public void DepositCash(UserO usr)
        {
            WriteLine("Enter the amount to deposit:");
            string amo = ReadLine();
            int    amount;

            if (int.TryParse(amo, out amount))
            {
                amount = System.Convert.ToInt32(amo);
                UserBLL bll     = new UserBLL();
                UserBO  obj     = new UserBO(bll.SearchByObject(usr));
                UserBO  Deposit = new UserBO(obj);
                Deposit.Starting_balance = Deposit.Starting_balance + amount;
                bll.Save_User(Deposit);
                WriteLine("Deposit successful.");
                DateTime dateTime = DateTime.UtcNow.Date;
                string   dat      = dateTime.ToString("dd/MM/yyyy");
                ReportBO repobj   = new ReportBO {
                    Type = "Cash Deposit", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat
                };
                TransactionBLL tll = new TransactionBLL();
                tll.Save_Transaction(repobj);
                WriteLine("Do you wish to print a reciept?(y/n)");
                char ans2 = ReadKey().KeyChar;
                if (ans2.Equals('y') || ans2.Equals('Y'))
                {
                    bll.Receipt_Deposit(obj, amount);
                }
            }
            else
            {
                WriteLine("Amount enetered was not in a correct format");
            }
        }
Example #2
0
        public void NormalCash(UserO usr, ref bool MaxAmount)
        {
            WriteLine("Enter the amount of money You want to withdraw");
            string amo = ReadLine();
            int    amount;

            if (int.TryParse(amo, out amount))
            {
                amount = System.Convert.ToInt32(amo);
                UserBLL bll = new UserBLL();
                if (bll.CheckDate(amount))
                {
                    MaxAmount = true;
                    return;
                }
                WriteLine($"Are you sure you want to withdraw Rs.{amount}(Y/N)? ");
                char ans = ReadKey().KeyChar;
                if (ans.Equals('y') || ans.Equals('Y'))
                {
                    UserBO obj = new UserBO(bll.SearchByObject(usr));
                    UserBO cop = new UserBO(obj);
                    if (bll.CheckBalance(obj, amount))
                    {
                        obj.Starting_balance = obj.Starting_balance - amount;
                        bll.Test_Save(obj);
                        WriteLine("Ammount Withdrawn sucessfully");
                        DateTime dateTime = DateTime.UtcNow.Date;
                        string   dat      = dateTime.ToString("dd/MM/yyyy");
                        ReportBO repobj   = new ReportBO {
                            Type = "Cash Withdrawl", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat
                        };
                        TransactionBLL tll = new TransactionBLL();
                        tll.Save_Transaction(repobj);
                        WriteLine("Do You wish to print a receipt(y/n)");
                        char ans2 = ReadKey().KeyChar;
                        if (ans2.Equals('y') || ans2.Equals('Y'))
                        {
                            Display_Recipt(amount, obj);
                        }
                    }
                    else
                    {
                        bll.Test_Save(cop);
                        WriteLine("You dont have enough balance in your account");
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                WriteLine("Please Enter a valid amount i.e, digits");
            }
        }
Example #3
0
        public void FastCash(UserO usr, ref bool MaxAmount)
        {
            Console.Clear();
            WriteLine("1----500");
            WriteLine("2----1000");
            WriteLine("3----2000");
            WriteLine("4----5000");
            WriteLine("5----10000");
            WriteLine("6----15000");
            WriteLine("7----20000");
            int     opt    = System.Convert.ToInt32(ReadLine());
            UserBLL bll    = new UserBLL();
            int     amount = Place_Balance(opt);

            if (bll.CheckDate(amount))
            {
                MaxAmount = true;
                return;
            }
            WriteLine($"Are you sure you want to withdraw Rs.{amount}(Y/N)? ");
            char ans = ReadKey().KeyChar;

            if (ans.Equals('y') || ans.Equals('Y'))
            {
                UserBO obj = new UserBO(bll.SearchByObject(usr));
                UserBO cop = new UserBO(obj);
                if (bll.CheckBalance(obj, amount))
                {
                    obj.Starting_balance = obj.Starting_balance - amount;
                    bll.Test_Save(obj);
                    WriteLine("Ammount Withdrawn sucessfully");
                    DateTime dateTime = DateTime.UtcNow.Date;
                    string   dat      = dateTime.ToString("dd/MM/yyyy");
                    ReportBO repobj   = new ReportBO {
                        Type = "Cash Withdrawl", User_Id = obj.UsrAccNum, Name = obj.Name, Amount = amount.ToString(), Date = dat
                    };
                    TransactionBLL tll = new TransactionBLL();
                    tll.Save_Transaction(repobj);
                    WriteLine("Do You wish to print a receipt(y/n)");
                    char ans2 = ReadKey().KeyChar;
                    if (ans2.Equals('y') || ans2.Equals('Y'))
                    {
                        Display_Recipt(amount, obj);
                    }
                }
                else
                {
                    bll.Test_Save(cop);
                    WriteLine("You dont have enough balance in your account");
                }
            }
            else
            {
                WriteLine("GoodLuck");
            }
        }