Example #1
0
        public DataObject.Status Get(int Id_Device)
        {
            DataObject.Status dataObjectDeviceStatus = null;

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [Configuration].[GetDeviceStatus] {0}";

                using (SqlCommand command = new SqlCommand(string.Format(query, Id_Device), connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectDeviceStatus             = new DataObject.Status();
                            dataObjectDeviceStatus.Id          = int.Parse(reader.GetValue(0).ToString());
                            dataObjectDeviceStatus.Description = reader.GetValue(1).ToString();
                        }
                    }
                }
            }

            return(dataObjectDeviceStatus);
        }
Example #2
0
        public DataObject.Status Get(int Id_Device)
        {
            DataObject.Status dataObjectDeviceStatus = null;

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [Configuration].[GetDeviceStatus] {0}";

                using (SqlCommand command = new SqlCommand(string.Format(query, Id_Device), connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectDeviceStatus = new DataObject.Status();
                            dataObjectDeviceStatus.Id = int.Parse(reader.GetValue(0).ToString());
                            dataObjectDeviceStatus.Description = reader.GetValue(1).ToString();
                        }
                    }
                }
            }

            return dataObjectDeviceStatus;
        }