VERSION 5.00
Object = "{5734474E-78D3-4254-99B9-C35F31BDF509}#63.0#0"; "vbskpro2.ocx"
Begin VB.Form frmBackRest 
   BorderStyle     =   0  'None
   Caption         =   "Backup/Restore Database"
   ClientHeight    =   7500
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   11865
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   7500
   ScaleWidth      =   11865
   ShowInTaskbar   =   0   'False
   Tag             =   "uBackup"
   Begin VB.PictureBox picBG 
      Appearance      =   0  'Flat
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   6975
      Left            =   300
      ScaleHeight     =   6975
      ScaleWidth      =   11085
      TabIndex        =   7
      TabStop         =   0   'False
      Top             =   300
      Width           =   11085
      Begin VB.TextBox txtDest 
         Appearance      =   0  'Flat
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   3090
         TabIndex        =   0
         Top             =   2070
         Width           =   3435
      End
      Begin VB.CommandButton cmdBrowse 
         BackColor       =   &H00C0FFFF&
         Caption         =   "A&mbil File ..."
         Height          =   315
         Index           =   0
         Left            =   6630
         TabIndex        =   1
         Top             =   2070
         Visible         =   0   'False
         Width           =   1215
      End
      Begin VB.CommandButton cmdBackup 
         Caption         =   "&Backup Database !"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3090
         TabIndex        =   2
         Top             =   2490
         Width           =   2145
      End
      Begin VB.CommandButton cmdRestore 
         Caption         =   "&Restore Database !"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3060
         MaskColor       =   &H0000FFFF&
         TabIndex        =   5
         Top             =   4620
         Width           =   2145
      End
      Begin VB.CommandButton cmdBrowse 
         Caption         =   "Ambil &File ..."
         Height          =   315
         Index           =   1
         Left            =   6600
         TabIndex        =   4
         Top             =   4200
         Width           =   1215
      End
      Begin VB.TextBox txtSource 
         Appearance      =   0  'Flat
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   3090
         TabIndex        =   3
         Top             =   4200
         Width           =   3435
      End
      Begin VB.CommandButton cmdQuit 
         Caption         =   "&Tutup Form"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   6630
         TabIndex        =   6
         Top             =   6315
         Width           =   1275
      End
      Begin VB.Line ln 
         BorderColor     =   &H00FFFFFF&
         Index           =   4
         Tag             =   "1"
         X1              =   3030
         X2              =   7800
         Y1              =   3720
         Y2              =   3720
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "Restore Database"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   195
         Index           =   3
         Left            =   3090
         TabIndex        =   12
         Top             =   3450
         Width           =   1305
      End
      Begin VB.Line ln 
         BorderColor     =   &H00FFFFFF&
         Index           =   2
         Tag             =   "1"
         X1              =   3030
         X2              =   7800
         Y1              =   1680
         Y2              =   1680
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "Backup Database"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   195
         Index           =   2
         Left            =   3090
         TabIndex        =   11
         Top             =   1410
         Width           =   1245
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "Nama file hasil backup"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   195
         Index           =   1
         Left            =   3090
         TabIndex        =   10
         Top             =   1770
         Width           =   1875
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "Nama file yang akan direstore"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   195
         Index           =   0
         Left            =   3090
         TabIndex        =   9
         Top             =   3900
         Width           =   2535
      End
      Begin VB.Line ln 
         BorderColor     =   &H00FFFFFF&
         Index           =   1
         Tag             =   "1"
         X1              =   3120
         X2              =   7890
         Y1              =   6150
         Y2              =   6150
      End
      Begin VB.Line ln 
         BorderColor     =   &H00808080&
         BorderWidth     =   2
         Index           =   0
         Tag             =   "2"
         X1              =   3120
         X2              =   7890
         Y1              =   6150
         Y2              =   6150
      End
      Begin VB.Shape shp 
         BorderColor     =   &H00C0C0C0&
         Height          =   315
         Index           =   2
         Left            =   180
         Tag             =   "2"
         Top             =   150
         Width           =   2625
      End
      Begin VB.Shape shp 
         BorderColor     =   &H00FFFFFF&
         Height          =   6765
         Index           =   1
         Left            =   150
         Tag             =   "1"
         Top             =   120
         Width           =   10785
      End
      Begin VB.Shape shp 
         BorderColor     =   &H00808080&
         BorderWidth     =   2
         Height          =   6765
         Index           =   0
         Left            =   150
         Tag             =   "2"
         Top             =   120
         Width           =   10785
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00E0E0E0&
         Caption         =   "Backup/Restore Database"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   210
         TabIndex        =   8
         Top             =   180
         Width           =   2565
      End
      Begin VB.Line ln 
         BorderColor     =   &H00808080&
         BorderWidth     =   2
         Index           =   3
         Tag             =   "2"
         X1              =   3030
         X2              =   7800
         Y1              =   1680
         Y2              =   1680
      End
      Begin VB.Line ln 
         BorderColor     =   &H00808080&
         BorderWidth     =   2
         Index           =   5
         Tag             =   "2"
         X1              =   3030
         X2              =   7800
         Y1              =   3720
         Y2              =   3720
      End
   End
   Begin vbskpro.Skinner Skinner 
      Left            =   0
      Top             =   0
      _ExtentX        =   1270
      _ExtentY        =   1270
      CloseButton     =   0
      MaxButton       =   0
      MinButton       =   0
      TitleBarSkin    =   3
      BodySkin        =   5
      Skin            =   98
      ChangeSkinButton=   0   'False
      SkinPicture     =   "frmBackup.frx":0000
      SysDisableSkinCaption=   "&Disable Skin"
   End
End
Attribute VB_Name = "frmBackRest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub lInitObj()
  Screen.MousePointer = vbHourglass
  goConn.ChangeLayout (Me)
  BackColor = MDI.BackColor
  Screen.MousePointer = vbDefault
End Sub

Private Sub cmdBackup_Click()
  If Len(txtDest.Text) > 0 Then
    cmdBackup.Enabled = False
    If goConnDB.BackupDB(gcDBLogin.DBName, txtDest.Text) Then
      MsgBox "Backup berhasil dilakukan.", vbInformation, "Backup Selesai"
    End If
    cmdBackup.Enabled = True
  End If
  Exit Sub
ErrHandler:
  MsgBox "Error: " & Err.Number & Err.Description, vbInformation
End Sub

Private Sub cmdBrowse_Click(Index As Integer)
  Dim cFileName As String
  cFileName = BrowseForFile(hWnd)
  If Len(cFileName) = 0 Then Exit Sub
  If Index = 0 Then
    txtDest.Text = cFileName & IIf(LCase(Right(cFileName, 4)) = ".bak", "", ".bak")
  Else
    txtSource.Text = cFileName
  End If
End Sub

Private Sub cmdQuit_Click()
  Unload Me
End Sub

Private Sub cmdRestore_Click()
  If Len(txtSource.Text) > 0 Then
    Call CloseForms(False, "frmBackRest")
      
    '~ store connection information before release it
    Dim cTemp As String, cTemp2 As String
    cTemp = goConn.Conn
    Set goConn.Conn = Nothing
    '~
    
    cmdRestore.Enabled = False
    If goConnDB.RestoreDB(gcDBLogin.DBName, txtSource.Text) Then
      MsgBox "Restore berhasil dilakukan.", vbInformation, "Restore Selesai"
    End If
    
    '~ restore connection
    Dim oTemp As ADODB.Connection
    Set oTemp = New ADODB.Connection
    oTemp.Open cTemp
    Set goConn.Conn = oTemp
    goConn.Conn.CursorLocation = adUseClient

    Set oTemp = Nothing
    '~
    
    cmdRestore.Enabled = True
  End If
End Sub

Private Sub Form_Load()
  Call lInitObj
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  Call lUnload
End Sub

Private Sub Form_Resize()
  Center picBG
  CenterForm Me, MDI
End Sub

Private Sub txtdest_KeyPress(KeyAscii As Integer)
  If KeyAscii = vbKeyReturn Then SendKeys "{TAB}": KeyAscii = 0
End Sub

Private Sub txtSource_KeyPress(KeyAscii As Integer)
  If KeyAscii = vbKeyReturn Then SendKeys "{TAB}": KeyAscii = 0
End Sub

Private Sub lUnload()
  Set frmBackRest = Nothing
End Sub
