コード例 #1
0
        /// <summary>
        /// Instantiate a new meal, set the id and name of the meal to the data from within the grid view, at the selected row.
        /// show the edit panel, and set isNew to false.
        /// Display the meal in the editing panel.
        /// MEAL LINE SHIT GOES HERE.
        /// </summary>
        protected void gvMeals_SelectedIndexChanged(object sender, EventArgs e)
        {
            // meals
            meal      = new SvcKitchen.Meal();
            meal.ID   = int.Parse(gvMeals.SelectedRow.Cells[2].Text);
            meal.Name = gvMeals.SelectedRow.Cells[3].Text;

            pnlEdit.Visible = true;

            isNewMeal = false;

            lblID.Text   = meal.ID.ToString();
            txtMeal.Text = meal.Name;

            // meal lines
            try
            {
                LoadMealLines();
                btnNewLine.Visible = true;
                PopulateIngredients();
            }
            catch
            {
                lblInfo.Text      = "There was an error attempting to load the recipe data.";
                lblInfo.ForeColor = System.Drawing.Color.DarkRed;
            }
        }
コード例 #2
0
        /// <summary>
        /// Show the editing panel and clear the form, set the isNew boolean to true, and instantiate a new meal.
        /// </summary>
        protected void btnNew_Click(object sender, EventArgs e)
        {
            pnlEdit.Visible = true;

            meal      = new SvcKitchen.Meal();
            isNewMeal = true;

            lblID.Text   = "";
            txtMeal.Text = "";
        }