123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- $PBExportHeader$uo_sys_funcpwr.sru
- forward
- global type uo_sys_funcpwr from nonvisualobject
- end type
- end forward
- global type uo_sys_funcpwr from nonvisualobject autoinstantiate
- end type
- type variables
- string ins_msg
- long ins_funcid
- end variables
- forward prototypes
- public function integer del (long funcid)
- public subroutine init_ds_funcinfo ()
- public function integer save (long funcid, long parentid, long mainid, long functype, string treename, string menuname, integer if_use, integer sortflag, integer versiontype, integer worktype, integer moduleid)
- end prototypes
- public function integer del (long funcid);
- Long rslt = 1
- DELETE sys_func_pwr
- Where funcid = :funcid;
- IF sqlca.SQLCode <> 0 OR sqlca.SQLNRows = 0 THEN
- ins_msg = '保存失败>'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ins_funcid = funcid
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSE
- COMMIT;
- END IF
- RETURN rslt
- end function
- public subroutine init_ds_funcinfo ();
- //datastore
- sys_ds_funcinfo = Create datastore
- sys_ds_funcinfo.DataObject = 'ds_sys_funcpwr_setting'
- sys_ds_maininfo = Create datastore
- sys_ds_maininfo.DataObject = 'ds_sys_funcpwr'
- sys_ds_userinfo = Create datastore
- sys_ds_userinfo.DataObject = 'ds_sys_funcpwr'
- sys_ds_shortcutinfo = Create datastore
- sys_ds_shortcutinfo.DataObject = 'ds_sys_funcpwr'
- //开发状态下, 刷新最新的数据
- IF Handle(This) = 0 THEN
- Int li_development
- SELECT top 1 development
- INTO :li_development
- From sys_DB_version;
- IF sqlca.SQLCode <> 0 THEN
- li_development = 0
- END IF
-
- IF li_development = 1 THEN
- sys_ds_funcinfo.SetTransObject(sqlca)
- sys_ds_maininfo.SetTransObject(sqlca)
- sys_ds_userinfo.SetTransObject(sqlca)
- sys_ds_shortcutinfo.SetTransObject(sqlca)
-
- sys_ds_funcinfo.Retrieve(-1)
- sys_ds_maininfo.Retrieve()
- sys_ds_userinfo.Retrieve()
- sys_ds_shortcutinfo.Retrieve()
- END IF
-
- END IF
- end subroutine
- public function integer save (long funcid, long parentid, long mainid, long functype, string treename, string menuname, integer if_use, integer sortflag, integer versiontype, integer worktype, integer moduleid);
- long rslt=1
- long ls_newid=0
- // funcid parentid mainid functype treename menuname if_use sortflag
- if funcid=0 then //add
-
- ls_newid = f_sys_scidentity(0,"sys_func_pwr","funcid",ins_msg,true,sqlca)
- if ls_newid <= 0 then
- rslt = 0
- goto ext
- end if
- funcid=ls_newid
- INSERT INTO sys_func_pwr
- ( funcid,
- parentid,
- mainid,
- functype,
- treename,
- menuname,
- if_use,
- sortflag,
- versiontype,
- worktype,
- moduleid)
- VALUES ( :funcid,
- :parentid,
- :mainid,
- :functype,
- :treename,
- :menuname,
- :if_use,
- :sortflag,
- :versiontype,
- :worktype,
- :moduleid) ;
- if sqlca.sqlcode<>0 then
- if pos(lower(sqlca.SQLErrText),'pk_sys_func_pwr') > 0 then
- ins_msg = '插入权限树操作失败,关键字重复'
- else
- ins_msg='保存失败>'+sqlca.sqlerrtext
- end if
- rslt=0
- goto ext
- end if
-
- else //edit
-
- update sys_func_pwr
- set parentid=:parentid,
- mainid=:mainid,
- functype=:functype,
- treename=:treename,
- menuname=:menuname,
- if_use=:if_use,
- sortflag=:sortflag,
- versiontype = :versiontype,
- worktype = :worktype,
- moduleid = :moduleid
- where funcid=:funcid;
- if sqlca.sqlcode<>0 or sqlca.sqlnrows=0 then
- if pos(lower(sqlca.SQLErrText),'pk_sys_func_pwr') > 0 then
- ins_msg = '插入权限树操作失败,关键字重复'
- else
- ins_msg='保存失败>'+sqlca.sqlerrtext
- end if
- rslt=0
- goto ext
- end if
- end if
- ins_funcid=funcid
- ext:
- if rslt=0 then
- rollback;
- else
- commit;
- end if
- return rslt
- end function
- on uo_sys_funcpwr.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_sys_funcpwr.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|