arunmali
12-05-2007, 05:42 AM
Does any one know abt Shift Scheduling in VB.NET.
I want to schedule 3 shifts like A, B, C within 24 Hrs.
Possibility of shift...
-- Anyone (A) shift should be 24 hrs.
-- A + B shift should be 24 hrs.
-- A + B + C shift should be 24 hrs.
Suppose IF I take a time for 7.00 AM to next day 7.00 AM how to manage this.......
arunmali
12-06-2007, 05:24 AM
Private Function CurrentShift(ByVal dtFrom As DateTime, ByVal dtTo As DateTime, ByVal CurrentShiftName As String) As Boolean
Dim dtCurrent As DateTime
dtCurrent = Format(Date.Now, "hh:mm:ss tt")
Dim dtNewFrom, dtNewTo, dtForFrom, dtForTo As Date
If dtFrom >= dtTo Then
dtForFrom = Format(dtFrom, "hh:mm:ss tt")
dtForTo = Format(dtTo, "hh:mm:ss tt")
dtNewFrom = Date.Today & " " & dtForFrom
dtNewTo = Date.Today & " " & dtForTo
Dim iDateDiff As Integer = DateDiff(DateInterval.Hour, dtFrom, dtTo)
If iDateDiff > 12 Then
dtNewTo = DateAdd(DateInterval.Day, 1, dtNewTo)
Else
dtNewTo = DateAdd(DateInterval.Day, 1, dtNewTo)
dtCurrent = DateAdd(DateInterval.Day, 1, dtCurrent)
End If
Else
dtForFrom = Format(dtFrom, "hh:mm:ss tt")
dtForTo = Format(dtTo, "hh:mm:ss tt")
dtNewFrom = Date.Today & " " & dtForFrom
dtNewTo = Date.Today & " " & dtForTo
End If
If dtCurrent >= dtNewFrom And dtCurrent <= dtNewTo Then
g_cCurrentShift = CurrentShiftName
Return True
End If
End Function
arunmali
01-25-2008, 07:32 AM
axxbvcmn bfhgkjd000 emndgf