Esempio n. 1
0
        //GET: Account/Profiler
        public async Task <ActionResult> Profiler()
        {
            if (ModelState.IsValid)
            {
                ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());

                if (user.FirstLoginFlag == true && user.PhoneNumberConfirmed == false)
                {
                    return(RedirectToAction("AddPhoneNumber", "Manage"));
                }

                Plaid plaid = new Plaid
                {
                    User = user
                };
                try { await plaid.GetAccountList(); }
                catch { }

                ViewBag.Message = TempData["result"] as string;

                return(View(plaid));
            }

            return(View());
        }
Esempio n. 2
0
        public async Task <ActionResult> AccountSync()
        {
            ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());

            if (user.FirstLoginFlag == true && user.PhoneNumberConfirmed == false)
            {
                return(RedirectToAction("AddPhoneNumber", "Manage"));
            }

            Plaid plaid = new Plaid
            {
                User = user
            };

            try
            {
                await plaid.GetAccountList();

                plaid.p_token = plaid.Reauthaccounts.FirstOrDefault().access_token ?? "";
            }
            catch { }
            ViewBag.Message = TempData["result"] as string;

            return(View(plaid));
        }
Esempio n. 3
0
        //
        // GET: Dashboard/Main
        public async Task <ActionResult> Main()
        {
            if (user.FirstLoginFlag == true && user.PhoneNumberConfirmed == false)
            {
                return(RedirectToAction("AddPhoneNumber", "Manage"));
            }
            if (user.FirstLoginFlag == true)
            {
                return(RedirectToAction("AccountSync", "Account"));
            }

            Plaid plaid = new Plaid
            {
                User       = user,
                Start_date = Session["startdate"] as string,
                End_date   = Session["enddate"] as string
            };

            var transaction_list = Session["transactions"] as List <User_Transactions>;

            if (transaction_list is null)
            {
                await plaid.GetAccountList();

                if (plaid.Reauthaccounts.Count != 0)
                {
                    return(RedirectToAction("AccountSync", "Account"));
                }
                plaid.GetTransactions();
                Session["transactions"]    = plaid.Transaction_list;
                Session["BarChart"]        = plaid.BarChart;
                Session["DonutChart"]      = plaid.DonutChart;
                Session["AccountList"]     = plaid.Account_list;
                Session["Assets"]          = plaid.Assets;
                Session["Liabilities"]     = plaid.Liabilities;
                Session["NetWorth"]        = plaid.NetWorth;
                Session["InstitutionList"] = plaid.InstitutionList;
            }
            else
            {
                plaid.Transaction_list = transaction_list;
                plaid.BarChart         = Session["BarChart"] as List <BarChartData>;
                plaid.DonutChart       = Session["DonutChart"] as List <DonutChartData>;
                plaid.SelectedAccount  = (Session["SelectedAccount"] as string) ?? "All Accounts";
                plaid.Start_date       = (Session["startdate"] as string) ?? DateTime.Today.AddMonths(-1).ToShortDateString();
                plaid.End_date         = (Session["enddate"] as string) ?? DateTime.Today.ToShortDateString();

                plaid.Account_list    = Session["AccountList"] as List <User_Accounts>;
                plaid.Assets          = Session["Assets"] as string;
                plaid.Liabilities     = Session["Liabilities"] as string;
                plaid.NetWorth        = Session["NetWorth"] as string;
                plaid.InstitutionList = Session["InstitutionList"] as List <Institution>;

                plaid.DonutDataSum(plaid.DonutChart);
            }

            return(View(plaid));
        }
Esempio n. 4
0
        public async Task <RedirectToRouteResult> Account(string xyz)
        {
            Plaid plaid = new Plaid
            {
                User       = user,
                Start_date = Session["startdate"] as string,
                End_date   = Session["enddate"] as string
            };

            try
            {
                DateTime start_date = DateTime.Parse(plaid.Start_date);
                DateTime end_date   = DateTime.Parse(plaid.End_date);

                plaid.GetTransactions(start_date, end_date, xyz);
            }

            catch
            {
                DateTime?start_date = null;
                DateTime?end_date   = null;

                plaid.GetTransactions(start_date, end_date, xyz);
            }

            await plaid.GetAccountList();

            var accountlist = plaid.Account_list;
            var chartdata   = plaid.BarChart;
            var donutdata   = plaid.DonutChart;
            var networth    = plaid.NetWorth;

            Session["BarChart"]        = chartdata;
            Session["DonutChart"]      = donutdata;
            Session["AccountList"]     = accountlist;
            Session["Assets"]          = plaid.Assets;
            Session["Liabilities"]     = plaid.Liabilities;
            Session["NetWorth"]        = networth;
            Session["transactions"]    = plaid.Transaction_list;
            Session["SelectedAccount"] = plaid.SelectedAccount;
            Session["AccountID"]       = xyz;

            return(RedirectToAction("Main"));
        }