Exemplo n.º 1
0
 private void listViewSum_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSum.SelectedItems.Count == 1)
     {
         SummaryList sum = listViewSum.SelectedItems[0].Tag as SummaryList;
         comboBoxExtra.SelectedIndex = comboBoxExtra.FindString(sum.Id_Extradition.ToString().Split('.')[0]);
         textBoxBalance.Text         = sum.Current_balance.ToString();
     }
     else
     {
         comboBoxExtra.SelectedItem = null;
         textBoxBalance.Text        = "";
     }
 }
Exemplo n.º 2
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSum.SelectedItems.Count == 1)
         {
             SummaryList sum = listViewSum.SelectedItems[0].Tag as SummaryList;
             Program.kv.SummaryList.Remove(sum);
             Program.kv.SaveChanges();
             ShowSum();
         }
         comboBoxExtra.SelectedItem = null;
         textBoxBalance.Text        = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSum.SelectedItems.Count == 1)
         {
             if (comboBoxExtra.SelectedItem != null && textBoxBalance.Text != "")
             {
                 SummaryList sum = listViewSum.SelectedItems[0].Tag as SummaryList;
                 sum.Id_Extradition  = Convert.ToInt32(comboBoxExtra.SelectedItem.ToString().Split('.')[0]);
                 sum.Current_balance = Convert.ToInt32(textBoxBalance.Text);
                 Program.kv.SaveChanges();
                 ShowSum();
             }
         }
     }
     catch (Exception a)
     {
         MessageBox.Show("" + a.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }