protected void btnEditarNotificacion_Click(object sender, EventArgs e)
    {
        String textoValidacion = validarNotificacion(true);
        if (textoValidacion.Equals(""))
        {

            ARCHIVO archivo = new ARCHIVO();
            archivo = archivo.obtainArchivoById(Convert.ToInt32(lblArchivoId.Text));
            if (!archivo.NOMBRE.Equals(upFileNotificacion.PostedFile.FileName))
            {
                Stream fs = upFileNotificacion.PostedFile.InputStream;
                BinaryReader br = new BinaryReader(fs);
                Byte[] bytes = br.ReadBytes((Int32)fs.Length);

                archivo = archivo.refreshArchivo(Convert.ToInt32(lblArchivoId.Text),Path.GetFileName(upFileNotificacion.PostedFile.FileName),
                                         Path.GetExtension(upFileNotificacion.PostedFile.FileName).Substring(1), bytes);
            }
            if (archivo.ARCHIVOID != 0)
            {
                NOTIFICACION notificacion = new NOTIFICACION();
                notificacion.refreshNotificacion(Convert.ToInt32(lblNotificacionId.Text), txtNombreNotificacion.Text, txtDescripcionNotificacion.Text, archivo.ARCHIVOID, Convert.ToInt32(lblInstitucionId.Text));
                cargarNotificaciones();

                lblSucess.Text = "Se edito Correctamente la Notificacion";
                pnlSucess.Visible = true;
            }
            else
            {
                lblError.Text = "El archivo es demasiado pesado o el formato no es valido";
                pnlError.Visible = true;
            }

        }
        else
        {
            lblError.Text = textoValidacion;
            pnlError.Visible = true;
        }
    }
示例#2
0
    protected void btnEditarNotificacion_Click(object sender, EventArgs e)
    {
        String textoValidacion = validarNotificacion(true);

        if (textoValidacion.Equals(""))
        {
            ARCHIVO archivo = new ARCHIVO();
            archivo = archivo.obtainArchivoById(Convert.ToInt32(lblArchivoId.Text));
            if (!archivo.NOMBRE.Equals(upFileNotificacion.PostedFile.FileName))
            {
                Stream       fs    = upFileNotificacion.PostedFile.InputStream;
                BinaryReader br    = new BinaryReader(fs);
                Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                archivo = archivo.refreshArchivo(Convert.ToInt32(lblArchivoId.Text), Path.GetFileName(upFileNotificacion.PostedFile.FileName),
                                                 Path.GetExtension(upFileNotificacion.PostedFile.FileName).Substring(1), bytes);
            }
            if (archivo.ARCHIVOID != 0)
            {
                NOTIFICACION notificacion = new NOTIFICACION();
                notificacion.refreshNotificacion(Convert.ToInt32(lblNotificacionId.Text), txtNombreNotificacion.Text, txtDescripcionNotificacion.Text, archivo.ARCHIVOID, Convert.ToInt32(lblInstitucionId.Text));
                cargarNotificaciones();

                lblSucess.Text    = "Se edito Correctamente la Notificacion";
                pnlSucess.Visible = true;
            }
            else
            {
                lblError.Text    = "El archivo es demasiado pesado o el formato no es valido";
                pnlError.Visible = true;
            }
        }
        else
        {
            lblError.Text    = textoValidacion;
            pnlError.Visible = true;
        }
    }