Exemple #1
0
        /// <summary>
        /// Create a new HistoricalData object.
        /// </summary>
        /// <param name="histocalDataId">Initial value of the HistocalDataId property.</param>
        /// <param name="idId">Initial value of the IdId property.</param>
        /// <param name="value">Initial value of the Value property.</param>
        /// <param name="date">Initial value of the Date property.</param>
        public static HistoricalData CreateHistoricalData(global::System.Int32 histocalDataId, global::System.Int32 idId, global::System.Double value, global::System.DateTime date)
        {
            HistoricalData historicalData = new HistoricalData();

            historicalData.HistocalDataId = histocalDataId;
            historicalData.IdId           = idId;
            historicalData.Value          = value;
            historicalData.Date           = date;
            return(historicalData);
        }
Exemple #2
0
        public HistoricalData GetLastRecord(int id)
        {
            var lastRecordQuery = from data in Entities.HistoricalDatas
                                  where data.IdId.Equals(id)
                                  orderby data.Date descending
                                  select data;

            HistoricalData lastRecord = lastRecordQuery.FirstOrDefault();


            return(lastRecord);
        }
Exemple #3
0
        public bool AddNewHistoricalData(int id, Double value)
        {
            HistoricalData newHistoricalData = new HistoricalData();

            newHistoricalData.IdId  = id;
            newHistoricalData.Value = value;
            newHistoricalData.Date  = DateTime.Now;

            Entities.HistoricalDatas.AddObject(newHistoricalData);

            if (Entities.SaveChanges() > 0)
            {
                return(true);
            }

            return(false);
        }
Exemple #4
0
        public HistoricalDataForLastRecord GetLastRecord(int id)
        {
            var lastRecordQuery = from data in Entities.HistoricalDatas
                                  where data.IdId.Equals(id)
                                  orderby data.Date descending
                                  select data;

            HistoricalData lastRecordTemp = lastRecordQuery.FirstOrDefault();

            if (lastRecordTemp != null)
            {
                HistoricalDataForLastRecord lastRecord = new HistoricalDataForLastRecord(lastRecordTemp.HistocalDataId, lastRecordTemp.Value, lastRecordTemp.Date);

                return(lastRecord);
            }

            return(null);
        }
Exemple #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the HistoricalDatas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHistoricalDatas(HistoricalData historicalData)
 {
     base.AddObject("HistoricalDatas", historicalData);
 }