/// <summary> /// when user click "add a datapoint" menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AddDataPoint(object sender, EventArgs e) { IView view = ViewManager.GetInstance().GetView(TrendViewConst.AddDataPointData, m_View.ViewID); DataPointDataController ctl = (DataPointDataController)(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); ((DataPointData)(view)).SetFormType(FormType.Add); ((DataPointData)(view)).Display(ctl.GetDataPoint()); view.ShowView(true); }
/// <summary> /// when user clicked "Edit" in a list column /// </summary> /// <param name="DataPointName">the datapoint name the user selected to edit</param> public void EditDataPoint(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.EditDataPointData, m_View.ViewID); DataPointDataController ctl = (DataPointDataController)(view.getController()); ctl.SetFormType(FormType.Edit); ctl.Init(dataRow, ohterDataPointNameList); ((DataPointData)(view)).SetFormType(FormType.Edit); ((DataPointData)(view)).Display(ctl.GetDataPoint()); view.ShowView(true); } }