Exemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (mode == "New")
     {
         int result = bevarage.insert(txtcode.Text.Trim(), txtname.Text.Trim(), decimal.Parse(txtprice.Text.Trim()), txtdesc.Text.Trim());
         if (result > 0)
         {
             gvBevarage.DataSource = bevarage.Retrieve();
             gvBevarage.Refresh();
             ClearTextbox();
             btnSave.Enabled   = false;
             btnDelete.Enabled = false;
             EnableDisableTextBoxes(false);
             MessageBox.Show("Bevarage saved sussessfully.", "Success", MessageBoxButtons.OK);
         }
     }
     else if (mode == "Edit")
     {
         int result = bevarage.Edit(int.Parse(txtid.Text), txtcode.Text, txtname.Text, decimal.Parse(txtprice.Text), txtdesc.Text);
         if (result > 0)
         {
             gvBevarage.DataSource = bevarage.Retrieve();
             gvBevarage.Refresh();
             ClearTextbox();
             btnSave.Enabled   = false;
             btnDelete.Enabled = false;
             EnableDisableTextBoxes(false);
             MessageBox.Show("Bevarage updated sussessfully.", "Update", MessageBoxButtons.OK);
         }
     }
 }
Exemplo n.º 2
0
        private void ManageSetMenu_Load(object sender, EventArgs e)
        {
            foodList              = food.Retrieve();
            cmbFood.DataSource    = foodList;
            cmbFood.DisplayMember = "Name";
            cmbFood.ValueMember   = "Id";

            bevarageList              = bevarage.Retrieve();
            cmbBevarage.DataSource    = bevarageList;
            cmbBevarage.DisplayMember = "Name";
            cmbBevarage.ValueMember   = "Id";

            DataTable result = setmenu.Retrieve();

            gvSetMenu.DataSource = result;
            gvSetMenu.Refresh();
            btnSave.Enabled   = false;
            btnDelete.Enabled = false;
            txtid.Enabled     = false;
            EnableDisableTextBoxes(false);
            EnableDisableItemControlSection(false);
            btnMenuItemDelete.Enabled = false;
        }