Exemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ServicesSet serviceSet = new ServicesSet();

            serviceSet.Name  = textBoxName.Text;
            serviceSet.Price = Convert.ToInt64(textBoxPrice.Text);
            Program.BSTDB.ServicesSet.Add(serviceSet);
            Program.BSTDB.SaveChanges();
            ShowService();
        }
Exemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewService.SelectedItems.Count == 1)
     {
         ServicesSet serviceSet = listViewService.SelectedItems[0].Tag as ServicesSet;
         serviceSet.Name  = textBoxName.Text;
         serviceSet.Price = Convert.ToInt64(textBoxPrice.Text);
         Program.BSTDB.SaveChanges();
         ShowService();
     }
 }
Exemplo n.º 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewService.SelectedItems.Count == 1)
         {
             ServicesSet serviceSet = listViewService.SelectedItems[0].Tag as ServicesSet;
             Program.BSTDB.ServicesSet.Remove(serviceSet);
             Program.BSTDB.SaveChanges();
             ShowService();
         }
         textBoxName.Text  = "";
         textBoxPrice.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }