예제 #1
0
파일: BL.cs 프로젝트: poojansoni/Codes
 public void displayAccount(Account.Account a)
 {
     Console.WriteLine("Name | Customer ID | Account ID | Balance-left | Interest ");
     Console.WriteLine("______________________________________________________________________");
     Console.WriteLine(a.cust_name + " | " + a.cust_id + " | " + a.account_id + " | " + a.customer_balance + " | " + a.interst_rate);
     Console.WriteLine("______________________________________________________________________");
 }
예제 #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Car.Car selectedCar = (Car.Car)listBox1.SelectedItem;
            if (selectedCar.IsFree)
            {
                MessageBox.Show("Model: " + selectedCar.Model + "\n" + "Number: " + selectedCar.Number + "\n" +
                                "Price per one day: " + selectedCar.PricePerDay + "\n" + "Status: " + selectedCar.IsFree.ToString() +
                                "\nBusy days: " + selectedCar.Days);
            }
            else
            {
                object obj = admin.AccManager.Find(selectedCar.Number);

                if (obj as Account.Account == null)
                {
                    MessageBox.Show("Model: " + selectedCar.Model + "\n" + "Number: " + selectedCar.Number + "\n" +
                                    "Price per one day: " + selectedCar.PricePerDay + "\n" + "Status: " + selectedCar.IsFree.ToString() +
                                    "\nBusy days: " + selectedCar.Days + "\nTenant login: error");
                }
                else
                {
                    Account.Account acc = (Account.Account)obj;
                    MessageBox.Show("Model: " + selectedCar.Model + "\n" + "Number: " + selectedCar.Number + "\n" +
                                    "Price per one day: " + selectedCar.PricePerDay + "\n" + "Status: " + selectedCar.IsFree.ToString() +
                                    "\nBusy days: " + selectedCar.Days + "\nTenant login: " + acc.Login);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Write account to file
 /// </summary>
 /// <param name="account"></param>
 public void AppendAccountToFile(Account.Account account)
 {
     using (var bw = new BinaryWriter(File.Open(Path, FileMode.Append, FileAccess.Write, FileShare.None)))
     {
         Writer(bw, account);
     }
 }
예제 #4
0
파일: Program.cs 프로젝트: Xaw4/mmtb2011-SE
        static void Main(string[] args)
        {
            Console.WriteLine("---- Welcome to the new Account-Manager-3000 ----");

            Manager m = Manager.getInstance();

            m.addAccount(new Account("Fred", 50));
            m.dumpAccounts();
            m.addAccount(new Account("hons", 60));
            m.dumpAccounts();
            m.addAccount(new Account("Hubert"));
            m.dumpAccounts();

            Changeable ch = new Account("Chhh", 1000);

            LogObserver logger = new LogObserver();
            ch.registerObserver(logger);

            Account acc = ch as Account;
            acc.Deposit(100);

            acc.registerObserver(logger);
            acc.Withdraw(200);

            Console.ReadLine();
        }
예제 #5
0
파일: BL.cs 프로젝트: poojansoni/Codes
        public Account.Account addAccount(ref Customer.Customer c)
        {
            Account.Account a = new Account.Account();

            if (!validateCustomer(c))
            {
                addCustomer(ref c);
            }

            int acc_id = generateRandomID();

            Console.WriteLine("Enter Balance to be deposited: ");
            int bal = Convert.ToInt32(Console.ReadLine());

            Console.Write("Select Account-type:\n* Deposit\n* Loan\n* Mortgage\n: ");
            string type = Console.ReadLine();

            a.account_id       = acc_id;
            a.customer_balance = bal;
            a.account_type     = type;
            a.interst_rate     = CalculateInterest(c.cust_type, ref a);


            return(a);
        }
예제 #6
0
파일: BL.cs 프로젝트: poojansoni/Codes
        public void selectOption(Account.Account account)
        {
            switch (account.account_type)
            {
            case "Deposit":
                while (true)
                {
                    Console.Write("Want to Deposit/Withdraw?: ");
                    string choice = Console.ReadLine();
                    if (choice.Equals("Deposit"))
                    {
                        deposit(ref account);
                    }
                    else if (choice.Equals("Withdraw"))
                    {
                        withdraw(ref account);
                    }
                    else
                    {
                        break;
                    }
                }
                break;

            case "Loan":
                while (true)
                {
                    Console.Write("Want to Deposit?: ");
                    string choice1 = Console.ReadLine();

                    if (choice1.Equals("Deposit"))
                    {
                        deposit(ref account);
                    }
                    else
                    {
                        break;
                    }
                }
                break;

            case "Mortgage":
                while (true)
                {
                    Console.Write("Want to Deposit?: ");
                    string choice2 = Console.ReadLine();

                    if (choice2.Equals("Deposit"))
                    {
                        deposit(ref account);
                    }
                    else
                    {
                        break;
                    }
                }
                break;
            }
        }
예제 #7
0
        /// <summary>
        /// CreateAccount create new account
        /// </summary>
        /// <param name="id"></param>
        /// <param name="ownerFirstName"></param>
        /// <param name="ownerLastName"></param>
        /// <param name="amount"></param>
        /// <param name="points"></param>
        /// <param name="type"></param>
        public void CreateAccount(Account.Account account)
        {
            var accounts = _accountStorage.ReadAccountFromFile().ToList();

            accounts.Add(account);

            _accountStorage.OverWriteFile(accounts);
        }
예제 #8
0
파일: BL.cs 프로젝트: poojansoni/Codes
        private void deposit(ref Account.Account account)
        {
            Console.WriteLine("Your balance is : " + account.customer_balance);
            Console.Write("How much you want to deposit? ");
            int sum = Convert.ToInt32(Console.ReadLine());

            account.customer_balance = account.customer_balance + sum;
            Console.WriteLine("Current Balance is : " + account.customer_balance);
        }
예제 #9
0
파일: BL.cs 프로젝트: poojansoni/Codes
        private void withdraw(ref Account.Account account)
        {
            Console.WriteLine("Your balance is : " + account.customer_balance);
            Console.Write("How much you want to withdraw? ");
            int sum = Convert.ToInt32(Console.ReadLine());

            account.customer_balance = account.customer_balance - sum;
            Console.WriteLine(sum + " amount has been debited from your account\nYour Current Balance is : " + account.customer_balance);
        }
예제 #10
0
 private static void Writer(BinaryWriter binary, Account.Account account)
 {
     binary.Write(account.Id.ToString());
     binary.Write(account.OwnerFirstName);
     binary.Write(account.OwnerLastName);
     binary.Write(account.Amount);
     binary.Write(account.Points);
     binary.Write(account.Status.ToString());
     binary.Write(account.Type.ToString());
 }
예제 #11
0
    private void MovePlayer(ref Account.Account now)
    {
        if (PlayerList.ContainsKey(now.Name) == false)
        {
            AddPlayer(now.Name, "");
        }
        GameObject it  = PlayerList[now.Name];
        Vector3    pos = new Vector3(float.Parse(now.X), float.Parse(now.Y), float.Parse(now.Z));
        Vector3    ro  = new Vector3(float.Parse(now.EulerAnglesX), float.Parse(now.EulerAnglesY), float.Parse(now.EulerAnglesZ));

        it.transform.eulerAngles = ro;
        it.transform.position    = pos;
        it.GetComponent <Player>().Play(now.Ani);
    }
예제 #12
0
파일: BL.cs 프로젝트: poojansoni/Codes
        private double CalculateInterest(string cust_type, ref Account.Account a)
        {
            double rate = 15;

            switch (a.account_type)
            {
            case "Deposit":
                if (a.customer_balance > 0 && a.customer_balance < 1000)
                {
                    rate = 0;
                }

                break;

            case "Loan":
                if (cust_type.Equals("Individual"))
                {
                    rate          = 0;
                    a.monthsValid = 3;
                }
                else
                {
                    rate          = 0;
                    a.monthsValid = 2;
                }
                break;

            case "Mortgage":
                if (cust_type.Equals("Individual"))
                {
                    rate          = 0;
                    a.monthsValid = 6;
                }
                else
                {
                    rate          = rate / 2;
                    a.monthsValid = 12;
                }
                break;

            default: break;
            }
            return(rate);
        }
예제 #13
0
 private void button1_Click(object sender, EventArgs e)
 {
     Account.Account account = accManager.findAccount(maskedTextBox1.Text);
     if (account == null)
     {
         label3.Text = "There is no account with such login!";
         maskedTextBox1.Clear();
         maskedTextBox2.Clear();
         return;
     }
     if (account.Password.Equals(maskedTextBox2.Text))
     {
         if (account as Account.User != null)
         {
             Account.User user = account as Account.User;
             Form3        nF   = new Form3(this, user);
             this.Visible = false;
             nF.ShowDialog();
             this.Dispose();
         }
         if (account as Account.Admin != null)
         {
             Account.Admin admin = account as Account.Admin;
             admin.AccManager = accManager;
             AdminWindow nF = new AdminWindow(this, admin);
             this.Visible = false;
             nF.ShowDialog();
             this.Dispose();
         }
         accManager.SaveInformation();
     }
     else
     {
         label3.Text = "Incorrect password!";
         maskedTextBox1.Clear();
         maskedTextBox2.Clear();
     }
 }
예제 #14
0
 private void HandleSeverMessage()
 {
     if (Sever_Message.Count <= 0)
     {
         return;
     }
     Account.Account now = Sever_Message[0];
     Sever_Message.RemoveAt(0);
     Debug.Log(now.Type);
     if (now.Type == "Login")
     {
         AddPlayer(now.Name, "");
     }
     else if (now.Type == "Move")
     {
         MovePlayer(ref now);
     }
     else if (now.Type == "1")
     {
         ui.check_Login_no(10);
     }
     else if (now.Type == "0")
     {
         ui.check_Login_no(0);
     }
     else if (now.Type == "2")
     {
         ui.check_Login_no(1);
     }
     else if (now.Type == "3")
     {
         ui.check_Login_no(12);
     }
     else if (now.Type == "4")
     {
         ui.check_Login_no(11);
     }
 }
예제 #15
0
        static void Main(string[] args)
        {
            Console.WriteLine("**********Welcome to ___ Bank!**********");
            Console.Write("Do want to add Account? (y/n): ");
            char choice = Convert.ToChar(Console.ReadLine());

            Customer.Customer cust = new Customer.Customer();
            BL bl = new BL();

            Account.Account account = new Account.Account();

            if (choice.Equals('y') || choice.Equals('Y'))
            {
                account = bl.addAccount(ref cust);
            }
            else
            {
                //Console.WriteLine("Already have an account?\nEnter Account no: ");
            }

            bl.displayAccount(account);
            bl.selectOption(account);
        }
 public void CreateAccount(Account.Account account)
 {
     _accountStorage.AppendAccountToFile(account);
 }
예제 #17
0
파일: Manager.cs 프로젝트: Xaw4/mmtb2011-SE
 public void addAccount(Account acc)
 {
     accounts.Add(acc);
 }