Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            marketolog mark = new marketolog();

            mark.Rek   = textBox1.Text;
            mark.Kol   = Convert.ToInt32(textBox2.Text);
            mark.Price = Convert.ToInt32(textBox3.Text);
            Program.kafe.marketolog.Add(mark);
            Program.kafe.SaveChanges();
            ShowMark();
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (listView1.SelectedItems.Count == 1)
         {
             marketolog mark = listView1.SelectedItems[0].Tag as marketolog;
             Program.kafe.marketolog.Remove(mark);
             Program.kafe.SaveChanges();
             ShowMark();
         }
         textBox1.Text = "";
         textBox2.Text = "";
         textBox3.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить эту запись!", "ОШИБКА!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }