public void QueueWork(object sender, WorkQueue <Dictionary <string, Dictionary <string, Dictionary <string, string> > > > .EnqueueEventArgs e) { if (this.con == null || this.con.State != ConnectionState.Open) { if (this.con != null) { try { this.con.Close(); } catch (Exception) { } } try { if (DBUrl.SERVERMODE) { this.con = this.getConnection(); } else { string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DBUrl.DEFAULT_HOST_PATH + ";Jet OLEDB:Database Password="******"DBERROR~~~~~~~~~~~DBERROR : " + ex.Message + "\n" + ex.StackTrace); } } try { Dictionary <string, Dictionary <string, Dictionary <string, string> > > item = e.Item; foreach (KeyValuePair <string, Dictionary <string, Dictionary <string, string> > > current in item) { string key = current.Key; Dictionary <string, Dictionary <string, string> > value = current.Value; InSnergyGateway.RefreshGateWay(key, value, this.con); if (GateWayRefreshQueue.CBWork != null) { GateWayRefreshQueue.CBWork(key); } } } catch (Exception ex2) { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~DBERROR : " + ex2.Message + "\n" + ex2.StackTrace); } }
public static int Insertnewtask(Dictionary <string, Dictionary <string, Dictionary <string, string> > > dic_item) { int result; try { if (GateWayRefreshQueue.wq == null) { GateWayRefreshQueue.wq = new WorkQueue <Dictionary <string, Dictionary <string, Dictionary <string, string> > > >(10000, "InsGateway"); GateWayRefreshQueue @object = new GateWayRefreshQueue(); GateWayRefreshQueue.wq.UserWork += new UserWorkEventHandler <Dictionary <string, Dictionary <string, Dictionary <string, string> > > >(@object.QueueWork); } GateWayRefreshQueue.wq.EnqueueItem(dic_item); result = 1; } catch (Exception ex) { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~DBERROR : " + ex.Message + "\n" + ex.StackTrace); result = -1; } return(result); }
public static int InsertDataTask(GatewayDataCell gdc_itm) { int result; try { if (GateWayRefreshQueue.wq_data == null) { GateWayRefreshQueue.wq_data = new WorkQueue <GatewayDataCell>(10000, "GateWayData"); GateWayRefreshQueue @object = new GateWayRefreshQueue(); GateWayRefreshQueue.wq_data.UserWork += new UserWorkEventHandler <GatewayDataCell>(@object.QueueWork4Data); } GateWayRefreshQueue.wq_data.EnqueueItem(gdc_itm); result = 1; } catch (Exception ex) { DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~DBERROR : " + ex.Message + "\n" + ex.StackTrace); result = -1; } return(result); }