Exemplo n.º 1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listView_Magazine.SelectedItems.Count == 1)
     {
         MagazineSet magazine = listView_Magazine.SelectedItems[0].Tag as MagazineSet;
         magazine.IdManager = Convert.ToInt32(comboBoxManager.SelectedItem.ToString().Split('.')[0]);
         magazine.City      = textBoxCity.Text;
         Program.bdSKI.SaveChanges();
         ShowMagazine();
     }
 }
Exemplo n.º 2
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (textBoxCity.Text != "" && comboBoxManager.SelectedItem != null)
     {
         MagazineSet magazine = new MagazineSet();
         magazine.IdManager = Convert.ToInt32(comboBoxManager.SelectedItem.ToString().Split('.')[0]);
         magazine.City      = textBoxCity.Text;
         Program.bdSKI.MagazineSet.Add(magazine);
         Program.bdSKI.SaveChanges();
         ShowMagazine();
     }
 }
Exemplo n.º 3
0
        private void listView_Personal_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView_Magazine.SelectedItems.Count == 1)
            {
                MagazineSet magazine = listView_Magazine.SelectedItems[0].Tag as MagazineSet;

                comboBoxManager.SelectedIndex = comboBoxManager.FindString(magazine.IdManager.ToString());
                textBoxCity.Text = magazine.City;
            }
            else
            {
                comboBoxManager.SelectedItem = null;
                textBoxCity.Text             = "";
            }
        }
Exemplo n.º 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listView_Magazine.SelectedItems.Count == 1)
         {
             MagazineSet magazineSet = listView_Magazine.SelectedItems[0].Tag as MagazineSet;
             Program.bdSKI.MagazineSet.Remove(magazineSet);
             Program.bdSKI.SaveChanges();
             ShowMagazine();
         }
         comboBoxManager.SelectedItem = null;
         textBoxCity.Text             = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }