public void Insert(SummaryEntity summary) { string serializesSummary = JsonConvert.SerializeObject(summary); DAOBase dao = new DAOBase(); dao.WriteFile(serializesSummary); }
public List <DailySummaryEntity> GetList() { List <DailySummaryEntity> result = new List <DailySummaryEntity>(); SummaryDAO summaryDAO = new SummaryDAO(); SummaryEntity summary = summaryDAO.GetSummary(); if (summary == null) { summary = new SummaryEntity(); summary.SummaryList = new List <DailySummaryEntity>(); } result = summary.SummaryList; return(result); }
public void Insert(DailySummaryEntity dailySummary) { SummaryDAO summaryDAO = new SummaryDAO(); SummaryEntity summary = summaryDAO.GetSummary(); if (summary == null) { summary = new SummaryEntity(); } if (summary.SummaryList == null) { summary.SummaryList = new List <DailySummaryEntity>(); } summary.SummaryList.Add(dailySummary); summaryDAO.Insert(summary); }
public PValue GetSummaryValues(int tagid, DateTime startdate, DateTime enddate, string type) { PValue pvalue = new PValue(); //golden数据库读取单个标签点历史数据是根据标签点id号 if (tagid <= 0) { return(pvalue); //如果id=0则找不到该点,返回空pvalues } SummaryEntity result = new SummaryEntity(); try { result = this._iHistorian.GetNumberSummary(tagid, startdate, enddate); } catch (RTDBException ex) { //将golden的异常PgimDataException记录在_exception中,并以PgimDataException的名称继续抛出异常 this._exception = ex.ToString(); throw new Exception(ex.ToString()); //将pgim的异常继续向外传递。 } switch (type.ToLower()) { case "calcavg": pvalue = new PValue(result.CalcAvg, startdate, enddate, 0); break; case "total": pvalue = new PValue(result.Total, startdate, enddate, 0); break; case "max": pvalue = new PValue(result.Max, startdate, enddate, 0); break; case "min": pvalue = new PValue(result.Min, startdate, enddate, 0); break; default: break; } return(pvalue); }
public Summary(SummaryEntity summary) { Title = summary.Title; Text = summary.Text; }