Click here to Skip to main content
15,916,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
List<FertilVacancyItem> lstData = null;
          try
          {

              using (ContextSwitch cSwitch = new ContextSwitch())
              {
                  m_dataContext = cSwitch.GetFertilVacancyDataContext(m_webUrl);

                //  lstData = m_dataContext.FertilVacancy.Where(x => (x.CloseDate >= DateTime.Today) || (DBNull.Value.Equals(x.CloseDate) )).Where(x => (x.OpenDate <= DateTime.Today)).OrderByDescending(x => x.Id).ToList();
                  //if(m_dataContext.FertilVacancy.Where(x=> (DBNull.e x.CloseDate)
                  lstData = m_dataContext.FertilVacancy.Where(x => (x.OpenDate <= DateTime.Today)).OrderByDescending(x => x.Id).ToList();
               //   lstData = m_dataContext.FertilVacancy.OrderByDescending(x => x.Id).ToList();



              }
          }
          catch (Exception ex)
          {
              Logger.Instance.Error("VacancyManager_getFertilVacancyData", ex);
          }
          return lstData;
}

I am new bee in share point.
I need to check the close date is null.
if it is null i don't want to included the close date in where clause.
else if it is not null then close date must include in where clause.
Posted
Updated 11-Oct-11 20:23pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900