protected void Enregistrer(object sender, EventArgs e) { AffichageBD.AfficheBD hello = new AffichageBD.AfficheBD(); double[] compo = new double[4]; double compo_SP = double.Parse(TextBox1.Text); compo[0] = compo_SP; double compo_ftse = double.Parse(TextBox2.Text); compo[1] = compo_ftse; double compo_euro = double.Parse(TextBox3.Text); compo[2] = compo_euro; double compo_nikkei = double.Parse(TextBox4.Text); compo[3] = compo_nikkei; String now = DateTime.Now.ToString("dd/MM/yy"); hello.setCompo(compo, now); }
protected void Simulate(object sender, EventArgs e) { AffichageBD.AfficheBD hello = new AffichageBD.AfficheBD(); //for (int d = 0; d < 4; d++) //{ Button tmp = (Button)sender; int d; double lastSpot =0.0; double firstSpot = 0.0; int ind = hello.searchDate(DateTime.Now); if (tmp.ID.Equals("first")) { d = 0; Chart1.Titles.Add("Evolution du cours du Footsie"); for (int j = 0; j < ind; ++j) { if (hello.Spot[d][j] != 0) { Chart1.Series[0].Points.AddXY(hello.Dates[j], hello.Spot[d][j]); lastSpot = hello.Spot[d][j]; if (firstSpot == 0) { firstSpot = hello.Spot[d][j]; } } } double perf = Math.Round(100.0 * (lastSpot - firstSpot) / firstSpot, 2); Perf_Asset.Text = perf.ToString() + "%"; Asset.Style.Add(HtmlTextWriterStyle.Display, "inline"); } else if (tmp.ID.Equals("second")) { d = 1; Chart1.Titles.Add("Evolution du cours du S&P 500"); for (int j = 0; j < ind; ++j) { if (hello.Spot[d][j] != 0) { Chart1.Series[0].Points.AddXY(hello.Dates[j], hello.Spot[d][j]); lastSpot = hello.Spot[d][j]; if (firstSpot == 0) { firstSpot = hello.Spot[d][j]; } } } double perf = Math.Round(100.0 * (lastSpot - firstSpot) / firstSpot, 2); Perf_Asset.Text = perf.ToString() + "%"; Asset.Style.Add(HtmlTextWriterStyle.Display, "inline"); } else if (tmp.ID.Equals("third")) { d = 2; Chart1.Titles.Add("Evolution du cours du Nikkei"); for (int j = 0; j < ind; ++j) { if (hello.Spot[d][j] != 0) { Chart1.Series[0].Points.AddXY(hello.Dates[j], hello.Spot[d][j]); lastSpot = hello.Spot[d][j]; if (firstSpot == 0) { firstSpot = hello.Spot[d][j]; } } } double perf = Math.Round(100.0 * (lastSpot - firstSpot) / firstSpot, 2); Perf_Asset.Text = perf.ToString() + "%"; Asset.Style.Add(HtmlTextWriterStyle.Display, "inline"); } else if (tmp.ID.Equals("fourth")) { d = 3; Chart1.Titles.Add("Evolution du cours du Eurostoxx"); for (int j = 0; j < ind; ++j) { if (hello.Spot[d][j] != 0) { Chart1.Series[0].Points.AddXY(hello.Dates[j], hello.Spot[d][j]); lastSpot = hello.Spot[d][j]; if (firstSpot == 0) { firstSpot = hello.Spot[d][j]; } } } double perf = Math.Round(100.0 * (lastSpot - firstSpot) / firstSpot, 2); Perf_Asset.Text = perf.ToString() + "%"; Asset.Style.Add(HtmlTextWriterStyle.Display, "inline"); } //} //simulation.Style.Add(HtmlTextWriterStyle.Display, "none"); }