Example #1
0
 public Delete(Pharmacy p, DataGridView d)
 {
     InitializeComponent();
     pharmacy             = p;
     dgv                  = d;
     cmbDelete.DataSource = pharmacy.GetMedicine();
 }
Example #2
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewPharmacy.SelectedItems.Count == 1)
         {
             Pharmacy Ph = listViewPharmacy.SelectedItems[0].Tag as Pharmacy;
             Program.PhDB.Pharmacy.Remove(Ph);
             Program.PhDB.SaveChanges();
             ShowPharmacy();
             textBoxName.Text    = "";
             textBoxAddress.Text = "";
             textBoxEmail.Text   = "";
             textBoxPhone.Text   = "";
         }
         else
         {
             textBoxName.Text    = "";
             textBoxAddress.Text = "";
             textBoxEmail.Text   = "";
             textBoxPhone.Text   = "";
         }
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        public Form1()
        {
            InitializeComponent();
            Pharmacy avromed = new Pharmacy("Avromed");

            pharmacy           = avromed;
            dgv                = dgvList;
            dgvList.DataSource = pharmacy.GetMedicine();
        }
Example #4
0
        public Form1(Form f)
        {
            InitializeComponent();
            _login = f;
            f.Hide();
            Pharmacy zeferan = new Pharmacy("zeferan");

            _pharmacy          = zeferan;
            dgv                = dgvList;
            dgvList.DataSource = _pharmacy.GetMedicines();
        }
Example #5
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewPharmacy.SelectedItems.Count == 1)
     {
         Pharmacy Ph = listViewPharmacy.SelectedItems[0].Tag as Pharmacy;
         Ph.PharmacyName = textBoxName.Text;
         Ph.Adress       = textBoxAddress.Text;
         Ph.Email        = textBoxEmail.Text;
         Ph.Phone        = textBoxPhone.Text;
         Program.PhDB.SaveChanges();
         ShowPharmacy();
     }
 }
Example #6
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string username = txtSurname.Text.Trim();
            string password = txtPassword.Text.Trim();

            if (username != "c" || password != "1")
            {
                MessageBox.Show("Login or Password is faild", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Pharmacy pharmacy = new Pharmacy(this);
                pharmacy.Show();
            }
        }
Example #7
0
 private void listViewPharmacy_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewPharmacy.SelectedItems.Count == 1)
     {
         Pharmacy Ph = listViewPharmacy.SelectedItems[0].Tag as Pharmacy;
         textBoxName.Text    = Ph.PharmacyName;
         textBoxAddress.Text = Ph.Adress;
         textBoxEmail.Text   = Ph.Email;
         textBoxPhone.Text   = Ph.Phone;
     }
     else
     {
         textBoxName.Text    = "";
         textBoxAddress.Text = "";
         textBoxEmail.Text   = "";
         textBoxPhone.Text   = "";
     }
 }
Example #8
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Pharmacy Ph = new Pharmacy();

            Ph.PharmacyName = textBoxName.Text;
            Ph.Adress       = textBoxAddress.Text;
            Ph.Phone        = textBoxPhone.Text;
            if ((textBoxEmail.Text.Contains("@")) & (textBoxEmail.Text.Contains(".")))
            {
                Ph.Email = textBoxEmail.Text;
                Program.PhDB.Pharmacy.Add(Ph);
                Program.PhDB.SaveChanges();
                ShowPharmacy();
            }
            else
            {
                labelAttention.Text = "Неверно введена почта";
            }
        }