Esempio n. 1
0
 public static string GetEngines(bool addSelect, string modelUrl, string manufacturerUrl)
 {
     List<Engine> engines = new EngineBL().GetListByModelUrl(modelUrl, addSelect, manufacturerUrl);
     var engineItems = (from engine in engines
                        select new
                        {
                            id = engine.Url,
                            name = engine.Name,
                            power = engine.PowerKw
                        });
     return JsonConvert.SerializeObject(engineItems, Formatting.None);
 }
Esempio n. 2
0
        private void showEngine(string url, string modelUrl, string manufacturerUrl)
        {
            Engine engine = new EngineBL().GetEngine(url, modelUrl, manufacturerUrl);
            if(engine == null)
            {
                Response.StatusCode = 404;
                Server.Transfer("~/errors/not-found.html");
            }
            dgvEngine.DataSource = new EngineBL().GetEngineData(engine, 0);
            dgvEngine.DataBind();

            dgvEngineStage2.DataSource = new EngineBL().GetEngineData(engine, 1);
            dgvEngineStage2.DataBind();
            if (((System.Data.DataTable)dgvEngineStage2.DataSource).Rows.Count == 0)
                stage2.Visible = false;

            Model model = new ModelBL().GetByUrl(lblModelUrl.Value, lblManufacturerUrl.Value);
            if(model != null)
                lblModel.Text = model.Name;
            else
            {
                Response.StatusCode = 404;
                Server.Transfer("~/error/not-found.html");
            }

            if(engine != null)
                lblEngine.Text = model.Name + " " + engine.Name;
            else
            {
                Response.StatusCode = 404;
                Server.Transfer("~/error/not-found.html");
            }

            if(model != null)
                imgModel.ImageUrl = "/images/car-logos/" + lblManufacturerUrl.Value + "/" + "models/" + model.ImageUrl;
            else
            {
                Response.StatusCode = 404;
                Server.Transfer("~/errors/not-found.html");
            }
        }
Esempio n. 3
0
        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;
        }