Пример #1
0
        private void BtnCreat_Click(object sender, EventArgs e)
        {
            string name  = txtName.Text.Trim();
            float  price = float.Parse(txtPrice.Text);



            if (name == "" || price == null)
            {
                MessageBox.Show("Zehmet olmasa doldurun", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Medicine medicine = new Medicine {
                Name = name, Price = price
            };

            pharmacy.AddMedicine(medicine);


            dgvList.DataSource = null;
            dgvList.DataSource = pharmacy.GetMedicine();


            txtName.Text  = null;
            txtPrice.Text = null;
        }
Пример #2
0
        private void BtnMedicine_Click(object sender, EventArgs e)
        {
            int id = int.Parse(cmbDelete.SelectedValue.ToString().Substring(0, 2).Trim());

            pharmacy.DeleteMedicine(id);

            cmbDelete.DataSource = null;
            cmbDelete.DataSource = pharmacy.GetMedicine();

            dgv.DataSource = null;
            dgv.DataSource = pharmacy.GetMedicine();
        }
Пример #3
0
 public Delete(Pharmacy p, DataGridView d)
 {
     InitializeComponent();
     pharmacy             = p;
     dgv                  = d;
     cmbDelete.DataSource = pharmacy.GetMedicine();
 }
Пример #4
0
        public Form1()
        {
            InitializeComponent();
            Pharmacy avromed = new Pharmacy("Avromed");

            pharmacy           = avromed;
            dgv                = dgvList;
            dgvList.DataSource = pharmacy.GetMedicine();
        }
Пример #5
0
        private void dgvList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            btnEdit.Visible   = true;
            btnCreate.Visible = false;
            int id = (int)dgv.Rows[e.RowIndex].Cells[0].Value;

            ID = id;
            Medicine medicine = _pharmacy.GetMedicine(id);

            txtMedicine.Text     = medicine.Name;
            txtPrice.Text        = medicine.Price;
            txtTypeMedicine.Text = medicine.Typemedicine;
        }