Esempio n. 1
0
        private void LoadCommerces(SearchOptions options)
        {
            Category category = new Category();

            if (options.CategoryId != -1)
            {
                category = (from cat in CommercesDataContext.Categories
                                 where cat.id == options.CategoryId
                                 select cat).ToList()[0];

                ((SiteMaster)this.Master).chkOnlyInCategory.Visible = true;
                ((SiteMaster)this.Master).chkOnlyInCategory.Text = "Sólo en " + category.name;
            }

            List<Commerces> commerces = (from com in CommercesDataContext.Commerces
                                         select com).ToList();

            if (!String.IsNullOrEmpty(options.Text))
            {
                ((SiteMaster)this.Master).lblTitle.Text = "Resultados de la búsqueda de " + options.Text;

                commerces = (from com in commerces
                             where com.name.Contains(options.Text)
                             select com).ToList();

                if ((options.OnlyInCategory) && (options.CategoryId != -1))
                {
                    ((SiteMaster)this.Master).lblTitle.Text += " en la categoría " + category.name;

                    commerces = (from com in commerces
                                 where com.parent_id == options.CategoryId
                                 select com).ToList();
                }
            }
            else
            {
                ((SiteMaster)this.Master).lblTitle.Text = category.name;

                commerces = (from com in commerces
                             where com.parent_id == options.CategoryId
                             select com).ToList();
            }

            this.gvCommerces.DataSource = commerces;
            this.gvCommerces.DataBind();
        }
		private void detach_Categories(Category entity)
		{
			this.SendPropertyChanging();
			entity.Category1 = null;
		}
		private void attach_Categories(Category entity)
		{
			this.SendPropertyChanging();
			entity.Category1 = this;
		}
 partial void DeleteCategory(Category instance);
 partial void UpdateCategory(Category instance);
 partial void InsertCategory(Category instance);