以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  各位高手,从字符串“天数”到类型“Double”的转换无效?请教请教  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=161833)

--  作者:xhydxs
--  发布时间:2021/3/31 10:34:00
--  各位高手,从字符串“天数”到类型“Double”的转换无效?请教请教


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20210331103023.png
图片点击可在新窗口打开查看

 

 

这是代码

 

Select Case e.DataCol.Name
    Case "开始时间" , "结束时间"
        If e.DataRow.IsNull("开始时间") And  e.DataRow.IsNull("结束时间") Then
            e.DataRow("天数") = Nothing
        Else
            Dim d1 As Date = e.DataRow("开始时间")
            Dim d2 As Date = e.DataRow("结束时间")
            If d1 > d2
                e.DataRow("天数") = 0
            Else
                Dim cnt As Integer = (d2 - d1).TotalDays
                For i As Integer = 1 To cnt
                    Dim d3 As Date = d1.adddays(i)
                    If d3.DayOfWeek = 0 OrElse d3.DayOfWeek = 6 Then \'如果是星期天或者星期六
                        cnt = cnt - 1
                    End If
                Next
                e.DataRow("天数") = cnt + 1
            End If
        End If
    Case "是否半天"
        If e.NewValue = True Then
            Dim d1 As Date = e.DataRow("开始时间")
            Dim d2 As Date = e.DataRow("结束时间")
            If d1 > d2
                e.DataRow("天数") = 0
            Else
                Dim cnt As Integer = (d2 - d1).TotalDays
                For i As Integer = 1 To cnt
                    Dim d3 As Date = d1.adddays(i)
                    If d3.DayOfWeek = 0 OrElse d3.DayOfWeek = 6 Then \'如果是星期天或者星期六
                        cnt = cnt - 1
                    End If
                Next
                e.DataRow("天数") = cnt + 1 - 0.5
            End If
        End If
End Select

Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "正课","自习","天数"
        If e.DataRow ("请假类型") = "事假" Then
            dr("扣费") = dr("正课")*40*("天数") + dr("自习")*40*("天数")
            dr("扣分") = dr("天数")*0.5
        ElseIf e.DataRow ("请假类型") = "病假" Then
            dr("扣费") = dr("正课")*20*("天数") + dr("自习")*20*("天数")
            dr("扣分") = dr("天数")*0.2
        ElseIf e.DataRow ("请假类型") = "旷课" Then
            dr("扣费") = dr("正课")*160 + dr("自习")*160
        ElseIf e.DataRow ("请假类型") = "例会" Then
            dr("扣费") = dr("天数")*40
            dr("扣分") = dr("天数")*0.1
        ElseIf e.DataRow ("请假类型") = "迟到" Then
            dr("扣费") = dr("天数")*20
        ElseIf e.DataRow ("请假类型") =  "早退" Then
            dr("扣费") = dr("天数")*20
           
        Else
            e.DataRow("扣费") = 0
            e.DataRow("扣分") = 0
        End If
End Select


If e.DataCol.Name = "销假情况" Then \'如果是已结帐列的内容变动
    If e.NewValue = True Then \'而且变动后的值是True(已勾选)
        e.DataRow.Locked = True \'那么锁定此行
    End If
End If


 


--  作者:有点蓝
--  发布时间:2021/3/31 10:57:00
--  
dr("扣费") = dr("正课")*40*dr("天数") + dr("自习")*40*dr("天数")
--  作者:xhydxs
--  发布时间:2021/3/31 13:29:00
--  
图片点击可在新窗口打开查看谢谢