> EnumerableRowCollection<DataRow> query; > if (checkType && checkCategory) > query = from c in dtMax4SaleLimits.AsEnumerable() > where ((2 == c.Field<Byte>("type") && lsn_cat == c.Field<String>("lsn_cat")) > || (3 == c.Field<Byte>("type") && lessontype == c.Field<Int32>("lessontype"))) > && (c.Field<DateTime?>("start_time") < ending_time && > c.Field<DateTime?>("end_time") > begin_time) > select c; > else > { > if (checkCategory) > query = from c in dtMax4SaleLimits.AsEnumerable() > where (2 == c.Field<Byte>("type") && lsn_cat == c.Field<String>("lsn_cat")) > && (c.Field<DateTime?>("start_time") < ending_time && > c.Field<DateTime?>("end_time") > begin_time) > select c; > else > query = from c in dtMax4SaleLimits.AsEnumerable() > where (3 == c.Field<Byte>("type") && lessontype == c.Field<Int32>("lessontype")) > && (c.Field<DateTime?>("start_time") < ending_time && > c.Field<DateTime?>("end_time") > begin_time) > select c; > } > > Int32 recordsCount = query.Count(); > if (0 == recordsCount)>