public ApiResponsePIErrors(int statusCode, IDictionary <string, string> headers, PIErrors data) : base(statusCode, headers) { this.Data = data; }
public void ExecuteMetadataRefresh(object state) { OnStatusMessage("Beginning metadata refresh..."); try { base.RefreshMetadata(); if (InputMeasurementKeys != null && InputMeasurementKeys.Any()) { IPIPoints2 pts2 = (IPIPoints2)m_server.PIPoints; //NamedValues edits = new NamedValues(); //PIErrors errors = new PIErrors(); PointList piPoints; DataTable dtMeasurements = DataSource.Tables["ActiveMeasurements"]; DataRow[] rows; foreach (MeasurementKey key in InputMeasurementKeys) { rows = dtMeasurements.Select(string.Format("SIGNALID='{0}'", key.SignalID)); if (rows.Any()) { string tagname = rows[0]["POINTTAG"].ToString(); if (!String.IsNullOrWhiteSpace(rows[0]["ALTERNATETAG"].ToString())) tagname = rows[0]["ALTERNATETAG"].ToString(); piPoints = m_server.GetPoints(string.Format("EXDESC='{0}'", rows[0]["SIGNALID"].ToString())); if (piPoints.Count == 0) { m_server.PIPoints.Add(rows[0]["POINTTAG"].ToString(), m_piPointClass, PointTypeConstants.pttypFloat32); } else if (piPoints[1].Name != rows[0]["POINTTAG"].ToString()) { pts2.Rename(piPoints[1].Name, rows[0]["POINTTAG"].ToString()); } else { foreach (PIPoint pt in piPoints) { if (pt.Name != rows[0]["POINTTAG"].ToString()) pts2.Rename(pt.Name, rows[0]["POINTTAG"].ToString()); } } PIErrors errors = new PIErrors(); NamedValues edits = new NamedValues(); NamedValues edit = new NamedValues(); edit.Add("pointsource", m_piPointSource); edit.Add("Descriptor", rows[0]["SIGNALREFERENCE"].ToString()); edit.Add("exdesc", rows[0]["SIGNALID"].ToString()); edit.Add("sourcetag", rows[0]["POINTTAG"].ToString()); if (dtMeasurements.Columns.Contains("ENGINEERINGUNITS")) // engineering units is a new field for this view -- handle the case that its not there edit.Add("engunits", rows[0]["ENGINEERINGUNITS"].ToString()); edits.Add(rows[0]["POINTTAG"].ToString(), edit); pts2.EditTags(edits, out errors, null); if (errors.Count > 0) OnStatusMessage(errors[0].Description); } } } else { OnStatusMessage("PI Historian is not configured with any input measurements. Therefore, metadata sync will not do work."); } } catch (ThreadAbortException) { throw; } catch (Exception ex) { OnProcessException(ex); } finally { m_metadataRefreshComplete.Set(); } OnStatusMessage("Completed metadata refresh successfully."); }