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 适用场景: ...
随机推荐
- 51nod 1005 大数加法
#include<iostream> #include<string> using namespace std; #define MAXN 10001 },b[MAXN]={} ...
- [转]Struts2理解--动态方法和method属性及通配符_默认Action
众所周知,默认条件下,在浏览器输入indexAction!execute.action,便会执行indexAction类里的execute方法,这样虽然方便,但可能带来安全隐患,通过url可以执行Ac ...
- Android 手机怎么录屏制成gif图片
参考:http://www.cnblogs.com/dasusu/p/4903511.html 上面的博主说的很详细了,但作为学习记录我就重新写一遍帮助自己加深记忆 一.准备条件 1.你搭建了Andr ...
- java学习指南
@Override public BaseResponse selectListPage(PageData page, Object obj) { BaseResponse response = ne ...
- java-collections.sort异常Comparison method violates its general contract!
转载:http://www.tuicool.com/articles/MZreyuv 异常信息 java.lang.IllegalArgumentException: Comparison metho ...
- nginx 报错 HTTP ERROR 500 (PHP数组简写模式)
同样的代码放在Apache上执行可以执行,在nginx上面就报错了. 百度出来一堆结果貌似都不对,然后只有注释代码->运行程序,一步步找到问题所在 $buffer = []; 这一步报错了 原来 ...
- 跳转到某个Activity
跳转 Activity之间的跳转 可以依靠Intent 简单粗暴的办法是 Intent intent= new Intent(*.this, MainActivity.class); startAct ...
- [转]eclipse快捷键
Ctrl+1 快速修复Ctrl+D: 删除当前行 Ctrl+Alt+↓ 复制当前行到下一行(复制增加)Ctrl+Alt+↑ 复制当前行到上一行(复制增加)Alt+↓ 当前行和下面一行交互位置(特别实用 ...
- Jedis测试redis
首先:Jedis是redis的java版本的客户端. public class JedisTest { //单机版测试Jedis,不使用连接池 @Test public void testJedis( ...
- curl实现发送Get和Post请求(PHP)
1.CURL介绍 CURL 是一个利用URL语法规定来传输文件和数据的工具,支持很多协议,如HTTP.FTP.TELNET等.最爽的是,PHP也支持 CURL 库.本文将介绍 CURL 的一些高级特性 ...