Пример #1
0
 void RenameByItemOfBank()
 {
     if (listView1.SelectedItems.Count > 0)
     {
         UIItemOfBankEditor ui   = new UIItemOfBankEditor();
         ListViewItem       item = listView1.SelectedItems[0];
         DataProvider       dp   = new DataProvider(_e.CurrentAccount.FullPath);
         ItemOfBank         it   = dp.GetItemOfBank(item.SubItems[1].Text);
         ui.CurrentItemOfBank = new ItemOfBank();
         it.CopyTo(ui.CurrentItemOfBank);
         ui.CurrentEnvironment = _e;
         if (ui.ShowDialog(this) == DialogResult.OK)
         {
             ui.CurrentItemOfBank.CopyTo(it);
             if (dp.UpdateItemOfBank(item.SubItems[1].Text, it))
             {
                 item.SubItems.Clear();
                 item.Text = it.Name;
                 item.SubItems.Add(it.ID);
                 item.SubItems.Add(it.OfBankName);
                 item.SubItems.Add(it.Description);
             }
         }
     }
 }
Пример #2
0
        void AppendByItemOfBank()
        {
            UIItemOfBankEditor ui = new UIItemOfBankEditor();

            ui.CurrentEnvironment = _e;
            if (ui.ShowDialog(this) == DialogResult.OK)
            {
                ItemOfBank it = new ItemOfBank();
                ui.CurrentItemOfBank.CopyTo(it);
                DataProvider dp = new DataProvider(_e.CurrentAccount.FullPath);
                if (dp.AppendItemOfBank(it))
                {
                    ListViewItem item = new ListViewItem();
                    item.Text     = it.Name;
                    item.ImageKey = "itemOfBank";
                    item.SubItems.Add(it.ID);
                    item.SubItems.Add(it.OfBankName);
                    item.SubItems.Add(it.Description);
                    listView1.Items.Add(item);
                }
            }
        }