private void CB50DMA_SelectedIndexChanged(object sender, EventArgs e) { if (UpdatedData) { DataTable dt; Dgv50_200.DataSource = null; if (CB50DMA.SelectedItem.ToString() == "200") { dt = ClsDataBase.GetBreakOutData(3); if (dt != null) { Dgv50_200.DataSource = dt; } } if (CB50DMA.SelectedItem.ToString() == "50") { dt = ClsDataBase.GetBreakOutData(2); if (dt != null) { Dgv50_200.DataSource = dt; } } if (CB50DMA.SelectedItem.ToString() == "50+200") { dt = ClsDataBase.GetBreakOutData(4); if (dt != null) { Dgv50_200.DataSource = dt; } } } }
private void UpdateDashBoard() { DataTable dt; int i = 0; try { Dates = ClsDataBase.GetDatesForDataDownload(ClsDataBase.GetConfigValue("LastDataDate"), null); } catch (Exception ex) { ClsLog.WriteLog("ERROR: Load Function, DashBoard module: " + ex.Message); } if (Dates.Count == 0) { UpdatedData = true; label1.ForeColor = Color.Green; label1.Text = "Data is up to date!!"; LabDates.Visible = false; BtnGetData.Enabled = false; BtnJson.Enabled = false; groupBox3.Enabled = true; groupBox4.Enabled = true; groupBox5.Enabled = true; groupBox6.Enabled = true; groupBox8.Enabled = true; Grv.Enabled = true; } else { UpdatedData = false; label1.ForeColor = Color.Red; label1.Text = "Data to be downloaded for the dates(" + Dates.Count.ToString() + ") :"; BtnGetData.Enabled = true; BtnJson.Enabled = true; groupBox3.Enabled = false; groupBox4.Enabled = false; groupBox5.Enabled = false; groupBox6.Enabled = false; groupBox8.Enabled = false; Grv.Enabled = false; } foreach (var Date in Dates) { if (i <= 3) { LabDates.Text = LabDates.Text + Date.Date.Day.ToString() + "-" + Date.Date.Month.ToString() + ", "; i++; } else { LabDates.Text = LabDates.Text.Remove(LabDates.Text.Length - 2); LabDates.Text = LabDates.Text + " + " + (Dates.Count - i).ToString() + " More"; break; } } if (UpdatedData) { dt = ClsDataBase.GetBreakOutData(1); if (dt != null) { DgvAllDma.DataSource = dt; } PanUpdateEOD.Visible = false; dt = ClsDataBase.GetBreakOutData(2); if (dt != null) { Dgv50_200.DataSource = dt; } dt = ClsDataBase.GetBreakOutData(5); if (dt != null) { DgvGCross.DataSource = dt; } dt = ClsDataBase.GetSwingScriptData(); if (dt != null) { DgvSwing.DataSource = dt; } dt = ClsDataBase.GetSwingThit(true); foreach (DataRow item in dt.Rows) { RTxtSwing.AppendText("It's Time to BUY:" + item[0].ToString() + " CP:" + item[1].ToString()); RTxtSwing.AppendText(Environment.NewLine); } RTxtSwing.Select(0, RTxtSwing.Text.Length); RTxtSwing.SelectionColor = Color.Green; dt = ClsDataBase.GetSwingThit(false); var txtLenth = RTxtSwing.Text.Length; foreach (DataRow item in dt.Rows) { RTxtSwing.AppendText("It's Time to SELL:" + item[0].ToString() + " CP:" + item[1].ToString()); RTxtSwing.AppendText(Environment.NewLine); } RTxtSwing.Select(txtLenth, RTxtSwing.Text.Length - txtLenth); RTxtSwing.SelectionColor = Color.Red; } else { PanUpdateEOD.Visible = true; } LabDataDetails.Text = "Latest Data Date: " + ClsDataBase.GetConfigValue("LastDataDate"); }