Beispiel #1
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (this.ValidateForm())
            {
                if (this.Confirm("¿Realmente deseas restaurar la base de datos SICAP?, Se sugiere realizar un respaldo antes de continuar"))
                {
                    using (posb.Config con = new posb.Config())
                    {
                        var path = Path.GetDirectoryName(this.txtPath.Text);

                        if (Directory.Exists(path))
                        {
                            if (!con.Restore(this.txtPath.Text, true))
                            {
                                this.Alert(con.ErrorMessage);

                                Application.Exit();
                            }
                            else
                            {
                                this.Alert("Se restauro correctamente la base de datos. Debe reiniciar SICAP para aplicar los cambios");
                                Application.Exit();
                            }
                        }
                        else
                        {
                            this.Alert("La carpeta no existe");
                            this.txtPath.Clear();
                            this.txtPath.Focus();
                        }
                    }
                }
            }
        }