Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Newspapers newspapers = new Newspapers();

            newspapers.Mail  = textBoxEmail.Text;
            newspapers.Prise = textBoxPrise.Text;
            newspapers.Name  = textBoxName.Text;
            Program.ads.Newspapers.Add(newspapers);
            Program.ads.SaveChanges();
            ShowNewspepar();
        }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewOrg.SelectedItems.Count == 1)
     {
         Newspapers newspapers = listViewOrg.SelectedItems[0].Tag as Newspapers;
         newspapers.Mail  = textBoxEmail.Text;
         newspapers.Prise = textBoxPrise.Text;
         newspapers.Name  = textBoxName.Text;
         Program.ads.SaveChanges();
         ShowNewspepar();
     }
 }
Esempio n. 3
0
 private void listViewNewspepar_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewOrg.SelectedItems.Count == 1)
     {
         Newspapers newspapers = listViewOrg.SelectedItems[0].Tag as Newspapers;
         newspapers.Mail  = textBoxEmail.Text;
         newspapers.Prise = textBoxPrise.Text;
         newspapers.Name  = textBoxName.Text;
     }
     else
     {
         textBoxEmail.Text = "";
         textBoxName.Text  = "";
         textBoxPrise.Text = "";
     }
 }
Esempio n. 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewOrg.SelectedItems.Count == 1)
         {
             Newspapers newspapers = listViewOrg.SelectedItems[0].Tag as Newspapers;
             Program.ads.Newspapers.Remove(newspapers);
             Program.ads.SaveChanges();
         }
         textBoxEmail.Text = "";
         textBoxName.Text  = "";
         textBoxPrise.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     ShowNewspepar();
 }