The SQL BETWEEN operator we can use in C# code. Before your query you have to use
System.Globalization.CultureInfo culInfo = new System.Globalization.CultureInfo("en-US");
Consider the Example:
Enjoy....
System.Globalization.CultureInfo culInfo = new System.Globalization.CultureInfo("en-US");
Consider the Example:
internal List<ECalendarSetup> GetCalenderInfoOnSelectedDate(ECalendarSetup calendarSetup)
{
ieclHrmDataContext = new IECL_HRMDataContext();
List<ECalendarSetup> calendarSetupsList = new List<ECalendarSetup>();
var query = from j in ieclHrmDataContext.HR_CALENDAR_INFOs
where j.CAL_DAY_DATE >= calendarSetup.FromDate && j.CAL_DAY_DATE <= calendarSetup.ToDate
select j;
foreach (var calendarInfo in query)
{
ECalendarSetup eCalendarSetup = new ECalendarSetup();
eCalendarSetup.Date = (DateTime) calendarInfo.CAL_DAY_DATE;
eCalendarSetup.DayStatus = calendarInfo.CAL_DAY_STATUS;
eCalendarSetup.StartTime = calendarInfo.CAL_START_TIME.ToString();
eCalendarSetup.EndTime = calendarInfo.CAL_END_TIME.ToString();
eCalendarSetup.Remarks = calendarInfo.CAL_REMARKS;
calendarSetupsList.Add(eCalendarSetup);
}
return calendarSetupsList;
}
Enjoy....
Comments
Post a Comment