1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using Lottomat.Application.Entity.InformationManage;
- using Lottomat.Application.IService.InformationManage;
- using Lottomat.Data.Repository;
- using Lottomat.Util.WebControl;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- namespace Lottomat.Application.Service.InformationManage
- {
- /// <summary>
- /// 版 本 1.0
- /// Copyright (c) 2016-2017
- /// 创 建:超级管理员
- /// 日 期:2017-10-24 14:24
- /// 描 述:彩吧工具
- /// </summary>
- public class ToolsService : RepositoryFactory<ToolsEntity>, IToolsService
- {
- #region 获取数据
- /// <summary>
- /// 获取列表
- /// </summary>
- /// <param name="pagination">分页</param>
- /// <param name="queryJson">查询参数</param>
- /// <returns>返回分页列表</returns>
- public IEnumerable<ToolsEntity> GetPageList(Pagination pagination, string queryJson)
- {
- return this.BaseRepository().FindList(pagination);
- }
- public IEnumerable<ToolsEntity> GetList(Expression<Func<ToolsEntity, bool>> condition)
- {
- //var expression = LinqExtensions.True<NewsEntity>();
- //expression = expression.And(t => t.TypeId == 1 && t.IsDelete == false);
- //expression = expression.And(condition);
- return this.BaseRepository().FindList(condition);
- }
- /// <summary>
- /// 获取列表
- /// </summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns>返回列表</returns>
- public IEnumerable<ToolsEntity> GetList(string queryJson)
- {
- return this.BaseRepository().IQueryable().ToList();
- }
- /// <summary>
- /// 获取实体
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <returns></returns>
- public ToolsEntity GetEntity(string keyValue)
- {
- return this.BaseRepository().FindEntity(keyValue);
- }
- #endregion
- #region 提交数据
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- public void RemoveForm(string keyValue)
- {
- this.BaseRepository().Delete(keyValue);
- }
- /// <summary>
- /// 保存表单(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <param name="entity">实体对象</param>
- /// <returns></returns>
- public void SaveForm(string keyValue, ToolsEntity entity)
- {
- if (!string.IsNullOrEmpty(keyValue))
- {
- entity.Modify(keyValue);
- this.BaseRepository().Update(entity);
- }
- else
- {
- entity.Create();
- this.BaseRepository().Insert(entity);
- }
- }
- #endregion
- }
- }
|