Hi
I Currently working on a project to schedule installers to do installations.
When scheduling the user will select the day of intall and if the number of days the instalation will take or motning or afternoon if its only hafday and I want the application to search which installer is available for that specific day or halfday
I currently have it working with full day install. I need help on how to find if an nstaller is available for a half day (morning or afternoon).
This is how i'm searching for full day.
Thanks
Private Sub Available_instalers()
Dim Available_instalers = New DataTable
Dim installer_nme As String
Dim available As Boolean = True
Dim dte_current As Date = CDate(val_from.Date.ToString("MMM/dd/yy"))
Dim dte_inst_From, dte_inst_To As Date
Dim st_inst_from, st_inst_to As String
Dim dr As DataRow
Try
With Available_instalers
.Columns.Add("Installer", GetType(System.String))
End With
dv_installer_Schedule = New DataView(dt_installer_Schedule)
'This loops through every installer and checks who is avalable for the selected day
For Each inRow In ds_Installer.Tables("Installer").Rows
dte_current = CDate(val_from.Date.ToString("MMM/dd/yy"))
available = True
installer_nme = inRow("ins_Name").ToString
If UCase(installer_nme) = "LUIS" Or UCase(installer_nme) = "STEPHAN" Then
dv_installer_Schedule.RowFilter = "(Installer ='" & installer_nme & "' OR Installer='L&S') AND insFrom >'" & Today() & "'"
Else
dv_installer_Schedule.RowFilter = "Installer='" & installer_nme & "' AND insFrom >'" & Today() & "'"
End If
dv_installer_Schedule.Sort = "insFrom asc"
'This loops each day to find if the installer is available
Do While dte_current <= Val_to
For Each schInstall In dv_installer_Schedule.ToTable.Rows
st_inst_from = schInstall("insFrom").ToString
st_inst_to = schInstall("insto").ToString
dte_inst_From = CDate(st_inst_from)
dte_inst_To = CDate(st_inst_to)
If dte_current >= dte_inst_From And dte_current <= dte_inst_To Then
available = False
Exit Do
End If
Next
dte_current = dte_current.AddDays(1)
Loop
If available Then
dr = Available_instalers.NewRow
dr("Installer") = installer_nme
Available_instalers.Rows.Add(dr)
End If
Next
Catch ex As Exception
MsgBox(Me.Text & " Available_instalers " & ex.Message, MsgBoxStyle.Critical)
End Try
dgv_Installer.DataSource = Available_instalers
End Sub