/// <summary> /// save datapoint list to a configuration /// </summary> /// <param name="grpName">configuration name</param> public void SaveDataPointListToGroup(string grpName) { string Function_Name = "SaveDataPointListToGroup"; try { m_Model.SaveDPListToGroup(ConvertDataTableToList(), grpName); } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
public void InitFormulaGrp() { string Function_Name = "InitFormulaGrp"; try { if (null == m_formulaCfgNameList) { m_formulaCfgNameList = m_Model.GetAllFormulaGrp(); } } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
public void InitHistDPGrp() { string Function_Name = "InitHistDPGrp"; try { if (null == m_HistDataPointCfgNameList) { m_HistDataPointCfgNameList = m_Model.GetAllHistDPGrp(); } } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
public void SaveFormulaListToGroup(string grpName) { string Function_Name = "SaveFormulaListToGroup"; List <EtyFormula> formulaList = new List <EtyFormula>(); foreach (DataRow formulaRow in m_FormulaTable.Rows) { EtyFormula formula = new EtyFormula(); SetFormulaEtyByRow(ref formula, formulaRow); formulaList.Add(formula); } try { m_Model.SaveFormulaListToGroup(formulaList, grpName); } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
public void SaveMarkerListToGroup(string grpName) { string Function_Name = "SaveMarkerListToGroup"; List <EtyMarker> markList = new List <EtyMarker>(); foreach (DataRow markerRow in m_markerTable.Rows) { EtyMarker marker = new EtyMarker(); SetMarkerEtyByRow(ref marker, markerRow); markList.Add(marker); } try { m_Model.SaveMarkerListToGroup(markList, grpName); } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
public void SaveHistDataPointListToGroup(string grpName) { string Function_Name = "SaveHistDataPointListToGroup"; List <EtyHistDataPoint> dataPointList = new List <EtyHistDataPoint>(); foreach (DataRow dataPointRow in m_DataPointTable.Rows) { EtyHistDataPoint DataPoint = new EtyHistDataPoint(); SetHistDataPointEtyByRow(ref DataPoint, dataPointRow); dataPointList.Add(DataPoint); } try { m_Model.SaveHistDPListToGroup(dataPointList, grpName); } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }
private void ExportHistoryData(string filename) { string Function_Name = "ExportHistoryData"; try { // Open Stream for Writing System.IO.StreamWriter SW; SW = System.IO.File.AppendText(filename); EtyHistDataPoint histDP = null; string originalMsg = ""; string messageData = ""; DateTime startTime = m_View.GetStartTime(); DateTime endTime = m_View.GetEndTime(); bool hasData = false; for (int i = 0; i < m_trendCache.m_histDataPointList.Count; i++) { histDP = m_trendCache.m_histDataPointList[i]; if (histDP.DPEnabled == false) { continue; } if (histDP.DPName.Trim() != "") { List <EtyDataLogDPLogTrend> histDPLogList = m_Model.GetHistDPLogList(m_trendCache.m_histDataPointList[i], startTime, endTime); originalMsg = histDP.DPName + "," + histDP.DPServer; foreach (EtyDataLogDPLogTrend dpLog in histDPLogList) { messageData = originalMsg; messageData += "," + dpLog.Value.ToString(); messageData += "," + dpLog.CreateTime.ToString("dd'/'MM'/'yyyy hh:mm:ss tt"); // ("dd-MM-yyyy HH:mm:ss"); messageData += "," + "127.0.0.1"; //histDP.DPHost.ToString(); SW.WriteLine(messageData); hasData = true; } } } SW.Close(); if (!hasData) { File.Delete(filename); MessageBoxDialog.Show( StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ExportNoData, LanguageHelper.TrendViewer_Msg_ExportNoData_EN), StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_WarningTitle, LanguageHelper.TrendViewer_Msg_WarningTitle_EN), MessageBoxButtons.OK, MessageBoxIcon.Warning); LogHelper.Error(CLASS_NAME, Function_Name, "No Data for current Datapoint History."); return; } MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ExportOK, LanguageHelper.TrendViewer_Msg_ExportOK_EN)); } catch (Exception ex) { TrendViewerHelper.HandleEx(ex); } }