private CorpWalletNameObjectWritable ReadWalletNames() { if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex) { return(CreateDefaultWalletNames()); } CharacterObject charObj = (CharacterObject) this.toolStripComboBoxCharacterSelection.SelectedItem; CorpWalletNameCollection col = new CorpWalletNameCollection(); IDBCollection icol = col as IDBCollection; icol.SetConstraint((long)CorpWalletName.QueryValues.CorpID, new DBConstraint(DBConstraint.QueryConstraints.Equal, charObj.CorpID)); Database.DatabaseError dbErr = this.m_db.ReadRecord(icol); if (dbErr != Database.DatabaseError.NoError && dbErr != Database.DatabaseError.NoRecordsFound ) { // should report to logging return(CreateDefaultWalletNames()); } IDBCollectionContents icolcon = col as IDBCollectionContents; if (0 == icolcon.Count()) { return(CreateDefaultWalletNames()); } return(icolcon.GetRecordInterface(0).GetDataObject() as CorpWalletNameObjectWritable); }
private void toolStripMenuItemCorpEditWalletName_Click(object sender, EventArgs e) { if (-1 == this.toolStripComboBoxCharacterSelection.SelectedIndex) { return; } CharacterObject charObj = (CharacterObject) this.toolStripComboBoxCharacterSelection.SelectedItem; CorpWalletNameObjectWritable wallet = ReadWalletNames(); CorpEditWalletNamesDlg dlg = new CorpEditWalletNamesDlg(); dlg.SetObject(wallet); DialogResult ret = dlg.ShowDialog(); if (ret == DialogResult.OK) { dlg.GetObject(wallet); CorpWalletNameCollection newCol = new CorpWalletNameCollection(); newCol.AppendList(false, long.Parse(charObj.CorpID), wallet); m_db.InsertOrUpdateRecord(newCol); } }