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 适用场景: ...
随机推荐
- 怎么在Microsoft Project中冻结列
在用Project排项目计划的时候如果在Gantt图中列比较多,左右滚动的时候就会经想像如果能想Excel一样冻结某些列就方便多了,其实在Project中虽然没有冻结列的功能,但通过一些变通方法还是可 ...
- jquery submit() 提交失败
今天写一个表单提交 居然走到$('#wechat_form').submit() 这,但怎么都没有提交这个表单 google 了一下 Additional Notes:Forms and their ...
- python基础-牛逼的三层循环,实现想在那里退出,就在那里退出。
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author: nulige tag=True #设置tag控制他,只要一输入Flash就退出整个循环 wh ...
- Python学习之day2
1.执行Python脚本时打印的字符有颜色 print "\033[32;1mhello\033[0m" #打印绿色 print "\033[31;1mhello\033 ...
- OC中的@property详解
简介: @property 生成了变量的get set 方法,同时指定了变量名称. 例如@property (nonatomic,strong) NSString *name;表示生成了_name私有 ...
- hdu3415 单调队列
Max Sum of Max-K-sub-sequence Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- linux系统下sendmail的搭建
学习鸟哥linux私房菜所得 sendmail 可以使用rpm -qa |grep sendmail来查看一下是否已安装sendmail-cf和sendmail 如果没有安装可用yum -y inst ...
- lua学习例子
extern "C"{ #include <lua.h> #include <lauxlib.h> #include <lualib.h> } ...
- 20145212&20145204信息安全系统实验五
一.实验步骤 1.阅读理解源码 进入/arm2410cl/exp/basic/07_httpd目录,使用 vim编辑器或其他编辑器阅读理解源代码. 2.编译应用程序 运行 make 产生可执行文件 h ...
- thinkphp分页
thinkphp默认分页 html代码 <div class="f_r"> {$page} </div> 一:最简单的分页 $m = M('stock_lo ...