/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddFormula_Click(object sender, EventArgs e) { DeviceFormulaCollectionMap sel = SelectedDeviceFormulaCollectionMap; if (sel != null) { frmFormula f = new frmFormula(); f.SetAddInfo(sel.DeviceID); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { Formula formula = f.FormulaClass; //YeHeCommuniServerApp.Default.DevieFormaulCollectionMapCollection.AddFormula( // this.Device.ID, formula); int formulaID = App.Default.ToDBI.InsertFormula(sel.DeviceID, formula.Begin, formula.End, formula.FormulaExpress); formula.ID = formulaID; FormulaCollection formulaCollection = App.Default.DevieFormaulCollectionMapCollection.GetFormulaCollection(sel.DeviceID); formulaCollection.Add(formula); AddFormulaListViewItem(formula); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddFormula_Click(object sender, EventArgs e) { frmFormula f = new frmFormula(); f.SetAddInfo(this.Device.ID); DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { if (f.IsAdd()) { int id = DB.FormulaDB.InsertFormula(this.Device.ID, f.Begin, f.End, f.Formula); Formula formula = new Formula(id, f.Begin, f.End, f.Formula); YeHeCommuniServerApp.Default.DevieFormaulCollectionMapCollection.AddFormula( this.Device.ID, formula); AddFormulaListViewItem(formula); } } }