Ejemplo n.º 1
0
        /// <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);
                }
            }
        }
 private void btnAddFormula_Click(object sender, RoutedEventArgs e)
 {
     if (cmbEntities.SelectedItem != null)
     {
         var entity = cmbEntities.SelectedItem as TableDrivedEntityDTO;
         FormulaIntention formulaIntention = new FormulaIntention();
         formulaIntention.EntityID = entity.ID;
         formulaIntention.Type     = Enum_FormulaIntention.FormulaForParameter;
         frmFormula view = new frmFormula(formulaIntention);
         view.FormulaSelected += View_FormulaSelected;
         view.ShowDialog();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEditFormula_Click(object sender, EventArgs e)
 {
     if (this.lvFormula.SelectedItems.Count > 0)
     {
         ListViewItem lvi     = this.lvFormula.SelectedItems[0];
         Formula      formula = this.lvFormula.SelectedItems[0].Tag as Formula;
         if (formula != null)
         {
             frmFormula f = new frmFormula();
             f.SetEditInfo(this.SelectedDeviceFormulaCollectionMap.DeviceID, formula);
             DialogResult dr = f.ShowDialog();
             if (dr == DialogResult.OK)
             {
                 App.Default.ToDBI.UpdateFormula(formula.ID, formula.Begin, formula.End, formula.FormulaExpress);
                 lvi.SubItems[0].Text = formula.BeginString;
                 lvi.SubItems[1].Text = formula.EndString;
                 lvi.SubItems[2].Text = formula.FormulaExpress;
             }
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEditFormula_Click(object sender, EventArgs e)
 {
     if (this.lvFormula.SelectedItems.Count > 0)
     {
         ListViewItem lvi = this.lvFormula.SelectedItems[0];
         Formula formula = this.lvFormula.SelectedItems[0].Tag as Formula;
         if (formula != null)
         {
             frmFormula f = new frmFormula();
             f.SetEditInfo(this.Device.ID, formula);
             DialogResult dr = f.ShowDialog();
             if (dr == DialogResult.OK)
             {
                 if (!f.IsAdd())
                 {
                     DB.FormulaDB.UpdateFormula(formula.ID, formula.Begin, formula.End, formula.FormulaExpress);
                     lvi.SubItems[0].Text = formula.BeginString;
                     lvi.SubItems[1].Text = formula.EndString;
                     lvi.SubItems[2].Text = formula.FormulaExpress;
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
        /// <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);
                }
            }
        }