HOw to convert this logic to C # below from visual basic 6. I am not for you how you suppose to do the logic below
// If ServiceTimeStart >= #12:00:00 AM# And ServiceTimeStart < #12:00:00 PM# Then
// ServiceTime = "M"
//ElseIf ServiceTimeStart >= #12:00:00 PM# And ServiceTimeStart < #6:00:00 PM# Then
// ServiceTime = "A"
//ElseIf ServiceTimeStart > #6:00:00 PM# And ServiceTimeStart < #12:00:00 AM# Then
// ServiceTime = "E"
//ElseIf IsNull(ServiceTimeStart) Then
// ServiceTime = "D"
End If
Loading
Vishnujeet KumarPosted Dec 4, 2012, 4:19 AM
if (ServiceTimeStart >= 01/01/0001 00:00:00 & ServiceTimeStart < 01/01/0001 12:00:00)
Vishnujeet KumarPosted Dec 4, 2012, 10:09 PM
Darnell ,
Please mark this answer as accepted answer if it resolves your problem.
that will be help other people,if he have same issue .
Vishnujeet KumarPosted Dec 4, 2012, 10:18 AM
very good, Darnell i think you got a solution.
let me know if any problem related to this.
useful link.
http://msdn.microsoft.com/en-us/library/3eaydw6e(v=vs.80).aspxDavid SmithPosted Dec 4, 2012, 9:57 AM
public static DateTime morningMax = new DateTime(0001, 1, 1, 00, 00, 00);
public static DateTime morningMin = new DateTime(0001, 1, 1, 12, 00, 00);
public static DateTime afternoonMin = new DateTime(0001, 1, 1, 12, 00, 00);
public static DateTime afternoonMax = new DateTime(0001, 1, 1, 18, 00, 00);
public static DateTime eveningMin = new DateTime(0001, 1, 1, 12, 00, 00);
public static DateTime eveningMax = new DateTime(0001, 1, 1, 12, 00, 00);
if (ultraDateTimeEditorStartDate.Value != null && Convert.ToDateTime(ultraDateTimeEditorStartDate.Value) >= DateTime.Now)
{
DateTime startDate = Convert.ToDateTime(ultraDateTimeEditorStartDate.Value);
DateTime serviceTimeStart = startDate;
if (serviceTimeStart >= DataAccess.morningMin && serviceTimeStart < DataAccess.morningMax)
{
//ServiceTime = "M";
}
else if (serviceTimeStart >= DataAccess.afternoonMin & serviceTimeStart < DataAccess.afternoonMax)
{
// ServiceTime = "A";
}
else if (serviceTimeStart > DataAccess.eveningMin & serviceTimeStart < DataAccess.eveningMax)
{
//ServiceTime = "E";
}
else if (serviceTimeStart == null || serviceTimeStart == default(DateTime))
{
//ServiceTime = "D";
}
}
David SmithPosted Dec 4, 2012, 9:40 AM
I just want to be clear.