Пример #1
0
        public IActionResult ListAccounts()
        {
            var database = new Database();
            var session  = Request.Cookies["SESSION_ID"];
            ProfileInterface Verified = database.VerifySession(session);

            //Check if Verified is a TellerProfile type object, this means the session is valid
            if (Verified?.profile_type != ProfileInterface.ProfileType.TELLER)
            {
                return(View("Denied"));
            }
            List <Dictionary <string, string> > acct_list = new List <Dictionary <string, string> >();
            var userid = Request.Query["username"];

            ViewBag.lookup = userid;
            var Account_lookup = database;

            Console.WriteLine(userid);
            var cust_accounts = Account_lookup.CustomerAcctList(userid);

            foreach (AccountInterface account in cust_accounts)
            {
                acct_list.Add(account.toDict());
            }
            ViewBag.accounts = acct_list;
            return(View());
        }
Пример #2
0
        private void ProfileButton_Click(object sender, EventArgs e)
        {
            if (profileForm.IsDisposed)
                profileForm = new ProfileInterface();
            profileForm.Show();

        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();
            _writer = new TextBoxStreamWriter(LogOutput);
            Console.SetOut(_writer);

            CardTemplate.DatabasePath = System.IO.Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\";
            CardTemplate.LoadAll();
            StreamReader str       = new StreamReader(CardTemplate.DatabasePath + "Bots/SmartCC/Config/useProfiles");
            string       useDefaut = str.ReadLine();

            str.Close();

            if (useDefaut == "true")
            {
                string star = CardTemplate.DatabasePath;
                Application.EnableVisualStyles();
                Application.Run(new ProfileSelector(CardTemplate.DatabasePath));
            }
            else
            {
                using (CodeCompiler compiler = new CodeCompiler(CardTemplate.DatabasePath + "Bots\\SmartCC\\Profiles\\Defaut\\", CardTemplate.DatabasePath))
                {
                    if (compiler.Compile())
                    {
                    }
                }
                String path = CardTemplate.DatabasePath + "Bots/SmartCC/Profile.current";
                using (var stream = new FileStream(path, FileMode.Truncate))
                {
                    using (var writer = new StreamWriter(stream))
                    {
                        writer.WriteLine("Defaut");
                        writer.Close();
                    }
                }
            }
            s = new Simulation();
            ValuesInterface.LoadValuesFromFile();
            ProfileInterface.LoadBehavior();

            Seed            = new Board();
            Seed.HeroEnemy  = Card.Create("HERO_01", true, GenerateId());
            Seed.HeroFriend = Card.Create("HERO_02", false, GenerateId());

            Seed.HeroFriend.CurrentHealth = 30;
            Seed.HeroFriend.MaxHealth     = 30;

            Seed.HeroEnemy.CurrentHealth = 30;
            Seed.HeroEnemy.MaxHealth     = 30;

            Seed.ManaAvailable = 10;

            ClearUI(ActionDenotator.NEW);
            UpdateUI();
        }
Пример #4
0
        //Route for the Transfer Page site/Teller/Transfer
        public IActionResult Transfer()
        {
            var              session   = Request.Cookies["SESSION_ID"];
            Database         Test_Auth = new Database();
            ProfileInterface Verified  = Test_Auth.VerifySession(session);

            //Check if Verified is a TellerProfile type object, this means the session is valid
            if (Verified?.profile_type != ProfileInterface.ProfileType.TELLER &&
                Verified?.profile_type != ProfileInterface.ProfileType.ADMIN)
            {
                return(View("Denied"));
            }


            var my_interface = Test_Auth.VerifySession(session);

            // TEST PURPOSES ONLY - REMOVE
            Test_Auth.setCurrentCustomer("clay", session);

            var customer = Test_Auth.getCurrentCustomer(session);

            if (customer == my_interface.username)
            {
                return(RedirectToAction("Dashboard", "Teller")); // if you're not helping someone, go back to dashboard
            }
            ViewBag.cust     = customer;
            ViewBag.searched = "yes";
            ViewBag.Accounts = ((TellerProfile)my_interface).ListAccounts(customer);


            if (Request.HasFormContentType)
            {
                if (!String.IsNullOrEmpty(Request.Form["username"]))
                {
                    ViewBag.cust     = customer;
                    ViewBag.searched = "yes";
                    ViewBag.Accounts = ((TellerProfile)my_interface).ListAccounts(customer);
                }
                //At this point there should be an acctFrom in the title. this is just a sanity check
                //To make sure we don't run this on page load.
                if (!String.IsNullOrEmpty(Request.Form["acctTo"]))
                {
                    ((TellerProfile)my_interface)?.Transfer(Convert.ToInt32(Request.Form["acctTo"]),
                                                            Convert.ToInt32(Request.Form["acctFrom"]), Convert.ToDecimal(Request.Form["amount"]));
                    ViewBag.To   = Request.Form["acctTo"];
                    ViewBag.amt  = Request.Form["amount"];
                    ViewBag.From = Request.Form["acctFrom"];
                    ViewBag.type = "Transfer";
                    return(View("Transaction"));
                }
            }

            ViewBag.User = my_interface.username;
            return(View());
        }
Пример #5
0
        public IActionResult Dashboard()
        {
            var database = new Database();

            ViewBag.Title = "Employee Dashboard";
            if (Request.Path.Value.ToString().ToLower().EndsWith('/'))
            {
                ViewBag.path = ".";
            }
            else
            {
                ViewBag.path = "./Teller";
            }
            var type    = "";
            var session = Request.Cookies["SESSION_ID"];
            ProfileInterface Verified = database.VerifySession(session);

            if (Verified == null)
            {
                return(View("Denied"));
            }
            else if (Verified.profile_type == ProfileInterface.ProfileType.CUSTOMER)
            {
                return(View("Denied"));
            }
            else if (Verified.profile_type == ProfileInterface.ProfileType.TELLER)
            {
                type = "Teller";
                ViewBag.user_role = "Teller";
            }
            else if (Verified.profile_type == ProfileInterface.ProfileType.ADMIN)
            {
                type = "Admin";
                ViewBag.user_role = "Admin";
            }
            else
            {
                return(View("Denied"));
            }
            if (ViewBag.set_username != "true")
            {
                ViewBag.LS = "";
            }
            ViewBag.User        = Verified.username;
            ViewBag.user_header = Verified.username;
            if (Request.HasFormContentType)
            {
                ViewBag.LS           = Request.Form["username"];
                ViewBag.set_username = "******";
                ViewBag.info         = database.CustomerLookup(Request.Form["username"], type);
            }
            return(View());
        }
Пример #6
0
        public IActionResult AccountDashboard(int account_number)
        {
            var database = new Database();
            var session  = Request.Cookies["SESSION_ID"];
            ProfileInterface Verified = database.VerifySession(session);
            var username = Verified.username;

            ViewBag.Title       = "Account Dashboard";
            ViewBag.user_header = username;
            var number               = account_number;
            var customer_served      = database.getCurrentCustomer(session);
            AccountInterface account = database.getAccount(number, customer_served);

            ViewBag.account = account;
            switch (Verified.profile_type)
            {
            case ProfileInterface.ProfileType.ADMIN: ViewBag.user_role = "Admin"; break;

            case ProfileInterface.ProfileType.TELLER: ViewBag.user_role = "Teller"; break;

            case ProfileInterface.ProfileType.CUSTOMER: ViewBag.user_role = "User"; break;
            }
            List <TransactionInterface> transactions = database.ListTransactions(account.accountNumber());

            foreach (TransactionInterface transaction in transactions)
            {
                account.addTransaction(transaction);
            }
            ViewBag.account_type = "Unknown";
            switch (account.getAccountType())
            {
            case AccountType.CHECKING:
                ViewBag.account_type = "Checking";
                break;

            case AccountType.MONEY_MARKET:
                ViewBag.account_type = "Money Market";
                break;

            case AccountType.MORTGAGE:
                ViewBag.account_type = "Mortgage";
                break;

            case AccountType.CREDIT:
                ViewBag.account_type = "Credit";
                break;

            case AccountType.SAVINGS:
                ViewBag.account_type = "Savings";
                break;
            }
            return(View());
        }
Пример #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            s.CreateLogFolder();
            s.SeedSimulation(root);

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            ValuesInterface.LoadValuesFromFile();
            ProfileInterface.LoadBehavior();
            s.Simulate(false);

            stopWatch.Stop();
            Console.WriteLine("Simulation stopped after :" + (stopWatch.ElapsedMilliseconds / 1000.0f).ToString());
        }
Пример #8
0
        public IActionResult Edit()
        {
            var database = new Database();
            var session  = Request.Cookies["SESSION_ID"];
            ProfileInterface Verified = database.VerifySession(session);

            //Check if Verified is a TellerProfile type object, this means the session is valid
            if (Verified.profile_type != ProfileInterface.ProfileType.TELLER)
            {
                return(View("Denied"));
            }
            var acct = Request.Query["acct"];

            ViewBag.num          = acct;
            ViewBag.transactions = database.ListTransactions(Convert.ToInt32(acct));
            return(View());
        }
Пример #9
0
        public IActionResult Transaction(string To, string amt, string From)
        {
            var              session  = Request.Cookies["SESSION_ID"];
            Database         data     = new Database();
            ProfileInterface Verified = data.VerifySession(session);

            //Check if Verified is a TellerProfile type object, this means the session is valid
            if (Verified?.profile_type != ProfileInterface.ProfileType.TELLER &&
                Verified?.profile_type != ProfileInterface.ProfileType.ADMIN)
            {
                return(View("Denied"));
            }
            else
            {
                ViewBag.ResultDict = ((TellerProfile)Verified).AddAmount(Convert.ToInt32(ViewBag.To), Convert.ToDecimal(ViewBag.amt));
                return(View());
            }
        }
Пример #10
0
 public UserProfileController(ProfileInterface data)
 {
     this.data = data;
 }
Пример #11
0
        public IActionResult Dashboard()
        {
            var session  = Request.Cookies["SESSION_ID"];
            var database = new Database();
            ProfileInterface Verified = database.VerifySession(session);
            var username = Verified.username;

            ViewBag.Title       = "Customer Dashboard";
            ViewBag.user_header = username;
            var customer_served = database.getCurrentCustomer(session);

            if (Verified.profile_type == ProfileInterface.ProfileType.TELLER ||
                Verified.profile_type == ProfileInterface.ProfileType.ADMIN)
            {
                ViewBag.allowed = true;
            }
            else
            {
                ViewBag.allowed = false;
            }

            if (Verified.profile_type == ProfileInterface.ProfileType.ADMIN)
            {
                ViewBag.isAdmin = true;
            }
            else
            {
                ViewBag.isAdmin = false;
            }

            switch (Verified.profile_type)
            {
            case ProfileInterface.ProfileType.ADMIN: ViewBag.user_role = "Admin"; break;

            case ProfileInterface.ProfileType.TELLER: ViewBag.user_role = "Teller"; break;

            case ProfileInterface.ProfileType.CUSTOMER: ViewBag.user_role = "User"; break;
            }

            ViewBag.full_name = database.GetFullName(customer_served);
            if (ViewBag.full_name != null)
            {
                ViewBag.accounts = database.CustomerAcctList(customer_served);
                foreach (AccountInterface account in ViewBag.accounts)
                {
                    List <TransactionInterface> transactions = database.ListTransactions(account.accountNumber());
                    int count = 0;
                    foreach (TransactionInterface transaction in transactions)
                    {
                        if (count < 5)
                        {
                            account.addTransaction(transaction);
                            count++;
                        }
                    }
                }
                ViewBag.isCustomer = true;
            }
            else
            {
                ViewBag.full_name  = database.GetEmployeeName(customer_served);
                ViewBag.isCustomer = false;
            }

            ViewBag.current_customer = customer_served;

            return(View());
        }
Пример #12
0
        public IActionResult Bill()
        {
            CustomerProfile  custprof  = null;
            var              session   = Request.Cookies["SESSION_ID"];
            Database         Test_Auth = new Database();
            ProfileInterface Verified  = Test_Auth.VerifySession(session);

            //Check if Verified is a TellerProfile type object, this means the session is valid
            if (Verified?.profile_type != ProfileInterface.ProfileType.CUSTOMER &&
                Verified?.profile_type != ProfileInterface.ProfileType.TELLER &&
                Verified?.profile_type != ProfileInterface.ProfileType.ADMIN)
            {
                return(View("Denied"));
            }


            var my_interface = Test_Auth.VerifySession(session);

            var customer = Test_Auth.getCurrentCustomer(session);

            ViewBag.cust = customer;
            if (Verified.profile_type != ProfileInterface.ProfileType.CUSTOMER)
            {
                custprof         = new CustomerProfile(customer);
                ViewBag.Accounts = custprof.ListAccounts();
            }
            else
            {
                ViewBag.Accounts = ((CustomerProfile)my_interface).ListAccounts();
            }
            ViewBag.searched = "yes";

            if (Request.HasFormContentType)
            {
                if (!String.IsNullOrEmpty(Request.Form["username"]))
                {
                    ViewBag.cust     = customer;
                    ViewBag.searched = "yes";
                    if (Verified.profile_type != ProfileInterface.ProfileType.CUSTOMER)
                    {
                        custprof         = new CustomerProfile(customer);
                        ViewBag.Accounts = custprof.ListAccounts();
                    }
                    else
                    {
                        ViewBag.Accounts = ((CustomerProfile)my_interface).ListAccounts();
                    }
                }
                //At this point there should be an acctFrom in the title. this is just a sanity check
                //To make sure we don't run this on page load.
                if (!String.IsNullOrEmpty(Request.Form["acctTo"]))
                {
                    Test_Auth.WithdrawAmt(Convert.ToInt32(Request.Form["acctFrom"]), Convert.ToDecimal(Request.Form["amount"]), "Bill Pay");
                    Test_Auth.WithdrawAmt(Convert.ToInt32(Request.Form["acctTo"]), Convert.ToDecimal(Request.Form["amount"]), "Bill Pay");

                    ViewBag.To   = Request.Form["acctTo"];
                    ViewBag.amt  = Request.Form["amount"];
                    ViewBag.From = Request.Form["acctFrom"];
                    ViewBag.type = "Bill Pay";
                    return(View("Transaction"));
                }
            }

            ViewBag.User = my_interface.username;
            return(View());
        }
Пример #13
0
 public ProfileController(ProfileInterface iProfileData)
 {
     _iProfileData = iProfileData;
 }