111 lines
3.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}
}