Ejemplo n.º 1
0
    private void EmphasizeCurrentSearch(RecipeDisplayEnum currentDisplay)
    {
        ReciepesSearchControl1.EmphasizeCurrentSearch(currentDisplay);

        //this.lnkAllRecipes.Style["background-color"] = "Transparent";
        //this.lnkMyRecipes.Style["background-color"] = "Transparent";
        //this.lnkFavRecipes.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.lnkAllRecipes.Style["background-color"] = "#A4CB3A";
        //        break;
        //    case RecipeDisplayEnum.MyRecipes:
        //        this.lnkMyRecipes.Style["background-color"] = "#A4CB3A";
        //        break;
        //    case RecipeDisplayEnum.MyFavoriteRecipes:
        //        this.lnkFavRecipes.Style["background-color"] = "#A4CB3A";
        //        break;
        //    case RecipeDisplayEnum.BySearchSimple:
        //        this.lnkSearch.Style["background-color"] = "#A4CB3A";
        //        break;
        //    case RecipeDisplayEnum.BySearchAdvanced:
        //        this.lnkAdvancedSearch.Style["background-color"] = "#A4CB3A";
        //        break;
        //    case RecipeDisplayEnum.ByCategory:
        //        this.lnkCategories.Style["background-color"] = "#A4CB3A";
        //        break;
        //}
    }
Ejemplo n.º 2
0
    //protected void Page_Init(object sender, EventArgs e)
    //{
    //    if (this.CategoryId.HasValue)
    //    {
    //        int count = this.RebindCategories(this.CategoryId);
    //        this.categories.Visible = true;
    //        if (count == 0)
    //            this.pnlCategories.Visible = false;
    //    }
    //}

    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.simpleSearch.Visible = true;
                this.advancedSearch.Visible = true;
                //this.btnSearch.Visible = true;
                //this.txtSearchTerm.Text = (!string.IsNullOrEmpty(Request["term"])) ? Request["term"] : "" ;
                this.txtServings.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("Recipe", 0, string.Empty, email);

            RebindRecipes();

            // 13.10.2010
            // Load categories at page load
            Category[] categories = BusinessFacade.Instance.GetRecipesCategoriesList(((BasePage)this.Page).UserId);
            var        list       = from cat in categories.Where(cat => cat.ParentCategoryId == null).ToArray()
                                    select new SRL_Category(cat.CategoryId, cat.CategoryName, cat.ParentCategoryId, cat.RecipesCount);

            SRL_Category[] categoryList = list.ToArray();
            ReciepesSearchControl1.FillList(categoryList, this.RecipeCategoryChangeBaseUrl);
        }
    }