using DIXWeb.DAL; using DIXWeb.Entity.Workflow; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DIXWeb.Business.GlobalM { public class WorkflowNodeDetailBusiness { public List GetWorkflowOrgType() { List list = null; using (DBContext db =new DBContext()) { list = db.WorkflowOrgType.ToList(); } return list; } public List GetWorkflowRoleType() { List list = null; using (DBContext db = new DBContext()) { list = db.WorkflowRoleType.ToList(); } return list; } public Receive GetWorkflowNDetail(int NodeId, int pageIndex, int pageSize) { Receive receive = new Receive(); try { using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@NodeId", NodeId), new System.Data.SqlClient.SqlParameter("@pageIndex", pageIndex), new System.Data.SqlClient.SqlParameter("@pageSize", pageSize), new System.Data.SqlClient.SqlParameter("@Total", 0), }; int index = paramList.Length - 1; paramList[index].Direction = ParameterDirection.Output; receive.rows = db.Database.SqlQuery("exec meta.p_getWorkflowNDetailByNodeId @NodeId,@pageIndex,@pageSize,@Total output ", paramList).ToList(); receive.total = int.Parse(paramList[index].Value.ToString()); receive.Code = 200; receive.Message = "SUCCESS"; } } catch (Exception ex) { receive.Code = 500; receive.Message = ex.Message; } return receive; } public void Insert(WorkflowNodeDetail record) { using (DBContext db = new DBContext()) { db.WorkflowNodeDetail.Add(record); db.SaveChanges(); } } public void Update(WorkflowNodeDetail record) { using (DBContext db = new DBContext()) { WorkflowNodeDetail tempRecord = db.WorkflowNodeDetail.Find(record.Id); //tempRecord.WorkflowId = record.WorkflowId; //tempRecord.NodeId = record.NodeId; tempRecord.OrgTypeId = record.OrgTypeId; tempRecord.OrgId = record.OrgId; tempRecord.RoleTypeId = record.RoleTypeId; tempRecord.RoleId = record.RoleId; tempRecord.DetailLevel = record.DetailLevel; tempRecord.ActiveType = record.ActiveType; tempRecord.ChTime = record.ChTime; tempRecord.ChUserId = record.ChUserId; db.SaveChanges(); } } public ReceiveNodeDetail SelectById(int Id) { ReceiveNodeDetail record = null; using (DBContext db = new DBContext()) { System.Data.SqlClient.SqlParameter[] paramList = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Id", Id), }; record = db.Database.SqlQuery("EXEC meta.p_getWorkflowNDetailById @Id ", paramList).FirstOrDefault(); } return record; } } }