6. Decision (Are the days over three days?) : According to the input value to judge if the days are over three days.

VB .NET:

  1.         Public Class GreaterThan3Days
  2.             Implements IRule
  3.             Public Function Execute(ByVal variable As System.Collections.Generic.Dictionary(Of String, Object)) As String Implements HSDc.RingleFlow.Api.Rule.IRule.Execute
  4.                 Dim result As String = "非大於3天"
  5.                 Dim xmlData As String = Nothing
  6.                 If (Not variable.TryGetValue("formData", xmlData)) Then
  7.                     result = "非大於3天"
  8.                 Else
  9.                     result = CheckFormData(xmlData)
  10.                End If
  11.                Return result
  12.            End Function
  13.            Private Function CheckFormData(ByVal xmlStr As String) As String
  14.                Dim ds As New DataSet()
  15.                Dim reader As TextReader = New StringReader(xmlStr)
  16.                Dim resultStr As String = "非大於3天"
  17.                ds.ReadXml(reader)
  18.                Dim leaveDays As Integer = Integer.Parse(ds.Tables("LeaveInfo")(0)("LeaveDay").ToString())
  19.                If (leaveDays > 3) Then
  20.                    resultStr = "大於3天"
  21.                End If
  22.                reader.Close()
  23.                Return resultStr
  24.            End Function
  25. End Class

 

Last edited Jun 25, 2012 at 10:23 AM by cathysung, version 2

Comments

No comments yet.