Beispiel #1
0
    protected void NewMenu()
    {
        MyBuyList.Shared.Entities.Menu menu = new MyBuyList.Shared.Entities.Menu();

        Dictionary <int, Recipe> selectedRecipes = Utils.SelectedRecipes;

        if (selectedRecipes != null && selectedRecipes.Count != 0)
        {
            foreach (KeyValuePair <int, Recipe> r in selectedRecipes)
            {
                MenuRecipe recipe = new MenuRecipe();
                recipe.RecipeId = r.Key;
                recipe.Recipe   = r.Value;
                recipe.Menu     = this.CurrentMenu;
                menu.MenuRecipes.Add(recipe);
            }
        }

        menu.MenuId     = 0;
        menu.MenuTypeId = 1;

        this.CurrentMenu = menu;

        this.RebindMenuRecipes();

        this.rbnCategoryOneMeal.Checked = true;
        this.rbnCategoryWeekly.Checked  = false;
        this.TablesTitleImg.ImageUrl    = "Images/SubHeader_MeatDetails.png";
        this.divNumDiners.Visible       = true;

        this.RebindMealsDetails();

        this.BindMenuCategories();
    }
    protected void SaveImage(object sender, EventArgs e)
    {
        if (!CurrentMenuId.HasValue)
        {
            return;
        }

        Menu   menu     = BusinessFacade.Instance.GetMenu(CurrentMenuId.Value);
        string category = "MenusScreenShots";

        string savePath = Server.MapPath(string.Format(@"~\Images\{0}\", category));

        if (!Directory.Exists(savePath))
        {
            Directory.CreateDirectory(savePath);
        }

        string t_strLargeImage = string.Format(@"{0}{1}.jpg", savePath, menu.MenuName);

        // Create instance
        ThumbMakerClass t_xThumbMaker = new ThumbMakerClass();

        t_xThumbMaker.SetURL(string.Format("http://{0}{1}/ScreenShotMenu.aspx?menuId={2}&action=screenshot", Request.Url.Host,
                                           Request.ApplicationPath, CurrentMenuId));
        t_xThumbMaker.SetRegInfo("KRMAXARQW-XTABNYBXW-KMQXRWMKB-BNTQABQTE");
        t_xThumbMaker.StartSnap();

        // Save the image with full size in C#
        bool saveImage = t_xThumbMaker.SaveImage(t_strLargeImage.Replace(@"""", "``"));

        if (saveImage)
        {
            Response.Redirect("ScreenShotMenu.aspx?menuId=" + CurrentMenuId);
        }
    }
Beispiel #3
0
    private void BuildTree(MCategory[] cats, int?parentCategoryId, TreeNode rootNode)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;

        var list = cats.Where(mc => mc.ParentMCategoryId == parentCategoryId);

        foreach (MCategory item in list)
        {
            TreeNode node = new TreeNode(item.MCategoryName, item.MCategoryId.ToString());
            if (menu.MenuCategories != null &&
                menu.MenuCategories.SingleOrDefault(mc => mc.MCategoryId == item.MCategoryId) != null)
            {
                node.Checked = true;
            }

            if (rootNode == null)
            {
                this.tvCategories.Nodes.Add(node);
            }
            else
            {
                rootNode.ChildNodes.Add(node);
            }

            BuildTree(cats, item.MCategoryId, node);
        }
    }
Beispiel #4
0
    protected void txtDinersNum_TextChanged(object sender, EventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;
        int     dinersNumber;
        TextBox txtDinersNum = sender as TextBox;

        if (txtDinersNum != null && int.TryParse(txtDinersNum.Text, out dinersNumber))
        {
            Meal  mealToChange    = null;
            int[] mealIdentifiers = GetMealIdentifiers(txtDinersNum.Attributes["mealSignature"]);

            if (menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
            {
                mealToChange = menu.Meals.SingleOrDefault(me => me.MealTypeId == mealIdentifiers[1]);
            }
            if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal)
            {
                mealToChange = menu.Meals.SingleOrDefault(me => me.CourseTypeId == mealIdentifiers[2]);
            }
            else
            {
                mealToChange = menu.Meals.SingleOrDefault(me => me.DayIndex == mealIdentifiers[0] && me.MealTypeId == mealIdentifiers[1]);
            }

            if (mealToChange != null)
            {
                mealToChange.Diners = dinersNumber;
            }
        }
    }
Beispiel #5
0
    protected void rptRecipes_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.currentMenu;

        Meal meal = this.CurrentMeal;

        HyperLink lnk = e.Item.FindControl("lblRecipeName") as HyperLink;

        if (lnk != null)
        {
            lnk.NavigateUrl = "~/RecipeDetails.aspx?RecipeId=" + ((MealRecipe)e.Item.DataItem).RecipeId.ToString();
        }

        if (this.currentMenu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            HtmlTableCell tdDinerNum = e.Item.FindControl("tdDinersNum") as HtmlTableCell;
            if (tdDinerNum != null)
            {
                tdDinerNum.Style["width"] = "33px";
                Label lblDinersNum = new Label();
                lblDinersNum.Text = meal.Diners.ToString();
                tdDinerNum.Controls.Add(lblDinersNum);
            }
        }
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request["menuId"]))
        {
            int menuId = int.Parse(Request["menuId"]);

            MyBuyList.Shared.Entities.Menu menu = BusinessFacade.Instance.GetMenuEx(menuId);

            if (menu != null && menu.IsDeleted == false && (menu.IsPublic == true || menu.UserId == ((BasePage)this.Page).UserId || ((BasePage)this.Page).UserType == 1))
            {
                Page.Title = "הדרך המטעימה לארגון הרשימה - MyBuyList";

                this.currentMenu = menu;
                this.BindMenuDetails(menu);

                ScriptManager.RegisterStartupScript(this, typeof(Page), "Key", "javascript:window.print();", true);
            }
            else
            {
                AppEnv.MoveToDefaultPage();
            }
        }
        else
        {
            AppEnv.MoveToDefaultPage();
        }
    }
Beispiel #7
0
    protected void rptRecipes_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;

        Meal       meal = null;
        MealRecipe currentMealRecipe = e.Item.DataItem as MealRecipe;

        if (currentMealRecipe != null)
        {
            meal = currentMealRecipe.Meal;
        }

        LinkButton lnkBtn = e.Item.FindControl("removeFromMeal") as LinkButton;

        if (lnkBtn != null)
        {
            lnkBtn.Attributes["recipeId"]      = currentMealRecipe.RecipeId.ToString();
            lnkBtn.Attributes["mealSignature"] = this.GetMealSignature(meal);
        }

        TextBox txtBox = e.Item.FindControl("txtServings") as TextBox;

        if (txtBox != null)
        {
            txtBox.Attributes["recipeId"]      = currentMealRecipe.RecipeId.ToString();
            txtBox.Attributes["mealSignature"] = this.GetMealSignature(meal);
        }
    }
Beispiel #8
0
    private void RefreshInfoTags(int menuId)
    {
        //get the correct info tags to update.
        HtmlGenericControl divMyFavoritesInfoTag = null;
        Label lblAllFavorites = null;

        foreach (RepeaterItem item in this.rptRecipes.Items)
        {
            HiddenField hf = item.FindControl("hfMenuId") as HiddenField;
            if (hf != null && int.Parse(hf.Value) == menuId)
            {
                divMyFavoritesInfoTag = item.FindControl("myFavoritesInfoTag") as HtmlGenericControl;
                lblAllFavorites       = item.FindControl("lblAllFavorites") as Label;
            }
        }
        //get the menu
        MyBuyList.Shared.Entities.Menu menu = BusinessFacade.Instance.GetMenu(menuId);

        if (menu != null && divMyFavoritesInfoTag != null && lblAllFavorites != null)
        {
            if (menu.UserFavoriteMenus.SingleOrDefault(ufm => ufm.UserId == ((BasePage)this.Page).UserId) != null)
            {
                divMyFavoritesInfoTag.Visible = true;
            }
            else
            {
                divMyFavoritesInfoTag.Visible = false;
            }

            lblAllFavorites.Text = menu.UserFavoriteMenus.Count.ToString();
        }
    }
Beispiel #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                MyBuyList.Shared.Entities.Menu menu = new MyBuyList.Shared.Entities.Menu();

                Meal theMeal = new Meal();
                theMeal.MealTypeId   = 4;
                theMeal.CourseTypeId = 0;
                theMeal.CreatedDate  = DateTime.Now;
                theMeal.ModifiedDate = DateTime.Now;

                Dictionary <int, Recipe> selectedRecipes         = Utils.SelectedRecipes;
                Dictionary <int, int>    selectedRecipesServings = Utils.SelectedRecipesServings;

                menu.MenuName    = string.Format("רשימת קניות מהירה מתאריך {0}, {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
                menu.MenuTypeId  = (int)MenuTypeEnum.QuickMenu;
                menu.UserId      = ((BasePage)this.Page).UserId;
                menu.IsPublic    = false;
                menu.Description = string.Format("רשימת קניות מהירה שהופקה בתאריך {0}, בשעה {1}. כוללת {2} מתכונים", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), (selectedRecipes != null) ? selectedRecipes.Count.ToString() : "0");

                if (selectedRecipes != null && selectedRecipes.Count != 0)
                {
                    foreach (KeyValuePair <int, Recipe> r in selectedRecipes)
                    {
                        MenuRecipe recipe = new MenuRecipe();
                        recipe.RecipeId = r.Key;
                        menu.MenuRecipes.Add(recipe);

                        MealRecipe mealRecipe = new MealRecipe();
                        mealRecipe.RecipeId = r.Key;
                        //mealRecipe.Servings = r.Value.ExpectedServings;
                        mealRecipe.ExpectedServings = r.Value.ExpectedServings;
                        mealRecipe.Servings         = selectedRecipesServings.Keys.Contains(recipe.RecipeId) ? selectedRecipesServings[recipe.RecipeId] : r.Value.Servings;
                        theMeal.MealRecipes.Add(mealRecipe);
                    }
                }

                menu.Meals.Add(theMeal);

                int newMenuId;

                BusinessFacade.Instance.CreateOrUpdateMenu(menu, out newMenuId);

                if (newMenuId != 0)
                {
                    Utils.SelectedRecipes         = null;
                    Utils.SelectedRecipesServings = null;
                    string url = string.Format("~/ShoppingList.aspx?menuId={0}", newMenuId);
                    this.Response.Redirect(url);
                }
            }
        }
        catch (Exception)
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (!string.IsNullOrEmpty(this.Request["menuId"]))
            {
                this.MenuId = int.Parse(this.Request["menuId"]);

                int menuTypeId = BusinessFacade.Instance.GetMenuType(this.MenuId).MenuTypeId;
                //this.Master.SetLeftBackgroundImage(menuTypeId);
                MyBuyList.Shared.Entities.Menu menu = BusinessFacade.Instance.GetMenu(this.MenuId);

                if (menu.UserId == 0)
                {
                    if (((BasePage)Page).CurrUser != null)
                    {
                        if (((BasePage)Page).UserId != -1)
                        {
                            BusinessFacade.Instance.UpdateMenuUser(this.MenuId, ((BasePage)Page).UserId);
                            menu = BusinessFacade.Instance.GetMenu(this.MenuId);
                        }
                    }
                }

                if (((BasePage)Page).CurrUser != null)
                {
                    if (menu.UserId == ((BasePage)Page).UserId || menu.IsPublic == true || ((BasePage)Page).UserType == 1)
                    {
                        this.foodsList = BusinessFacade.Instance.GetMenuShoppingList(this.MenuId);

                        ShopDepartment[] list = BusinessFacade.Instance.GetMenuShopDepartments(this.MenuId);
                        this.rptMenuShopDepartments.DataSource = list;
                        this.rptMenuShopDepartments.DataBind();

                        this.rptMenuRecipes.DataSource = BusinessFacade.Instance.GetRecipesInMenuMeals(this.MenuId).Values.ToArray <Recipe>();
                        this.rptMenuRecipes.DataBind();

                        this.btnPrintShoppingList_bottom.NavigateUrl = "~/PrintShopingList.aspx?menuId=" + this.MenuId.ToString();
                        this.btnPrintShoppingList_top.NavigateUrl    = "~/PrintShopingList.aspx?menuId=" + this.MenuId.ToString();

                        if (menu.UserId == ((BasePage)Page).UserId)
                        {
                            this.RebindAdditionalItems();
                            this.UpdatePanel2.Visible = true;
                        }
                    }
                    else
                    {
                        AppEnv.MoveToDefaultPage();
                    }
                }
                else
                {
                    AppEnv.MoveToDefaultPage();
                }
            }
        }
    }
Beispiel #11
0
    protected void rptCourses_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.currentMenu;

        Meal          currentMeal      = null;
        MealDayOfWeek currentWeekDay   = null;
        int           currentWeekDayId = 0;

        int currentCourseOrMenuTypeId = ((CourseOrMealType)e.Item.DataItem).CourseOrMealTypeId;

        RepeaterItem parentItem = e.Item.Parent.Parent as RepeaterItem;

        if (parentItem != null)
        {
            currentWeekDay = parentItem.DataItem as MealDayOfWeek;
        }
        if (currentWeekDay != null)
        {
            currentWeekDayId = currentWeekDay.DayId;
        }

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            foreach (Meal m in this.currentMenu.Meals.ToArray())
            {
                if (m.CourseTypeId == currentCourseOrMenuTypeId)
                {
                    currentMeal = m;
                }
            }
        }
        if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            foreach (Meal m in this.currentMenu.Meals.ToArray())
            {
                if (m.MealTypeId == currentCourseOrMenuTypeId && m.DayIndex == currentWeekDayId)
                {
                    currentMeal = m;
                }
            }
        }

        if (currentMeal == null)
        {
            return;
        }

        this.CurrentMeal = currentMeal;

        Repeater rpt = e.Item.FindControl("rptRecipes") as Repeater;

        if (rpt != null)
        {
            rpt.DataSource = currentMeal.MealRecipes.ToArray();
            rpt.DataBind();
        }
    }
Beispiel #12
0
        protected void RebindRecentMenus(int menuId1, int menuId2)
        {
            MyBuyList.Shared.Entities.Menu menu1 = BusinessFacade.Instance.GetMenu(menuId1);
            MyBuyList.Shared.Entities.Menu menu2 = BusinessFacade.Instance.GetMenu(menuId2);

            this.rptRecentMenus.DataSource = new MyBuyList.Shared.Entities.Menu[2] {
                menu1, menu2
            };
            this.rptRecentMenus.DataBind();
        }
    protected void btnSaveDescription_Click(object sender, EventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.Menu;

        if (BusinessFacade.Instance.UpdateMenuNameAndDescription(this.MenuId, menu.MenuName, this.txtDescription.Text))
        {
            menu.Description = this.txtDescription.Text;

            this.SetDescriptionEditorMode(false);
        }
    }
Beispiel #14
0
    private void BindMenuDetails(MyBuyList.Shared.Entities.Menu menu)
    {
        this.lblTitle2.Text      = menu.MenuName;
        this.lblCategories.Text  = this.GetCategoriesString(menu.MenuCategories.ToArray());
        this.lnkPublisher.Text   = menu.User.DisplayName;
        this.lblPublishDate.Text = menu.ModifiedDate.ToString("dd/MM/yyyy");
        this.lblDescription.Text = menu.Description;
        this.lblMenuTags.Text    = menu.Tags;

        if (menu.Picture != null)
        {
            this.imgMenuPicture.ImageUrl = "~/ShowPicture.ashx?MenuId=" + menu.MenuId;
        }
        else
        {
            this.imgMenuPicture.ImageUrl = "~/Images/Img_Default.jpg";
        }

        bool isInMyFavorites = (menu.UserFavoriteMenus.SingleOrDefault(ufm => ufm.UserId == ((BasePage)this.Page).UserId) != null);

        if (isInMyFavorites)
        {
            this.myFavoritesTopTag.Visible = true;
        }
        else
        {
            this.myFavoritesTopTag.Visible = false;
        }

        this.lblAllFavorites.Text = menu.UserFavoriteMenus.Count.ToString();

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            this.MenuDinersNum.Visible = true;

            if (menu.Meals.Count > 0 && menu.Meals.ToArray()[0].Diners != null)
            {
                this.lblNoDiner.Text = menu.Meals.ToArray()[0].Diners.ToString();
            }

            MealDayOfWeek[] fakeDaysOfWeek = new MealDayOfWeek[1] {
                new MealDayOfWeek(1, MyGlobalResources.Sunday)
            };
            this.rptDays.DataSource = fakeDaysOfWeek;
            this.rptDays.DataBind();
        }

        if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            this.rptDays.DataSource = this.MealDayOfWeek;
            this.rptDays.DataBind();
        }
    }
Beispiel #15
0
    protected void rptDays_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.currentMenu;

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            System.Web.UI.WebControls.Image tableTopImag = e.Item.FindControl("imgTableTop") as System.Web.UI.WebControls.Image;
            tableTopImag.ImageUrl = "~/Images/bgr_TableMenu_toPrint.jpg";

            Repeater rptCourses = e.Item.FindControl("rptCourses") as Repeater;


            var list = from item in BusinessFacade.Instance.GetCourseTypes()
                       select new CourseOrMealType(item.CourseTypeId, item.CourseTypeName);
            CourseOrMealType[] courseTypesArray = list.ToArray();

            if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal)
            {
                CourseOrMealType tempCourseType = courseTypesArray[0];
                for (int i = 0; i < (courseTypesArray.Length - 1); i++)
                {
                    courseTypesArray[i] = courseTypesArray[i + 1];
                }
                courseTypesArray[courseTypesArray.Length - 1] = tempCourseType;
                rptCourses.DataSource = courseTypesArray;
            }
            else
            {
                rptCourses.DataSource = courseTypesArray.Where(cmt => cmt.CourseOrMealTypeId == 0);
            }

            rptCourses.DataBind();
        }
        if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            MealDayOfWeek mdow = e.Item.DataItem as MealDayOfWeek;
            if (mdow != null)
            {
                System.Web.UI.WebControls.Image tableTopImag = e.Item.FindControl("imgTableTop") as System.Web.UI.WebControls.Image;
                tableTopImag.ImageUrl = "~/Images/bgr_Table" + mdow.DayId + "_toPrint.jpg";
            }

            Repeater rptCourses = e.Item.FindControl("rptCourses") as Repeater;

            var list = from item in BusinessFacade.Instance.GetMealTypes()
                       select new CourseOrMealType(item.MealTypeId, item.MealTypeName);

            CourseOrMealType[] mealTypesArray = list.ToArray();
            rptCourses.DataSource = mealTypesArray;
            rptCourses.DataBind();
        }
    }
Beispiel #16
0
    protected void ChangeServings(object sender, CommandEventArgs e)
    {
        int recipeId = Convert.ToInt32(e.CommandArgument);

        MyBuyList.Shared.Entities.Menu menu = CurrentMenu;

        //Recipe recipe1 = BusinessFacade.Instance.GetRecipe(recipeId);

        MenuRecipe menuRecipe = menu.MenuRecipes.SingleOrDefault(x => x.RecipeId == recipeId);

        if (menuRecipe != null)
        {
            MealRecipe mealRecipe = (from p in menu.Meals
                                     join p1 in menuRecipe.Recipe.MealRecipes on p.MealId equals p1.MealId
                                     where p.MenuId == menu.MenuId &&
                                     p1.RecipeId == recipeId && p1.Meal != null
                                     select new MealRecipe
            {
                RecipeId = recipeId,
                Servings = p1.Servings,
                Recipe = menuRecipe.Recipe,
                MealId = p.MealId
            }).SingleOrDefault();

            if (mealRecipe != null)
            {
                switch (e.CommandName)
                {
                case "Increase":
                    mealRecipe.Servings += menuRecipe.Recipe.Servings;
                    break;

                case "Decrease":
                    if (mealRecipe.Servings > menuRecipe.Recipe.Servings)
                    {
                        mealRecipe.Servings -= menuRecipe.Recipe.Servings;
                    }
                    break;
                }

                MealRecipe recipe = menuRecipe.Recipe.MealRecipes.SingleOrDefault(x => x.MealId == mealRecipe.MealId && x.Meal != null);
                if (recipe != null)
                {
                    recipe.Servings = mealRecipe.Servings;
                }
            }
        }
    }
    private void RebindAdditionalItems(MyBuyList.Shared.Entities.Menu menu)
    {
        var listAddItems = from el in BusinessFacade.Instance.GetShoppingListAdditionalItems(menu.MenuId)
                           select new
        {
            ItemId   = el.ShoppingListItemId,
            ItemName = (el.GeneralItem != null ? el.GeneralItem.GeneralItemName : el.ItemName)
        };

        this.rptAdditionalItems.DataSource = listAddItems.ToArray();
        this.rptAdditionalItems.DataBind();
        if (listAddItems.Count() > 0)
        {
            this.lblAdditionalItems.Visible = true;
        }
    }
    private void BindShoppingList(MyBuyList.Shared.Entities.Menu menu)
    {
        this.foodsList = BusinessFacade.Instance.GetMenuShoppingList(menu.MenuId);

        var list = BusinessFacade.Instance.GetMenuShopDepartments(menu.MenuId);

        this.rptMenuShopDepartments.DataSource = list;
        this.rptMenuShopDepartments.DataBind();

        this.rptMenuRecipes.DataSource = BusinessFacade.Instance.GetRecipesInMenuMeals(menu.MenuId).Values.ToArray <Recipe>();
        this.rptMenuRecipes.DataBind();

        if (menu.UserId == ((BasePage)Page).UserId)
        {
            this.RebindAdditionalItems(menu);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            FBUrl = Request.Url.AbsoluteUri;

            if (string.IsNullOrEmpty(this.Request["menuId"]))
            {
                AppEnv.MoveToDefaultPage();
            }

            int  menuId = int.Parse(Request["menuId"]);
            Menu menu   = BusinessFacade.Instance.GetMenuEx(menuId);

            if (menu == null)
            {
                AppEnv.MoveToDefaultPage();
            }

            if ((((BasePage)Page).UserType != 1) && (menu.UserId != ((BasePage)Page).UserId) && !(menu.IsPublic) || menu.IsDeleted)
            {
                AppEnv.MoveToDefaultPage();
            }
            else
            {
                Page.Title                     = string.Format(" ארגון רשימת הקניות שלך - MyBuyList - {0}", menu.MenuName);
                hlEditMenu.NavigateUrl        += menu.MenuId.ToString();
                hlEditMenu_bottom.NavigateUrl += menu.MenuId.ToString();
                currentMenu                    = menu;
                MenuTypeId                     = menu.MenuTypeId;
                BindMenuData();

                //-TODO???
                //this.PageDescription.Attributes["content"] = string.Format("פרטי מתכון - {0} מאת {1}", currRecipe.RecipeName, currRecipe.User.DisplayName);

                //-Should I store values in viewstate?
                //if (!string.IsNullOrEmpty(this.Request["view"]))
                //{
                //    this.ViewId = int.Parse(this.Request["view"]);
                //}
            }
        }
    }
Beispiel #20
0
    protected void RebindMealsDetails()
    {
        MyBuyList.Shared.Entities.Menu menu = CurrentMenu;

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            MealDayOfWeek[] fakeDaysOfWeek = new MealDayOfWeek[1] {
                new MealDayOfWeek(1, MyGlobalResources.Sunday)
            };
            rptDays.DataSource = fakeDaysOfWeek;
            rptDays.DataBind();
        }

        if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            rptDays.DataSource = MealDayOfWeek;
            rptDays.DataBind();
        }
    }
    private void SaveScreenShot()
    {
        if (string.IsNullOrEmpty(Request["menuId"]))
        {
            return;
        }

        int    menuId   = Convert.ToInt32(Request["menuId"]);
        Menu   menu     = BusinessFacade.Instance.GetMenu(menuId);
        string category = "MenusScreenShots";

        byte[] data;
        string url;

        using (WebClient client = new WebClient())
        {
            url = string.Format("http://{0}{1}/Images/{2}/{3}.jpg", Request.Url.Host, Request.ApplicationPath,
                                category, menu.MenuName.Replace(@"""", "``"));
            data = client.DownloadData(url);
        }
        try
        {
            string fileName = HttpUtility.UrlPathEncode(string.Format("{0}.jpg", menu.MenuName));

            Response.Clear();
            Response.ContentEncoding = Encoding.GetEncoding("utf-8");
            Response.Buffer          = true;
            Response.AddHeader("Content-Length", data.Length.ToString());
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", fileName));
            Response.AddHeader("Expires", "0");
            Response.AddHeader("Pragma", "cache");
            Response.AddHeader("Cache-Control", "no-cache");
            Response.ContentType = string.Format("image/JPEG");
            Response.AddHeader("Accept-Ranges", "bytes");
            Response.BinaryWrite(data);
            Response.Flush();
            Response.End();
        }
        catch (Exception)
        {
        }
    }
Beispiel #22
0
    protected void txtServings_TextChanged(object sender, EventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;

        TextBox txtServings = sender as TextBox;

        if (txtServings != null)
        {
            int   recipeId        = 0;
            int[] mealIdentifiers = GetMealIdentifiers(txtServings.Attributes["mealSignature"]);
            if (int.TryParse(txtServings.Attributes["recipeId"], out recipeId) && mealIdentifiers != null && mealIdentifiers.Length == 3)
            {
                Meal mealToChange = null;
                // TODO: change all the occurances of this code to "switch", and try to do it with a delegate, that point to different methods
                // according to the menuTypeId. These methods will get a menu object (menuToSave) and a meal object (from menu) or the whole menu object (menu)

                switch (menu.MenuTypeId)
                {
                case (int)MenuTypeEnum.QuickMenu:
                    mealToChange = menu.Meals.SingleOrDefault(me => me.MealTypeId == mealIdentifiers[1]);
                    break;

                case (int)MenuTypeEnum.OneMeal:
                    mealToChange = menu.Meals.SingleOrDefault(me => me.CourseTypeId == mealIdentifiers[2]);
                    break;

                case (int)MenuTypeEnum.Weekly:
                    mealToChange = menu.Meals.SingleOrDefault(me => me.DayIndex == mealIdentifiers[0] && me.MealTypeId == mealIdentifiers[1]);
                    break;
                }

                if (mealToChange != null)
                {
                    MealRecipe recipeToChange = mealToChange.MealRecipes.SingleOrDefault(re => re.RecipeId == recipeId);
                    if (recipeToChange != null)
                    {
                        recipeToChange.Servings = int.Parse(txtServings.Text);
                    }
                }
            }
        }
    }
Beispiel #23
0
    protected void RebindMenuDetails()
    {
        MyBuyList.Shared.Entities.Menu menu = CurrentMenu;

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            rbnCategoryOneMeal.Checked    = true;
            rbnCategoryWeekly.Checked     = false;
            TablesTitleImg.ImageUrl       = "Images/SubHeader_MeatDetails.png";
            divNumDiners.Visible          = true;
            ddlChooseCourse.Visible       = true;
            ddlChooseCourse.SelectedValue = "-1";
            ddlChooseDay.Visible          = false;
            ddlChooseMeal.Visible         = false;

            if (menu.Meals.Count > 0)
            {
                txtNumDiners.Text = menu.Meals.ToArray()[0].Diners.ToString(); //all meals (courses) should have the same diners number.
            }
        }
        else
        {
            rbnCategoryOneMeal.Checked  = false;
            rbnCategoryWeekly.Checked   = true;
            TablesTitleImg.ImageUrl     = "Images/SubHeader_WeklyMenu.png"; //Change to designer's image.
            divNumDiners.Visible        = false;
            ddlChooseCourse.Visible     = false;
            ddlChooseDay.Visible        = true;
            ddlChooseDay.SelectedValue  = "0";
            ddlChooseMeal.Visible       = true;
            ddlChooseMeal.SelectedValue = "0";
        }

        chxPulicMenu.Checked    = menu.IsPublic;
        txtMenuName.Text        = menu.MenuName;
        txtMenuDescription.Text = menu.Description;
        txtMenuTags.Text        = menu.Tags;
        txtEmbeddedVideo.Text   = menu.EmbeddedVideo;
        txtCategories.Text      = this.GetCategoriesString(menu.MenuCategories.ToArray());

        RebindMealsDetails();
    }
Beispiel #24
0
    protected void btnCatOK_Click(object sender, EventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;

        menu.MenuCategories.Clear();
        string updatedCategoriesStr = "";

        foreach (TreeNode node in this.tvCategories.CheckedNodes)
        {
            MenuCategory mcat = new MenuCategory();
            mcat.MenuId      = menu.MenuId;
            mcat.MCategoryId = int.Parse(node.Value);
            menu.MenuCategories.Add(mcat);
            updatedCategoriesStr += node.Text + ", ";
        }
        updatedCategoriesStr = updatedCategoriesStr.Remove(updatedCategoriesStr.Length - 2);

        this.BindMenuCategories();

        this.txtCategories.Text = updatedCategoriesStr;
        this.upCategories.Update();
    }
Beispiel #25
0
    protected void lnkRemove_Click(object sender, EventArgs e)
    {
        MyBuyList.Shared.Entities.Menu menu = this.CurrentMenu;

        LinkButton lnkBtn = sender as LinkButton;

        int recipeId;

        if (lnkBtn != null && int.TryParse(lnkBtn.Attributes["recipeId"], out recipeId))
        {
            foreach (Meal meal in menu.Meals)
            {
                MealRecipe mealRecipeToRemove = meal.MealRecipes.SingleOrDefault(mr => mr.RecipeId == recipeId);
                if (mealRecipeToRemove != null)
                {
                    meal.MealRecipes.Remove(mealRecipeToRemove);
                }
            }

            MenuRecipe menuRecipeToRemove = menu.MenuRecipes.SingleOrDefault(mr => mr.RecipeId == recipeId);

            if (menuRecipeToRemove != null)
            {
                menu.MenuRecipes.Remove(menuRecipeToRemove);
            }

            Dictionary <int, Recipe> selectedRecipes = Utils.SelectedRecipes;
            selectedRecipes.Remove(recipeId);
        }

        CurrentMenu = menu;

        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setDirty", "setDirty();", true);

        RebindMenuRecipes();
        RebindMealsDetails();
        upSelectedRecipes.Update();
        upMealsDetails.Update();
    }
Beispiel #26
0
    protected void RebindMenuRecipes()
    {
        MyBuyList.Shared.Entities.Menu menu = CurrentMenu;

        Dictionary <int, Recipe> recipes = new Dictionary <int, Recipe>();

        foreach (MenuRecipe r in menu.MenuRecipes)
        {
            recipes.Add(r.RecipeId, r.Recipe);
        }

        if (recipes.Count > 0)
        {
            dlRecipes.DataSource = recipes;
            dlRecipes.DataBind();
        }
        else
        {
            dlRecipes.Visible = false;
            lblStatus.Visible = true;
            lblStatus.Text    = "לא נבחרו מתכונים";
        }
    }
Beispiel #27
0
    private string PrintMenuRecipes(int menuId)
    {
        MyBuyList.Shared.Entities.Menu menu = BusinessFacade.Instance.GetMenu(menuId);
        string data = "<html>" +
                      "<body dir='rtl'>" +
                      "<table  dir='rtl'> " +
                      "<tr>" +
                      "<td style='width:400px;'> " +
                      " &nbsp; " +
                      "</td> " +
                      "<td>" +
                      "&nbsp;" +
                      "</td>" +
                      "<td rowspan='2'>" +
                      "<img src='http://www.mybuylist.com/Images/New/Logo.gif' />" +
                      "</td>" +
                      "</tr>" +
                      "<tr>" +
                      "<td colspan='2' align='center'>" +
                      "&nbsp;" +
                      "<b style='font-size:larger; color:Red;'>" + menu.MenuName + "</b>" +

                      "</td>" +
                      "</tr>" +
                      "<tr> " +
                      "<td>  ";


        MenuRecipe[] recipeList = BusinessFacade.Instance.GetMenuRecipes(menuId).ToArray <MenuRecipe>();
        Dictionary <int, List <int> > recipeServList = BusinessFacade.Instance.GetMenuRecipesIngrid(menuId);
        bool isFirst = true;

        foreach (MenuRecipe currMenuRecipe in recipeList)
        {
            if (isFirst)
            {
                isFirst = false;
            }
            else
            {
                data += "<hr />";
            }

            if (recipeServList.ContainsKey(currMenuRecipe.RecipeId))
            {
                List <int> RecipeServings = recipeServList[currMenuRecipe.RecipeId];
                RecipeServings.Sort();
                data += "<b>" + currMenuRecipe.Recipe.RecipeName + "</b><br>";

                foreach (int serv in RecipeServings)
                {
                    if (serv == currMenuRecipe.Recipe.Servings)
                    {
                        data += "<b>מצרכים כפי שהוגדרו במתכון המקורי (" + serv.ToString() + " מנות):</b> <br>";
                        foreach (Ingredient cuurIngredient in currMenuRecipe.Recipe.Ingredients)
                        {
                            data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + new SRL_Ingredient(cuurIngredient).DisplayIngredient;
                            data += "<br>";
                        }
                    }
                    else
                    {
                        data += "<b>מצרכים כפי שבחרת לארוחה עבור (" + serv.ToString() + " מנות):</b> <br>";
                        foreach (Ingredient cuurIngredient in currMenuRecipe.Recipe.Ingredients)
                        {
                            SRL_Ingredient cuurSRLIngredient = new SRL_Ingredient();
                            cuurSRLIngredient.FoodId              = cuurIngredient.FoodId;
                            cuurSRLIngredient.FoodName            = BusinessFacade.Instance.GetFood(cuurSRLIngredient.FoodId).FoodName;
                            cuurSRLIngredient.MeasurementUnitId   = cuurIngredient.MeasurementUnitId;
                            cuurSRLIngredient.MeasurementUnitName = BusinessFacade.Instance.GetMeasurementUnit(cuurSRLIngredient.MeasurementUnitId).UnitName;
                            cuurSRLIngredient.Quantity            = Decimal.Round((cuurIngredient.Quantity / currMenuRecipe.Recipe.Servings) * serv, 2);
                            cuurSRLIngredient.Remarks             = cuurIngredient.Remarks;
                            data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + cuurSRLIngredient.DisplayIngredient;
                            data += "<br>";
                        }
                    }
                }

                data += "<br><b>אופן הכנה: </b><br>";
                data += currMenuRecipe.Recipe.PreparationMethod + "<br><br>";
            }
            else
            {
                data += "<b>" + currMenuRecipe.Recipe.RecipeName + "</b><br>";
                data += "<b>מצרכים:</b> <br>";
                foreach (Ingredient cuurIngredient in currMenuRecipe.Recipe.Ingredients)
                {
                    data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + new SRL_Ingredient(cuurIngredient).DisplayIngredient;
                    data += "<br>";
                }

                data += "<br><b>אופן הכנה: </b><br>";
                data += currMenuRecipe.Recipe.PreparationMethod + "<br><br>";
            }
        }


        data += "</td> " +
                "</tr> " +
                "</table> " +
                "</body>" +
                "</html>";

        return(data);
    }
Beispiel #28
0
    private string PrintMenuMeals(int menuId)
    {
        MyBuyList.Shared.Entities.Menu menu = BusinessFacade.Instance.GetMenu(menuId);

        bool isWeekly = false;

        if (menu.MenuTypeId != 1)
        {
            isWeekly = true;
        }

        string data = "<html>" +
                      "<body dir='rtl'>" +
                      "<table  dir='rtl'> " +
                      "<tr>" +
                      "<td style='width:400px;'> " +
                      " &nbsp; " +
                      "</td> " +
                      "<td>" +
                      "&nbsp;" +
                      "</td>" +
                      "<td rowspan='2'>" +
                      "<img src='http://www.mybuylist.com/Images/New/Logo.gif' />" +
                      "</td>" +
                      "</tr>" +
                      "<tr>" +
                      "<td colspan='2' align='center'>" +
                      "&nbsp;" +
                      "<b style='font-size:larger; color:Red;'>" + menu.MenuName + "</b>" +

                      "</td>" +
                      "</tr>" +

                      "<tr> " +
                      "<td>  ";

        if (isWeekly)
        {
            MealType[] mealTypes = BusinessFacade.Instance.GetMealTypes();
            for (int i = 1; i <= 7; i++)
            {
                data += "<b> יום מספר " + i.ToString() + ":</b><br>";
                foreach (MealType currType in mealTypes)
                {
                    Meal[] currDayMeals = (BusinessFacade.Instance.GetMealsList(menuId)).Where(m => m.DayIndex == i && m.MealTypeId == currType.MealTypeId).ToArray <Meal>();

                    data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;" + currType.MealTypeName + "- <br>";
                    foreach (Meal cuurMeal in currDayMeals)
                    {
                        foreach (MealRecipe currRecipe in cuurMeal.MealRecipes)
                        {
                            data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + currRecipe.Recipe.RecipeName;
                            data += "<br>";
                        }
                    }
                }
            }
        }
        else
        {
            CourseType[] courseTypeList = BusinessFacade.Instance.GetCourseTypes();
            foreach (CourseType currType in courseTypeList)
            {
                Meal[] currDayMeals = (BusinessFacade.Instance.GetMealsList(menuId)).Where(m => m.CourseTypeId == currType.CourseTypeId).ToArray <Meal>();
                data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;" + currType.CourseTypeName + "- <br>";
                foreach (Meal cuurMeal in currDayMeals)
                {
                    foreach (MealRecipe currRecipe in cuurMeal.MealRecipes)
                    {
                        data += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + currRecipe.Recipe.RecipeName;
                        data += "<br>";
                    }
                }
            }
        }

        data += "</td> " +
                "</tr> " +
                "</table> " +
                "</body>" +
                "</html>";

        return(data);
    }
    private void BindMenuData()
    {
        Menu menu = currentMenu;

        if (menu != null)
        {
            lblMenuName.Text    = menu.MenuName;
            lblCategories.Text  = this.GetCategoriesString(menu.MenuCategories.ToArray());
            lnkPublisher.Text   = menu.User.DisplayName;
            lblPublishDate.Text = menu.ModifiedDate.ToString("dd/MM/yyyy");
            lblDescription.Text = menu.Description;
            lblMenuTags.Text    = menu.Tags;

            //TODO: add code to change title-image "שם התפריט" to "רשימת קניות מהירה" and change lblMenuName to the date only "מתאריך ..." when the menu
            //is a quick menu.

            if (menu.Picture != null)
            {
                this.imgMenuPicture.ImageUrl = "~/ShowPicture.ashx?MenuId=" + menu.MenuId;
            }
            else if (!string.IsNullOrEmpty(menu.EmbeddedVideo) && menu.EmbeddedVideo.Contains("object") && menu.EmbeddedVideo.Contains("embed"))
            {
                this.imgMenuPicture.Visible         = false;
                this.menu_video.Style["margin-top"] = "10px";
            }
            else
            {
                this.imgMenuPicture.ImageUrl = "~/Images/Img_Default.jpg";   //needs to be changed. ask Dalit.
            }

            if (!string.IsNullOrEmpty(menu.EmbeddedVideo) && menu.EmbeddedVideo.Contains("object") && menu.EmbeddedVideo.Contains("embed"))
            {
                //adjustment method may not work for embedded videos that are not from youtube.
                this.menu_video.InnerHtml = this.AdjustVideo(menu.EmbeddedVideo);
            }
            else
            {
                this.menu_video.Visible = false;
            }

            bool isInMyFavorites = (this.currentMenu.UserFavoriteMenus.SingleOrDefault(ufm => ufm.UserId == ((BasePage)this.Page).UserId) != null);

            if (isInMyFavorites)
            {
                this.myFavoritesTopTag.Visible = true;
            }
            else
            {
                this.myFavoritesTopTag.Visible = false;
            }

            this.lblAllFavorites.Text = menu.UserFavoriteMenus.Count.ToString();

            bool isInUserFavorites = (this.currentMenu.UserFavoriteMenus.SingleOrDefault(ufm => ufm.UserId == ((BasePage)this.Page).UserId) != null);
            if (isInUserFavorites)
            {
                this.btnAddMenuToFavorites.Visible        = false;
                this.btnAddMenuToFavorites_bottom.Visible = false;
            }
            else
            {
                this.btnRemoveMenuFromFavorites.Visible        = false;
                this.btnRemoveMenuFromFavorites_bottom.Visible = false;
            }

            hlShowShoppingList.NavigateUrl        = string.Format("~/ShoppingList.aspx?menuId={0}", menu.MenuId);
            hlShowShoppingList_bottom.NavigateUrl = string.Format("~/ShoppingList.aspx?menuId={0}", menu.MenuId);
            hlPrintMenu.NavigateUrl        = string.Format("~/PrintMenu.aspx?menuId={0}", menu.MenuId);
            hlPrintMenu_bottom.NavigateUrl = string.Format("~/PrintMenu.aspx?menuId={0}", menu.MenuId);

            if (((BasePage)Page).UserId == -1)
            {
                //this.btnSendMail.Visible = false;
                //this.lblPrintMenuSeperator.Visible = false;
                //this.btnSendMail_bottom.Visible = false;
                //this.lblPrintMenuSeperator_bottom.Visible = false;
                btnAddMenuToFavorites.Visible             = false;
                btnAddMenuToFavorites_bottom.Visible      = false;
                lblAddToFavoritesSeparator.Visible        = false;
                lblAddToFavoritesSeparator_bottom.Visible = false;
            }
            if (((BasePage)Page).UserId != menu.User.UserId && (((BasePage)Page).UserType != 1))
            {
                hlEditMenu.Visible                  = false;
                btnDeleteMenu.Visible               = false;
                lblSendMailSeparator.Visible        = false;
                lblEditMenuSeperator.Visible        = false;
                hlEditMenu_bottom.Visible           = false;
                btnDeleteMenu_bottom.Visible        = false;
                lblSendMailSeparator_bottom.Visible = false;
                lblEditMenuSeperator_bottom.Visible = false;
            }

            if (menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
            {
                hlEditMenu.Visible                  = false;
                hlEditMenu_bottom.Visible           = false;
                lblSendMailSeparator.Visible        = false;
                lblSendMailSeparator_bottom.Visible = false;
            }

            if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
            {
                MenuDinersNum.Visible = true;

                if (menu.Meals.Count > 0 && menu.Meals.ToArray()[0].Diners != null)
                {
                    this.lblNoDiner.Text = menu.Meals.ToArray()[0].Diners.ToString();
                }
                MealDayOfWeek[] fakeDaysOfWeek = new MealDayOfWeek[1] {
                    new MealDayOfWeek(1, MyGlobalResources.Sunday)
                };
                rptDays.DataSource = fakeDaysOfWeek;
                rptDays.DataBind();
            }

            if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
            {
                this.rptDays.DataSource = this.MealDayOfWeek;
                this.rptDays.DataBind();
            }

            string userEmail   = string.Empty;
            User   currentUser = BusinessFacade.Instance.GetUser(((BasePage)this.Page).UserId);
            if (currentUser != null)
            {
                userEmail = currentUser.Email;
            }
            ucSendMailToFriend.BindItemDetails("Menu", menu.MenuId, menu.MenuName, userEmail);
        }
    }
    protected void rptCourses_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        Menu menu = this.currentMenu;

        Meal          currentMeal      = null;
        MealDayOfWeek currentWeekDay   = null;
        int           currentWeekDayId = 0;

        int currentCourseOrMenuTypeId = ((CourseOrMealType)e.Item.DataItem).CourseOrMealTypeId;

        RepeaterItem parentItem = e.Item.Parent.Parent as RepeaterItem;

        if (parentItem != null)
        {
            currentWeekDay = parentItem.DataItem as MealDayOfWeek;
        }
        if (currentWeekDay != null)
        {
            currentWeekDayId = currentWeekDay.DayId;
        }

        if (menu.MenuTypeId == (int)MenuTypeEnum.OneMeal || menu.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
        {
            foreach (Meal m in this.currentMenu.Meals.ToArray())
            {
                if (m.CourseTypeId == currentCourseOrMenuTypeId)
                {
                    currentMeal = m;
                }

                if (currentCourseOrMenuTypeId == 6)
                {
                    Label txtComments = e.Item.FindControl("LabelComments") as Label;
                    if (txtComments != null)
                    {
                        if (m.Comments != null)
                        {
                            txtComments.Text = m.Comments.Replace("\r\n", "<br />");
                        }
                        txtComments.Visible = true;
                    }
                }
            }
        }
        if (menu.MenuTypeId == (int)MenuTypeEnum.Weekly)
        {
            foreach (Meal m in this.currentMenu.Meals.ToArray())
            {
                if (m.MealTypeId == currentCourseOrMenuTypeId && m.DayIndex == currentWeekDayId)
                {
                    currentMeal = m;
                }

                if (currentCourseOrMenuTypeId == 5 && m.DayIndex == currentWeekDayId)
                {
                    Label txtComments = e.Item.FindControl("LabelComments") as Label;
                    if (m.Comments != null)
                    {
                        txtComments.Text = m.Comments.Replace("\r\n", "<br />");
                    }
                    txtComments.Visible = true;
                }
            }
        }

        if (currentMeal == null)
        {
            return;
        }

        CurrentMeal = currentMeal;

        Repeater rpt = e.Item.FindControl("rptRecipes") as Repeater;

        if (rpt != null)
        {
            rpt.DataSource = currentMeal.MealRecipes.ToArray();
            rpt.DataBind();
        }
    }