public void AgregarHtmlOculto()
 {
     if (HttpContext.Current.Session["GestionOfertaEditarAgregar_obj"] != null)
     {
         cOferta objOferta = (cOferta)HttpContext.Current.Session["GestionOfertaEditarAgregar_obj"];
         string  resultado = string.Empty;
         resultado += "<input type=\"hidden\" id=\"hiddenTitulo\" value=\"" + objOferta.ofe_titulo + "\" />";
         resultado += "<input type=\"hidden\" id=\"hiddenDescr\" value=\"" + objOferta.ofe_descr + "\" />";
         List <SitioBase.capaDatos.cArchivo> listaArchivo = WebService.RecuperarTodosArchivos(objOferta.ofe_idOferta, "ofertas", string.Empty);
         if (listaArchivo != null)
         {
             if (listaArchivo.Count > 0)
             {
                 resultado += "<input type=\"hidden\" id=\"hiddenNameImage\" value=\"" + listaArchivo[0].arc_nombre + "\" />";
                 //resultado += "<input type=\"hidden\" id=\"hiddenIdImage\" value=\"" + listaArchivo[0].arc_codRecurso + "\" />";
                 HttpContext.Current.Session["GestionOfertaEditarAgregar_codRecurso"] = listaArchivo[0].arc_codRecurso;
             }
         }
         //string strText = string.Empty;
         //if (HttpContext.Current.Session["GestionProductoImagen_Text"] != null && !string.IsNullOrWhiteSpace(HttpContext.Current.Session["GestionProductoImagen_Text"].ToString()))
         //    strText = HttpContext.Current.Session["GestionProductoImagen_Text"].ToString();
         //resultado += "<input type=\"hidden\" id=\"hiddenText\" value=\"" + strText + "\" />";
         //string strNombre = string.Empty;
         //if (HttpContext.Current.Session["GestionOfertaEditarAgregar_Nombre"] != null)
         //    strNombre = HttpContext.Current.Session["GestionOfertaEditarAgregar_Nombre"].ToString();
         //resultado += "<input type=\"hidden\" id=\"hiddenNombre\" value=\"" + strNombre + "\" />";
         Response.Write(resultado);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Seguridad(consPalabraClave);

            if (Request.QueryString.AllKeys.Contains("id"))
            {
                HttpContext.Current.Session["GestionOfertaEditar_idOferta"] = Request.QueryString.Get("id");
                cOferta objOferta = WebService.RecuperarTodasOfertas().FirstOrDefault(x => x.ofe_idOferta == Convert.ToInt32(HttpContext.Current.Session["GestionOfertaEditar_idOferta"]));
                HttpContext.Current.Session["GestionOfertaEditar_objOferta"] = objOferta;
            }
        }
예제 #3
0
        public string loginCarrito(string pName, string pPass, int pIdOferta)
        {
            string resultado = null;

            resultado = login(pName, pPass);
            if (resultado == "Ok" && Session["clientesDefault_Cliente"] != null)
            {
                cClientes oCliente = (cClientes)Session["clientesDefault_Cliente"];
                WebService.InsertarOfertaRating(pIdOferta, oCliente.cli_codigo, true);
                cOferta o = WebService.RecuperarOfertaPorId(pIdOferta);
                if (o != null)
                {
                    Session["home_Tipo"] = o.ofe_tipo;
                    if (o.tfr_codigo != null)
                    {
                        Session["home_IdTransfer"] = o.tfr_codigo;
                    }
                }
                Session["home_IdOferta"] = pIdOferta;
            }
            return(resultado);
        }
        //
        public void AgregarHtmlOculto()
        {
            string resultado = string.Empty;

            if (HttpContext.Current.Session["GestionOfertaEditar_idOferta"] != null)
            {
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_idOferta\" value=\"" + Server.HtmlEncode(HttpContext.Current.Session["GestionOfertaEditar_idOferta"].ToString()) + "\" />";
            }

            if (HttpContext.Current.Session["GestionOfertaEditar_objOferta"] != null)
            {
                cOferta objOferta = (cOferta)HttpContext.Current.Session["GestionOfertaEditar_objOferta"];
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_titulo\" value=\"" + Server.HtmlEncode(objOferta.ofe_titulo) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_descr\" value=\"" + Server.HtmlEncode(objOferta.ofe_descr) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_descuento\" value=\"" + Server.HtmlEncode(objOferta.ofe_descuento) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_etiqueta\" value=\"" + Server.HtmlEncode(objOferta.ofe_etiqueta) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_etiquetaColor\" value=\"" + Server.HtmlEncode(objOferta.ofe_etiquetaColor) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_tipo\" value=\"" + Server.HtmlEncode(objOferta.ofe_tipo.ToString()) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_nombreTransfer\" value=\"" + Server.HtmlEncode(objOferta.ofe_nombreTransfer == null ? "" : objOferta.ofe_nombreTransfer) + "\" />";
                resultado += "<input type=\"hidden\" id=\"hiddenOfe_fechaFin\" value=\"" + Server.HtmlEncode(string.IsNullOrEmpty(objOferta.ofe_fechaFinOfertaToString) ? "" : objOferta.ofe_fechaFinOfertaToString) + "\" />";
            }
            Response.Write(resultado);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        Seguridad(consPalabraClave);
        if (!IsPostBack)
        {
            if (Request.QueryString.AllKeys.Contains("id"))
            {
                HttpContext.Current.Session["GestionOfertaEditarAgregar_codRecurso"] = 0;
                HttpContext.Current.Session["GestionOfertaEditarAgregar_id"]         = Request.QueryString.Get("id");
                cOferta objOferta = WebService.RecuperarOfertaPorId(Convert.ToInt32(HttpContext.Current.Session["GestionOfertaEditarAgregar_id"]));
                HttpContext.Current.Session["GestionOfertaEditarAgregar_obj"] = objOferta;
            }
            else
            {
                HttpContext.Current.Session["GestionOfertaEditarAgregar_Nombre"] = null;
                HttpContext.Current.Session["GestionOfertaEditarAgregar_id"]     = null;
            }
        }
        else// if (IsPostBack)
        {
            Label1.Text = "";
            Boolean fileOK = false;
            String  path   = Server.MapPath("~/archivos/ofertas/");
            if (FileUpload1.HasFile)
            {
                String fileExtension =
                    System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                String[] allowedExtensions =
                { ".gif", ".png", ".jpeg", ".jpg" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }

            if (fileOK)
            {
                try
                {
                    if (HttpContext.Current.Session["GestionOfertaEditarAgregar_id"] != null && HttpContext.Current.Session["GestionOfertaEditarAgregar_codRecurso"] != null)
                    {
                        string nombre = FileUpload1.FileName;
                        nombre = nombre.Replace(" ", "");
                        //string RutaCompleta = AppDomain.CurrentDomain.BaseDirectory + @"\archivos\" + ruta + @"\";
                        // string RutaCompletaNombreArchivo = path + nombre;

                        string[] listaParteNombre      = nombre.Split('.');
                        string   CacheNombreArchivo    = string.Empty;
                        string   CacheExtencionArchivo = string.Empty;
                        for (int i = 0; i < listaParteNombre.Length - 1; i++)
                        {
                            CacheNombreArchivo += listaParteNombre[i];
                        }
                        CacheExtencionArchivo = listaParteNombre[listaParteNombre.Length - 1];
                        int    cont        = -1;
                        string parteNueva  = string.Empty;
                        string nombreFinal = CacheNombreArchivo + parteNueva + "." + CacheExtencionArchivo;
                        while (System.IO.File.Exists(path + nombreFinal))
                        {
                            cont++;
                            parteNueva  = cont.ToString();
                            nombreFinal = CacheNombreArchivo + parteNueva + "." + CacheExtencionArchivo;
                        }

                        FileUpload1.PostedFile.SaveAs(path + nombreFinal);

                        cThumbnail.obtenerImagen("ofertas", nombreFinal, "283", "185", "", false);

                        WebService.InsertarActualizarArchivo(Convert.ToInt32(HttpContext.Current.Session["GestionOfertaEditarAgregar_codRecurso"]), Convert.ToInt32(HttpContext.Current.Session["GestionOfertaEditarAgregar_id"]), "ofertas", CacheExtencionArchivo, FileUpload1.PostedFile.ContentType, nombreFinal, string.Empty, string.Empty, string.Empty, Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["codigoUsuarioSinRegistrar"]));
                        //WebService.ActualizarInsertarProductosImagen(HttpContext.Current.Session["GestionOfertaEditarAgregar_id"].ToString(), nombreFinal);
                        //Label1.Text = "File uploaded!";

                        HttpContext.Current.Session["GestionOfertaEditarAgregar_Nombre"] = null;
                        HttpContext.Current.Session["GestionOfertaEditarAgregar_id"]     = null;
                        string parametro = string.Empty;

                        //if (HttpContext.Current.Session["GestionProductoImagen_Text"] != null && !string.IsNullOrWhiteSpace(HttpContext.Current.Session["GestionProductoImagen_Text"].ToString()))
                        //{
                        //    parametro = "?text=" + HttpContext.Current.Session["GestionProductoImagen_Text"].ToString();
                        //}
                        Response.Redirect("GestionOferta.aspx");
                    }
                }
                catch (Exception ex)
                {
                    //Label1.Text = "File could not be uploaded.";
                }
            }
            else
            {
                Label1.Text = "Error: No se subió ningún archivo o archivo incorrecto.";
            }
        }
    }