コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CH_Foto DatosAux = new CH_Foto {
                Conexion = Comun.Conexion, IDUsuario = Comun.IDUsuario
            };
            CH_FotoNegocio             FN = new CH_FotoNegocio();
            RR_AdministradorWebNegocio RN = new RR_AdministradorWebNegocio();

            if (Request.QueryString["op"] != null && Request.QueryString["op"] == "3")
            {
                if (Request.QueryString["id"] != null)
                {
                    string ID = Request.QueryString["id"].ToString();
                    if (Request.QueryString["id"].ToString() == ID)
                    {
                        DatosAux.NuevoRegistro = true;
                        DatosAux.IDFoto        = ID;
                        RN.CargarFotoXID(DatosAux);
                        if (DatosAux.Completado)
                        {
                            string ScriptError = DialogMessage.Show(TipoMensaje.Success, "Registro agregado a la página correctamente.", "Información", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                        }
                        else
                        {
                            string ScriptError = DialogMessage.Show(TipoMensaje.Error, "No se puede agregar el registro a la página registro.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                        }
                    }
                }
            }
            Lista = FN.ObtenerCatalogoFotos(DatosAux);
        }
コード例 #2
0
        public void CargaFotoXID(CH_Foto Datos)
        {
            string id       = "";
            bool   espagina = true;

            try
            {
                object[] Parametros = { Datos.NuevoRegistro, id, Datos.IDFoto, espagina, Datos.IDUsuario };
                object   Result     = SqlHelper.ExecuteScalar(Datos.Conexion, "RR_spCSLDB_AC_FotosPagina", Parametros);
                int      Resultado  = 0;
                int.TryParse(Result.ToString(), out Resultado);
                if (Resultado == 1)
                {
                    Datos.Completado = true;
                }
                else
                {
                    Datos.Completado = false;
                }
                Datos.Resultado = Resultado;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
 public List <CH_Foto> ObtenerCatalogoFotos(CH_Foto Datos)
 {
     try
     {
         List <CH_Foto> Lista = new List <CH_Foto>();
         CH_Foto        Item;
         SqlDataReader  Dr = SqlHelper.ExecuteReader(Datos.Conexion, "CH_spCSLDB_get_GaleriaFotos");
         while (Dr.Read())
         {
             Item               = new CH_Foto();
             Item.IDFoto        = Dr.GetString(Dr.GetOrdinal("IDFoto"));
             Item.URLImagen     = Dr.GetString(Dr.GetOrdinal("UrlFoto"));
             Item.Alt           = Dr.GetString(Dr.GetOrdinal("TextoAlternativo"));
             Item.Title         = Dr.GetString(Dr.GetOrdinal("Titulo"));
             Item.Descripcion   = Dr.GetString(Dr.GetOrdinal("Descripcion"));
             Item.NombreArchivo = Dr.GetString(Dr.GetOrdinal("NombreArchivo"));
             Item.Extension     = Dr.GetString(Dr.GetOrdinal("TipoArchivo"));
             Lista.Add(Item);
         }
         return(Lista);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 public void ACFoto(CH_Foto Datos)
 {
     try
     {
         object[]      Parametros = { Datos.NuevoRegistro, Datos.IDFoto,        Datos.URLImagen, Datos.Alt,          Datos.Title,
                                      Datos.Descripcion,        Datos.NombreArchivo, Datos.Extension, Datos.CambioImagen, Datos.IDUsuario };
         SqlDataReader Dr = SqlHelper.ExecuteReader(Datos.Conexion, "CH_spCSLDB_AC_Fotos", Parametros);
         while (Dr.Read())
         {
             int Resultado = Dr.GetInt32(Dr.GetOrdinal("Resultado"));
             if (Resultado == 1)
             {
                 Datos.Completado = true;
                 Datos.URLImagen  = Dr.GetString(Dr.GetOrdinal("UrlFoto"));
                 Datos.IDFoto     = Dr.GetString(Dr.GetOrdinal("IDFoto"));
             }
             Datos.Resultado = Resultado;
             break;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
 public void ImagenSubidaFotoXID(CH_Foto Datos)
 {
     try
     {
         CH_FotosDatos FD = new CH_FotosDatos();
         FD.ImagenSubidaFotoXID(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #6
0
 public void EliminarFotoXID(CH_Foto Datos)
 {
     try
     {
         CH_FotosDatos FD = new CH_FotosDatos();
         FD.EliminarFotoXID(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #7
0
 public List <CH_Foto> ObtenerCatalogoFotos(CH_Foto Datos)
 {
     try
     {
         CH_FotosDatos FD = new CH_FotosDatos();
         return(FD.ObtenerCatalogoFotos(Datos));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #8
0
 public void ObtenerDetalleFotoXID(CH_Foto Datos)
 {
     try
     {
         CH_FotosDatos FD = new CH_FotosDatos();
         FD.ObtenerDetalleFotoXID(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #9
0
 public void CargarFotoXID(CH_Foto Datos)
 {
     try
     {
         RR_AdministradorWebDatos FD = new RR_AdministradorWebDatos();
         FD.CargaFotoXID(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #10
0
 public void ACFoto(CH_Foto Datos)
 {
     try
     {
         CH_FotosDatos FD = new CH_FotosDatos();
         FD.ACFoto(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #11
0
 public void CargarImagenID(CH_Foto Datos)
 {
     try
     {
         GM_PlanCampaniaDatos FD = new GM_PlanCampaniaDatos();
         FD.CargaImageID(Datos);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string  ID_foto = "";
            CH_Foto Datos   = new CH_Foto {
                Conexion = Comun.Conexion, IDUsuario = Comun.IDUsuario
            };
            EC_EventoExtra DatosAux = new EC_EventoExtra {
                Conexion = Comun.Conexion, id_usuario = Comun.IDUsuario
            };
            EC_EventoExtraNegocio FN = new EC_EventoExtraNegocio();


            if (Request.QueryString["op"] != null && Request.QueryString["op"] == "3")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id2"] != null)
                {
                    ID_foto = Request.QueryString["id"].ToString();

                    if (Request.QueryString["id"].ToString() == ID_foto)
                    {
                        DatosAux.id_actividadEvento = Request.QueryString["id2"].ToString();
                        DatosAux.id_foto            = ID_foto;

                        FN.CargarFotoXID(DatosAux);
                        if (DatosAux.Completado)
                        {
                            string ScriptError = DialogMessage.Show(TipoMensaje.Success, "Registro agregado a la página correctamente.", "Información", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                        }
                        else
                        {
                            string ScriptError = DialogMessage.Show(TipoMensaje.Error, "No se puede agregar el registro a la página registro.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                        }
                        Response.Redirect("frmEventosExtraGrid.aspx", false);
                    }
                }
            }
            else if (Request.QueryString["op"] != null && Request.QueryString["op"] == "2")
            {
                if (Request.QueryString["id"] != null)
                {
                    ID_evento = Request.QueryString["id"].ToString();
                    DatosAux.id_actividadEvento = ID_evento;
                    Lista = FN.ObtenerCatalogoFotos(DatosAux);
                }
            }
        }
コード例 #13
0
 public void EliminarFotoXID(CH_Foto Datos)
 {
     try
     {
         object[] Parametros = { Datos.IDFoto, Datos.IDUsuario };
         object   Result     = SqlHelper.ExecuteScalar(Datos.Conexion, "CH_spCSLDB_del_Foto", Parametros);
         int      Resultado  = 0;
         int.TryParse(Result.ToString(), out Resultado);
         if (Resultado == 1)
         {
             Datos.Completado = true;
         }
         Datos.Resultado = Resultado;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #14
0
 private void CargarDatos(CH_Foto DatosAux)
 {
     try
     {
         hf.Value             = DatosAux.IDFoto;
         txtDescripcion.Value = DatosAux.Descripcion;
         txtTitle.Value       = DatosAux.Title;
         txtAlt.Value         = DatosAux.Alt;
         string BaseDir = Server.MapPath("");
         // BaseDir = BaseDir + DatosAux.URLImagen;
         if (File.Exists(BaseDir + DatosAux.URLImagen))
         {
             Logo.Attributes.Remove("src");
             Logo.Attributes.Add("src", DatosAux.URLImagen);
         }
         Response.Cookies.Clear();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #15
0
 public void CargaImageID(CH_Foto Datos)
 {
     try
     {
         object[] Parametros = { Datos.NuevoRegistro, Datos.IDFoto, Datos.IDUsuario };
         object   Result     = SqlHelper.ExecuteScalar(Datos.Conexion, "", Parametros);
         int      Resultado  = 0;//GM_spCSLDB_AG_ImageWp
         int.TryParse(Result.ToString(), out Resultado);
         if (Resultado == 1)
         {
             Datos.Completado = true;
         }
         else
         {
             Datos.Completado = false;
         }
         Datos.Resultado = Resultado;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #16
0
 public void ObtenerDetalleFotoXID(CH_Foto Datos)
 {
     try
     {
         object[]      Parametros = { Datos.IDFoto };
         SqlDataReader Dr         = SqlHelper.ExecuteReader(Datos.Conexion, "CH_spCSLDB_get_GaleriaFotosDetalle", Parametros);
         while (Dr.Read())
         {
             Datos.IDFoto        = Dr.GetString(Dr.GetOrdinal("IDFoto"));
             Datos.URLImagen     = Dr.GetString(Dr.GetOrdinal("UrlFoto"));
             Datos.Alt           = Dr.GetString(Dr.GetOrdinal("TextoAlternativo"));
             Datos.Title         = Dr.GetString(Dr.GetOrdinal("Titulo"));
             Datos.Descripcion   = Dr.GetString(Dr.GetOrdinal("Descripcion"));
             Datos.NombreArchivo = Dr.GetString(Dr.GetOrdinal("NombreArchivo"));
             Datos.Extension     = Dr.GetString(Dr.GetOrdinal("TipoArchivo"));
             Datos.Completado    = true;
             break;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #17
0
 private void Guardar(bool NuevoRegistro, string ID, string Title, string Alt, string Descripcion, string FileName, HttpPostedFile PostedImage, bool BandCambioImagen)
 {
     try
     {
         string  BaseDir       = Server.MapPath("");
         string  FileExtension = BandCambioImagen ? Path.GetExtension(FileName) : string.Empty;
         CH_Foto Datos         = new CH_Foto
         {
             NuevoRegistro = NuevoRegistro,
             IDFoto        = ID,
             Title         = Title,
             Alt           = Alt,
             Descripcion   = Descripcion,
             Extension     = FileExtension,
             NombreArchivo = FileName,
             CambioImagen  = BandCambioImagen,
             URLImagen     = BaseDir,
             Conexion      = Comun.Conexion,
             IDUsuario     = User.Identity.Name
         };
         CH_FotoNegocio FN = new CH_FotoNegocio();
         FN.ACFoto(Datos);
         if (Datos.Completado)
         {
             if (BandCambioImagen)
             {
                 if (PostedImage != null && PostedImage.ContentLength > 0)
                 {
                     try
                     {
                         string BaseDirMarca = Server.MapPath("~/Images/MarcaAgua/watermark_final.png");
                         if (File.Exists(BaseDirMarca))
                         {
                             Stream S = PostedImage.InputStream;
                             System.Drawing.Image Img = new System.Drawing.Bitmap(S);
                             Img = UtilImagen.ResizeImageW(Img, 1024);
                             Img = UtilImagen.ResizeImageH(Img, 700);
                             System.Drawing.Image Marca = System.Drawing.Image.FromFile(BaseDirMarca);
                             Img = UtilImagen.SetWaterMark("", Img, Marca);
                             Img.Save(BaseDir + Datos.URLImagen);
                             FN.ImagenSubidaFotoXID(Datos);
                         }
                         else
                         {
                             throw new Exception("No existe la imagen.");
                         }
                     }
                     catch (Exception)
                     {
                         string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Ocurrió un error al guardar la imagen.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
                         ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
                     }
                 }
             }
             Response.Redirect("frmGaleriaFotos.aspx", false);
         }
         else
         {
             string ScriptError = DialogMessage.Show(TipoMensaje.Error, "Error al guardar los datos.", "Error", ShowMethod.FadeIn, HideMethod.FadeOut, ToastPosition.TopFullWidth, true);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "popup", ScriptError, true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["op"] != null)
         {
             if (Request.QueryString["op"] == "2")
             {
                 if (Request.QueryString["id"] != null)
                 {
                     string  ID       = Request.QueryString["id"].ToString();
                     CH_Foto DatosAux = new CH_Foto {
                         Conexion = Comun.Conexion, IDFoto = ID
                     };
                     CH_FotoNegocio CN = new CH_FotoNegocio();
                     CN.ObtenerDetalleFotoXID(DatosAux);
                     if (DatosAux.Completado)
                     {
                         this.CargarDatos(DatosAux);
                     }
                     else
                     {
                         //Ocurrió un error
                         Response.Redirect("frmGaleriaFotos.aspx?error=" + "Error al cargar los datos&nError=1");
                     }
                 }
                 else
                 {
                     Response.Redirect("frmGaleriaFotos.aspx");
                 }
             }
             else
             {
                 Response.Redirect("frmGaleriaFotos.aspx");
             }
         }
         else
         {
             this.IniciarDatos();
         }
     }
     else
     {
         if (Request.Form.Count > 0)
         {
             bool Band = false;
             if (imgLogo.HasFile) //Hay cambio de imagen
             {
                 Band = true;
             }
             string         txtTitle       = Request.Form["ctl00$cph_MasterBody$txtTitle"].ToString();
             string         txtAlt         = Request.Form["ctl00$cph_MasterBody$txtAlt"].ToString();
             string         txtDescripcion = Request.Form["ctl00$cph_MasterBody$txtDescripcion"].ToString();
             string         txtUrlImg      = Band ? imgLogo.PostedFile.FileName : string.Empty;
             HttpPostedFile bannerImage    = imgLogo.PostedFile as HttpPostedFile;
             try
             {
                 string AuxID         = Request.Form["ctl00$cph_MasterBody$hf"].ToString();
                 bool   NuevoRegistro = string.IsNullOrEmpty(AuxID);
                 this.Guardar(NuevoRegistro, AuxID, txtTitle, txtAlt, txtDescripcion, txtUrlImg, bannerImage, Band);
             }
             catch (Exception ex)
             {
                 Response.Redirect("ErrorPage.aspx?msjError=" + ex.Message);
             }
         }
     }
 }