Ejemplo n.º 1
0
 public void RefreshData()
 {
     m_isconnect = IsConnected() ? true : false;
     if (m_isconnect)
     {
         var acct = DataServiceAPI.DownloadData("IB/Account");
         PortfolioData.AccountData = JsonConvert.DeserializeObject <IEnumerable <IBAccountModel> >(acct);
         var port = DataServiceAPI.DownloadData("IB/Portfolio");
         PortfolioData.Portfolio = JsonConvert.DeserializeObject <IEnumerable <IBPortfolioModel> >(port);
         var cashstart = DataServiceAPI.DownloadData("IB/CashBalanceStart");
         PortfolioData.AUMSinceIncp = Convert.ToDouble(cashstart);
         var strats = DataServiceAPI.DownloadData("IB/Strategy");
         PortfolioData.AllAvailableStrategies = JsonConvert.DeserializeObject <IEnumerable <IBStrategy> >(strats).Select(x => x.StrategyName).ToList();
         var mktsummary = DataServiceAPI.DownloadData("MD/GetMarketSummary");
         MktSummaryTickers = JsonConvert.DeserializeObject <IEnumerable <MktData> >(mktsummary).ToList();
     }
 }
Ejemplo n.º 2
0
        public ActionResult Login(LoginVM entity)
        {
            try
            {
                if (entity.Username == null || entity.Password == null)
                {
                    TempData["ErrorMSG"] = "Access Denied! Invalid Credential";
                    return(View(entity));
                }
                if (!ModelState.IsValid)
                {
                    return(View(entity));
                }
                string result  = DataServiceAPI.DownloadData($"/IB/Authen/{entity.Username}/{entity.Password}");
                bool   isLogin = Convert.ToBoolean(result);
                if (isLogin)
                {//Login Success
                 //For Set Authentication in Cookie (Remeber ME Option)
                    SignInRemember(entity.Username, entity.isRemember);

                    //Set A Unique ID in session
                    Session["UserID"] = entity.Password;

                    // If we got this far, something failed, redisplay form
                    // return RedirectToAction("Index", "Dashboard");
                    return(RedirectToLocal(entity.ReturnURL));
                }
                else
                {
                    TempData["ErrorMSG"] = "Access Denied! Wrong Credential";
                    return(View(entity));
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMSG"] = ex.Message;
                return(View(entity));
            }
        }
Ejemplo n.º 3
0
 private bool IsConnected()
 {
     return(Convert.ToBoolean(DataServiceAPI.DownloadData("IB/IsConnected")));
 }
Ejemplo n.º 4
0
 public ActionResult LogoutAccount()
 {
     DataServiceAPI.DownloadData("IB/logout");
     DataServiceAPI.DownloadData("MD/logout");
     return(Json("Request sent", JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 5
0
 public ActionResult LoginAccount()
 {
     DataServiceAPI.DownloadData($"MD/login/{MDPort}/{MDId}");
     DataServiceAPI.DownloadData($"IB/login/{IBPort}/{IBId}");
     return(Json("Request sent", JsonRequestBehavior.AllowGet));
 }