Select Case e.DataCol.Name
Case "开始日期","天数"
Dim dr As DataRow
dr = e.DataRow
If dr.IsNull("开始日期") OrElse dr.IsNull("天数") Then
dr("结束日期") = Nothing
Else
Dim c As Integer = 0
Dim d As Date
Dim i As Integer = 1
Dim drs = DataTables("法定假期").Select("")
Dim lst1 As new List(of Date)
Dim lst2 As new List(of Date)
For Each cdr As DataRow In drs
If cdr("名称") = "上班" Then
For m As Integer = 1 To cdr("天数")
lst2.Add(cdr("开始日期").AddDays(m-1))
Next
Else
For m As Integer = 1 To cdr("天数")
lst1.Add(cdr("开始日期").AddDays(m-1))
Next
End If
Next
Dim tshu As Integer = dr("天数")
d = dr("开始日期")
Do While i < tshu
d = d.AddDays(1)
If d.DayOfWeek = 0 OrElse d.DayOfWeek = 6 Then
If lst2.Contains(d) Then
i = i + 1
End If
Else
If lst1.Contains(d) = False Then
i = i + 1
End If
End If
Loop
dr("结束日期") = d
End If
End Select