public override void DoJob() { //this.buildInstrumentInfo(); // db queue insert CALCULATION_SERVER_STATUS_Table_DAO dao = new CALCULATION_SERVER_STATUS_Table_DAO(); dao.SERVER_NAME_ = this.MessageViewModel_.MessageHeaderViewModel_.Item_code_; dao.SERVER_IP_ = ""; dao.SERVER_PORT_ = "13212"; dao.SERVER_CORENUM_ = "2"; dao.SERVER_STATUS_ = "alive"; dao.SERVER_USE_ = "use"; dao.SERVER_DESCRIPTION_ = "haha test cal server"; dao.SERVER_ALIVETIME_ = DateTime.Now.ToString("yyyyMMddffffff"); string connectionStr = DataBaseConnectManager.ConnectionString_; if (dao.SERVER_STATUS_ == "regist") { dao.insert(DataBaseConnectManager.ConnectionFactory(connectionStr)); } else if (dao.SERVER_STATUS_ == "start") { dao.update(DataBaseConnectManager.ConnectionFactory(connectionStr)); } else if (dao.SERVER_STATUS_ == "stop") { dao.update(DataBaseConnectManager.ConnectionFactory(connectionStr)); } else if (dao.SERVER_STATUS_ == "deRegist") { dao.update(DataBaseConnectManager.ConnectionFactory(connectionStr)); } else { } //string fileName = this.InstrumentCode_; //File.WriteAllText(fileName, this.InstrumentXml_); //Console.WriteLine("File Saved. , name : {0} : ", fileName); //AsynchronousSocketListener.InstrumentQueue_.Enqueue(this); }
public void select(DbConnection conn) { if (conn.State != ConnectionState.Open) conn.Open(); DataTable tb = new DataTable(); this.DAOList_ = new List<CALCULATION_SERVER_STATUS_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = CALCULATION_SERVER_STATUS_Table_DAOManager.SelectQuery_; //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_); dbCommand.CommandText = selectQuery; //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn); DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn); dataAdapter.Fill(tb); DataRow[] dr = tb.Select(); int rowCount = dr.Length; foreach (DataRow item in dr) { CALCULATION_SERVER_STATUS_Table_DAO dao = new CALCULATION_SERVER_STATUS_Table_DAO(); dao.SERVER_NAME_ = item[0].ToString(); dao.SERVER_IP_ = item[1].ToString(); dao.SERVER_PORT_ = item[2].ToString(); dao.SERVER_STATUS_ = item[3].ToString(); dao.SERVER_CORENUM_ = item[4].ToString(); dao.SERVER_USE_ = item[5].ToString(); dao.SERVER_ALIVETIME_ = item[6].ToString(); dao.SERVER_DESCRIPTION_ = item[7].ToString(); this.DAOList_.Add(dao); } }
public void select(DbConnection conn) { if (conn.State != ConnectionState.Open) { conn.Open(); } DataTable tb = new DataTable(); this.DAOList_ = new List <CALCULATION_SERVER_STATUS_Table_DAO>(); DbCommand dbCommand = conn.CreateCommand(); string selectQuery = CALCULATION_SERVER_STATUS_Table_DAOManager.SelectQuery_; //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_); dbCommand.CommandText = selectQuery; //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn); DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn); dataAdapter.Fill(tb); DataRow[] dr = tb.Select(); int rowCount = dr.Length; foreach (DataRow item in dr) { CALCULATION_SERVER_STATUS_Table_DAO dao = new CALCULATION_SERVER_STATUS_Table_DAO(); dao.SERVER_NAME_ = item[0].ToString(); dao.SERVER_IP_ = item[1].ToString(); dao.SERVER_PORT_ = item[2].ToString(); dao.SERVER_STATUS_ = item[3].ToString(); dao.SERVER_CORENUM_ = item[4].ToString(); dao.SERVER_USE_ = item[5].ToString(); dao.SERVER_ALIVETIME_ = item[6].ToString(); dao.SERVER_DESCRIPTION_ = item[7].ToString(); this.DAOList_.Add(dao); } }