9 附录:主要程序代码
(1)Profile程序
// Profile renshi
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=renshi;UID=;PWD='"
connect;
open(w_welcome)
sleep(1)
if sqlca.sqlcode<>0 then
messagebox("错误","数据库连接错误,经检查后重试!",stopsign!)
close(w_welcome)
return
end if
close(w_welcome)
openwithparm(w_11,"First")
(2)全局变量
String gs_operator_id
String gs_operator_name
String gs_password
String gs_permission
String gs_loginparm
string ls_text
(3)登陆窗口sle_1代码
String ls_1
ls_1=sle_1.text
select"h_operator"."operator_name"
into :gs_operator_name
from "h_operator"
where "h_operator"."operator_id"=:ls_1;
if sqlca.sqlcode<>0 then
sle_3.text="没找到!"
sle_1.text=""
sle_2.text=""
return
end if
sle_3.text=gs_operator_name
(4)登陆窗口cb_ok代码
string password,operatorid
operatorid=trim(sle_1.text)
password=trim(sle_2.text)
select operator_id,operator_name into :gs_operator_id,:gs_operator_name from h_operator
where operator_id =:operatorid and password =: password and permission=:ls_text using sqlca;
if sqlca.sqlcode=0 then
messagebox("登陆成功","欢迎登陆企业人事管理系统")
if ls_text="管理" then
open(w_main1)
else
open(w_main)
m_main.m_peixun.m_peixun_input.enabled=false
m_main.m_yuangong.m_yuangong_input.enabled=false
m_main.m_yuangong.m_kaohe.enabled=false
m_main.m_bumen.m_bumen_input.enabled=false
m_main.m_system.m_system_operator.enabled=false
m_main.m_biandong.m_biandong_xinjin.enabled=false
m_main.m_biandong.m_biandong_lizhi.enabled=false
end if
close(parent)
else
messagebox("警告","密码错误",exclamation!)
sle_1.setfocus()
sle_1.text=''
sle_2.text=''
end if
(5)信息添加cb_add代码(其他信息添加菜单中的代码类似,在此就不再赘述了)
long ll_currentrow
ll_currentrow=dw_bumen.insertrow(0)
dw_bumen.scrolltorow(ll_currentrow)
dw_bumen.setrow(ll_currentrow)
dw_bumen.setfocus()
(6)信息删除 cb_delete代码(其他信息删除的代码类似,在此就不再赘述了)
int li_select
li_select=messagebox("提示","确实要删除吗",exclamation!,yesno!)
if li_select=1 then
dw_bumen.deleterow(0)
end if
(7)信息保存cb_save代码(其他信息保存的代码类似,在此就不再赘述了)
dw_bumen.update()
if sqlca.sqlcode<>0 then
rollback;
messagebox("错误","存储错误")
return
else
commit;
end if
(8)退出cb_exit代码(其他退出按钮的代码类似,在此就不再赘述了)
if dwo.name="b_exit"then
close(parent)
end if
(9)查询cb_retrieve(其他查询按钮的代码类似,在此就不再赘述了)
long ll_rows
string ls_bno,ls_bname
if trim(sle_bno.text)="" and trim(sle_bname.text)="" then
messagebox("提示","请输入员工号!")
sle_bno.setfocus()
return
end if
ls_bno=trim(sle_bno.text)
if len(ls_bno)>0 then
dw_bumen_query.setfilter("bno='"+ls_bno+"'")
dw_bumen_query.filter()
ll_rows=dw_bumen_query.retrieve()
if ll_rows=0 then
messagebox("提示","无记录!")
return
end if
sle_bname.text=dw_bumen_query.object.bname[1]
&