ProcessRelationServices.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.Entities;
  6. using EMIS.ViewModel.SystemView;
  7. namespace EMIS.CommonLogic.SystemServices
  8. {
  9. public class ProcessRelationServices : BaseServices, IProcessRelationServices
  10. {
  11. /// <summary>
  12. /// 添加
  13. /// </summary>
  14. /// <param name="formID">表单ID</param>
  15. /// <param name="InstanceID">流程唯一主ID</param>
  16. /// <param name="TableName">表名</param>
  17. /// <returns></returns>
  18. public bool ProcessRelationAdd(Guid formID, string InstanceID, string TableName)
  19. {
  20. try
  21. {
  22. Sys_ProcessRelation processRelation = new Sys_ProcessRelation();
  23. processRelation.ProcessRelation = Guid.NewGuid();
  24. processRelation.formID = formID;
  25. processRelation.InstanceID = InstanceID;
  26. processRelation.TableName = TableName;
  27. UnitOfWork.Add(processRelation);
  28. UnitOfWork.Commit();
  29. return true;
  30. }
  31. catch (Exception)
  32. {
  33. throw;
  34. }
  35. }
  36. /// <summary>
  37. /// 批量添加
  38. /// </summary>
  39. /// <param name="formID">表单ID</param>
  40. /// <param name="InstanceID">流程唯一主ID</param>
  41. /// <param name="TableName">表名</param>
  42. /// <returns></returns>
  43. public bool ProcessRelationAdd(IList<BaseProcessRelationView> processRelationList, string TableName)
  44. {
  45. try
  46. {
  47. foreach (var processRelation in processRelationList)
  48. {
  49. Sys_ProcessRelation processRelationEntity = new Sys_ProcessRelation();
  50. processRelationEntity.ProcessRelation = Guid.NewGuid();
  51. processRelationEntity.formID = processRelation.FormID;
  52. processRelationEntity.InstanceID = processRelation.InstanceID;
  53. processRelationEntity.TableName = TableName;
  54. UnitOfWork.Add(processRelationEntity);
  55. }
  56. UnitOfWork.Commit();
  57. return true;
  58. }
  59. catch (Exception)
  60. {
  61. throw;
  62. }
  63. }
  64. }
  65. }