public IEnumerable <Average> ListAverages(Average.ChartSpans chartSpan, string deviceName, string objectName, string parameterName) { const string CommandName = "SP_Message_AveragesList"; List <Average> averages = new List <Average>(); using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("intChartSpan", (int)chartSpan); command.Parameters.AddWithValue("strDeviceName", deviceName); command.Parameters.AddWithValue("strObjectName", objectName); command.Parameters.AddWithValue("strParameterName", parameterName); command.CommandText = CommandName; try { SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Average average = InstanciateAverage(reader); averages.Add(average); } } catch (Exception) { throw; } } if (connection.State == ConnectionState.Open) { connection.Close(); } } return(averages); }
public ChartsViewModel(Average.ChartSpans chartSpan) { ChartSpan = chartSpan; SetTitle(); }
public IEnumerable <Average> ListAverages(Average.ChartSpans chartSpan, string deviceName, string objectName, string parameterName) { throw new NotImplementedException(); }
//[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "ListLastDevicesMessages")] public IEnumerable <Average> ListDeviceAverages(Average.ChartSpans chartSpan, string deviceName, string objectName, string parameterName) { return(messageRepository.ListAverages(chartSpan, deviceName, objectName, parameterName)); }