/// <summary> /// /// </summary> /// <param name="formula"></param> private void AddFormulaListViewItem(Formula formula) { ListViewItem lvi = new ListViewItem(new string[]{ ( formula.BeginString ), ( formula.EndString ), formula.FormulaExpress }); lvi.Tag = formula; this.lvFormula.Items.Add(lvi); }
public static DeviceFormulaCollectionMap CreateDeviceFormulaCollectionMap(int deviceID) { DeviceFormulaCollectionMap _deviceFormulaCollectionMap = new DeviceFormulaCollectionMap(deviceID); DataTable formulaDataTable = FormulaDBI.GetDataTable(deviceID); foreach (DataRow row in formulaDataTable.Rows) { DateTime begin = Convert.ToDateTime(row["DTBegin"]); DateTime end = Convert.ToDateTime(row["DTEnd"]); string formula = row["formula"].ToString(); if (formula.Length > 0) { Xdgk.CF.Formula item = new Xdgk.CF.Formula(deviceID, begin, end, formula); _deviceFormulaCollectionMap.FormulaCollection.Add(item); } } return _deviceFormulaCollectionMap; }
static public DeviceFormulaCollectionMap CreateDeviceFormulaCollectionMap(int deviceID) { DeviceFormulaCollectionMap _deviceFormulaCollectionMap = new DeviceFormulaCollectionMap(deviceID); DataTable formulaDataTable = FormulaDBI.GetDataTable(deviceID); foreach (DataRow row in formulaDataTable.Rows) { DateTime begin = Convert.ToDateTime(row["DTBegin"]); DateTime end = Convert.ToDateTime(row["DTEnd"]); string formula = row["formula"].ToString(); if (formula.Length > 0) { Xdgk.CF.Formula item = new Xdgk.CF.Formula(deviceID, begin, end, formula); _deviceFormulaCollectionMap.FormulaCollection.Add(item); } } return(_deviceFormulaCollectionMap); }
/// <summary> /// /// </summary> /// <returns></returns> private bool TestFormula() { try { Formula testFormula = new Formula( 0, DateTime.Parse("2000-1-1"), DateTime.Parse("2000-12-30"), this.Formula ); int result1 = testFormula.CalcInstantFluxForTest(0, 0); int result2 = testFormula.CalcInstantFluxForTest(10, 10); //NUnit.UiKit.UserMessage.Display(string.Format("{0} {1}", result1, result2)); } catch (Ciloci.Flee.ExpressionCompileException ex) { NUnit.UiKit.UserMessage.DisplayFailure(ex.Message); return false; } return true; }
/// <summary> /// /// </summary> private void Add() { //int id = DB.FormulaDB.InsertFormula(this._deviceID, // this.Begin, this.End, this.Formula); this.FormulaClass = new Formula(0, this.Begin, this.End, this.Formula); }
/// <summary> /// /// </summary> /// <param name="device"></param> /// <param name="formula"></param> public void SetEditInfo(int deviceID, Formula formula) { //if (deviceID == null) //{ // throw new ArgumentNullException("device"); //} if (formula == null) { throw new ArgumentNullException("formula"); } this._deviceID = deviceID; this._formula = formula; this._isAdd = false; this.Begin = _formula.Begin; this.End = _formula.End; this.Formula = _formula.FormulaExpress; this.FormulaClass = formula; }