private void OKBtn_Click(object sender, EventArgs e) { INCCDB.Descriptor candidate = new INCCDB.Descriptor(StratumIdTextBox.Text, StratumIdDescTextBox.Text); st = new INCCDB.StratumDescriptor(candidate, st.Stratum); INCCDB.StratumDescriptor realst = (INCCDB.StratumDescriptor)CurrentStratumIdsComboBox.SelectedItem; if (realst != null && st.CompareTo(realst) != 0) { if (list.Exists(i => { return(st.Desc.Name.CompareTo(i.Desc.Name) == 0); })) { return; } // todo: do the prefix match check here (1st 3 chars match on one or more existing entries) // todo: what the hell is jl talking about? // todo: I dunno, where was his mind? st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return(st.Desc.Name.CompareTo(i.Desc.Name) == 0); }); CurrentStratumIdsComboBox.SelectedItem = newst; } else { // It is brand spanking new..... st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return(st.Desc.Name.CompareTo(i.Desc.Name) == 0); }); CurrentStratumIdsComboBox.SelectedItem = newst; } // Refreshes Strata List after add. list = NC.App.DB.StrataList(det); }
private void OKBtn_Click(object sender, EventArgs e) { INCCDB.Descriptor candidate = new INCCDB.Descriptor(StratumIdTextBox.Text, StratumIdDescTextBox.Text); st = new INCCDB.StratumDescriptor(candidate, st.Stratum); INCCDB.StratumDescriptor realst = (INCCDB.StratumDescriptor)CurrentStratumIdsComboBox.SelectedItem; if (realst != null && st.CompareTo(realst) != 0) { if (list.Exists(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; })) return; st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; }); CurrentStratumIdsComboBox.SelectedItem = newst; } else { // It is brand spanking new..... st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; }); CurrentStratumIdsComboBox.SelectedItem = newst; } // Refreshes Strata List after add. list = NC.App.DB.StrataList(det); }
private void OKBtn_Click(object sender, EventArgs e) { INCCDB.Descriptor candidate = new INCCDB.Descriptor(StratumIdTextBox.Text, StratumIdDescTextBox.Text); st = new INCCDB.StratumDescriptor(candidate, st.Stratum); INCCDB.StratumDescriptor realst = (INCCDB.StratumDescriptor)CurrentStratumIdsComboBox.SelectedItem; if (realst != null && st.CompareTo(realst) != 0) { if (list.Exists(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; })) return; // todo: do the prefix match check here (1st 3 chars match on one or more existing entries) // todo: what the hell is jl talking about? // todo: I dunno, where was his mind? st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; }); CurrentStratumIdsComboBox.SelectedItem = newst; } else { // It is brand spanking new..... st.Desc.modified = true; NC.App.DB.UpdateStratum(st.Desc, st.Stratum); // creates it NC.App.DB.AssociateStratum(det, st.Desc, st.Stratum); // associates it with the detector RefreshCombo(); INCCDB.StratumDescriptor newst = list.Find(i => { return st.Desc.Name.CompareTo(i.Desc.Name) == 0; }); CurrentStratumIdsComboBox.SelectedItem = newst; } // Refreshes Strata List after add. list = NC.App.DB.StrataList(det); }