/// <summary> /// 获取工作报告列表 /// </summary> /// <param name="ntype"></param> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="totalCount"></param> /// <returns></returns> public List<Work_Note> GetDailyList(KSOAEnum.NoteType ntype, int PageSize, int PageIndex, out int totalCount) { string strtype = ntype.ToString(); var query = _db.Work_Note.Where(s => s.IsDelete == false && s.WType == strtype).Select(s => new Work_Note { ID = s.ID, WType = s.WType, WriterID = s.WriterID, WriterName = s.WriterName, WTitle = s.WTitle, WConetent = s.WConetent, WTaster = s.WTaster, IsRead = s.IsRead, AddTime = s.AddTime, IsDelete = s.IsDelete }).OrderBy(s => s.AddTime); totalCount = query.Count(); var list = new List<Work_Note>(); if (PageIndex < 0 || PageSize < 0) { return null; } if (PageIndex == 1 && PageSize > totalCount) { list = query.ToList(); } else if (PageIndex == 1 && PageSize > 0) { list = query.Take(PageSize).ToList(); } else { list = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); } return list; }
/// <summary> /// 选取作品 /// </summary> /// <param name="ntype"></param> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="totalCount"></param> /// <returns></returns> public List<Bank_CommercialOpus> GetCommercialOpusList(string keyword, KSOAEnum.OpusType ntype, int PageSize, int PageIndex, out int totalCount) { string strtype = ntype.ToString(); var query = _db.Bank_CommercialOpus.Where(s => s.IsDelete == false).Select(s => new Bank_CommercialOpus { ID = s.ID, CompanyName = s.CompanyName, ChannelAddress = s.ChannelAddress, CpAddress = s.CpAddress, OpusID = s.OpusID, AddTime = s.AddTime, IsDelete = s.IsDelete }).OrderBy(s => s.AddTime); if (strtype != "A") { query = _db.Bank_CommercialOpus.Where(s => s.IsDelete == false).Select(s => new Bank_CommercialOpus { ID = s.ID, CompanyName = s.CompanyName, ChannelAddress = s.ChannelAddress, CpAddress = s.CpAddress, OpusID = s.OpusID, AddTime = s.AddTime, IsDelete = s.IsDelete }).OrderBy(s => s.AddTime); } totalCount = query.Count(); var list = new List<Bank_CommercialOpus>(); if (PageIndex < 0 || PageSize < 0) { return null; } if (PageIndex == 1 && PageSize > totalCount) { list = query.ToList(); } else if (PageIndex == 1 && PageSize > 0) { list = query.Take(PageSize).ToList(); } else { list = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); } return list; }
/// <summary> ///获取作品分页列表 /// </summary> /// <param name="ntype"></param> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="totalCount"></param> /// <returns></returns> public List<Bank_Opus> GetOpusList(KSOAEnum.OpusType ntype, int PageSize, int PageIndex, out int totalCount) { string strtype = ntype.ToString(); var query = _db.Bank_Opus.Where(s => s.IsDelete == false).Select(s => new Bank_Opus { ID = s.ID, OpTitle = s.OpTitle, OpBeginTime = s.OpBeginTime, OpAuthor = s.OpAuthor, OpType = s.OpType, AddTime = s.AddTime, IsDelete = s.IsDelete }).OrderBy(s => s.AddTime); if (strtype != "A") { query = _db.Bank_Opus.Where(s => s.IsDelete == false && s.OpType == strtype).Select(s => new Bank_Opus { ID = s.ID, OpTitle = s.OpTitle, OpBeginTime = s.OpBeginTime, OpAuthor = s.OpAuthor, OpType = s.OpType, AddTime = s.AddTime, IsDelete = s.IsDelete }).OrderBy(s => s.AddTime); } totalCount = query.Count(); var list = new List<Bank_Opus>(); if (PageIndex < 0 || PageSize < 0) { return null; } if (PageIndex == 1 && PageSize > totalCount) { list = query.ToList(); } else if (PageIndex == 1 && PageSize > 0) { list = query.Take(PageSize).ToList(); } else { list = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); } return list; }