日期:2014-05-18 浏览次数:21340 次
public class FlowSize { public long up; public long down; public long flow; public long daysum; public long monthsum; public FlowSize() { this.down = 0; this.up = 0; } public void clear() { this.down = 0; this.up = 0; } public bool Isempty() { if ((this.down == 0) && (this.up == 0)) return true; else return false; } public static bool WriteDebugLog = true; public static int TimeWaitCloseMainWindow = 30; public static int TimeWaitClose = 30; public static int TimeWaitKillProcess = 30; }
public static void Refresh_TempData(FlowSize grab_flow) { DateTime time = DateTime.Now; string dbpath = Application.StartupPath + @"\FlowDB.mdb"; OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + dbpath); long flow = 0; FlowSize grab, real; grab = new FlowSize(); real = new FlowSize(); try { con.Open(); OleDbCommand cmd = con.CreateCommand(); cmd.CommandText = "select * from FlowPerMonth where cstr(YearMonth) = '" + GetStandardYM(time)+ "'"; OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { flow = Convert.ToInt64(reader["User_GB"].ToString()) * num + Convert.ToInt64(reader["User_B"].ToString()); } reader.Close(); cmd.CommandText = "select * from FlowPerday where cstr(FlowData) ='" + GetStandardYMD(time) + "'"; reader = cmd.ExecuteReader(); while (reader.Read()) { grab.up += Convert.ToInt64(reader["Grab_up_GB"].ToString()) * num + Convert.ToInt64(reader["Grab_up_B"].ToString()); grab.down += Convert.ToInt64(reader["Grab_down_GB"].ToString()) * num + Convert.ToInt64(reader["Grab_down_B"].ToString()); } reader.Close(); con.Close(); UpdateWindow.UpdateFlowMonth(flow+grab_flow.up+grab_flow.down); UpdateWindow.UpdateFlowPerDay(grab.up+grab_flow.up, grab.down+grab_flow.down); } catch (Exception ee) { Flowfairy.FairyLog.WriteLog(ee.ToString()); } }