Esempio n. 1
0
        private void generarRestore()
        {
            string ubicacion = Server.MapPath("~/database/restore/");

            if (FileUploadRestore.HasFile == true)
            {
                //FileUploadRestore.SaveAs(Server.MapPath("~/UploadedBackup/") + FileUploadRestore.FileName);
                FileUploadRestore.SaveAs(ubicacion + FileUploadRestore.FileName);
                try
                {
                    //string backupfile = Server.MapPath("~/UploadedBackup/") + FileUploadRestore.FileName;
                    string backupfile = ubicacion + FileUploadRestore.FileName;
                    bool   ok         = gestorBackup.restaurarBackup(backupfile);
                    if (ok)
                    {
                        ModalPopUpMensajes.Show();
                        LabelMensaje.Text = "Restore realizado con exito.";
                    }
                }
                catch (Exception ex)
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = ex.ToString();
                }
            }
            else
            {
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "No se selecciono el archivo.";
            }
        }
        private void CargarCliente()
        {
            BE.BE_Usuario   usuario       = new BE.BE_Usuario();
            BLL.BLL_Usuario gestorUsuario = new BLL.BLL_Usuario();

            usuario.APELLIDO   = txtBoxApellido.Text;
            usuario.NOMBRE     = txtBoxNombre.Text;
            usuario.DOMICILIO  = txtBoxDir.Text;
            usuario.CIUDAD     = txtBoxCiudad.Text;
            usuario.EMAIL      = UC_Mail.Text;
            usuario.DNI        = int.Parse(txtBoxDNI.Text);
            usuario.TELEFONO   = txtBoxTelefono.Text;
            usuario.CONTRASEÑA = txtBoxContrasena.Text;
            usuario.ESEMPLEADO = false;

            if (gestorUsuario.crear(usuario))
            {
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Usuario Creado Correctamente.";
                LimpiarTxtBoxes(Page);
            }
            else
            {
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Error al crear el usuario.";
            }
        }
Esempio n. 3
0
        protected void Btnenviar_Onclick(object sender, EventArgs e)
        {
            // validate the Captcha to check we're not dealing with a bot
            bool isHuman = RecuperarCaptcha.Validate(CaptchaCodeTextBox.Text);

            CaptchaCodeTextBox.Text = null; // clear previous user input

            if (!isHuman)
            {
                // TODO: Captcha validation failed, show error message
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Error en el captcha.";
            }
            else
            {
                // TODO: captcha validation succeeded; execute the protected action
                BLL.BLL_Usuario gestorUsuario = new BLL.BLL_Usuario();
                bool            existe        = gestorUsuario.ValidarEmail(CU_Mail.Text);
                if (!existe)
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = "El email indicado no existe en nuestra base de datos.";
                }
                else
                {
                    //Enviar mail si existe el mismo en la base.
                    //bool resultado = gestorUsuario.BorrarEmailSuscripcion(CU_Mail.Text);
                    bool resultado = gestorUsuario.EnviarMailCambioContraseña(CU_Mail.Text);
                }
            }
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            // validate the Captcha to check we're not dealing with a bot
            bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text);

            CaptchaCodeTextBox.Text = null;     // clear previous user input

            if (!isHuman)
            {
                // TODO: Captcha validation failed, show error message
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Error en el captcha.";
            }
            else
            {
                // TODO: captcha validation succeeded; execute the protected action

                BE.BE_UsuarioSuscripcion usuario = new BE.BE_UsuarioSuscripcion();
                usuario.EMAIL = CU_Mail.Text;
                foreach (ListItem item in checkBoxListReg.Items)
                {
                    if (string.Equals(item.Value, "Imagenes") && item.Selected)
                    {
                        usuario.IMAGENES = 1;
                    }
                    if (string.Equals(item.Value, "Riego") && item.Selected)
                    {
                        usuario.RIEGO = 1;
                    }
                    if (string.Equals(item.Value, "Humedad") && item.Selected)
                    {
                        usuario.HUMEDAD = 1;
                    }
                }

                int resultado = gestorNewsletter.insertarMail(usuario);

                if (resultado == 0)
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = "Registracion realizada con éxito";
                }
                else if (resultado == 1)
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = "El email ya está registrado.";
                }
                else if (resultado == 2)
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = "Hubo un error al registrar el email.";
                }
            }
        }
Esempio n. 5
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //LiteralHTML.Text = txtEditor.Text;
                BE.BE_Noticia   unaNoti   = new BE.BE_Noticia();
                BE.BE_Categoria categoria = new BE.BE_Categoria();
                categoria.ID      = int.Parse(DDCategorias.SelectedItem.Value);
                categoria.NOMBRE  = DDCategorias.SelectedItem.Text;
                unaNoti.CATEGORIA = categoria;
                unaNoti.TITULO    = TxtTitulo.Text;
                unaNoti.CUERPO    = WebUtility.HtmlEncode(txtEditor.Text);
                if (TxtFechaCreacion.Text != "")
                {
                    unaNoti.FECHACREACION = DateTime.Parse(TxtFechaCreacion.Text);
                }
                else
                {
                    unaNoti.FECHACREACION = DateTime.Now;
                }
                unaNoti.FECHAMODIFICACION = DateTime.Now;
                if (ChkHabilitado.Checked)
                {
                    unaNoti.HABILITADO = 1;
                }
                else
                {
                    unaNoti.HABILITADO = 0;
                }
                if (HFIdNoticia.Value != "")
                {
                    unaNoti.ID = int.Parse(HFIdNoticia.Value);
                    gestorNoticia.ActualizarNoticia(unaNoti);
                }
                else
                {
                    unaNoti.ID = gestorNoticia.ObtenerUltimoIDNoticia();
                    gestorNoticia.InsertarNoticia(unaNoti);
                }
                MostrarNoticia(unaNoti);

                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Noticia Guardada con exito.";
            }
            catch (Exception ex)
            {
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = "Error al guardar en la base de datos.";
            }
        }
 protected void btnRegistrarse_Click(object sender, EventArgs e)
 {
     if (VerificarContrasena())
     {
         if (VerificarCaptcha())
         {
             CargarCliente();
         }
         else
         {
             ModalPopUpMensajes.Show();
             LabelMensaje.Text = "Error en el Captcha.";
         }
     }
     else
     {
         ModalPopUpMensajes.Show();
         LabelMensaje.Text = "Las contraseñas no Coinciden.";
     }
 }
Esempio n. 7
0
        private void generarBackup()
        {
            string dircompleto = Server.MapPath("~/database/backups/");
            //string rutaGenerada = dircompleto + @"\";
            string fechaArchivo = DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" +
                                  DateTime.Now.Year.ToString() + "_" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() +
                                  "-" + DateTime.Now.Second.ToString();
            string extension = ".bak";

            string nombreGenerado = "BK" + fechaArchivo + extension;

            try
            {
                bool generado = gestorBackup.realizarBackup(dircompleto + nombreGenerado);
                if (generado)
                {
                    gestorBackup.registrarBackup(dircompleto + nombreGenerado);
                    BE.BE_Evento evt = new BE.BE_Evento();
                    evt.IDEVENTO = BE.BE_Evento.GENERAR_BACKUP;
                    gestorBitacora.registrarEvento(evt, "fecha: " + DateTime.Now.ToString(), 0);

                    DisplayDownloadDialog(nombreGenerado, dircompleto + nombreGenerado);
                }
                else
                {
                    ModalPopUpMensajes.Show();
                    LabelMensaje.Text = "Error al generar el Backup";
                }
            }
            catch (Exception ex)
            {
                ModalPopUpMensajes.Show();
                LabelMensaje.Text = ex.ToString();
            }

            Server.Transfer("AdminBackup.aspx");
        }