예제 #1
0
        private void btnAddIdMapEntry_Click(object sender, EventArgs e)
        {
            CaptureSummaInfo();

            NewIdMapEntry newEntryForm = new NewIdMapEntry();

            newEntryForm.ShowDialog();

            if (newEntryForm.DialogResult == DialogResult.OK)
            {
                try {
                    int siteId  = Int32.Parse(newEntryForm.SiteId);
                    int summaId = Int32.Parse(newEntryForm.SummaId);

                    _summaIdMap.AddMapEntry(siteId, summaId);
                }
                catch (ArgumentException ae) {
                    new ErrorHandler(ae.ToString()).ShowDialog();
                }
                catch (FormatException fe) {
                    new ErrorHandler(fe.ToString()).ShowDialog();
                }
            }
            ShowAllSettings();
        }
예제 #2
0
        private void lvIdMap_ItemActivate(object sender, EventArgs e)
        {
            ListViewItem  selectedItem = lvIdMap.SelectedItems[0];
            string        siteid       = selectedItem.Text;
            string        summaid      = selectedItem.SubItems[1].Text;
            NewIdMapEntry idMapForm    = new NewIdMapEntry(siteid, summaid);
            DialogResult  result       = idMapForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                try {
                    _summaIdMap.RemoveMapEntry(Int32.Parse(selectedItem.Text));
                    _summaIdMap.AddMapEntry(Int32.Parse(idMapForm.SiteId),
                                            Int32.Parse(idMapForm.SummaId));
                }
                catch (FormatException fe) {
                    new ErrorHandler(fe.ToString()).ShowDialog();
                }
            }
            ShowAllSettings();
        }