/// <summary> /// Get Server Info by ID /// </summary> /// <param name="svId"></param> /// <returns></returns> public static Server GetServerInfo(int svId) { using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); Server srv = new Server(); using (MySqlCommand command = connection.CreateCommand()) { command.CommandText = "SRV_SERVER_INFO_GET"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@svId", svId); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { srv.id = reader.GetInt32(0); srv.name = reader.GetString(1); srv.ip = reader.GetString(2); } } reader.Close(); } connection.Close(); return srv; } }
public SpSelectSrv(int svid, int chid) { SrvInfo = AgentServer.SvrListInfo.Where(v => v.id == svid).FirstOrDefault(); ChnInfo = SrvInfo.channels.Where(v => v.id == chid).FirstOrDefault(); }
public SpRegisteredServer() { // todo load server & channel info serverInfo = DataBaseServer.GetServerInfo(Properties.Settings.Default.SERVER_ID); serverInfo.channels = DataBaseServer.GetServerChannel(Properties.Settings.Default.SERVER_ID); }