Esempio n. 1
0
        private void btnSub_Click(object sender, EventArgs e)
        {
            //Create an instance of a person
            RecipeClass temp = new RecipeClass();

            //Assign the instance of a person a name
            //temp.Feedback = "";
            //temp.Id = txtFName.Text;
            temp.Name     = txtName.Text; // txtMName.Text;
            temp.Desc     = txtDesc.Text; // txtLName.Text;
            temp.Ingr     = txtIngr.Text;
            temp.Favorite = ckbxFav.Checked;
            temp.Notes    = txtNotes.Text;
            temp.Reci     = txtRecipe.Text;
            temp.Type     = cboType.Text;

            if (temp.validEntry())
            {
                label1.Text = temp.AddRecipe();
                if (label1.Text == "1Record(s) Added")
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("More data must be entered.");
            }
        }//End
Esempio n. 2
0
        }//End picbox

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            RecipeClass temp = new RecipeClass();

            temp.Name     = txtName.Text; // txtMName.Text;
            temp.Desc     = txtDesc.Text; // txtLName.Text;
            temp.Ingr     = txtIngr.Text;
            temp.Favorite = ckbxFav.Checked;
            temp.Notes    = txtNotes.Text;
            temp.Reci     = txtRecipe.Text;
            temp.Type     = cboType.Text;
            temp.Id       = Int32.Parse(lblID.Text);

            if (temp.validEntry())
            {
                label1.Text = temp.UpdateRec();
            }
            else
            {
                MessageBox.Show("More data must be entered.");
            }
        }