/// <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); }
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); }
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); }
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); }
/// <summary> /// Deprecated Method for adding a new object to the HistoricalDatas EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToHistoricalDatas(HistoricalData historicalData) { base.AddObject("HistoricalDatas", historicalData); }