Exemplo n.º 1
0
    /// <summary>
    /// This button on click method is for adding a new Meal to the database.
    /// Added April 13. Modification of Meal's Add method.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void AddMealButton_Click(object sender, EventArgs e)
    {
        //finding the customer profile choice to display
        string addItem = AddMealsTextBox.Text.Trim();
        int    userID  = Convert.ToInt32(Session["adminID"]);

        MessageUserControl.TryRun(() =>
        {
            MealController sysmgr = new MealController();

            sysmgr.AddMeal(addItem, userID);
            MealsListView.DataBind();
            AddMealsTextBox.Text = "";
        }, "Success", "Successfully added the new meal: \"" + addItem + "\"");
    }
Exemplo n.º 2
0
    /// <summary>
    /// when the view active/archive is clicked, this changes the chosen ods for all listviews to the other ods.
    /// if the archived ods is being used, then the active ods is set, and vice-versa.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ToggleView(object sender, EventArgs e)
    {
        if (seeArchive)
        {
            seeArchive = false;
            PTListview.DataSourceID = "PTODS";
            PTListview.DataBind();

            GenderListView.DataSourceID = "GenderODS";
            GenderListView.DataBind();

            MealsListView.DataSourceID = "MealsODS";
            MealsListView.DataBind();

            AgeRangeListView.DataSourceID = "AgeRangeODS";
            AgeRangeListView.DataBind();

            RevealButton.Text = "Show Archived";
        }
        else
        {
            seeArchive = true;
            PTListview.DataSourceID = "ArchivedPTODS";
            PTListview.DataBind();

            GenderListView.DataSourceID = "ArchivedGenderODS";
            GenderListView.DataBind();

            MealsListView.DataSourceID = "ArchivedMealsODS";
            MealsListView.DataBind();

            AgeRangeListView.DataSourceID = "ArchivedAgeRangeODS";
            AgeRangeListView.DataBind();

            RevealButton.Text = "Show Active";
        }
    }