Beispiel #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            BankSet bankSet = listViewBank.SelectedItems[0].Tag as BankSet;

            bankSet.Job        = textBoxJob.Text;
            bankSet.Need       = textBoxNeed.Text;
            bankSet.Income     = textBoxIncome.Text;
            bankSet.Arranget   = textBoxArranget.Text;
            bankSet.IdEmployer = Convert.ToInt32(comboBoxEmployer.SelectedItem.ToString().Split('.')[0]);
            ShowBank();
        }
Beispiel #2
0
 private void button1Add_Click(object sender, EventArgs e)
 {
     if (comboBoxEmployer.SelectedItem != null && textBoxJob.Text != "" && textBoxIncome.Text != "" && textBoxNeed.Text != "" && textBoxArranget.Text != "" && comboBoxStaff.SelectedItem != null)
     {
         BankSet bankSet = new BankSet();
         bankSet.Job        = textBoxJob.Text;
         bankSet.Need       = textBoxNeed.Text;
         bankSet.Income     = textBoxIncome.Text;
         bankSet.Arranget   = textBoxArranget.Text;
         bankSet.IdEmployer = Convert.ToInt32(comboBoxEmployer.SelectedItem.ToString().Split('.')[0]);
         bankSet.IdStaff    = Convert.ToInt32(comboBoxStaff.SelectedItem.ToString().Split('.')[0]);
         Program.WFCZN.BankSet.Add(bankSet);
         Program.WFCZN.SaveChanges();
         ShowBank();
     }
 }
Beispiel #3
0
 private void listViewBank_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewBank.SelectedItems.Count == 1)
     {
         BankSet bankSet = listViewBank.SelectedItems[0].Tag as BankSet;
         textBoxJob.Text                = bankSet.Job;
         textBoxNeed.Text               = bankSet.Need;
         textBoxIncome.Text             = bankSet.Income;
         textBoxArranget.Text           = bankSet.Arranget;
         comboBoxEmployer.SelectedIndex = comboBoxEmployer.FindString(bankSet.IdEmployer.ToString());
         comboBoxStaff.SelectedIndex    = comboBoxStaff.FindString(bankSet.IdStaff.ToString());
     }
     else
     {
         textBoxJob.Text       = "";
         textBoxNeed.Text      = "";
         textBoxIncome.Text    = "";
         textBoxArranget.Text  = "";
         comboBoxEmployer.Text = null;
         comboBoxStaff.Text    = null;
     }
 }
Beispiel #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewBank.SelectedItems.Count == 1)
         {
             BankSet bankSet = listViewBank.SelectedItems[0].Tag as BankSet;
             Program.WFCZN.BankSet.Remove(bankSet);
             Program.WFCZN.SaveChanges();
             ShowBank();
         }
         textBoxJob.Text               = "";
         textBoxNeed.Text              = "";
         textBoxIncome.Text            = "";
         textBoxArranget.Text          = "";
         comboBoxEmployer.SelectedItem = null;
         comboBoxStaff.SelectedItem    = null;
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }