private void button_analyze_juristic_Click(object sender, EventArgs e) { PageJuristic stk = new PageJuristic("foreign_"); db_manager.DBConnect(); //DateTime last_date = stk.getLastDBDate(db_manager); juristic_days = (int)long.Parse(textBox_jur_period.Text); int view_days = getViewDays(juristic_days); jti = stk.GetStockTradeHistory(db_manager.getConnection(), comboBox_source.SelectedIndex + 1, view_days); AnaLyzeJuristic(jti, juristic_days); panel_juristic.Invalidate(); }
public DateTime getLastUpdateDate() { StockPage stk = new StockPage(); DateTime stk_date = stk.getLastDBDate(this, "2379"); Logger.v("Stock database last date:" + String.Format("{0}", stk_date)); PageJuristic foreign = new PageJuristic("foreign_"); DateTime foreign_date = foreign.getLastDBDate(this); Logger.v("Foreign database last date:" + String.Format("{0}", foreign_date)); DateTime res = foreign_date.CompareTo(stk_date) > 0 ? stk_date : foreign_date; Debug.WriteLine("Last DB date : " + res.ToShortDateString()); return(res); }
public void DBConnect() { string myConnectionString = "server=localhost;uid=shang;" + "pwd=king3697;database=twstock;"; try { conn = new MySql.Data.MySqlClient.MySqlConnection(); conn.ConnectionString = myConnectionString; conn.Open(); } catch (MySql.Data.MySqlClient.MySqlException ex) { try { setupUser(); SetupDatabase(); conn.Open(); } catch (MySql.Data.MySqlClient.MySqlException ex_in) { } } StockPage sp = new StockPage(); PageJuristic jp = new PageJuristic("foreign_"); sp.SetupDatebase(conn); jp.SetupDatebase(conn); CompanyProfilePage cpp = new CompanyProfilePage(); cpp.SetupDatebase(conn); cpp.SetupEarningDatebase(conn); UserManager userManager = new UserManager(); userManager.SetupDatebase(conn); }