Пример #1
0
        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);
        }
Пример #2
0
        public ChartsViewModel(Average.ChartSpans chartSpan)
        {
            ChartSpan = chartSpan;

            SetTitle();
        }
Пример #3
0
 public IEnumerable <Average> ListAverages(Average.ChartSpans chartSpan, string deviceName, string objectName, string parameterName)
 {
     throw new NotImplementedException();
 }
Пример #4
0
 //[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));
 }