static void initServerItems() { SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = mInitServerItems; SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader(); while (sqlDataReader_.Read()) { string operatorName_ = sqlDataReader_.GetString(0).Trim(); ServerItem serverItem_ = new ServerItem(); serverItem_.mServerId = sqlDataReader_.GetInt32(1); serverItem_.mServerNo = sqlDataReader_.GetInt32(2); serverItem_.mServerName = sqlDataReader_.GetString(3).Trim(); if (!mServerStates.ContainsKey(operatorName_)) { ServerState serverState_ = new ServerState(); mServerStates[operatorName_] = serverState_; } mServerStates[operatorName_].pushServerItem(serverItem_); } sqlDataReader_.Close(); sqlConnection_.Close(); }
public void pushServerItem(ServerItem nServerItem) { mServerItems[nServerItem.mServerId] = nServerItem; }