2017-11-29 21:32:55 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-01-13 19:26:36 +08:00
|
|
|
|
using System.Linq;
|
2017-11-30 17:47:41 +08:00
|
|
|
|
using OpenAuth.App.Response;
|
2017-11-29 20:49:14 +08:00
|
|
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
|
using OpenAuth.Repository.Interface;
|
2017-01-13 19:26:36 +08:00
|
|
|
|
|
2017-02-06 00:12:11 +08:00
|
|
|
|
namespace OpenAuth.App
|
2017-01-13 19:26:36 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 表单服务
|
|
|
|
|
/// <para>李玉宝新增于2017-01-13 17:48:00</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class WFFormService
|
|
|
|
|
{
|
2017-11-28 23:54:49 +08:00
|
|
|
|
public IUnitWork _unitWork { get; set; }
|
2017-01-13 19:26:36 +08:00
|
|
|
|
|
|
|
|
|
public List<WFFrmMain> GetAllList()
|
|
|
|
|
{
|
|
|
|
|
return _unitWork.Find<WFFrmMain>(null).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public WFFrmMain GetForm(string keyValue)
|
2017-01-13 19:26:36 +08:00
|
|
|
|
{
|
|
|
|
|
return _unitWork.FindSingle<WFFrmMain>(u => u.Id == keyValue);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public void RemoveForm(string[] keyValue)
|
2017-01-13 19:26:36 +08:00
|
|
|
|
{
|
2017-01-24 16:04:17 +08:00
|
|
|
|
_unitWork.Delete<WFFrmMain>(u =>keyValue.Contains(u.Id));
|
2017-01-13 19:26:36 +08:00
|
|
|
|
}
|
2017-02-06 00:12:11 +08:00
|
|
|
|
|
2017-11-30 17:47:41 +08:00
|
|
|
|
public TableData Load(int pageCurrent, int pageSize)
|
2017-02-06 23:17:51 +08:00
|
|
|
|
{
|
2017-11-30 17:47:41 +08:00
|
|
|
|
var result = new TableData
|
2017-02-06 00:12:11 +08:00
|
|
|
|
{
|
2017-11-28 23:54:49 +08:00
|
|
|
|
count = _unitWork.Find<WFFrmMain>(null).Count(),
|
|
|
|
|
data = _unitWork.Find<WFFrmMain>(pageCurrent, pageSize, "ModifyDate descending", null).ToList()
|
2017-02-06 00:12:11 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2017-02-06 23:17:51 +08:00
|
|
|
|
|
|
|
|
|
public void SaveForm(string keyValue, WFFrmMain entity)
|
2017-11-30 17:47:41 +08:00
|
|
|
|
{
|
|
|
|
|
|
2017-02-07 11:36:26 +08:00
|
|
|
|
if (string.IsNullOrEmpty(keyValue))
|
|
|
|
|
{
|
|
|
|
|
_unitWork.Add(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-11-30 17:47:41 +08:00
|
|
|
|
entity.Id = keyValue;
|
|
|
|
|
_unitWork.Update(u =>u.Id, entity);
|
|
|
|
|
}
|
|
|
|
|
_unitWork.Save();
|
2017-02-06 23:17:51 +08:00
|
|
|
|
}
|
2017-01-13 19:26:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|