毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

vb+SQL排课系统论文报告+算法+源码+答辩PPT 第6页

更新时间:2010-7-10:  来源:毕业论文
vb+SQL排课系统论文报告+算法+源码+答辩PPT 第6页
  Call ExecuteSQL(SQL, msg)
                rst2.MoveNext
            Loop
            rst2.MoveFirst
            rst1.MoveNext
        Loop
        MsgBox ("已经生成了空课表!")
    End If
End Sub
Private Sub setCourseToM_courseTable(strCourse As String, dayindex1 As Integer, dayindex2 As Integer, flag As Boolean)
'将课程写入到M_courseTable课表矩阵
    Dim temp As Integer
    Dim randIndex As Integer
    M_colIndex = 0
    M_rowIndex = 0
    '1随机选择一日
    Randomize       '随机数种子
    randIndex = Int(Rnd() * (dayindex2 - dayindex1)) + dayindex1
    '2得到插入的位置
    Call GetPosition(randIndex, dayindex2, flag)        '在randIndex至dayindex2之间进行遍历
    If M_rowIndex = 0 Then                              '如果没有找到,就从dayindex1至randIndex之间进行遍历
         Call GetPosition(dayindex1, randIndex, flag)
    End If
    '3设置M_courseTable
    If M_rowIndex = 0 Then                           '如果安排不下,报告排课条件错误
        MsgBox ("排课条件设置有问题!" & strCourse & "无法排下!")
        M_Flag = False
    Else                                            '如果可以安排,设置M_courseTable的值
        If flag = True Then
            M_courseTable(M_rowIndex, M_colIndex) = strCourse
          本文来自辣文论文网原文请找QQ752018766 M_rowIndex, M_colIndex) = strCourse
        End If
        M_Flag = True
    End If
End Sub 毕业论文http://www.751com.cn
Private Sub GetPosition(startIndex As Integer, endIndex As Integer, flag As Boolean)
'得到课程能够插入的位置
    Dim temp As Integer
    Dim randSegment As Integer
    '1随机选择某一节号
    Randomize       '随机数种子
    randSegment = Int(Rnd() * (M_segmentNum - 1)) + 1
    '2遍历节,在startIndex至endIndex之间开始遍历
    For temp = startIndex To endIndex
        '在randSegment至M_segmentNum之间开始遍历
        For index = randSegment To M_segmentNum
            If flag = True Then           '如果需要累排,检查是否能够累排两节课
                If index + 1 <= M_segmentNum Then
                    If M_courseTable(index, temp) = "" And M_courseTable(index + 1, temp) = "" Then
                        M_rowIndex = index
                        M_colIndex = temp
                    End If
                End If
            Else                           '如果不需要累排,检查是否能够排一节课
                 If M_courseTable(index, temp) = "" Then
                    M_rowIndex = index
                    M_colIndex = temp
                End If
            End If
            If M_rowIndex > 0 And TestAvialable(M_rowIndex, M_colIndex, flag) Then Exit Sub    '如果找到了,就退出函数
        Next index
        '如果没有找到插入位置,在1到randSegment之内开始遍历
        For index = 1 To randSegment
            If flag = True Then           '如果需要累排,检查是否能够累排两节课
                If index + 1 <= M_segmentNum Then
                    If M_courseTable(index, temp) = "" And M_courseTable(index + 1, temp) = "" Then
                        M_rowIndex = index
                        M_colIndex = temp
                    End If
                End If
            Else                          '如果不需要累排,检查是否能够排一节课
                 If M_courseTable(index, temp) = "" Then
                    M_rowIndex = index
                    M_colIndex = temp
                End If
            End If
            If M_rowIndex > 0 And TestAvialable(M_rowIndex, M_colIndex, flag) Then Exit Sub     '如果找到了,就退出函数
        Next index
    Next temp
End Sub
Private Function TestAvialable(rowIndex As Integer, colIndex As Integer, flag As Boolean) As Boolean
'检测教师资源是否冲突
    Dim rst1 As ADODB.Recordset
    Dim rst2 As ADODB.Recordset
    Dim teacher As String
    Dim dayName As String
    Dim count As Integer
    dayName = GetDayName(colIndex)
    count = 1
    TestAvialable = True
    '1得到当前课程的任毕业论文http://www.751com.cn课教师
    SQL = "select 任课教师 from 班级课程信息表 where 班级名称='" & M_class & "' and 课程名称='" & M_course & "'"
    Set rst1 = SelectSQL(SQL, msg)
    teacher = rst1.Fields("任课教师")
    '2得到教师所有的授课班级
    SQL = "select 班级名称 from 班级课程信息表 where  任课教师='" & teacher & "'"
    Set rst1 = SelectSQL(SQL, msg)
    '3遍历每一个班的课表,看看教师的授课时间是否冲突
    Do While Not rst1.EOF
        SQL = "SELECT 节号,星期一,星期二,星期三,星期四,星期五,星期辣,星期

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

vb+SQL排课系统论文报告+算法+源码+答辩PPT 第6页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。