duan
2024-08-21 22bd5bc1ce2b49284cc2f042c7f4f48619fcf85b
提交 | 用户 | age
8e1d1f 1 using DIXWeb.DAL;
A 2 using DIXWeb.Entity.Workflow;
3 using System;
4 using System.Collections.Generic;
7b83a6 5 using System.Data;
8e1d1f 6 using System.Linq;
A 7 using System.Text;
8 using System.Threading.Tasks;
9
10 namespace DIXWeb.Business.GlobalM
11 {
12     public class WorkflowNodeDetailBusiness
13     {
14         public List<WorkflowOrgType> GetWorkflowOrgType()
15         {
16             List<WorkflowOrgType> list = null;
17             using (DBContext db =new DBContext())
18             {
19                 list = db.WorkflowOrgType.ToList();
20             }
21             return list;
22         }
23
24         public List<WorkflowRoleType> GetWorkflowRoleType()
25         {
26             List<WorkflowRoleType> list = null;
27             using (DBContext db = new DBContext())
28             {
29                 list = db.WorkflowRoleType.ToList();
30             }
31             return list;
32         }
15b421 33
7b83a6 34         public Receive GetWorkflowNDetail(int NodeId, int pageIndex, int pageSize)
15b421 35         {
7b83a6 36             Receive receive = new Receive();
A 37             try
15b421 38             {
7b83a6 39                 using (DBContext db = new DBContext())
A 40                 {
41                     System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
42                         new System.Data.SqlClient.SqlParameter("@NodeId", NodeId),
43                         new System.Data.SqlClient.SqlParameter("@pageIndex", pageIndex),
44                         new System.Data.SqlClient.SqlParameter("@pageSize", pageSize),
45                         new System.Data.SqlClient.SqlParameter("@Total", 0),
46                     };
47                     int index = paramList.Length - 1;
48                     paramList[index].Direction = ParameterDirection.Output;
49                     receive.rows = db.Database.SqlQuery<ReceiveNodeDetail>("exec meta.p_getWorkflowNDetailByNodeId @NodeId,@pageIndex,@pageSize,@Total output ", paramList).ToList();
50                     receive.total = int.Parse(paramList[index].Value.ToString());
51                     receive.Code = 200;
52                     receive.Message = "SUCCESS";
53                 }
15b421 54             }
7b83a6 55             catch (Exception ex)
A 56             {
57                 receive.Code = 500;
58                 receive.Message = ex.Message;
59             }
60             return receive;
15b421 61         }
A 62
63         public void Insert(WorkflowNodeDetail record)
64         {
65             using (DBContext db = new DBContext())
66             {
67                 db.WorkflowNodeDetail.Add(record);
68                 db.SaveChanges();
69             }
70         }
71
72         public void Update(WorkflowNodeDetail record)
73         {
74             using (DBContext db = new DBContext())
75             {
76                 WorkflowNodeDetail tempRecord = db.WorkflowNodeDetail.Find(record.Id);
77                 //tempRecord.WorkflowId = record.WorkflowId;
78                 //tempRecord.NodeId = record.NodeId;
79                 tempRecord.OrgTypeId = record.OrgTypeId;
80                 tempRecord.OrgId = record.OrgId;
81                 tempRecord.RoleTypeId = record.RoleTypeId;
82                 tempRecord.RoleId = record.RoleId;
83                 tempRecord.DetailLevel = record.DetailLevel;
1bf8ef 84                 tempRecord.ActiveType = record.ActiveType;
15b421 85                 tempRecord.ChTime = record.ChTime;
A 86                 tempRecord.ChUserId = record.ChUserId;
87                 db.SaveChanges();
88             }
89         }
90
91         public ReceiveNodeDetail SelectById(int Id)
92         {
93             ReceiveNodeDetail record = null;
94             using (DBContext db = new DBContext())
95             {
96                 System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] {
97                     new System.Data.SqlClient.SqlParameter("@Id", Id),
98                 };
99                 record = db.Database.SqlQuery<ReceiveNodeDetail>("EXEC meta.p_getWorkflowNDetailById @Id ", paramList).FirstOrDefault();
100             }
101             return record;
102         }
8e1d1f 103     }
A 104 }