예제 #1
0
파일: zak.cs 프로젝트: Kaina1511/KAFE-KARIN
        private void button1_Click(object sender, EventArgs e)
        {
            zakupchik zak = new zakupchik();

            zak.pok   = textBox1.Text;
            zak.kol   = Convert.ToInt32(textBox2.Text);
            zak.price = Convert.ToInt32(textBox3.Text);
            Program.kafe.zakupchik.Add(zak);
            Program.kafe.SaveChanges();
            ShowZak();
        }
예제 #2
0
파일: zak.cs 프로젝트: Kaina1511/KAFE-KARIN
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (listView1.SelectedItems.Count == 1)
         {
             zakupchik zak = listView1.SelectedItems[0].Tag as zakupchik;
             Program.kafe.zakupchik.Remove(zak);
             Program.kafe.SaveChanges();
             ShowZak();
         }
         textBox1.Text = "";
         textBox2.Text = "";
         textBox3.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить эту запись!", "ОШИБКА!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }