123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- $PBExportHeader$w_system_import_setting.srw
- forward
- global type w_system_import_setting from window
- end type
- type cb_exit from commandbutton within w_system_import_setting
- end type
- type cb_backup from commandbutton within w_system_import_setting
- end type
- type cb_ch from commandbutton within w_system_import_setting
- end type
- type sle_filename from singlelineedit within w_system_import_setting
- end type
- type gb_1 from groupbox within w_system_import_setting
- end type
- type cb_export from commandbutton within w_system_import_setting
- end type
- end forward
- global type w_system_import_setting from window
- integer x = 814
- integer y = 864
- integer width = 2240
- integer height = 672
- boolean titlebar = true
- string title = "导入系统功能"
- boolean controlmenu = true
- boolean minbox = true
- windowtype windowtype = popup!
- long backcolor = 79741120
- cb_exit cb_exit
- cb_backup cb_backup
- cb_ch cb_ch
- sle_filename sle_filename
- gb_1 gb_1
- cb_export cb_export
- end type
- global w_system_import_setting w_system_import_setting
- type variables
- BOOLEAN OL_BACKUP=TRUE
- end variables
- on w_system_import_setting.create
- this.cb_exit=create cb_exit
- this.cb_backup=create cb_backup
- this.cb_ch=create cb_ch
- this.sle_filename=create sle_filename
- this.gb_1=create gb_1
- this.cb_export=create cb_export
- this.Control[]={this.cb_exit,&
- this.cb_backup,&
- this.cb_ch,&
- this.sle_filename,&
- this.gb_1,&
- this.cb_export}
- end on
- on w_system_import_setting.destroy
- destroy(this.cb_exit)
- destroy(this.cb_backup)
- destroy(this.cb_ch)
- destroy(this.sle_filename)
- destroy(this.gb_1)
- destroy(this.cb_export)
- end on
- event open;IF Message.DoubleParm = 1 THEN
- OL_BACKUP=FALSE
- END IF
- end event
- type cb_exit from commandbutton within w_system_import_setting
- integer x = 1326
- integer y = 368
- integer width = 320
- integer height = 96
- integer taborder = 80
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "退出"
- end type
- event clicked;close(parent)
- end event
- type cb_backup from commandbutton within w_system_import_setting
- integer x = 832
- integer y = 368
- integer width = 320
- integer height = 96
- integer taborder = 50
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- boolean enabled = false
- string text = "导入"
- end type
- event clicked;IF NOT sys_power_issuper THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- datastore ds_setting
- ds_setting = CREATE datastore
- ds_setting.DataObject = 'dw_system_import_setting'
- ds_setting.SetTransObject(sqlca)
- ds_setting.ImportFile(sle_filename.Text)
- ds_setting.AcceptText()
- IF ds_setting.RowCount() <= 0 THEN
- MessageBox('提示','你导入的系统功能文件没有数据',information!,ok!)
- RETURN
- END IF
- DELETE FROM sys_func_pwr;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!)
- RETURN
- END IF
- Long ll_i
- Long ll_funcid
- Long ll_parentid
- Long ll_mainid
- Int li_functype
- String ls_treename
- String ls_menuname
- Int li_if_use
- Int li_sortflag
- int li_versiontype
- int li_worktype
- FOR ll_i = 1 TO ds_setting.RowCount()
- ll_funcid = ds_setting.Object.funcid[ll_i]
- ll_parentid = ds_setting.Object.parentid[ll_i]
- ll_mainid = ds_setting.Object.mainid[ll_i]
- li_functype = ds_setting.Object.functype[ll_i]
- ls_treename = ds_setting.Object.treename[ll_i]
- ls_menuname = ds_setting.Object.MenuName[ll_i]
- li_if_use = ds_setting.Object.if_use[ll_i]
- li_sortflag = ds_setting.Object.sortflag[ll_i]
- li_versiontype = ds_setting.Object.versiontype[ll_i]
- li_worktype = ds_setting.Object.worktype[ll_i]
- INSERT INTO sys_func_pwr(funcid,parentid,mainid,functype,treename,menuname,if_use,sortflag,versiontype,worktype)
- Values(:ll_funcid,:ll_parentid,:ll_mainid,:li_functype,:ls_treename,:ls_menuname,:li_if_use,:li_sortflag,:li_versiontype,:li_worktype);
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('错误','导入系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!)
- RETURN
- END IF
- NEXT
- commit;
- MessageBox('提示','导入系统功能数据成功',information!,ok!)
- end event
- type cb_ch from commandbutton within w_system_import_setting
- integer x = 1975
- integer y = 188
- integer width = 114
- integer height = 92
- integer taborder = 20
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "..."
- end type
- event clicked;//new
- integer i
- string pathname,filename
- i=getfilesavename("选择备份文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf")
- IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>"" THEN
- cb_backup.enabled=OL_BACKUP
- cb_export.enabled=OL_BACKUP
- sle_filename.text=pathname
- END IF
- end event
- type sle_filename from singlelineedit within w_system_import_setting
- event key pbm_keydown
- integer x = 151
- integer y = 188
- integer width = 1801
- integer height = 92
- integer taborder = 10
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- event key;if trim(this.text)="" then
- cb_backup.enabled=false
- else
- cb_backup.enabled=OL_BACKUP
- end if
- end event
- event modified;if trim(this.text)="" then
- cb_backup.enabled=false
- else
- cb_backup.enabled=OL_BACKUP
- end if
- end event
- type gb_1 from groupbox within w_system_import_setting
- integer x = 91
- integer y = 108
- integer width = 2030
- integer height = 216
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 79741120
- string text = "文件路径"
- end type
- type cb_export from commandbutton within w_system_import_setting
- integer x = 338
- integer y = 368
- integer width = 320
- integer height = 96
- integer taborder = 30
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- boolean enabled = false
- string text = "导出"
- end type
- event clicked;IF NOT sys_power_issuper THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- string arg_filename,arg_msg
- blob arg_blob
- arg_filename = trim(sle_filename.text)
- if arg_filename = '' then
- messagebox('提示','请输入文件名称',information!,ok!)
- return
- end if
- if messagebox("询问","是否确定要将系统权限导出成文件",question!,yesno!,1) = 2 then
- return
- end if
- datastore ds_setting
- ds_setting = create datastore
- ds_setting.dataobject = 'dw_system_import_setting'
- ds_setting.settransobject(sqlca)
- ds_setting.retrieve( )
- if fileexists(arg_filename) then
- if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
- return
- end if
- end if
- if ds_setting.saveas(arg_filename,dbase2!,false) = 1 then
- arg_msg = '数据导出成功!'
- else
- arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
- end if
- messagebox('提示',arg_msg,information!,ok!)
- end event
|