1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MySystem.MainModels;
- namespace MySystem
- {
- public class MachineApplyDbconn
- {
- public readonly static MachineApplyDbconn Instance = new MachineApplyDbconn();
-
- #region 获取单个字段
- public MachineApply Get(int Id)
- {
- WebCMSEntities db = new WebCMSEntities();
- MachineApply apply = db.MachineApply.FirstOrDefault(m => m.Id == Id);
- if (apply != null)
- {
- }
- return apply;
- }
- #endregion
- #region 获取列表
- public List<int> GetList(int UserId, int pageNum = 1, int pageSize = 10)
- {
-
-
-
-
-
-
-
-
-
-
- List<int> newlist = new List<int>();
- WebCMSEntities db = new WebCMSEntities();
- var mysqllist = db.MachineApply.Select(m => new { m.Id, m.UserId }).Where(m => m.UserId == UserId).OrderByDescending(m => m.Id).ToList();
- if (mysqllist.Count > 0)
- {
-
- foreach (var sub in mysqllist)
- {
- newlist.Add(sub.Id);
-
- }
-
- }
- db.Dispose();
- return newlist;
- }
- #endregion
- }
- }
|