Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (this.Display == RecipeDisplayEnum.ByCategory)
            {
                int count = this.RebindCategories(this.CategoryId);
                this.categories.Visible = true;
                if (count == 0)
                {
                    this.pnlCategories.Visible = false;
                }
            }
            if (this.Display == RecipeDisplayEnum.BySearchSimple)
            {
                //this.simpleSearch.Visible = true;
                //this.btnSearch.Visible = true;
                //this.txtSearchTerm.Text = (!string.IsNullOrEmpty(Request["term"])) ? Request["term"] : "";
                //this.btnSearch.CommandArgument = "BySearchSimple";
            }
            if (this.Display == RecipeDisplayEnum.BySearchAdvanced)
            {
                this.BindMenuCategories();
                //this.simpleSearch.Visible = true;
                this.advancedSearch.Visible = true;
                //this.btnSearch.Visible = true;
                //this.txtSearchTerm.Text = (!string.IsNullOrEmpty(Request["term"])) ? Request["term"] : "";
                this.txtDiners.Text   = (!string.IsNullOrEmpty(Request["serv"])) ? Request["serv"] : "";
                this.txtCategory.Text = "";
                //this.btnSearch.CommandArgument = "BySearchAdvanced";
            }

            EmphasizeCurrentSearch(this.Display);

            MyBuyList.Shared.Entities.User currentUser = BusinessFacade.Instance.GetUser(((BasePage)this.Page).UserId);
            string email = (currentUser != null) ? currentUser.Email : string.Empty;
            this.ucSendMailToFriend.BindItemDetails("Menu", 0, string.Empty, email);

            RebindRecipes();

            // 17.09.2010
            // Load categories at page load
            MCategory[] categories = BusinessFacade.Instance.GetMenusCategoriesList(((BasePage)this.Page).UserId);
            var         list       = from mcat in categories.Where(mcat => mcat.ParentMCategoryId == null).ToArray()
                                     select mcat;

            MCategory[] categoryList = list.ToArray();
            MenusSearchControl1.FillList(categoryList, this.MenuCategoryChangeBaseUrl);

            if (CurrUser != null)
            {
                ucShoppingList1.UserId = CurrUser.UserId;
            }
        }
    }
Exemple #2
0
    private void EmphasizeCurrentSearch(RecipeDisplayEnum currentDisplay)
    {
        MenusSearchControl1.EmphasizeCurrentSearch(currentDisplay);

        //this.lnkAllMenus.Style["text-decoration"] = "none";
        //this.lnkMyMenus.Style["text-decoration"] = "none";
        //this.lnkFavMenus.Style["text-decoration"] = "none";
        //this.lnkAllMenus.Style["background-color"] = "Transparent";
        //this.lnkMyMenus.Style["background-color"] = "Transparent";
        //this.lnkFavMenus.Style["background-color"] = "Transparent";
        //this.lnkSearch.Style["background-color"] = "Transparent";
        //this.lnkAdvancedSearch.Style["background-color"] = "Transparent";
        //this.lnkCategories.Style["background-color"] = "Transparent";

        switch (currentDisplay)
        {
        case RecipeDisplayEnum.All:
            //this.lnkAllMenus.Style["background-color"] = "#FBAB14";
            //this.lnkAllMenus.Style["text-decoration"] = "underline";
            break;

        case RecipeDisplayEnum.MyRecipes:
            //this.lnkMyMenus.Style["background-color"] = "#FBAB14";
            //this.lnkMyMenus.Style["text-decoration"] = "underline";
            break;

        case RecipeDisplayEnum.MyFavoriteRecipes:
            //this.lnkFavMenus.Style["background-color"] = "#FBAB14";
            //this.lnkFavMenus.Style["text-decoration"] = "underline";
            break;
            //case RecipeDisplayEnum.BySearchSimple:
            //    this.lnkSearch.Style["background-color"] = "#FBAB14";
            //    break;
            //case RecipeDisplayEnum.BySearchAdvanced:
            //    this.lnkAdvancedSearch.Style["background-color"] = "#FBAB14";
            //    break;
            //case RecipeDisplayEnum.ByCategory:
            //    this.lnkCategories.Style["background-color"] = "#FBAB14";
            //    break;
        }
    }