public BsTableDataSource <SumReadModel> GetSumReadUI(RouteSearcReadModel request) { using (var db = DbFactory.Open()) { List <SumReadModel> list = new List <SumReadModel>(); if (request.IsRead) { list = db.SqlList <SumReadModel>("select a.ReceiveUserName,a.ReceiveUserPhone,a.Position,a.ReceiveDateTime,a.Id as MessageId,c.grade from AppSendMessage a inner join AppMobileLogin b on b.userName=a.ReceiveUserPhone left join ADCDInfo c on c.adcd = a.ReciveAdcd where AppWarnInfoID = '" + request.WarnInfoId + "' and ReceiveUserName != SendMessageByUserName and a.IsReaded = 1 and a.Position!='驻村干部'"); } else { list = db.SqlList <SumReadModel>("select a.ReceiveUserName,a.ReceiveUserPhone,a.Position,a.ReceiveDateTime,a.Id as MessageId,c.grade from AppSendMessage a inner join AppMobileLogin b on b.userName=a.ReceiveUserPhone left join ADCDInfo c on c.adcd = a.ReciveAdcd where AppWarnInfoID = '" + request.WarnInfoId + "' and ReceiveUserName != SendMessageByUserName and a.IsReaded = 0 and a.Position!='驻村干部'"); } var pageList = list.Skip(request.PageSize * (request.PageIndex - 1)) .Take(request.PageSize).OrderByDescending(x => x.ReceiveDateTime).ToList(); return(new BsTableDataSource <SumReadModel> { total = list.Count(), rows = pageList }); } }
public BsTableDataSource <SumReadModel> Get(RouteSearcReadModel request) { return(sumMessage.GetSumReadUI(request)); }