Exemplo n.º 1
0
        private void AddNewSetBtn_Click(object sender, EventArgs e)
        {
            IDDIsotopicsAdd ia = new IDDIsotopicsAdd();

            if (ia.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (string.IsNullOrEmpty(ia.ID))
                {
                    return;
                }

                // check for Id existence
                if (!NC.App.DB.Isotopics.Has(ia.ID))
                {
                    Isotopics iso = new Isotopics(m_iso); // copy current values to new iso
                    iso.id   = String.Copy(ia.ID);
                    modified = iso.modified = true;
                    NC.App.DB.Isotopics.Revert(m_iso);  // revert originating selection on in-memory list back to DB values

                    //PopulateWithSelectedItem();
                    NC.App.DB.Isotopics.GetList().Add(iso);
                    // do not add to database until the OK or the Save set button is selected NC.App.DB.Isotopics.Set(m_iso);
                    applog.TraceInformation("New isotopics " + iso.id + " (not saved to database)");
                    IsotopicsIdComboBox.Items.Add(iso.id);
                    IsotopicsIdComboBox.SelectedItem = iso.id;  // force m_iso assignment in event handler
                }
                else
                {
                    MessageBox.Show("'" + ia.ID + "' is already in use", "I .... uuuh oh");
                }
            }
        }
Exemplo n.º 2
0
        private void AddNewSetBtn_Click(object sender, EventArgs e)
        {
            IDDIsotopicsAdd ia = new IDDIsotopicsAdd();
            if (ia.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrEmpty(ia.ID))
                    return;

                // check for Id existence
                if (!NC.App.DB.Isotopics.Has(ia.ID))
                {
                    Isotopics iso = new Isotopics(m_iso); // copy current values to new iso
                    iso.id = string.Copy(ia.ID);
                    modified = iso.modified = true;
                    NC.App.DB.Isotopics.Revert(m_iso);  // revert originating selection on in-memory list back to DB values

                    //PopulateWithSelectedItem();
                    NC.App.DB.Isotopics.GetList().Add(iso);
                    // do not add to database until the OK or the Save set button is selected NC.App.DB.Isotopics.Set(m_iso);
                    applog.TraceInformation("New isotopics " + iso.id + " (not saved to database)");
                    IsotopicsIdComboBox.Items.Add(iso.id);
                    IsotopicsIdComboBox.SelectedItem = iso.id;  // force m_iso assignment in event handler
                }
                else
                    MessageBox.Show("'" + ia.ID + "' is already in use", "I .... uuuh oh");

            }
        }