#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("数据库备份恢复-配置", 590, 471, 208, 114) ;,$WS_POPUP
$Group1 = GUICtrlCreateGroup("默认配置", 16, 16, 553, 157)
$Checkbox2 = GUICtrlCreateCheckbox("备份到FTP服务器", 112, 35, 130, 17)
$Checkbox3 = GUICtrlCreateCheckbox("备份到本地目录", 364, 35, 130, 17)
$Label1 = GUICtrlCreateLabel("服务器:", 34, 68, 52, 17)
GUICtrlSetTip (-1, "FTP地址,直接填IP", "", 0, 1)
$Input1 = GUICtrlCreateInput("", 82, 64, 110, 21)
$Label2 = GUICtrlCreateLabel("用户名:", 218, 68, 52, 17)
GUICtrlSetTip (-1, "FTP用户名,需要FTP管理员权限", "", 0, 1)
$Input2 = GUICtrlCreateInput("", 266, 64, 110, 21)
$Label3 = GUICtrlCreateLabel("密码:", 404, 68, 40, 17)
GUICtrlSetTip (-1, "FTP密码", "", 0, 1)
$Input3 = GUICtrlCreateInput("", 440, 64, 110, 21)
$Label4 = GUICtrlCreateLabel("备份周期:", 34, 107, 64, 17)
GUICtrlSetTip (-1, "备份周期,每几小时备份一次", "", 0, 1)
$Input4 = GUICtrlCreateInput("", 94, 104, 17, 17)
$Label5 = GUICtrlCreateLabel("/小时", 114, 107, 33, 17)
$Label6 = GUICtrlCreateLabel("保留备份次数:", 180, 107, 88, 17)
GUICtrlSetTip (-1, "需要保留备份次数", "", 0, 1)
$Input5 = GUICtrlCreateInput("", 263, 104, 17, 17)
$Label7 = GUICtrlCreateLabel("/份", 283, 107, 21, 17)
$Checkbox1 = GUICtrlCreateCheckbox("压缩备份", 350, 105, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("是否开机启动", 460, 105, 97, 17)
$Label8 = GUICtrlCreateLabel("远程路径:", 34, 144, 64, 17)
GUICtrlSetTip (-1, "远程路径,直接使用根目录)", "", 0, 1)
$Input6 = GUICtrlCreateInput("PubwinDBBackup", 93, 140, 175, 21)
GUICtrlSetState($Input6, $GUI_DISABLE)
$Label9 = GUICtrlCreateLabel("本地路径:", 315, 144, 64, 17)
GUICtrlSetTip (-1, "本地路径,不用以”\“结束)", "", 0, 1)
$Input7 = GUICtrlCreateInput("E:\PubwinBackup", 374, 140, 175, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup(" SQL数据库连接配置 ", 16, 188, 553, 213)
$Label10 = GUICtrlCreateLabel("服务器:", 55, 216, 52, 17)
GUICtrlSetTip (-1, "SQL服务器地址IP。本地为localhost或127.0.0.1", "", 0, 1)
$Combo1 = GUICtrlCreateCombo("", 104, 212, 193, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "localhost|127.0.0.1", "")
$Label11 = GUICtrlCreateLabel("端口:", 321, 216, 40, 17)
GUICtrlSetTip (-1, "SQL服务器端口,默认为1433", "", 0, 1)
$Combo2 = GUICtrlCreateCombo("", 359, 212, 169, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1433", "")
$Group3 = GUICtrlCreateGroup(" SQL身份验证模式 ", 32, 244, 521, 141)
$Radio1 = GUICtrlCreateRadio("使用 Windows 身份验证", 88, 266, 169, 17)
$Radio2 = GUICtrlCreateRadio("使用SQL Server 身份验证", 88, 293, 169, 17)
GUICtrlSetState($radio1, $GUI_CHECKED)
$Label12 = GUICtrlCreateLabel("用户名:", 160, 323, 52, 17)
GUICtrlSetTip (-1, "连接SQL帐号,默认帐号为netcafe", "", 0, 1)
$Input8 = GUICtrlCreateInput("", 208, 319, 233, 21)
$Label13 = GUICtrlCreateLabel("密码:", 171, 352, 40, 17)
GUICtrlSetTip (-1, '连接SQL密码,默认密码为"pubwin"', "", 0, 1)
$Input9 = GUICtrlCreateInput("", 208, 348, 233, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("SQL连接测试", 56, 410, 115, 25)
$Button2 = GUICtrlCreateButton("保存配置", 256, 410, 107, 25)
$Button3 = GUICtrlCreateButton("取消", 456, 410, 75, 25)
GUISetState(@SW_SHOW)
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
GUICtrlSetState($Input8, $GUI_DISABLE)
GUICtrlSetState($Input9, $GUI_DISABLE)
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
_Check()
Case $Radio1
GUICtrlSetState($Input8, $GUI_DISABLE)
GUICtrlSetState($Input9, $GUI_DISABLE)
Case $Radio2
GUICtrlSetState($Input8, $GUI_ENABLE)
GUICtrlSetState($Input9, $GUI_ENABLE)
Case $Checkbox2
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
GUICtrlSetState($Input1, $GUI_ENABLE)
GUICtrlSetState($Input2, $GUI_ENABLE)
GUICtrlSetState($Input3, $GUI_ENABLE)
Else
GUICtrlSetState($Input1, $GUI_DISABLE)
GUICtrlSetState($Input2, $GUI_DISABLE)
GUICtrlSetState($Input3, $GUI_DISABLE)
EndIf
EndSwitch
WEnd
Func _Check()
If GUICtrlRead($Checkbox2) = $GUI_UNCHECKED And GUICtrlRead($Checkbox3) = $GUI_UNCHECKED Then
MsgBox(16,"错误!","请选择备份保存方式")
ElseIf GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
If GUICtrlRead($Input1)="" Then
MsgBox(16,"错误!","请输入FTP服务器地址")
ElseIf GUICtrlRead($Input2)="" Then
MsgBox(16,"错误!","请输入FTP登录帐号")
ElseIf GUICtrlRead($Input3)="" Then
MsgBox(16,"错误!","请输入FTP登录密码")
EndIf
ElseIf GUICtrlRead($Input4)="" Then
MsgBox(16,"错误!","请输入备份周期")
ElseIf GUICtrlRead($Input5)="" Then
MsgBox(16,"错误!","请输入保留备份次数")
;ElseIf GUICtrlRead($Input6)="" Then
; MsgBox(16,"错误!","请选择远程备份路径")
ElseIf GUICtrlRead($Input7)="" Then
MsgBox(16,"错误!","请选择本地备份路径")
ElseIf GUICtrlRead($Combo1)="" Then
MsgBox(16,"错误!","请输入SQL服务器地址")
ElseIf GUICtrlRead($Combo2) ="" Then
MsgBox(16,"错误!","请输入SQL服务器端口")
ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then
If GUICtrlRead($Input8) ="" Then
MsgBox(16,"错误!","请输入SQL登录帐号")
ElseIf GUICtrlRead($Input9)=""Then
MsgBox(16,"错误!","请输入SQL登录密码")
EndIf
EndIf
EndFunc