public void addLoad()
 {
     // get next medID available
     txtMedID.Text       = DBcommands.GetNextMedID().ToString();
     txtDate.Text        = DateTime.UtcNow.Date.ToString();
     txtDescription.Text = "";
 }
Beispiel #2
0
        private void BtnFind_Click(object sender, EventArgs e)
        {
            cat = DBcommands.getCat(txtCatID.Text.ToString());

            txtCatName.Text = cat.CatName;
            txtCatAge.Text  = cat.CatAge.ToString();
            LoadDataGrid();
        }
Beispiel #3
0
 private void BtnChange_Click(object sender, EventArgs e)
 {
     cat.CatName = txtCatName.Text;
     cat.CatAge  = Convert.ToInt32(txtCatAge.Text);
     try
     {
         DBcommands.saveCat(cat);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.GetType().ToString());
     }
 }
Beispiel #4
0
        private void LoadDataGrid()
        {
            DataTable catMedTable = new DataTable();

            try
            {
                catMedTable          = DBcommands.GetMedTable(cat.CatID);
                dgvCatMed.DataSource = catMedTable;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
Beispiel #5
0
        private void BtnMod_Click(object sender, EventArgs e)
        {
            catMed = DBcommands.getMeds(txtCatID.Text);

            AddModifyMed modMed = new AddModifyMed();

            modMed.Mod    = true;
            modMed.cat    = cat;
            modMed.catMed = catMed;
            modMed.modLoad();

            DialogResult result = modMed.ShowDialog();

            LoadDataGrid();
        }
        private void BtnAccept_Click(object sender, EventArgs e)
        {
            if (Mod == true)
            {
                // db command for modify
                catMed.CatID       = cat.CatID;
                catMed.Description = txtDescription.Text;
                DBcommands.modMed(catMed);

                DialogResult = DialogResult.OK;
            }
            else if (Add == true)
            {
                // db command for add
                catMed.CatID       = cat.CatID;
                catMed.MedID       = Convert.ToInt32(txtMedID.Text);
                catMed.Date        = DateTime.UtcNow.Date.ToString();
                catMed.Description = txtDescription.Text;
                DBcommands.addMed(catMed);
                DialogResult = DialogResult.OK;
            }
        }