public static string GetManufacturers(bool addSelect, string type) { List<Manufacturer> manufacturers = new ManufacturerBL().GetByType(type, addSelect); var manufacturerItems = (from manufacturer in manufacturers select new { id = manufacturer.Url, name = manufacturer.Name }); return JsonConvert.SerializeObject(manufacturerItems, Formatting.None); }
private void showModels(string manufacturerUrl) { rptModels.DataSource = new ModelBL().GetByManufacturerUrl(manufacturerUrl, false, Page.RouteData.Values["typeUrl"].ToString()); rptModels.DataBind(); Manufacturer manufacturer = new ManufacturerBL().GetManufacturer(manufacturerUrl); if(manufacturer != null) lblManufacturer.Text = new ManufacturerBL().GetManufacturer(manufacturerUrl).Name; else { Response.StatusCode = 404; Server.Transfer("~/errors/not-found.html"); } }
private XmlElement returnByType(string typeUrl, XmlDocument xmlDoc, string typeName) { XmlElement xmlSitemapType = xmlDoc.CreateElement("siteMapNode"); xmlSitemapType.SetAttribute("url", "/vozila/" + typeUrl); xmlSitemapType.SetAttribute("title", typeName); xmlSitemapType.SetAttribute("description", typeName); List<Manufacturer> manufacturers = new ManufacturerBL().GetByType(typeUrl, false); foreach (Manufacturer manufacturer in manufacturers) { XmlElement xmlSitemapManufacturer = xmlDoc.CreateElement("siteMapNode"); xmlSitemapManufacturer.SetAttribute("url", "/vozila/" + typeUrl + "/" + manufacturer.Url); xmlSitemapManufacturer.SetAttribute("title", manufacturer.Name); xmlSitemapManufacturer.SetAttribute("description", manufacturer.Name); DataTable models = new ModelBL().GetByManufacturerUrl(manufacturer.Url, false, typeUrl); foreach (DataRow row in models.Rows) { XmlElement xmlSitemapModel = xmlDoc.CreateElement("siteMapNode"); xmlSitemapModel.SetAttribute("url", "/vozila/" + typeUrl + "/" + manufacturer.Url + "/" + row["url"].ToString()); xmlSitemapModel.SetAttribute("title", row["name"].ToString()); xmlSitemapModel.SetAttribute("description", row["name"].ToString()); DataTable engines = new EngineBL().GetByModelUrl(row["url"].ToString(), manufacturer.Url); foreach (DataRow engineRow in engines.Rows) { XmlElement xmlSitemapEngine = xmlDoc.CreateElement("siteMapNode"); xmlSitemapEngine.SetAttribute("url", "/vozila/" + typeUrl + "/" + manufacturer.Url + "/" + row["url"] + "/" + engineRow["url"].ToString()); xmlSitemapEngine.SetAttribute("title", engineRow["name"].ToString()); xmlSitemapEngine.SetAttribute("description", engineRow["name"].ToString()); xmlSitemapModel.AppendChild(xmlSitemapEngine); } xmlSitemapManufacturer.AppendChild(xmlSitemapModel); } xmlSitemapType.AppendChild(xmlSitemapManufacturer); } return xmlSitemapType; }