WFProcessTransitionHistoryService.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using LeaRun.Application.Entity.FlowManage;
  2. using LeaRun.Application.IService.FlowManage;
  3. using LeaRun.Data.Repository;
  4. using LeaRun.Util.Extension;
  5. namespace LeaRun.Application.Service.FlowManage
  6. {
  7. /// <summary>
  8. /// 版 本 6.1
  9. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  10. /// 创建人:陈彬彬
  11. /// 日 期:2016.03.18 15:54
  12. /// 描 述:工作流实例节点转化记录操作(支持:SqlServer)
  13. /// </summary>
  14. public class WFProcessTransitionHistoryService : RepositoryFactory, WFProcessTransitionHistoryIService
  15. {
  16. #region 获取数据
  17. /// <summary>
  18. /// 获取流转实体
  19. /// </summary>
  20. /// <param name="processId">流程实例ID</param>
  21. /// <param name="toNodeId">流转到的节点Id</param>
  22. /// <returns></returns>
  23. public WFProcessTransitionHistoryEntity GetEntity(string processId,string toNodeId)
  24. {
  25. try
  26. {
  27. var Expression = LinqExtensions.True<WFProcessTransitionHistoryEntity>();
  28. Expression = Expression.And<WFProcessTransitionHistoryEntity>(t => t.ProcessId == processId);
  29. Expression = Expression.And<WFProcessTransitionHistoryEntity>(t => t.toNodeId == toNodeId);
  30. return this.BaseRepository().FindEntity<WFProcessTransitionHistoryEntity>(Expression);
  31. }
  32. catch {
  33. throw;
  34. }
  35. }
  36. #endregion
  37. #region 提交数据
  38. /// <summary>
  39. /// 保存实例
  40. /// </summary>
  41. /// <param name="keyValue"></param>
  42. /// <param name="entity"></param>
  43. /// <returns></returns>
  44. public int SaveEntity(string keyValue, WFProcessTransitionHistoryEntity entity)
  45. {
  46. try
  47. {
  48. int num;
  49. if (string.IsNullOrEmpty(keyValue))
  50. {
  51. entity.Create();
  52. num = this.BaseRepository().Insert(entity);
  53. }
  54. else
  55. {
  56. entity.Modify(keyValue);
  57. num = this.BaseRepository().Update(entity);
  58. }
  59. return num;
  60. }
  61. catch
  62. {
  63. throw;
  64. }
  65. }
  66. #endregion
  67. }
  68. }