linq 的switch实现
List<RemindSend> lrs = (from a in db.Remind
join b in db.Certified
on a.certifiedId equals b.CertifiedId
where a.status == 1 && a.addTime.Year == DateTime.Now.Year && a.addTime.Month == DateTime.Now.Month && a.addTime.Day == DateTime.Now.Day
select new RemindSend
{
cerfiedid = b.CertifiedId,
queueCode = b.QueueCode,
queueNum = b.QueueNum,
openid = a.openid,
remindPerson = b.QueueCode.Substring(0, 1) == "F" ?
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueNum < b.QueueNum && c.QueueCode.StartsWith(b.QueueCode.Substring(0, 1))).Count()
: b.QueueCode.Substring(0, 1) == "B" ?
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueCode.StartsWith("F")).Count() +
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueNum < b.QueueNum && c.QueueCode.StartsWith(b.QueueCode.Substring(0, 1))).Count()
: b.QueueCode.Substring(0, 1) == "A" ?
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueCode.StartsWith("F")).Count() +
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueCode.StartsWith("B")).Count() +
db.Certified.Where(c => c.Status == 1 && c.GetTime.Year == DateTime.Now.Year && c.GetTime.Month == DateTime.Now.Month && c.GetTime.Day == DateTime.Now.Day && c.QueueNum < b.QueueNum && c.QueueCode.StartsWith(b.QueueCode.Substring(0, 1))).Count()
: 1,
remindid = a.remindid
}).ToList();
linq 的switch实现的更多相关文章
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(17)-LinQ动态排序
系列目录 首先修复程序中的一个BUG这个BUG在GridPager类中,把sord修改为sort这个名称填写错误,会导致后台一直无法获取datagrid的排序字段 本来是没有这一讲的,为了使20行的代 ...
- LinqToDB 源码分析——轻谈Linq查询
LinqToDB框架最大的优势应该是实现了对Linq的支持.如果少了这一个功能相信他在使用上的快感会少了一个层次.本来笔者想要直接讲解LinqToDB框架是如何实现对Linq的支持.写到一半的时候却发 ...
- 年终巨献 史上最全 ——LINQ to SQL语句
LINQ to SQL语句(1)之Where 适用场景:实现过滤,查询等功能. 说明:与SQL命令中的Where作用相似,都是起到范围限定也就是过滤作用的,而判断条件就是它后面所接的子句.Where操 ...
- C# ORM中Dto Linq Expression 和 数据库Model Linq Expression之间的转换
今天在百度知道中看到一个问题,研究了一会便回答了: http://zhidao.baidu.com/question/920461189016484459.html 如何使dto linq 表达式转换 ...
- .NET面试题系列[14] - LINQ to SQL与IQueryable
.NET面试题系列目录 名言警句 "理解IQueryable的最简单方式就是,把它看作一个查询,在执行的时候,将会生成结果序列." - Jon Skeet LINQ to Obje ...
- c# Linq查询
c#提供的ling查询极大的遍历了集合的查询过程,且使用简单方便,非常的有用. 下面将分别用简单的例子说明:ling基本查询.延迟查询属性.类型筛选.复合from字句.多级排序.分组查询.联合查询.合 ...
- 《C#本质论》读书笔记(15)使用查询表达式的LINQ
15.1 查询表达式的概念 简单的查询表达式 private static void ShowContextualKeywords1() { IEnumerable<string> sel ...
- MVC NPOI Linq导出Excel通用类
之前写了一个模型导出Excel通用类,但是在实际应用中,可能不是直接导出模型,而是通过Linq查询后获取到最终结果再导出 通用类: public enum DataTypeEnum { Int = , ...
- LINQ TO SQL 大全
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精 LINQ to SQL语句(1)之Where 适用场景: ...
随机推荐
- 【JavaScript】【CSS】前端规则摘抄
源:http://zhibimo.com
- 【好玩的前端知识】 Kube
Kube javascript tools
- 修改httpd默认端口号
Tomcat: vim /etc/httpd/conf/httpd.conf//别忘了service httpd restart Nginx: vim /etc/nginx/nginx.conf//完 ...
- memcached
Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度.Memcached ...
- redis-windows执行redis-cli查询
1.无密码时的访问 redis-cli -h redis > redis > keys *1) "myset"2) "mysortset" redi ...
- Linux系统下的程序开发之:命名规范
2016年12月13日16:19:53 ------------------------------- 不能使用类似驼峰法的命名文件:dingdanOrder.html 这样的命名,会让系统无法找到目 ...
- Javascript实现前端简单路由
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http ...
- infragistics-webdatagrid
infragistics-webdatagrid DataRow DataTable DataSet DataColumn stringBuilder append appendFormat 存储过程 ...
- 用C语言,如何判断主机是 大端还是小端(字节序)
所谓大端就是指高位值在内存中放低位地址,所谓小端是指低位值在内存中放低位地址.比如 0x12345678 在大端机上是 12345678,在小端机上是 78564312,而一个主机是大端还是小端要看C ...
- Go - 字典(map)
字典是一种内置的数据结构,用来保存 键值对 的 无序集合. (1)字典的创建 1) make(map[KeyType] ValueType, initialCapacity) 2) make(map[ ...