T
Tamer Ibrahim
Hi,
foreach is not able to iterate through the collection because there is no
public GetEnumerator method
the foreach is not working in this code snippet, How can I resolve this ?
bool ValidatingReservation()
{
ValidReservation.Fill(dtValidReservation, DropDownListFileID.SelectedValue);
int i = 0; bool boolResult = false;
DateTime r1start = Convert.ToDateTime(BasicDatePickerFromDate.SelectedDate),
r2start = Convert.ToDateTime(dtValidReservation.Rows["StartDdate"]),
r1end = Convert.ToDateTime(BasicDatePickerToDate.SelectedDate),
r2end = Convert.ToDateTime(dtValidReservation.Rows["EndDdate"]) ;
if (dtValidReservation.Rows.Count == 0) return true;
else foreach( int i in dtValidReservation.Rows)
{
boolResult = (r1start == r2start) || (r1start > r2start ? r1start <= r2end :
r2start <= r1end);
if(boolResult) break;
}
return boolResult;
}
foreach is not able to iterate through the collection because there is no
public GetEnumerator method
the foreach is not working in this code snippet, How can I resolve this ?
bool ValidatingReservation()
{
ValidReservation.Fill(dtValidReservation, DropDownListFileID.SelectedValue);
int i = 0; bool boolResult = false;
DateTime r1start = Convert.ToDateTime(BasicDatePickerFromDate.SelectedDate),
r2start = Convert.ToDateTime(dtValidReservation.Rows["StartDdate"]),
r1end = Convert.ToDateTime(BasicDatePickerToDate.SelectedDate),
r2end = Convert.ToDateTime(dtValidReservation.Rows["EndDdate"]) ;
if (dtValidReservation.Rows.Count == 0) return true;
else foreach( int i in dtValidReservation.Rows)
{
boolResult = (r1start == r2start) || (r1start > r2start ? r1start <= r2end :
r2start <= r1end);
if(boolResult) break;
}
return boolResult;
}