Exemple #1
0
 public Restaurar(BE.Usuario user = null)
 {
     usuario    = user;
     _backupBll = new BLL.Backup();
     InitializeComponent();
     Traducir();
 }
Exemple #2
0
        private void btn_generar_Click(object sender, EventArgs e)
        {
            BLL.Backup backup_BLL = new BLL.Backup();
            string     fecha      = DateTime.Now.ToShortDateString().Replace('/', '-');

            if (this.txt_ubicacion.Text != "" && this.txt_nombreBackup.Text != "")
            {
                string fileNamefinal        = this.txt_nombreBackup.Text + "-" + fecha;
                string pathFinal            = this.txt_ubicacion.Text + "\\" + fileNamefinal;
                int    cantidad_particiones = (int)this.nud_particiones.Value;
                if (backup_BLL.GenerarBackup(pathFinal, cantidad_particiones) == -1)
                {
                    BE.Backup backupGenerado = new BE.Backup();
                    backupGenerado.descripcion     = fileNamefinal;
                    backupGenerado.ruta            = this.txt_ubicacion.Text;
                    backupGenerado.nro_particiones = (int)this.nud_particiones.Value;

                    if (backup_BLL.AddBackup(backupGenerado) != -1)
                    {
                        MessageBox.Show("Se realizó el backup correctamente");
                        bitacora_BAJA.RegistrarEnBitacora(this.usuario_logueado, DateTime.Now, "Se creó una Copia de Seguridad");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al generar registro de backup en DB");
                    }
                }
                else
                {
                    MessageBox.Show("Error al generar backup. Vuelva a intentar más tarde");
                }
            }
            else
            {
                MessageBox.Show("Debe completar todos los campos para continuar");
            }
        }