物资管理信息系统5
//import win.ui;/*DSG{{*/var frmUserDel = ..win.form(text="删除用户";right=376;bottom=320;parent=...) frmUserDel.add( button={cls="button";text="确定";left=229;top=148;right=319;bottom=179;z=4}; button2={cls="button";text="取消";left=229;top=240;right=319;bottom=271;z=5}; listview={cls="listview";left=19;top=56;right=180;bottom=271;bgcolor=16777215;edge=1;z=6}; password={cls="edit";left=198;top=56;right=341;bottom=88;edge=1;password=1;z=3};static={cls="static";text="系统现有用户";left=17;top=20;right=164;bottom=44;transparent=1;z=1}; static2={cls="static";text="请输入所选用户的密码";left=191;top=20;right=355;bottom=47;transparent=1;z=2} )/*}}*/var db = frmUserDel.parent.db frmUserDel.listview.insertColumn("用户编号",70) frmUserDel.listview.insertColumn("用户名",100)for id,name in db.each("SELECT id,用户名 from [use] ORDER BY id"){ frmUserDel.listview.addItem({id;name}) } frmUserDel.button.oncommand = function(id,event){//确定var id = frmUserDel.listview.getItemText(frmUserDel.listview.selIndex,1)var pass = frmUserDel.password.textvar rs = db.stepQuery("SELECT 密码 FROM [use]",{id = id}) rs ?= rs.密码if(rs!=pass){ frmUserDel.msgbox("密码不符请重输") frmUserDel.password.text = ""frmUserDel.password.setFocus(0); } elseif(frmUserDel.listview.count=1){ frmUserDel.msgbox("删除无效,系统必须有一个!") frmUserDel.close() }else{ db.exec("DELETE FROM [use] where id=@id",{id = id}) frmUserDel.msgbox("删除成功") frmUserDel.listview.delItem(frmUserDel.listview.selIndex) } } frmUserDel.button2.oncommand = function(id,event){ frmUserDel.close() } frmUserDel.listview.onnotify = function(id,code,ptr){ select(code) {case 0xFFFFFFFE/*_NM_CLICK*/{//鼠标点击用户编号密码框置焦点if(frmUserDel.listview.selIndex){ frmUserDel.password.text = ""frmUserDel.password.setFocus() } } } } frmUserDel.show() win.loopMessage();return frmUserDel;
赞 (0)