protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] != null)
            {
                string s = "<script type=\"text/javascript\">alert(\"" + Session["Usuario"].ToString() + "\");</script>";
                ENCliente enCli = new EN.ENCliente();
                DataSet ds = new DataSet();
                ds = enCli.ObtenerDatosClienteConDni(Session["Usuario"].ToString());
                string script = "<script type=\"text/javascript\">document.getElementById(\"tit\").innerHTML = \"Bienvenido " + ds.Tables["Cliente"].Rows[0][1].ToString() + ".\";</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Rellenar", s);
            }

            EN.ENVentas enVe = new EN.ENVentas();
            DataSet ds2 = new DataSet();
            ds2 = enVe.ObtenerListaVentas();
            ArrayList lista = new ArrayList();
            StringBuilder cstext1 = new StringBuilder();
            StringBuilder cstext2 = new StringBuilder();

            if (ds2.Tables["Ventas"].Rows.Count > 0)
            {
                cstext1.Append("<script type=\"text/javascript\">");
                cstext1.Append("var ul = document.getElementById(\"Ofertas\");");

                for (int i = 0; i < ds2.Tables["Ventas"].Rows.Count; i++)
                {

                    cstext1.Append("var a = document.createElement(\"a\");");
                    cstext1.Append("a.href = \"Ofertas.aspx\";");
                    cstext1.Append("a.setAttribute('onclick','AlquilerCochesWeb.ServicioWeb.RellenarOferta(\"" + ds2.Tables["Ventas"].Rows[i][0].ToString() + "\")');");
                    cstext1.Append("a.text =" + ds2.Tables["Ventas"].Rows[i][1].ToString() + " " + ds2.Tables["Ventas"].Rows[i][2].ToString() + " KM: " + ds2.Tables["Ventas"].Rows[i][3].ToString() + " PVP: " + ds2.Tables["Ventas"].Rows[i][5].ToString() + "€\";");
                    cstext1.Append("var li = document.createElement(\"li\");");
                    cstext1.Append("li.appendChild(a);");
                    cstext1.Append("ul.appendChild(li);");

                }
                cstext1.Append("</");
                cstext1.Append("script>");
            }

            cstext2.Append("<script type=\"text/javascript\">");
            cstext2.Append("$(\"#scroller\").simplyScroll();");
            cstext2.Append("</");
            cstext2.Append("script>");

            Page.ClientScript.RegisterStartupScript(this.GetType(), "Rellenar", cstext1.ToString());
        }
        private void RellenarOfertas()
        {
            EN.ENVentas enVe = new EN.ENVentas();
            DataSet ds = new DataSet();
            ds = enVe.ObtenerListaVentas();
            ArrayList lista = new ArrayList();
            StringBuilder cstext1 = new StringBuilder();
            StringBuilder cstext2 = new StringBuilder();

            if (ds.Tables["Ventas"].Rows.Count > 0)
            {
                cstext1.Append("<script type=\"text/javascript\"> var ofertas = document.getElementById(\"IndexBoxOfertas\");");
                cstext1.Append("var ul = document.createElement(\"ul\");");
                cstext1.Append("ul.id = \"scroller\";");
                cstext1.Append("ofertas.appendChild(ul);");
                string aux = "";

                for (int i = 0; i < ds.Tables["Ventas"].Rows.Count; i++)
                {
                    switch(Int32.Parse(ds.Tables["Ventas"].Rows[i][7].ToString()))
                    {
                        case 1: aux = "Turismos/";
                            break;
                        case 2: aux = "Familiares/";
                            break;
                        case 3: aux = "Furgonetas/";
                            break;
                        case 4: aux = "Especiales/";
                            break;
                    }
                    cstext1.Append("var img = document.createElement(\"img\");");
                    cstext1.Append("img.title = \"" + ds.Tables["Ventas"].Rows[i][1].ToString() + " " + ds.Tables["Ventas"].Rows[i][2].ToString() + " KM: " + ds.Tables["Ventas"].Rows[i][3].ToString() + " PVP: " + ds.Tables["Ventas"].Rows[i][5].ToString() + "€\";");
                    cstext1.Append("img.alt = \"" + ds.Tables["Ventas"].Rows[i][2].ToString() + "\";");
                    cstext1.Append("img.src = \"Imagenes/ImagenesCompra/CochesCompra/" + aux + ds.Tables["Ventas"].Rows[i][0].ToString() + ".jpg\";");
                    cstext1.Append("img.setAttribute('width','200');");
                    cstext1.Append("img.setAttribute('height','200');");
                    cstext1.Append("var a = document.createElement(\"a\");");
                    cstext1.Append("a.href = \"Ofertas.aspx\";");
                    cstext1.Append("a.setAttribute('onclick','AlquilerCochesWeb.ServicioWeb.RellenarOferta(\"" + ds.Tables["Ventas"].Rows[i][0].ToString() + "\")');");
                    cstext1.Append("a.appendChild(img);");
                    cstext1.Append("var li = document.createElement(\"li\");");
                    cstext1.Append("li.appendChild(a);");
                    cstext1.Append("ul.appendChild(li);");

                }
                cstext1.Append("</");
                cstext1.Append("script>");
            }

            cstext2.Append("<script type=\"text/javascript\">");
            cstext2.Append("$(\"#scroller\").simplyScroll();");
            cstext2.Append("</");
            cstext2.Append("script>");

            Page.ClientScript.RegisterStartupScript(this.GetType(), "Rellenar", cstext1.ToString());
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Rellenar2", cstext2.ToString());
        }