选定班级的”确定” 按钮的clicked事件代码如下:
string name,msg,room1_name,room2_name,grade_num
int n,i,j,class_num,course_num,course_room1,course_week1,course_time1
int course_room2,course_week2,course_time2,week_start,week_end
if ddlb_class.text<>"" then
i=pos(ddlb_class.text,"(")
j=pos(ddlb_class.text,")")
name=left(ddlb_class.text,i -1) //获得班级名称
grade_num=mid(ddlb_class.text,i+2,j - i -4 ) //获得班级人数
n=ds_class.find("名称='"+name+"'",1,ds_class.rowcount())
//显示班级课程信息
class_num=ds_class.GetItemNumber(n,1)
dw_course.setfilter("课程分配_班级="+string(class_num)+"")
dw_course.filter()
//清除课程安排
sle_n1.text=""
sle_n2.text=""
ddlb_week1.selectitem(1)
ddlb_time1.selectitem(1)
ddlb_week2.selectitem(1)
ddlb_time2.selectitem(1)
//清除原班级课程表
for i=1 to dw_ctabletemp.rowcount()
for j=2 to 6
dw_ctabletemp.setitem(i,j,"")
next
next
ds_rooms.retrieve() //获得最新教室资源数据
//筛选容量适合班级人数的教室
ds_rooms.setfilter("")
ds_rooms.filter()
//筛选新班级的排课记录
ds_table.setfilter("班级="+string(class_num)+"")
ds_table.filter()
//显示班级课程表
for i=ds_table.rowcount() to 1 step -1
//获得课程排课记录数据
course_num=ds_table.getitemnumber(i,2) //获得课程编号
course_room1=ds_table.getitemnumber(i,4) //获得教室1编号
course_week1=ds_table.getitemnumber(i,5) //获得星期几上课
course_time1=ds_table.getitemnumber(i,6) //获得第几节上课
course_room2=ds_table.getitemnumber(i,7) //获得教室2编号
course_week2=ds_table.getitemnumber(i,8) //获得星期几上课
course_time2=ds_table.getitemnumber(i,9) //获得第几节上课
week_start=ds_table.getitemnumber(i,10) //获得起始周
week_end=ds_table.getitemnumber(i,11) //获得结束周
//获得课程名称
n=dw_course.find("课程分配_课程
="+string(course_num),1,dw_course.rowcount())
name=dw_course.getitemstring(n,2)
//获得教室名称
n=ds_rooms.find("教室资源_教室
="+string(course_room1),1,ds_rooms.rowcount())
//messagebox("",string(course_room1)+" "+string(n)+"
"+string(ds_rooms.rowcount()))
//return
room1_name=ds_rooms.getitemstring(n,1)
msg=name+"~r~n"+room1_name+","+string(week_start)+"-"+string(week_end)+"周"
//将排课记录数据显示在课程表中
dw_ctabletemp.setitem(course_time1,course_week1+1,msg)
if course_room2>0 then
//获得教室名称
n=ds_rooms.find("教室资源_教室
="+string(course_room2),1,ds_rooms.rowcount())
room2_name=ds_rooms.getitemstring(n,1)
msg=name+"~r~n"+room2_name+","+string(week_start)+"-"+string(week_end)+"周"
//将排课记录数据显示在课程表中
dw_ctabletemp.setitem(course_time2,course_week2+1,msg)
end if
next
n=1
if ds_table.rowcount()>0 then
//显示第一门课程的上课时间安排数据
sle_n1.text=string(week_start)
sle_n2.text=string(week_end)
ddlb_week1.selectitem(course_week1+1)
ddlb_time1.selectitem(course_time1+1)
ddlb_room1.selectitem(room1_name,0)
n=ddlb_room1.finditem(room1_name,0)
if course_room2 > 0 then
ddlb_week2.selectitem(course_week2+1)
ddlb_time2.selectitem(course_time2+1)
ddlb_room2.selectitem(room2_name,0)
n=ddlb_room2.finditem(room2_name,0)
end if
end if
//筛选容量适合班级人数的教室
ds_rooms.setfilter("教室信息_容量>="+grade_num)
ds_rooms.filter()
//建立教室名称列表
ddlb_room1.reset()
ddlb_room2.reset()
for i=1 to ds_rooms.rowcount()
name=ds_rooms.getitemstring(i,1)
ddlb_room1.additem(name)
ddlb_room2.additem(name)
next
ddlb_room1.selectitem(1)
ddlb_room2.selectitem(1)
ddlb_room2.event selectionchanged(1)
cb_save.enabled=true
else
dw_course.setfilter("课程分配_班级=-1")
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>