public ActionResult Invest(GetSetData i) { //Takes the information from the database Coins //AsNoTracking is used to create snapshot of database table youre working with List <Coin> TempData = db.Coins.AsNoTracking().ToList(); //This filters through the snapshot by the USD that is less than amount entered. //Saves it in list named tp List <Coin> tp = TempData.Where(x => double.Parse(x.usd) <= i.Amount).ToList(); //after filtering by amount we now filter by the risk //if risk is low we take the bottom bottom standarddeviation which is 30% if (i.Risk.ToLower() == "low") { tp = tp.Where(x => x.stdv < 0.3).ToList(); } else if (i.Risk.ToLower() == "medium") { tp = tp.Where(x => x.stdv >= 0.3 && x.stdv < 0.6).ToList(); } else if (i.Risk.ToLower() == "high") { tp = tp.Where(x => x.stdv >= 0.6).ToList(); } return(View(tp)); }
//public ActionResult Questions(GetSetData i) //{ // ViewBag.Message = "Your Start page."; // ViewBag.Amount = i.Amount; // ViewBag.Period = i.Period; // ViewBag.Risk = i.Risk; // ViewBag.Growth = i.Growth; // return View(); //} public ActionResult Results(GetSetData i) { ViewBag.Message = "Your Start page."; ViewBag.Amount = i.Amount; ViewBag.Period = i.Period; ViewBag.Risk = i.Risk; ViewBag.Growth = i.Growth; return(View()); }
protected override void OnStartup(StartupEventArgs e) { string theme = GetSetData.GetSetting("Theme"); string image = $"Images/Splash{theme.Replace(".xaml","")}.png"; SplashScreen splash = new SplashScreen(image); splash.Show(true, true); base.OnStartup(e); }
public static string GetImagePath() { string rootPath = GetSetData.GetSetting("RootImagePath"); string imagePath = GetSetData.GetSetting("ImagePath"); string fullpath = Path.Combine( rootPath, AudioStates.Genre, imagePath); return(fullpath); }
public void DefineProcess(string ids) { MyProcess p = new MyProcess(); p.StartInfo.FileName = GetSetData.GetSetting("RecordEditorLocation"); p.StartInfo.Arguments = ids; p.EnableRaisingEvents = true; p.Exited += new EventHandler(myProcess_HasExited); p.Start(); p.WaitForInputIdle(); }
public static void CheckSongPathExist() { Mouse.OverrideCursor = Cursors.Wait; List <string> notValidPath = new List <string>(); Views.MyMessageBox messageBox = new Views.MyMessageBox(); var pathlist = GetSetData.GetSongPathList(); bool found = true; if (pathlist != null) { foreach (var p in pathlist) { if (!Directory.Exists(p)) { notValidPath.Add(p); found = false; } } } else { found = false; messageBox.MMessage = $"Pathlist is empty!"; } if (found == false) { messageBox.MMessage = $"This path was not found!\n{String.Join(Environment.NewLine, notValidPath)}"; } else { messageBox.MMessage = $"All path are valid."; } Mouse.OverrideCursor = Cursors.Arrow; messageBox.MTitle = "Check Song Path"; messageBox.ShowDialog(); }
public static bool CheckSongPathExistAsync() { List <string> notValidPath = new List <string>(); var pathlist = GetSetData.GetSongPathList(); bool found = true; if (pathlist != null) { foreach (var p in pathlist) { Debug.Print($"path={p}"); if (!Directory.Exists(p)) { Debug.Print(p); found = false; break; } } } else { found = false; } if (found == false) { Views.MyMessageBox messageBox = new Views.MyMessageBox(); messageBox.MTitle = "Check Song Path"; messageBox.MMessage = "No song path found!\n\nExit Application."; var result = messageBox.ShowDialog(); } return(found); }
//} //public ActionResult GetCoinHistory() //{ // string url = "https://coinbin.org/coins/history"; // HttpWebRequest request = HttpWebRequest.CreateHttp(url); // request.UserAgent = @"User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 OPR/38.0.2220.41"; // HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // StreamReader rd = new StreamReader(response.GetResponseStream()); // string data = rd.ReadToEnd(); // JObject o = JObject.Parse(data); // List<JToken> coins = o["history"].ToList(); // lcn = new List<Coin>(); // coins. // return View(); //} public ActionResult Invest(GetSetData i) { List <Coin> TempData = db.Coins.AsNoTracking().ToList(); List <Coin> tp = TempData.Where(x => double.Parse(x.usd) <= i.Amount).ToList(); if (i.Risk.ToLower() == "low") { tp = tp.Where(x => x.stdv < 0.3).ToList(); } else if (i.Risk.ToLower() == "medium") { tp = tp.Where(x => x.stdv >= 0.3 && x.stdv < 0.6).ToList(); } else if (i.Risk.ToLower() == "high") { tp = tp.Where(x => x.stdv >= 0.6).ToList(); } //(from elt in db.Coins.Where(x => int.Parse( x.usd )< i.Amount) select elt).ToList(); //Where(x => double.Parse(x.usd) >= amount); if (i.Amount != null) { return(View(tp)); } else { return(View(TempData)); } }