Exemplo n.º 1
0
        private void ButtonAdd_Click(object sender, EventArgs e)
        {
            Pharmacies pharmSet = new Pharmacies();

            pharmSet.TitleDrug = textBoxTitleDrug.Text;
            pharmSet.Dosage    = textBoxDosage.Text;
            pharmSet.Maker     = textBoxMaker.Text;
            pharmSet.Hours     = textBoxHours.Text;
            Program.frDb.Pharmacies.Add(pharmSet);
            Program.frDb.SaveChanges();
            ShowPharm();
        }
Exemplo n.º 2
0
        private void ButtonAdd_Click(object sender, EventArgs e)
        {
            Pharmacies pharmSet = new Pharmacies();

            pharmSet.TitlePharm = textBoxTitlePharm.Text;
            pharmSet.Address    = textBoxAddress.Text;
            pharmSet.Phone      = textBoxPhone.Text;
            pharmSet.Hours      = textBoxHours.Text;
            Program.frDb.Pharmacies.Add(pharmSet);
            Program.frDb.SaveChanges();
            ShowPharm();
        }
Exemplo n.º 3
0
 private void ButtonEdit_Click(object sender, EventArgs e)
 {
     if (listViewPharm.SelectedItems.Count == 1)
     {
         Pharmacies readerSet = new Pharmacies();
         readerSet.TitlePharm = textBoxTitlePharm.Text;
         readerSet.Address    = textBoxAddress.Text;
         readerSet.Phone      = textBoxPhone.Text;
         readerSet.Hours      = textBoxHours.Text;
         Program.frDb.SaveChanges();
         ShowPharm();
     }
 }
Exemplo n.º 4
0
 private void ListViewPharm_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewPharm.SelectedItems.Count == 1)
     {
         Pharmacies pharmSet = listViewPharm.SelectedItems[0].Tag as Pharmacies;
         pharmSet.TitlePharm = textBoxTitlePharm.Text;
         pharmSet.Address    = textBoxAddress.Text;
         pharmSet.Phone      = textBoxPhone.Text;
         pharmSet.Hours      = textBoxHours.Text;
     }
     else
     {
         textBoxTitlePharm.Text = "";
         textBoxAddress.Text    = "";
         textBoxPhone.Text      = "";
         textBoxHours.Text      = "";
     }
 }
Exemplo n.º 5
0
 private void ButtonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewPharm.SelectedItems.Count == 1)
         {
             Pharmacies readerSet = listViewPharm.SelectedItems[0].Tag as Pharmacies;
             Program.frDb.Pharmacies.Remove(readerSet);
             Program.frDb.SaveChanges();
             ShowPharm();
         }
         textBoxTitlePharm.Text = "";
         textBoxAddress.Text    = "";
         textBoxPhone.Text      = "";
         textBoxHours.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }