public void AddHistDataPoint(object sender, EventArgs e) { IView view = ViewManager.GetInstance().GetView(TrendViewConst.AddHistDataPointData, m_View.ViewID); HistDataPointDataController ctl = (HistDataPointDataController)(view.getController()); ctl.SetFormType(FormType.Add); List <string> DataPointNameList = new List <string>(); foreach (DataRow dataRow in m_DataPointTable.Rows) { DataPointNameList.Add(dataRow["DATA_PT_NAME"].ToString()); } ctl.Init(DataPointNameList); ((HistDataPointData)(view)).SetFormType(FormType.Add); ((HistDataPointData)(view)).Display(ctl.GetHistDataPoint()); view.ShowView(true); }
// this func is changed. public void EditHistDataPoint(string DataPointName) { List <string> ohterDataPointNameList = new List <string>(); foreach (DataRow DataPoint in m_DataPointTable.Select("DATA_PT_NAME <> '" + DataPointName + "'")) { ohterDataPointNameList.Add(DataPoint["DATA_PT_NAME"].ToString()); } foreach (DataRow dataRow in m_DataPointTable.Select("DATA_PT_NAME = '" + DataPointName + "'")) //will only be one row, because we don't allow duplicate name { IView view = ViewManager.GetInstance().GetView(TrendViewConst.EditHistDataPointData, m_View.ViewID); HistDataPointDataController ctl = (HistDataPointDataController)(view.getController()); ctl.SetFormType(FormType.Edit); ctl.Init(dataRow, ohterDataPointNameList); ((HistDataPointData)(view)).SetFormType(FormType.Edit); ((HistDataPointData)(view)).Display(ctl.GetHistDataPoint()); view.ShowView(true); } }