Esempio n. 1
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     {
         if (listViewApteka.SelectedItems.Count == 1)
         {
             Apteka apteka = listViewApteka.SelectedItems[0].Tag as Apteka;
             apteka.Name   = textBoxName.Text;
             apteka.Adress = textBoxAdress.Text;
             apteka.Phone  = textBoxPhone.Text;
             apteka.Time   = textBoxTime.Text;
             Program.apteka.SaveChanges();
             Apt apt = new Apt();
             apt.Show();
             this.Hide();
         }
     }
 }
Esempio n. 2
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (textBoxName.Text == "" || textBoxAdress.Text == "" || textBoxPhone.Text == "" || textBoxTime.Text == "")
     {
         MessageBox.Show("Введите данные", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         Apteka apteka = new Apteka();
         apteka.Name   = textBoxName.Text;
         apteka.Adress = textBoxAdress.Text;
         apteka.Phone  = textBoxPhone.Text;
         apteka.Time   = textBoxTime.Text;
         Program.apteka.Apteka.Add(apteka);
         Program.apteka.SaveChanges();
         Apt apt = new Apt();
         apt.Show();
         this.Hide();
     }
 }
Esempio n. 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewApteka.SelectedItems.Count == 1)
         {
             Apteka apteka = listViewApteka.SelectedItems[0].Tag as Apteka;
             Program.apteka.Apteka.Remove(apteka);
             Program.apteka.SaveChanges();
             Apt apt = new Apt();
             apt.Show();
             this.Hide();
         }
         textBoxName.Text   = "";
         textBoxAdress.Text = "";
         textBoxPhone.Text  = "";
         textBoxTime.Text   = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form apt = new Apt();

            apt.Show();
        }