w_set_init.srw 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759
  1. $PBExportHeader$w_set_init.srw
  2. forward
  3. global type w_set_init from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_set_init
  6. end type
  7. type st_1 from statictext within w_set_init
  8. end type
  9. type sle_bookname from singlelineedit within w_set_init
  10. end type
  11. type st_2 from statictext within w_set_init
  12. end type
  13. type sle_database from singlelineedit within w_set_init
  14. end type
  15. type st_10 from statictext within w_set_init
  16. end type
  17. type rb_1 from radiobutton within w_set_init
  18. end type
  19. type rb_2 from radiobutton within w_set_init
  20. end type
  21. type cb_1 from commandbutton within w_set_init
  22. end type
  23. type st_11 from statictext within w_set_init
  24. end type
  25. type sle_fjname from singlelineedit within w_set_init
  26. end type
  27. type cb_ch3 from commandbutton within w_set_init
  28. end type
  29. type sle_filename from singlelineedit within w_set_init
  30. end type
  31. type cb_ch2 from commandbutton within w_set_init
  32. end type
  33. type st_13 from statictext within w_set_init
  34. end type
  35. type sle_folder from singlelineedit within w_set_init
  36. end type
  37. type cb_2 from commandbutton within w_set_init
  38. end type
  39. type st_8 from statictext within w_set_init
  40. end type
  41. type cbx_fj from checkbox within w_set_init
  42. end type
  43. type cbx_yj from checkbox within w_set_init
  44. end type
  45. type sle_yjname from singlelineedit within w_set_init
  46. end type
  47. type cb_ch4 from commandbutton within w_set_init
  48. end type
  49. type st_12 from statictext within w_set_init
  50. end type
  51. type ddlb_1 from dropdownlistbox within w_set_init
  52. end type
  53. type cbx_modify from checkbox within w_set_init
  54. end type
  55. type sle_sqldb_mdf_sor from singlelineedit within w_set_init
  56. end type
  57. type sle_sqldb_ldf_sor from singlelineedit within w_set_init
  58. end type
  59. type sle_bookcode from singlelineedit within w_set_init
  60. end type
  61. type st_7 from statictext within w_set_init
  62. end type
  63. type sle_server from singlelineedit within w_set_init
  64. end type
  65. type sle_logid from singlelineedit within w_set_init
  66. end type
  67. type st_5 from statictext within w_set_init
  68. end type
  69. type st_6 from statictext within w_set_init
  70. end type
  71. type sle_logpass from singlelineedit within w_set_init
  72. end type
  73. type cb_connect from uo_imflatbutton within w_set_init
  74. end type
  75. type gb_3 from groupbox within w_set_init
  76. end type
  77. type gb_1 from groupbox within w_set_init
  78. end type
  79. type gb_2 from groupbox within w_set_init
  80. end type
  81. type gb_4 from groupbox within w_set_init
  82. end type
  83. end forward
  84. global type w_set_init from w_publ_base
  85. integer width = 2245
  86. integer height = 1936
  87. string title = "帐套设置"
  88. boolean minbox = false
  89. windowtype windowtype = response!
  90. long backcolor = 16777215
  91. boolean center = true
  92. cb_ok cb_ok
  93. st_1 st_1
  94. sle_bookname sle_bookname
  95. st_2 st_2
  96. sle_database sle_database
  97. st_10 st_10
  98. rb_1 rb_1
  99. rb_2 rb_2
  100. cb_1 cb_1
  101. st_11 st_11
  102. sle_fjname sle_fjname
  103. cb_ch3 cb_ch3
  104. sle_filename sle_filename
  105. cb_ch2 cb_ch2
  106. st_13 st_13
  107. sle_folder sle_folder
  108. cb_2 cb_2
  109. st_8 st_8
  110. cbx_fj cbx_fj
  111. cbx_yj cbx_yj
  112. sle_yjname sle_yjname
  113. cb_ch4 cb_ch4
  114. st_12 st_12
  115. ddlb_1 ddlb_1
  116. cbx_modify cbx_modify
  117. sle_sqldb_mdf_sor sle_sqldb_mdf_sor
  118. sle_sqldb_ldf_sor sle_sqldb_ldf_sor
  119. sle_bookcode sle_bookcode
  120. st_7 st_7
  121. sle_server sle_server
  122. sle_logid sle_logid
  123. st_5 st_5
  124. st_6 st_6
  125. sle_logpass sle_logpass
  126. cb_connect cb_connect
  127. gb_3 gb_3
  128. gb_1 gb_1
  129. gb_2 gb_2
  130. gb_4 gb_4
  131. end type
  132. global w_set_init w_set_init
  133. type prototypes
  134. Subroutine Sleep(ulong dwMilliseconds) LIBRARY "kernel32.dll"
  135. Function long ShellExecuteA (long hwnd, string lpOperation ,String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll" alias for "ShellExecuteA;Ansi"
  136. Function long GetFullPathName (String lpFileName ,Long nBufferLength,ref string lpBuffer,ref long lpFilePart) library "kernel32" ALIAS FOR "GetFullPathNameA;Ansi"
  137. end prototypes
  138. type variables
  139. long ins_bookid = 0
  140. string ins_servername
  141. string ins_logid
  142. string ins_logpass
  143. string masterpath
  144. //string mssqlpath
  145. long ins_rslt = 0
  146. long ins_ifguid = 0
  147. end variables
  148. forward prototypes
  149. public subroutine wf_facechange ()
  150. public function integer wf_buildsqldb (ref string arg_msg)
  151. public function integer wf_chk_database (string arg_databasename, transaction arg_transaction)
  152. public function integer wf_create_database (string arg_folder, string arg_databasename, string arg_filename, string arg_sqldb_mdf_sor, string arg_sqldb_ldf_sor, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg)
  153. public function integer wf_drop_database (string arg_databasename, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg)
  154. end prototypes
  155. public subroutine wf_facechange ();IF rb_2.Checked THEN
  156. cb_1.Text = '︾'
  157. cb_1.Visible = false
  158. st_11.Visible = false
  159. ELSE
  160. cb_1.Visible = true
  161. st_11.Visible = true
  162. END IF
  163. long ph
  164. ph = 200
  165. IF cb_1.Text = '︽' THEN
  166. This.Height = 1550 + ph
  167. gb_2.Visible = True
  168. st_12.Visible = True
  169. ddlb_1.Visible = True
  170. cbx_modify.Visible = True
  171. st_8.Visible = True
  172. sle_filename.Visible = true
  173. cb_ch2.Visible = true
  174. cbx_fj.Visible = true
  175. sle_fjname.visible = true
  176. cb_ch3.visible = true
  177. cbx_yj.visible = true
  178. sle_yjname.visible = true
  179. cb_ch4.visible = true
  180. st_13.visible = true
  181. sle_folder.visible = true
  182. cb_2.visible = true
  183. cb_ok.Y = 1520
  184. cb_exit.Y = 1520
  185. cb_connect.Y = 1520
  186. ELSE
  187. This.Height = 892 + ph
  188. gb_2.Visible = false
  189. st_12.Visible = false
  190. ddlb_1.Visible = false
  191. cbx_modify.Visible = false
  192. st_8.Visible = false
  193. sle_filename.Visible = false
  194. cb_ch2.Visible = false
  195. cbx_fj.Visible = false
  196. sle_fjname.visible = false
  197. cb_ch3.visible = false
  198. cbx_yj.visible = false
  199. sle_yjname.visible = false
  200. cb_ch4.visible = false
  201. st_13.visible = false
  202. sle_folder.visible = false
  203. cb_2.visible = false
  204. cb_ok.Y = 876
  205. cb_exit.Y = 876
  206. cb_connect.Y =876
  207. END IF
  208. end subroutine
  209. public function integer wf_buildsqldb (ref string arg_msg);//wf_buildsqldb
  210. Integer li_FileNum,rslt = 1
  211. String comm,msg
  212. Long i,j,lu_return
  213. String ls_test
  214. String ls_dat
  215. String ls_databasename
  216. String ls_filename
  217. Transaction db_Transaction
  218. db_Transaction = Create Transaction
  219. Open(w_sys_wait)
  220. IF Trim(sle_folder.Text) = '' THEN
  221. arg_msg = '请输入目标文件路径!'
  222. rslt = 0
  223. GOTO ext
  224. END IF
  225. Int ll_result
  226. ll_result = createdirectory(sle_folder.Text)
  227. //IF ll_result = -1 THEN
  228. // arg_msg = '目标文件路径创建失败!'
  229. // rslt = 0
  230. // GOTO ext
  231. //END IF
  232. ls_dat = sle_filename.Text
  233. IF Not FileExists ( ls_dat ) THEN
  234. arg_msg = "主数据库文件不存在!"
  235. rslt = 0
  236. GOTO ext
  237. END IF
  238. IF rb_1.Checked THEN
  239. ls_dat = Trim(sle_fjname.Text)
  240. IF Not FileExists ( ls_dat ) THEN
  241. arg_msg = "附件数据库文件不存在!"
  242. rslt = 0
  243. GOTO ext
  244. END IF
  245. END IF
  246. IF cbx_yj.Checked THEN
  247. ls_dat = Trim(sle_yjname.Text)
  248. IF Not FileExists ( ls_dat ) THEN
  249. arg_msg = "邮件数据库文件不存在!"
  250. rslt = 0
  251. GOTO ext
  252. END IF
  253. END IF
  254. w_sys_wait.wf_set_msg("正在尝试新建数据库,此过程预计需要用时1分钟...")
  255. db_Transaction.DBMS = "SNC SQL Native Client(OLE DB)"
  256. db_Transaction.Database = 'master'
  257. db_Transaction.UserID = ins_logid
  258. db_Transaction.DBPass = ins_logpass
  259. db_Transaction.LogID = ins_logid
  260. db_Transaction.LogPass = ins_logpass
  261. db_Transaction.ServerName = ins_servername
  262. db_Transaction.Lock = "RU"
  263. db_Transaction.AutoCommit = False
  264. db_Transaction.DBParm = "Database= 'master' ,PBTrimCharColumns='YES'"
  265. IF db_Transaction.Database = '' Or db_Transaction.ServerName = '' THEN
  266. arg_msg = "连接数据库失败!"
  267. rslt = 0
  268. GOTO ext
  269. END IF
  270. CONNECT Using db_Transaction;
  271. db_Transaction.AutoCommit = True
  272. IF db_Transaction.SQLCode <> 0 THEN
  273. DISCONNECT Using db_Transaction;
  274. arg_msg = '服务器连接失败!!'
  275. rslt = 0
  276. GOTO ext
  277. END IF
  278. //检查主数据库
  279. ls_databasename = Trim(sle_database.Text)
  280. IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN
  281. IF MessageBox ("询问","主数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN
  282. rslt = 2
  283. GOTO ext
  284. ELSE
  285. IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN
  286. rslt = 0
  287. GOTO ext
  288. END IF
  289. END IF
  290. END IF
  291. //检查附件数据库
  292. ls_databasename = Trim(sle_database.Text)+ '_fj'
  293. IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN
  294. IF MessageBox ("询问","附件数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN
  295. rslt = 2
  296. GOTO ext
  297. ELSE
  298. IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN
  299. rslt = 0
  300. GOTO ext
  301. END IF
  302. END IF
  303. END IF
  304. //检查邮件数据库
  305. ls_databasename = Trim(sle_database.Text) + '_yj'
  306. IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN
  307. IF MessageBox ("询问","邮件数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN
  308. rslt = 2
  309. GOTO ext
  310. ELSE
  311. IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN
  312. rslt = 0
  313. GOTO ext
  314. END IF
  315. END IF
  316. END IF
  317. //新建主数据库
  318. ls_databasename = Trim(sle_database.Text)
  319. ls_filename = Trim(sle_filename.Text)
  320. //st_jd.Text = '正在新建主数据库'
  321. IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, sle_sqldb_mdf_sor.Text, sle_sqldb_ldf_sor.Text, db_Transaction, False, arg_msg) = 0 THEN
  322. rslt = 0
  323. GOTO ext
  324. END IF
  325. comm = "DELETE FROM " + Trim(sle_database.Text) + ".dbo.U_OuterConnection"
  326. EXECUTE Immediate :comm Using db_Transaction;
  327. //新建附件数据库
  328. IF cbx_fj.Checked THEN
  329. ls_databasename = Trim(sle_database.Text)+ '_fj'
  330. ls_filename = Trim(sle_fjname.Text)
  331. // st_jd.Text = '正在新建附件数据库'
  332. IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, 'filemanage_Data', 'filemanage_Log', db_Transaction, False, arg_msg) = 0 THEN
  333. rslt = 0
  334. GOTO ext
  335. END IF
  336. String ls_MDF,ls_ldf
  337. ls_MDF = ls_databasename + ".MDF"
  338. ls_ldf = ls_databasename + ".ldf"
  339. comm = "INSERT INTO " + Trim(sle_database.Text) + ".dbo.U_OuterConnection ("+&
  340. "ConnectionID ,"+&
  341. "DBMS ,"+&
  342. "ConnectionName ,"+&
  343. "ConnectionType ,"+&
  344. "DataBaseName ,"+&
  345. "ServerName ,"+&
  346. "LogId ,"+&
  347. "LogPass ,"+&
  348. "mdf_name ,"+&
  349. "ldf_name ,"+&
  350. "opdate"+&
  351. ")"+&
  352. "VALUES"+&
  353. "("+&
  354. "11,"+&
  355. "'MSS Microsoft SQL Server 6.x',"+&
  356. "'附件数据库',"+&
  357. "0,"+&
  358. "'" + ls_databasename + "',"+&
  359. "'" + db_Transaction.ServerName+"',"+&
  360. "'" + db_Transaction.LogID + "',"+&
  361. "'" + db_Transaction.LogPass + "',"+&
  362. "'" + ls_MDF + "',"+&
  363. "'" + ls_ldf + "',"+&
  364. "getdate()"+&
  365. ");"
  366. EXECUTE Immediate :comm Using db_Transaction;
  367. IF db_Transaction.SQLCode <> 0 THEN
  368. rslt = 0
  369. arg_msg = '设置附件数据库连接失败,请手动设置,' + db_Transaction.SQLErrText
  370. GOTO ext
  371. END IF
  372. END IF
  373. //新建邮件数据库
  374. IF cbx_yj.Checked THEN
  375. ls_databasename = Trim(sle_database.Text) + '_yj'
  376. ls_filename = Trim(sle_yjname.Text)
  377. // st_jd.Text = '正在新建邮件数据库'
  378. IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, 'filemanage_Data', 'filemanage_Log', db_Transaction, False, arg_msg) = 0 THEN
  379. rslt = 0
  380. GOTO ext
  381. END IF
  382. ls_MDF = ls_databasename + ".MDF"
  383. ls_ldf = ls_databasename + ".ldf"
  384. comm = "INSERT INTO " + Trim(sle_database.Text) + ".dbo.U_OuterConnection ("+&
  385. "ConnectionID ,"+&
  386. "DBMS ,"+&
  387. "ConnectionName ,"+&
  388. "ConnectionType ,"+&
  389. "DataBaseName ,"+&
  390. "ServerName ,"+&
  391. "LogId ,"+&
  392. "LogPass ,"+&
  393. "mdf_name ,"+&
  394. "ldf_name ,"+&
  395. "opdate"+&
  396. ")"+&
  397. "VALUES"+&
  398. "("+&
  399. "12,"+&
  400. "'MSS Microsoft SQL Server 6.x',"+&
  401. "'邮件数据库',"+&
  402. "2,"+&
  403. "'" + ls_databasename + "',"+&
  404. "'" + db_Transaction.ServerName+"',"+&
  405. "'" + db_Transaction.LogID + "',"+&
  406. "'" + db_Transaction.LogPass + "',"+&
  407. "'" + ls_MDF + "',"+&
  408. "'" + ls_ldf + "',"+&
  409. "getdate()"+&
  410. ");"
  411. EXECUTE Immediate :comm Using db_Transaction;
  412. IF db_Transaction.SQLCode <> 0 THEN
  413. rslt = 0
  414. arg_msg = '设置邮件数据库连接失败,请手动设置,' + db_Transaction.SQLErrText
  415. GOTO ext
  416. END IF
  417. END IF
  418. ext:
  419. w_sys_wait.Hide()
  420. Close(w_sys_wait)
  421. IF rslt = 1 THEN
  422. COMMIT Using db_Transaction;
  423. ELSE
  424. ROLLBACK Using db_Transaction;
  425. END IF
  426. DISCONNECT Using db_Transaction;
  427. Destroy db_Transaction
  428. RETURN rslt
  429. end function
  430. public function integer wf_chk_database (string arg_databasename, transaction arg_transaction);String ls_test
  431. ls_test = "if exists(select 1 from master..sysdatabases where name='" + arg_databasename + "') raiserror('Database existed',18,1) else raiserror('Database not existed',18,1) "
  432. EXECUTE Immediate :ls_test Using arg_transaction;
  433. IF pos(arg_transaction.SQLErrText , 'Database existed' ) > 0 THEN
  434. RETURN 1
  435. ELSE
  436. RETURN 0
  437. END IF
  438. end function
  439. public function integer wf_create_database (string arg_folder, string arg_databasename, string arg_filename, string arg_sqldb_mdf_sor, string arg_sqldb_ldf_sor, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1
  440. String comm
  441. comm = ' create DATABASE '+arg_databasename+&
  442. " on(name='"+arg_sqldb_mdf_sor+"',FILENAME= '"+arg_folder + '\' + arg_databasename+'_data.ldf'+"') log on (name='"+arg_sqldb_ldf_sor+"',FILENAME= '"+arg_folder + '\' + arg_databasename+'_log.ldf'+"')"
  443. EXECUTE Immediate :comm Using arg_transaction;
  444. IF arg_transaction.SQLCode <> 0 THEN
  445. arg_msg = '建立数据库['+arg_databasename+']失败,请手动建立及恢复>'+arg_transaction.SQLErrText
  446. rslt = 0
  447. GOTO ext
  448. END IF
  449. // st_jd.Text = '正在恢复主数据库...'
  450. comm = 'RESTORE DATABASE '+arg_databasename+" from DISK= '"+arg_filename+"'"+&
  451. " WITH MOVE '"+arg_sqldb_mdf_sor+"' TO '"+arg_folder + '\' + arg_databasename+'_data.ldf'+"',"+&
  452. " MOVE '"+arg_sqldb_ldf_sor+"' TO '"+arg_folder + '\' + arg_databasename+'_log.ldf'+"',"+'REPLACE'
  453. EXECUTE Immediate :comm Using arg_transaction;
  454. IF arg_transaction.SQLCode <> 0 THEN
  455. arg_msg = '恢复数据库['+arg_databasename+']失败,请手动恢复>'+arg_transaction.SQLErrText
  456. rslt = 0
  457. END IF
  458. ext:
  459. IF rslt = 0 THEN
  460. ROLLBACK Using arg_transaction;
  461. ELSEIF arg_ifcommit THEN
  462. COMMIT Using arg_transaction;
  463. END IF
  464. RETURN rslt
  465. end function
  466. public function integer wf_drop_database (string arg_databasename, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1
  467. String comm
  468. comm = " IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'" + arg_databasename + "') DROP DATABASE [" + arg_databasename + "]"
  469. EXECUTE Immediate :comm Using arg_Transaction;
  470. IF arg_Transaction.SQLCode <> 0 THEN
  471. arg_msg = '删除数据库失败,请手动删除['+arg_databasename+']>'+arg_Transaction.SQLErrText
  472. rslt = 0
  473. ELSE
  474. rslt = 1
  475. END IF
  476. IF rslt = 0 THEN
  477. ROLLBACK Using arg_Transaction;
  478. ELSEIF arg_ifcommit THEN
  479. COMMIT Using arg_Transaction;
  480. END IF
  481. RETURN rslt
  482. end function
  483. on w_set_init.create
  484. int iCurrent
  485. call super::create
  486. this.cb_ok=create cb_ok
  487. this.st_1=create st_1
  488. this.sle_bookname=create sle_bookname
  489. this.st_2=create st_2
  490. this.sle_database=create sle_database
  491. this.st_10=create st_10
  492. this.rb_1=create rb_1
  493. this.rb_2=create rb_2
  494. this.cb_1=create cb_1
  495. this.st_11=create st_11
  496. this.sle_fjname=create sle_fjname
  497. this.cb_ch3=create cb_ch3
  498. this.sle_filename=create sle_filename
  499. this.cb_ch2=create cb_ch2
  500. this.st_13=create st_13
  501. this.sle_folder=create sle_folder
  502. this.cb_2=create cb_2
  503. this.st_8=create st_8
  504. this.cbx_fj=create cbx_fj
  505. this.cbx_yj=create cbx_yj
  506. this.sle_yjname=create sle_yjname
  507. this.cb_ch4=create cb_ch4
  508. this.st_12=create st_12
  509. this.ddlb_1=create ddlb_1
  510. this.cbx_modify=create cbx_modify
  511. this.sle_sqldb_mdf_sor=create sle_sqldb_mdf_sor
  512. this.sle_sqldb_ldf_sor=create sle_sqldb_ldf_sor
  513. this.sle_bookcode=create sle_bookcode
  514. this.st_7=create st_7
  515. this.sle_server=create sle_server
  516. this.sle_logid=create sle_logid
  517. this.st_5=create st_5
  518. this.st_6=create st_6
  519. this.sle_logpass=create sle_logpass
  520. this.cb_connect=create cb_connect
  521. this.gb_3=create gb_3
  522. this.gb_1=create gb_1
  523. this.gb_2=create gb_2
  524. this.gb_4=create gb_4
  525. iCurrent=UpperBound(this.Control)
  526. this.Control[iCurrent+1]=this.cb_ok
  527. this.Control[iCurrent+2]=this.st_1
  528. this.Control[iCurrent+3]=this.sle_bookname
  529. this.Control[iCurrent+4]=this.st_2
  530. this.Control[iCurrent+5]=this.sle_database
  531. this.Control[iCurrent+6]=this.st_10
  532. this.Control[iCurrent+7]=this.rb_1
  533. this.Control[iCurrent+8]=this.rb_2
  534. this.Control[iCurrent+9]=this.cb_1
  535. this.Control[iCurrent+10]=this.st_11
  536. this.Control[iCurrent+11]=this.sle_fjname
  537. this.Control[iCurrent+12]=this.cb_ch3
  538. this.Control[iCurrent+13]=this.sle_filename
  539. this.Control[iCurrent+14]=this.cb_ch2
  540. this.Control[iCurrent+15]=this.st_13
  541. this.Control[iCurrent+16]=this.sle_folder
  542. this.Control[iCurrent+17]=this.cb_2
  543. this.Control[iCurrent+18]=this.st_8
  544. this.Control[iCurrent+19]=this.cbx_fj
  545. this.Control[iCurrent+20]=this.cbx_yj
  546. this.Control[iCurrent+21]=this.sle_yjname
  547. this.Control[iCurrent+22]=this.cb_ch4
  548. this.Control[iCurrent+23]=this.st_12
  549. this.Control[iCurrent+24]=this.ddlb_1
  550. this.Control[iCurrent+25]=this.cbx_modify
  551. this.Control[iCurrent+26]=this.sle_sqldb_mdf_sor
  552. this.Control[iCurrent+27]=this.sle_sqldb_ldf_sor
  553. this.Control[iCurrent+28]=this.sle_bookcode
  554. this.Control[iCurrent+29]=this.st_7
  555. this.Control[iCurrent+30]=this.sle_server
  556. this.Control[iCurrent+31]=this.sle_logid
  557. this.Control[iCurrent+32]=this.st_5
  558. this.Control[iCurrent+33]=this.st_6
  559. this.Control[iCurrent+34]=this.sle_logpass
  560. this.Control[iCurrent+35]=this.cb_connect
  561. this.Control[iCurrent+36]=this.gb_3
  562. this.Control[iCurrent+37]=this.gb_1
  563. this.Control[iCurrent+38]=this.gb_2
  564. this.Control[iCurrent+39]=this.gb_4
  565. end on
  566. on w_set_init.destroy
  567. call super::destroy
  568. destroy(this.cb_ok)
  569. destroy(this.st_1)
  570. destroy(this.sle_bookname)
  571. destroy(this.st_2)
  572. destroy(this.sle_database)
  573. destroy(this.st_10)
  574. destroy(this.rb_1)
  575. destroy(this.rb_2)
  576. destroy(this.cb_1)
  577. destroy(this.st_11)
  578. destroy(this.sle_fjname)
  579. destroy(this.cb_ch3)
  580. destroy(this.sle_filename)
  581. destroy(this.cb_ch2)
  582. destroy(this.st_13)
  583. destroy(this.sle_folder)
  584. destroy(this.cb_2)
  585. destroy(this.st_8)
  586. destroy(this.cbx_fj)
  587. destroy(this.cbx_yj)
  588. destroy(this.sle_yjname)
  589. destroy(this.cb_ch4)
  590. destroy(this.st_12)
  591. destroy(this.ddlb_1)
  592. destroy(this.cbx_modify)
  593. destroy(this.sle_sqldb_mdf_sor)
  594. destroy(this.sle_sqldb_ldf_sor)
  595. destroy(this.sle_bookcode)
  596. destroy(this.st_7)
  597. destroy(this.sle_server)
  598. destroy(this.sle_logid)
  599. destroy(this.st_5)
  600. destroy(this.st_6)
  601. destroy(this.sle_logpass)
  602. destroy(this.cb_connect)
  603. destroy(this.gb_3)
  604. destroy(this.gb_1)
  605. destroy(this.gb_2)
  606. destroy(this.gb_4)
  607. end on
  608. event open;call super::open;s_set_book_parm s_parm
  609. s_parm = Message.PowerObjectParm
  610. IF IsNull(s_parm) THEN
  611. ins_bookid = 0
  612. ins_ifguid = 0
  613. ELSE
  614. ins_bookid = s_parm.bookid
  615. ins_ifguid = s_parm.ifguid
  616. END IF
  617. IF IsNull(ins_bookid) THEN
  618. ins_bookid = 0
  619. END IF
  620. IF ins_bookid <= 0 THEN
  621. ins_bookid = 1
  622. END IF
  623. IF ins_bookid > 20 THEN
  624. ins_bookid = 20
  625. END IF
  626. sle_bookcode.Text = String(ins_bookid, '00')
  627. IF sys_cur_path = "" THEN
  628. Long rslt = 1
  629. String lpBuffer
  630. lpBuffer = Fill('',200)
  631. Long lpfilepart,li_FileNum
  632. rslt = GetFullPathName(sys_inifilename,196,lpBuffer,lpfilepart)
  633. sys_cur_path = Left(lpBuffer,Len(lpBuffer)-Len(sys_inifilename))
  634. END IF
  635. //设置数据库连接
  636. sle_logid.Text = ProfileString (sys_inifilename, "database", "logid", "SA")
  637. sle_logpass.Text = f_psw_bczh(ProfileString (sys_inifilename, "database", "LogPassWord", ""),1,sys_power_key)
  638. sle_server.Text = ProfileString (sys_inifilename, "database", "servername", "127.0.0.1")
  639. IF sle_server.Text = "" THEN
  640. sle_server.Text = "127.0.0.1"
  641. END IF
  642. IF sle_logid.Text = "" THEN
  643. sle_logid.Text = "SA"
  644. END IF
  645. //
  646. ins_servername = ProfileString (sys_inifilename, "database", "servername", "")
  647. ins_logid = ProfileString (sys_inifilename, "database", "logid", "SA")
  648. ins_logpass = f_psw_bczh(ProfileString (sys_inifilename, "database", "LogPassWord", ""),1,sys_power_key)
  649. sle_sqldb_mdf_sor.Text = ProfileString (sys_inifilename, "database", "sqldb_mdf_sor", '')
  650. sle_sqldb_ldf_sor.Text = ProfileString (sys_inifilename, "database", "sqldb_ldf_sor",'' )
  651. String ls_fjname, ls_yjname
  652. ls_fjname = ProfileString (sys_inifilename, "database", "defaultfjdb",'' )
  653. ls_yjname = ProfileString (sys_inifilename, "database", "defaultyjdb",'' )
  654. IF ls_fjname = "" THEN
  655. ls_fjname = "企精灵附件数据库"
  656. END IF
  657. IF ls_yjname = "" THEN
  658. ls_yjname = "企精灵邮件数据库"
  659. END IF
  660. sle_fjname.Text = sys_cur_path + ls_fjname +'.dat'
  661. sle_yjname.Text = sys_cur_path + ls_yjname +'.dat'
  662. Long i
  663. String ls_temp
  664. FOR i = 1 To 3
  665. ls_temp = ProfileString (sys_inifilename, "database", "demodb" + String(i), '')
  666. IF ls_temp <> '' THEN
  667. ddlb_1.AddItem (ls_temp)
  668. END IF
  669. IF i = 1 THEN
  670. ddlb_1.Text = ls_temp
  671. sle_filename.Text = sys_cur_path + ddlb_1.Text + '.dat'
  672. END IF
  673. NEXT
  674. masterpath = sys_cur_path + 'database'
  675. sle_folder.Text = masterpath
  676. String ls_ini_book
  677. String ins_bookcode
  678. Long ins_ifuse
  679. ls_ini_book = ProfileString (sys_inifilename_other,'sys_dl_book', String(ins_bookid), '')
  680. IF ls_ini_book <> '' THEN
  681. sle_bookname.Text = Mid(ls_ini_book,1,Pos(ls_ini_book,':') -1 )
  682. ls_ini_book = Replace(ls_ini_book,1,Pos(ls_ini_book,':') ,'')
  683. sle_database.Text = Mid(ls_ini_book,1,Pos(ls_ini_book,':') -1 )
  684. ls_ini_book = Replace(ls_ini_book,1,Pos(ls_ini_book,':') ,'')
  685. ins_bookcode = Mid(ls_ini_book,1,Pos(ls_ini_book,':') -1 )
  686. ls_ini_book = Replace(ls_ini_book,1,Pos(ls_ini_book,':') ,'')
  687. ins_ifuse = Long(ls_ini_book)
  688. rb_2.Checked = True
  689. ELSE
  690. sle_database.Text = "EW5_DB"
  691. // rb_1.Checked = True
  692. END IF
  693. cb_1.Text = '︾'
  694. IF ins_ifguid = 1 THEN
  695. This.Title =This.Title
  696. gb_1.Text = gb_1.Text
  697. cb_ok.Text = '完成'
  698. END IF
  699. wf_facechange()
  700. end event
  701. event close;call super::close;closewithreturn(this, ins_rslt)
  702. end event
  703. type cb_func from w_publ_base`cb_func within w_set_init
  704. boolean visible = false
  705. end type
  706. type cb_exit from w_publ_base`cb_exit within w_set_init
  707. integer x = 1778
  708. integer y = 1584
  709. end type
  710. type cb_ok from uo_imflatbutton within w_set_init
  711. integer x = 1367
  712. integer y = 1584
  713. integer width = 311
  714. integer height = 96
  715. integer taborder = 20
  716. boolean bringtotop = true
  717. string normalpicname = "ok.bmp"
  718. end type
  719. event clicked;call super::clicked;IF Trim(sle_bookname.Text) = '' THEN
  720. MessageBox('系统提示','请输入帐套!',information!,OK!)
  721. RETURN
  722. END IF
  723. IF Trim(sle_database.Text) = '' THEN
  724. MessageBox('系统提示','请输入数据库!',information!,OK!)
  725. RETURN
  726. END IF
  727. SetProfileString (sys_inifilename, "database", "logid", sle_logid.Text)
  728. SetProfileString (sys_inifilename, "database", "LogPassWord", f_psw_bczh(sle_logpass.Text,0,sys_power_key))
  729. SetProfileString (sys_inifilename, "database", "servername", sle_server.Text)
  730. ins_servername = ProfileString (sys_inifilename, "database", "servername", "")
  731. ins_logid = ProfileString (sys_inifilename, "database", "logid", "SA")
  732. ins_logpass = f_psw_bczh(ProfileString (sys_inifilename, "database", "LogPassWord", ""),1,sys_power_key)
  733. IF rb_1.Checked THEN
  734. String ls_msg
  735. Int ll_rslt
  736. ll_rslt = wf_buildsqldb(ls_msg) //1-成功
  737. IF ll_rslt = 0 THEN //错误
  738. MessageBox("提示",ls_msg,information!,OK!)
  739. RETURN
  740. ELSEIF ll_rslt = 2 THEN //取消
  741. RETURN
  742. END IF
  743. END IF
  744. SetProfileString (sys_inifilename, "database", "bookname", sle_bookname.Text )
  745. SetProfileString (sys_inifilename, "database", "database", sle_database.Text)
  746. SetProfileString (sys_inifilename, "database", "sqldb_mdf_sor", sle_sqldb_mdf_sor.Text)
  747. SetProfileString (sys_inifilename, "database", "sqldb_ldf_sor", sle_sqldb_ldf_sor.Text)
  748. //增加一个帐套
  749. String ls_ini_book
  750. string is_bookcode
  751. Long id
  752. String ifuse
  753. is_bookcode = string(ins_bookid, '00')
  754. id = ins_bookid
  755. String ls_temp
  756. ls_temp = Trim(sle_bookname.Text) + ':'+&
  757. Trim(sle_database.Text)+ ':'+&
  758. is_bookcode+':'+&
  759. '1'
  760. //SetProfileString (sys_inifilename_other,'sys_dl_book', '1', f_psw_bczh(ls_temp,0,sys_power_key))
  761. SetProfileString (sys_inifilename_other,'sys_dl_book', String(id), ls_temp)
  762. SetProfileString(sys_inifilename,'longjoews','LastAcount',Trim(sle_bookname.Text))
  763. SetProfileString (sys_inifilename, "database", "firstrun","0")
  764. ins_rslt = 1
  765. //////////////////////////////////////////亚洲国际通信设置
  766. String ls_run,sys_cur_path1
  767. String ls_server
  768. String ls_logid
  769. String ls_logpass
  770. String ls_database
  771. String ls_txtLJNETIP
  772. String ls_txtLJNETPort
  773. ls_server = Trim(sle_server.Text)
  774. ls_logid = Trim(sle_logid.Text)
  775. ls_logpass = Trim(sle_logpass.Text)
  776. ls_database = Trim(sle_database.Text) + "_yj"
  777. ls_txtLJNETIP="scm.fib2b.cn"
  778. ls_txtLJNETPort="30086"
  779. sys_cur_path1 = sys_cur_path + "亚洲国际通讯服务配置程序\LongjoeEDISvr_config.exe"
  780. ls_run = ' -longjoe&'&
  781. + ls_server + '&'&
  782. + ls_logid + '&'&
  783. + ls_logpass + '&'&
  784. + ls_database + '&'&
  785. + ls_txtLJNETIP + '&'&
  786. + ls_txtLJNETPort + '&'
  787. IF Run(sys_cur_path1 + ls_run) = -1 THEN
  788. // MessageBox('错误','运行程序失败!',stopsign!,ok!)
  789. // RETURN
  790. END IF
  791. close(parent)
  792. //MessageBox('提示','设置保存完成!系统必须重启!')
  793. //
  794. //Restart()
  795. end event
  796. type st_1 from statictext within w_set_init
  797. integer x = 142
  798. integer y = 548
  799. integer width = 256
  800. integer height = 60
  801. boolean bringtotop = true
  802. integer textsize = -8
  803. integer weight = 400
  804. fontpitch fontpitch = variable!
  805. fontfamily fontfamily = swiss!
  806. string facename = "MS Sans Serif"
  807. long textcolor = 41943040
  808. long backcolor = 16777215
  809. boolean enabled = false
  810. string text = "帐套名称:"
  811. alignment alignment = right!
  812. boolean focusrectangle = false
  813. end type
  814. type sle_bookname from singlelineedit within w_set_init
  815. integer x = 411
  816. integer y = 536
  817. integer width = 1504
  818. integer height = 80
  819. integer taborder = 20
  820. boolean bringtotop = true
  821. integer textsize = -8
  822. integer weight = 400
  823. fontpitch fontpitch = variable!
  824. fontfamily fontfamily = swiss!
  825. string facename = "MS Sans Serif"
  826. long textcolor = 41943040
  827. string text = "演示帐套"
  828. boolean autohscroll = false
  829. borderstyle borderstyle = stylelowered!
  830. end type
  831. type st_2 from statictext within w_set_init
  832. integer x = 101
  833. integer y = 648
  834. integer width = 297
  835. integer height = 60
  836. boolean bringtotop = true
  837. integer textsize = -8
  838. integer weight = 400
  839. fontpitch fontpitch = variable!
  840. fontfamily fontfamily = swiss!
  841. string facename = "MS Sans Serif"
  842. long textcolor = 41943040
  843. long backcolor = 16777215
  844. boolean enabled = false
  845. string text = "数据库名称:"
  846. alignment alignment = right!
  847. boolean focusrectangle = false
  848. end type
  849. type sle_database from singlelineedit within w_set_init
  850. integer x = 411
  851. integer y = 636
  852. integer width = 1655
  853. integer height = 80
  854. integer taborder = 30
  855. boolean bringtotop = true
  856. integer textsize = -8
  857. integer weight = 400
  858. fontpitch fontpitch = variable!
  859. fontfamily fontfamily = swiss!
  860. string facename = "MS Sans Serif"
  861. long textcolor = 41943040
  862. boolean autohscroll = false
  863. borderstyle borderstyle = stylelowered!
  864. end type
  865. type st_10 from statictext within w_set_init
  866. integer x = 73
  867. integer y = 748
  868. integer width = 325
  869. integer height = 60
  870. boolean bringtotop = true
  871. integer textsize = -8
  872. integer weight = 400
  873. fontpitch fontpitch = variable!
  874. fontfamily fontfamily = swiss!
  875. string facename = "MS Sans Serif"
  876. long textcolor = 41943040
  877. long backcolor = 16777215
  878. boolean enabled = false
  879. string text = "初始化类型:"
  880. alignment alignment = right!
  881. boolean focusrectangle = false
  882. end type
  883. type rb_1 from radiobutton within w_set_init
  884. integer x = 96
  885. integer y = 984
  886. integer width = 402
  887. integer height = 60
  888. boolean bringtotop = true
  889. integer textsize = -9
  890. integer weight = 400
  891. fontcharset fontcharset = gb2312charset!
  892. fontpitch fontpitch = variable!
  893. string facename = "宋体"
  894. long textcolor = 33554432
  895. long backcolor = 16777215
  896. boolean enabled = false
  897. string text = "新建数据库"
  898. end type
  899. event clicked;wf_facechange()
  900. end event
  901. type rb_2 from radiobutton within w_set_init
  902. integer x = 421
  903. integer y = 760
  904. integer width = 466
  905. integer height = 60
  906. boolean bringtotop = true
  907. integer textsize = -9
  908. integer weight = 400
  909. fontcharset fontcharset = gb2312charset!
  910. fontpitch fontpitch = variable!
  911. string facename = "宋体"
  912. long textcolor = 33554432
  913. long backcolor = 16777215
  914. string text = "连接现有数据库"
  915. boolean checked = true
  916. end type
  917. event clicked;wf_facechange()
  918. end event
  919. type cb_1 from commandbutton within w_set_init
  920. integer x = 1746
  921. integer y = 744
  922. integer width = 82
  923. integer height = 84
  924. integer taborder = 20
  925. boolean bringtotop = true
  926. integer textsize = -9
  927. integer weight = 400
  928. fontcharset fontcharset = gb2312charset!
  929. fontpitch fontpitch = variable!
  930. string facename = "宋体"
  931. string text = "︾"
  932. end type
  933. event clicked;IF cb_1.Text = '︽' THEN
  934. cb_1.Text = '︾'
  935. ELSE
  936. cb_1.Text = '︽'
  937. END IF
  938. wf_facechange()
  939. end event
  940. type st_11 from statictext within w_set_init
  941. integer x = 1838
  942. integer y = 768
  943. integer width = 233
  944. integer height = 48
  945. boolean bringtotop = true
  946. integer textsize = -9
  947. integer weight = 400
  948. fontcharset fontcharset = gb2312charset!
  949. fontpitch fontpitch = variable!
  950. string facename = "宋体"
  951. long textcolor = 33554432
  952. long backcolor = 16777215
  953. string text = "高级选项"
  954. boolean focusrectangle = false
  955. end type
  956. type sle_fjname from singlelineedit within w_set_init
  957. integer x = 407
  958. integer y = 1264
  959. integer width = 1655
  960. integer height = 80
  961. integer taborder = 170
  962. boolean bringtotop = true
  963. integer textsize = -9
  964. integer weight = 400
  965. fontcharset fontcharset = gb2312charset!
  966. fontpitch fontpitch = variable!
  967. string facename = "宋体"
  968. long textcolor = 33554432
  969. borderstyle borderstyle = stylelowered!
  970. end type
  971. type cb_ch3 from commandbutton within w_set_init
  972. integer x = 2071
  973. integer y = 1264
  974. integer width = 114
  975. integer height = 84
  976. integer taborder = 220
  977. boolean bringtotop = true
  978. integer textsize = -9
  979. integer weight = 400
  980. fontcharset fontcharset = gb2312charset!
  981. fontpitch fontpitch = variable!
  982. string facename = "宋体"
  983. string text = "..."
  984. end type
  985. event clicked;
  986. Integer i
  987. String Pathname,Filename
  988. i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat")
  989. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  990. sle_fjname.Text = Pathname
  991. END IF
  992. end event
  993. type sle_filename from singlelineedit within w_set_init
  994. integer x = 407
  995. integer y = 1160
  996. integer width = 1655
  997. integer height = 80
  998. integer taborder = 160
  999. boolean bringtotop = true
  1000. integer textsize = -9
  1001. integer weight = 400
  1002. fontcharset fontcharset = gb2312charset!
  1003. fontpitch fontpitch = variable!
  1004. string facename = "宋体"
  1005. long textcolor = 33554432
  1006. boolean enabled = false
  1007. borderstyle borderstyle = stylelowered!
  1008. end type
  1009. type cb_ch2 from commandbutton within w_set_init
  1010. integer x = 2071
  1011. integer y = 1160
  1012. integer width = 114
  1013. integer height = 84
  1014. integer taborder = 210
  1015. boolean bringtotop = true
  1016. integer textsize = -9
  1017. integer weight = 400
  1018. fontcharset fontcharset = gb2312charset!
  1019. fontpitch fontpitch = variable!
  1020. string facename = "宋体"
  1021. boolean enabled = false
  1022. string text = "..."
  1023. end type
  1024. event clicked;
  1025. Integer i
  1026. String Pathname,Filename
  1027. i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat")
  1028. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  1029. sle_filename.Text = Pathname
  1030. END IF
  1031. end event
  1032. type st_13 from statictext within w_set_init
  1033. integer x = 23
  1034. integer y = 1496
  1035. integer width = 370
  1036. integer height = 76
  1037. boolean bringtotop = true
  1038. integer textsize = -9
  1039. integer weight = 400
  1040. fontcharset fontcharset = gb2312charset!
  1041. fontpitch fontpitch = variable!
  1042. string facename = "宋体"
  1043. long textcolor = 33554432
  1044. long backcolor = 16777215
  1045. boolean enabled = false
  1046. string text = "目标文件路径:"
  1047. alignment alignment = right!
  1048. boolean focusrectangle = false
  1049. end type
  1050. type sle_folder from singlelineedit within w_set_init
  1051. integer x = 407
  1052. integer y = 1480
  1053. integer width = 1655
  1054. integer height = 80
  1055. integer taborder = 200
  1056. boolean bringtotop = true
  1057. integer textsize = -9
  1058. integer weight = 400
  1059. fontcharset fontcharset = gb2312charset!
  1060. fontpitch fontpitch = variable!
  1061. string facename = "宋体"
  1062. long textcolor = 33554432
  1063. borderstyle borderstyle = stylelowered!
  1064. end type
  1065. type cb_2 from commandbutton within w_set_init
  1066. integer x = 2071
  1067. integer y = 1480
  1068. integer width = 114
  1069. integer height = 84
  1070. integer taborder = 250
  1071. boolean bringtotop = true
  1072. integer textsize = -9
  1073. integer weight = 400
  1074. fontcharset fontcharset = gb2312charset!
  1075. fontpitch fontpitch = variable!
  1076. string facename = "宋体"
  1077. string text = "..."
  1078. end type
  1079. event clicked;
  1080. //
  1081. //GetFolder()
  1082. //功 能:显示文件夹选择对话框。
  1083. //语 法:GetFolder (title , director )
  1084. //参 数:title:String类型,指定文件夹选择框的标题;
  1085. // directory:String类型,文件夹的路径,即指定显示哪个文件夹下的子文件夹,又用于保存用户最终选择的文件夹的路径。
  1086. //返回值:Integer。函数执行成功时返回1,发生错误时返回-1。当用户选择了”取消”按钮或直接关闭对话框,函数返回0。
  1087. //示 例:This example displays the folder contents of the Sybase directory in a folder selection dialog box. The string passed in the title argument displays above the tree view:
  1088. string ls_path
  1089. integer li_result
  1090. ls_path = mid(sys_cur_path,1,len(sys_cur_path )- 1)
  1091. li_result = GetFolder( "目标文件路径", ls_path )
  1092. sle_folder.text=ls_path
  1093. end event
  1094. type st_8 from statictext within w_set_init
  1095. integer x = 23
  1096. integer y = 1172
  1097. integer width = 370
  1098. integer height = 76
  1099. boolean bringtotop = true
  1100. integer textsize = -9
  1101. integer weight = 400
  1102. fontcharset fontcharset = gb2312charset!
  1103. fontpitch fontpitch = variable!
  1104. string facename = "宋体"
  1105. long textcolor = 33554432
  1106. long backcolor = 16777215
  1107. boolean enabled = false
  1108. string text = "主数据库:"
  1109. alignment alignment = right!
  1110. boolean focusrectangle = false
  1111. end type
  1112. type cbx_fj from checkbox within w_set_init
  1113. integer x = 18
  1114. integer y = 1276
  1115. integer width = 375
  1116. integer height = 60
  1117. boolean bringtotop = true
  1118. integer textsize = -9
  1119. integer weight = 400
  1120. fontcharset fontcharset = gb2312charset!
  1121. fontpitch fontpitch = variable!
  1122. string facename = "宋体"
  1123. long textcolor = 33554432
  1124. long backcolor = 16777215
  1125. string text = "附件数据库:"
  1126. boolean checked = true
  1127. end type
  1128. event clicked;if rb_2.checked then return
  1129. IF cbx_fj.Checked THEN
  1130. sle_fjname.Enabled = TRUE
  1131. cb_ch3.Enabled = TRUE
  1132. ELSE
  1133. sle_fjname.Enabled = FALSE
  1134. cb_ch3.Enabled = FALSE
  1135. END IF
  1136. end event
  1137. type cbx_yj from checkbox within w_set_init
  1138. integer x = 18
  1139. integer y = 1384
  1140. integer width = 384
  1141. integer height = 60
  1142. boolean bringtotop = true
  1143. integer textsize = -9
  1144. integer weight = 400
  1145. fontcharset fontcharset = gb2312charset!
  1146. fontpitch fontpitch = variable!
  1147. string facename = "宋体"
  1148. long textcolor = 33554432
  1149. long backcolor = 16777215
  1150. string text = "邮件数据库:"
  1151. boolean checked = true
  1152. end type
  1153. event clicked;IF rb_2.Checked THEN RETURN
  1154. IF cbx_yj.Checked THEN
  1155. sle_yjname.Enabled = TRUE
  1156. cb_ch4.Enabled = TRUE
  1157. ELSE
  1158. sle_yjname.Enabled = FALSE
  1159. cb_ch4.Enabled = FALSE
  1160. END IF
  1161. end event
  1162. type sle_yjname from singlelineedit within w_set_init
  1163. integer x = 407
  1164. integer y = 1372
  1165. integer width = 1655
  1166. integer height = 80
  1167. integer taborder = 180
  1168. boolean bringtotop = true
  1169. integer textsize = -9
  1170. integer weight = 400
  1171. fontcharset fontcharset = gb2312charset!
  1172. fontpitch fontpitch = variable!
  1173. string facename = "宋体"
  1174. long textcolor = 33554432
  1175. borderstyle borderstyle = stylelowered!
  1176. end type
  1177. type cb_ch4 from commandbutton within w_set_init
  1178. integer x = 2071
  1179. integer y = 1372
  1180. integer width = 114
  1181. integer height = 84
  1182. integer taborder = 240
  1183. boolean bringtotop = true
  1184. integer textsize = -9
  1185. integer weight = 400
  1186. fontcharset fontcharset = gb2312charset!
  1187. fontpitch fontpitch = variable!
  1188. string facename = "宋体"
  1189. string text = "..."
  1190. end type
  1191. event clicked;
  1192. Integer i
  1193. String Pathname,Filename
  1194. i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat")
  1195. IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN
  1196. sle_yjname.Text = Pathname
  1197. END IF
  1198. end event
  1199. type st_12 from statictext within w_set_init
  1200. integer x = 96
  1201. integer y = 1060
  1202. integer width = 297
  1203. integer height = 60
  1204. boolean bringtotop = true
  1205. integer textsize = -8
  1206. integer weight = 400
  1207. fontpitch fontpitch = variable!
  1208. fontfamily fontfamily = swiss!
  1209. string facename = "MS Sans Serif"
  1210. long textcolor = 41943040
  1211. long backcolor = 16777215
  1212. boolean enabled = false
  1213. string text = "数据库来源:"
  1214. alignment alignment = right!
  1215. boolean focusrectangle = false
  1216. end type
  1217. type ddlb_1 from dropdownlistbox within w_set_init
  1218. integer x = 407
  1219. integer y = 1052
  1220. integer width = 1166
  1221. integer height = 300
  1222. integer taborder = 40
  1223. boolean bringtotop = true
  1224. integer textsize = -9
  1225. integer weight = 400
  1226. fontcharset fontcharset = gb2312charset!
  1227. fontpitch fontpitch = variable!
  1228. string facename = "宋体"
  1229. long textcolor = 33554432
  1230. borderstyle borderstyle = stylelowered!
  1231. end type
  1232. event selectionchanged;sle_filename.text = sys_cur_path + this.text + '.dat'
  1233. end event
  1234. type cbx_modify from checkbox within w_set_init
  1235. integer x = 1591
  1236. integer y = 1060
  1237. integer width = 311
  1238. integer height = 60
  1239. integer taborder = 50
  1240. boolean bringtotop = true
  1241. integer textsize = -9
  1242. integer weight = 400
  1243. fontcharset fontcharset = gb2312charset!
  1244. fontpitch fontpitch = variable!
  1245. string facename = "宋体"
  1246. long textcolor = 33554432
  1247. long backcolor = 16777215
  1248. string text = "手动修改"
  1249. end type
  1250. event clicked;IF THIS.Checked THEN
  1251. ddlb_1.Enabled = FALSE
  1252. cb_ch2.Enabled = TRUE
  1253. sle_filename.Enabled = TRUE
  1254. sle_filename.text = ''
  1255. ELSE
  1256. ddlb_1.Enabled = TRUE
  1257. cb_ch2.Enabled = FALSE
  1258. sle_filename.Enabled = FALSE
  1259. sle_filename.text = sys_cur_path + ddlb_1.text + '.dat'
  1260. END IF
  1261. end event
  1262. type sle_sqldb_mdf_sor from singlelineedit within w_set_init
  1263. boolean visible = false
  1264. integer x = 1582
  1265. integer y = 372
  1266. integer width = 1655
  1267. integer height = 80
  1268. integer taborder = 190
  1269. boolean bringtotop = true
  1270. integer textsize = -9
  1271. integer weight = 400
  1272. fontcharset fontcharset = gb2312charset!
  1273. fontpitch fontpitch = variable!
  1274. string facename = "宋体"
  1275. long textcolor = 33554432
  1276. borderstyle borderstyle = stylelowered!
  1277. end type
  1278. type sle_sqldb_ldf_sor from singlelineedit within w_set_init
  1279. boolean visible = false
  1280. integer x = 1582
  1281. integer y = 464
  1282. integer width = 1655
  1283. integer height = 80
  1284. integer taborder = 230
  1285. boolean bringtotop = true
  1286. integer textsize = -9
  1287. integer weight = 400
  1288. fontcharset fontcharset = gb2312charset!
  1289. fontpitch fontpitch = variable!
  1290. string facename = "宋体"
  1291. long textcolor = 33554432
  1292. borderstyle borderstyle = stylelowered!
  1293. end type
  1294. type sle_bookcode from singlelineedit within w_set_init
  1295. integer x = 1929
  1296. integer y = 536
  1297. integer width = 137
  1298. integer height = 80
  1299. integer taborder = 30
  1300. boolean bringtotop = true
  1301. integer textsize = -8
  1302. integer weight = 400
  1303. fontcharset fontcharset = ansi!
  1304. fontpitch fontpitch = variable!
  1305. fontfamily fontfamily = swiss!
  1306. string facename = "MS Sans Serif"
  1307. long textcolor = 41943040
  1308. boolean enabled = false
  1309. string text = "none"
  1310. boolean displayonly = true
  1311. borderstyle borderstyle = stylelowered!
  1312. end type
  1313. type st_7 from statictext within w_set_init
  1314. integer x = 137
  1315. integer y = 108
  1316. integer width = 256
  1317. integer height = 60
  1318. boolean bringtotop = true
  1319. integer textsize = -8
  1320. integer weight = 400
  1321. fontpitch fontpitch = variable!
  1322. fontfamily fontfamily = swiss!
  1323. string facename = "MS Sans Serif"
  1324. long textcolor = 41943040
  1325. long backcolor = 16777215
  1326. boolean enabled = false
  1327. string text = "服务器:"
  1328. alignment alignment = right!
  1329. boolean focusrectangle = false
  1330. end type
  1331. type sle_server from singlelineedit within w_set_init
  1332. integer x = 407
  1333. integer y = 96
  1334. integer width = 1655
  1335. integer height = 80
  1336. integer taborder = 140
  1337. boolean bringtotop = true
  1338. integer textsize = -8
  1339. integer weight = 400
  1340. fontpitch fontpitch = variable!
  1341. fontfamily fontfamily = swiss!
  1342. string facename = "MS Sans Serif"
  1343. long textcolor = 41943040
  1344. boolean autohscroll = false
  1345. borderstyle borderstyle = stylelowered!
  1346. end type
  1347. type sle_logid from singlelineedit within w_set_init
  1348. integer x = 407
  1349. integer y = 196
  1350. integer width = 1655
  1351. integer height = 80
  1352. integer taborder = 150
  1353. boolean bringtotop = true
  1354. integer textsize = -8
  1355. integer weight = 400
  1356. fontpitch fontpitch = variable!
  1357. fontfamily fontfamily = swiss!
  1358. string facename = "MS Sans Serif"
  1359. long textcolor = 41943040
  1360. boolean autohscroll = false
  1361. borderstyle borderstyle = stylelowered!
  1362. end type
  1363. type st_5 from statictext within w_set_init
  1364. integer x = 137
  1365. integer y = 208
  1366. integer width = 256
  1367. integer height = 60
  1368. boolean bringtotop = true
  1369. integer textsize = -8
  1370. integer weight = 400
  1371. fontpitch fontpitch = variable!
  1372. fontfamily fontfamily = swiss!
  1373. string facename = "MS Sans Serif"
  1374. long textcolor = 41943040
  1375. long backcolor = 16777215
  1376. boolean enabled = false
  1377. string text = "登录 ID:"
  1378. alignment alignment = right!
  1379. boolean focusrectangle = false
  1380. end type
  1381. type st_6 from statictext within w_set_init
  1382. integer x = 137
  1383. integer y = 300
  1384. integer width = 256
  1385. integer height = 60
  1386. boolean bringtotop = true
  1387. integer textsize = -8
  1388. integer weight = 400
  1389. fontpitch fontpitch = variable!
  1390. fontfamily fontfamily = swiss!
  1391. string facename = "MS Sans Serif"
  1392. long textcolor = 41943040
  1393. long backcolor = 16777215
  1394. boolean enabled = false
  1395. string text = "登录 口令:"
  1396. alignment alignment = right!
  1397. boolean focusrectangle = false
  1398. end type
  1399. type sle_logpass from singlelineedit within w_set_init
  1400. integer x = 407
  1401. integer y = 292
  1402. integer width = 1655
  1403. integer height = 80
  1404. integer taborder = 160
  1405. boolean bringtotop = true
  1406. integer textsize = -8
  1407. integer weight = 400
  1408. fontpitch fontpitch = variable!
  1409. fontfamily fontfamily = swiss!
  1410. string facename = "MS Sans Serif"
  1411. long textcolor = 41943040
  1412. boolean autohscroll = false
  1413. boolean password = true
  1414. borderstyle borderstyle = stylelowered!
  1415. end type
  1416. type cb_connect from uo_imflatbutton within w_set_init
  1417. integer x = 393
  1418. integer y = 1592
  1419. integer width = 315
  1420. integer height = 96
  1421. integer taborder = 100
  1422. boolean bringtotop = true
  1423. string text = "测试连接"
  1424. end type
  1425. event clicked;call super::clicked;IF Trim(sle_server.Text) = '' THEN
  1426. MessageBox('系统提示','请输入服务器!',information!,OK!)
  1427. RETURN
  1428. END IF
  1429. IF Trim(sle_logid.Text) = '' THEN
  1430. MessageBox('系统提示','请输入登陆ID!',information!,OK!)
  1431. RETURN
  1432. END IF
  1433. string ls_database = "master"
  1434. Open(w_sys_wait)
  1435. w_sys_wait.wf_set_msg("正在尝试连接数据库,此过程预计需要用时1分钟...")
  1436. Transaction db_Transaction
  1437. db_Transaction = Create Transaction
  1438. db_Transaction.DBMS = "SNC SQL Native Client(OLE DB)"
  1439. db_Transaction.Database = ls_database
  1440. db_Transaction.UserID = sle_logid.Text
  1441. db_Transaction.DBPass = sle_logpass.Text
  1442. db_Transaction.LogID = sle_logid.Text
  1443. db_Transaction.LogPass = sle_logpass.Text
  1444. db_Transaction.ServerName = sle_server.Text
  1445. db_Transaction.Lock = "RU"
  1446. db_Transaction.AutoCommit = False
  1447. db_Transaction.DBParm = "Database= '" + ls_database + "',PBTrimCharColumns='YES'"
  1448. CONNECT Using db_Transaction;
  1449. Int rslt = 1
  1450. String arg_msg = ''
  1451. IF db_Transaction.SQLCode < 0 THEN
  1452. rslt = 0
  1453. arg_msg = "连接数据库失败!"
  1454. IF Pos(db_Transaction.SQLErrText, "'"+sle_logid.Text+"'") > 0 THEN
  1455. arg_msg = arg_msg + "用户密码错误!"
  1456. sle_logpass.SetFocus()
  1457. END IF
  1458. IF Pos(db_Transaction.SQLErrText, "'"+ls_database+"'") > 0 THEN
  1459. rslt = 1
  1460. END IF
  1461. ELSE
  1462. rslt = 1
  1463. END IF
  1464. DISCONNECT Using db_Transaction;
  1465. Destroy db_Transaction;
  1466. Close(w_sys_wait)
  1467. IF rslt = 0 THEN
  1468. MessageBox("系统提示",arg_msg)
  1469. ELSE
  1470. MessageBox("系统提示","连接数据库成功!")
  1471. END IF
  1472. end event
  1473. type gb_3 from groupbox within w_set_init
  1474. integer x = 411
  1475. integer y = 716
  1476. integer width = 1051
  1477. integer height = 120
  1478. integer taborder = 300
  1479. integer textsize = -9
  1480. integer weight = 400
  1481. fontcharset fontcharset = gb2312charset!
  1482. fontpitch fontpitch = variable!
  1483. string facename = "宋体"
  1484. long textcolor = 16711680
  1485. long backcolor = 16777215
  1486. end type
  1487. type gb_1 from groupbox within w_set_init
  1488. integer y = 468
  1489. integer width = 2217
  1490. integer height = 388
  1491. integer taborder = 270
  1492. integer textsize = -9
  1493. integer weight = 400
  1494. fontcharset fontcharset = gb2312charset!
  1495. fontpitch fontpitch = variable!
  1496. string facename = "宋体"
  1497. long textcolor = 33554432
  1498. long backcolor = 16777215
  1499. string text = "2.帐套设置"
  1500. end type
  1501. type gb_2 from groupbox within w_set_init
  1502. integer x = 9
  1503. integer y = 872
  1504. integer width = 2217
  1505. integer height = 716
  1506. integer taborder = 280
  1507. integer textsize = -9
  1508. integer weight = 400
  1509. fontcharset fontcharset = gb2312charset!
  1510. fontpitch fontpitch = variable!
  1511. string facename = "宋体"
  1512. long textcolor = 33554432
  1513. long backcolor = 16777215
  1514. string text = "3.高级选项"
  1515. end type
  1516. type gb_4 from groupbox within w_set_init
  1517. integer x = 9
  1518. integer y = 24
  1519. integer width = 2217
  1520. integer height = 432
  1521. integer taborder = 280
  1522. integer textsize = -9
  1523. integer weight = 400
  1524. fontcharset fontcharset = gb2312charset!
  1525. fontpitch fontpitch = variable!
  1526. string facename = "宋体"
  1527. long textcolor = 33554432
  1528. long backcolor = 16777215
  1529. string text = "1.服务器设置"
  1530. end type