public static T_FixedAssetsUseModel DTO(this T_FixedAssetsUse node) { if (node == null) { return(null); } var model = new T_FixedAssetsUseModel() { Id = node.Id, Address = node.Address, AssetsId = node.AssetsId, CompanyId = node.CompanyId, CreateDate = node.CreateDate, CreateUserId = node.CreateUserId, CreateUserName = node.CreateUserName, FromDate = node.FromDate, EndDate = node.EndDate, GroupId = node.GroupId, Remark = node.Remark, Status = node.Status, UseUserId = node.UseUserId, UseUserName = node.UseUserName, }; return(model); }
public static T_FixedAssetsUse ToModel(this T_FixedAssetsUseModel node) { return(new T_FixedAssetsUse() { Id = node.Id, Address = node.Address, AssetsId = node.AssetsId, CompanyId = node.CompanyId, CreateDate = node.CreateDate, CreateUserId = node.CreateUserId, CreateUserName = node.CreateUserName, FromDate = node.FromDate, EndDate = node.EndDate, GroupId = node.GroupId, Remark = node.Remark, Status = node.Status, UseUserId = node.UseUserId, UseUserName = node.UseUserName, }); }
/// <summary> /// 复杂查询 /// </summary> /// <param name="model">查询对象</param> /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param> /// <param name="PageSize">每页行数,默认15</param> /// <param name="PageIndex">当前页码,默认100</param> /// <returns></returns> public DataGrid <T_FixedAssetsUseModel> Search(T_FixedAssetsUseModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100) { Expression <Func <T_FixedAssetsUse, bool> > where = null; //最终查询条件 var lambdaList = new List <Expression <Func <T_FixedAssetsUse, bool> > >(); //lambda查询条件集合 int total = 0; //总行数 //if (model.BeginTime.HasValue) // lambdaList.Add(c => c.CreateTime >= (DateTime)model.BeginTime); //if (model.EndTime.HasValue) // lambdaList.Add(c => c.CreateTime <= (DateTime)model.EndTime); //将集合表达式树转换成Expression表达式树 MyVisitor <T_FixedAssetsUse, T_FixedAssetsUse> visitor = new MyVisitor <T_FixedAssetsUse, T_FixedAssetsUse>(); where = visitor.Modify(lambdaList); var list = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList(); var result = new DataGrid <T_FixedAssetsUseModel>() { rows = list, total = total }; return(result); }
public int DeleteData(T_FixedAssetsUseModel model) { return(this.Delete(model.Id)); }
public int EditData(T_FixedAssetsUseModel model) { return(this.Edit(model.ToModel())); }
public int AddData(T_FixedAssetsUseModel model) { return(this.Add(model.ToModel())); }