public void UpdateIndicator(int index, string name, string equation, string format) { DataRow row = GlobalRow; if (name != null) { row["Indicator" + index.ToString() + "Name"] = name; } else { row["Indicator" + index.ToString() + "Name"] = DBNull.Value; } if (equation != null) { row["Indicator" + index.ToString() + "Equation"] = equation; } else { row["Indicator" + index.ToString() + "Equation"] = DBNull.Value; } if (format != null) { row["Indicator" + index.ToString() + "Format"] = format; } else { row["Indicator" + index.ToString() + "Format"] = DBNull.Value; } GlobalTable.AcceptChanges(); }
private void UpdateGlobalConfigTable(bool update_version) { DataRow row = GlobalRow; row["Version"] = update_version ? Config.Local.CurrentVersion : "0.0.0.0"; GlobalTable.AcceptChanges(); }
public void Update() { // check if data-base is already up-to-date. if (HistoryTable.Rows.Count > 0 && GlobalTable.Rows.Count > 0 && GlobalTable.Rows[0]["LastUpdate"] != DBNull.Value && ((DateTime)GlobalTable.Rows[0]["LastUpdate"]).ToShortDateString() == DateTime.Now.ToShortDateString()) { return; } // get stock's option list ArrayList list = null; // clear data-set Clear(); list = Comm.Server.GetHistoricalData(symbol, DateTime.Now.AddYears(-2), DateTime.Now); if (list == null || list.Count == 0) { return; } // begin updating data HistoryTable.BeginLoadData(); GlobalTable.BeginLoadData(); // clear data-set Clear(); foreach (History history in list) { // add option to table AddHistoryEntry(history); } // update time-stamp DataRow row = GlobalTable.NewRow(); row["Symbol"] = symbol; row["LastUpdate"] = DateTime.Now; GlobalTable.Rows.Add(row); // accept changes GlobalTable.AcceptChanges(); HistoryTable.AcceptChanges(); // end updating data GlobalTable.EndLoadData(); HistoryTable.EndLoadData(); // save history data-base Save(); }