111 lines
3.0 KiB
C#
111 lines
3.0 KiB
C#
using Learun.Util;
|
||
using Learun.Util.SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
|
||
namespace Learun.Application.OA.Schedule
|
||
{
|
||
/// <summary>
|
||
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
|
||
/// Copyright (c) 2013-2018 Hexagon PPM
|
||
/// 创建人:研发部
|
||
/// 日 期:2017.07.11
|
||
/// 描 述:日程管理
|
||
/// </summary>
|
||
public class ScheduleService
|
||
{
|
||
#region 仓储
|
||
Repository<ScheduleEntity> _scheduleRepository => new Repository<ScheduleEntity>();
|
||
#endregion
|
||
#region 获取数据
|
||
/// <summary>
|
||
/// 获取列表
|
||
/// </summary>
|
||
/// <returns>返回列表</returns>
|
||
public IEnumerable<ScheduleEntity> GetList()
|
||
{
|
||
try
|
||
{
|
||
return _scheduleRepository.GetList();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
throw;
|
||
else
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取实体
|
||
/// </summary>
|
||
/// <param name="keyValue">主键值</param>
|
||
/// <returns></returns>
|
||
public ScheduleEntity GetEntity(string keyValue)
|
||
{
|
||
try
|
||
{
|
||
return _scheduleRepository.GetById(keyValue);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
throw;
|
||
else
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 提交数据
|
||
/// <summary>
|
||
/// 删除数据
|
||
/// </summary>
|
||
/// <param name="keyValue">主键</param>
|
||
public void RemoveForm(string keyValue)
|
||
{
|
||
try
|
||
{
|
||
_scheduleRepository.DeleteById(keyValue);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
throw;
|
||
else
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 保存表单(新增、修改)
|
||
/// </summary>
|
||
/// <param name="keyValue">主键值</param>
|
||
/// <param name="entity">实体对象</param>
|
||
/// <returns></returns>
|
||
public void SaveForm(string keyValue, ScheduleEntity entity)
|
||
{
|
||
try
|
||
{
|
||
if (!string.IsNullOrEmpty(keyValue))
|
||
{
|
||
entity.Modify(keyValue);
|
||
_scheduleRepository.Update(entity);
|
||
}
|
||
else
|
||
{
|
||
entity.Create();
|
||
_scheduleRepository.Insert(entity);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
throw;
|
||
else
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
}
|