public void Delete(Modules.OA_FlowRunProcess model) { dal.Initialization(); FineOffice.Entity.OA_FlowRunProcess entity = new Entity.OA_FlowRunProcess { ID = model.ID, }; dal.Delete(entity); dal.Dispose(); }
/// <summary> /// 流程节点退回 /// </summary> public void SendBackRunProcess(Modules.OA_FlowRunProcess handleProcess, Modules.OA_FlowRunProcess backProcess) { dal.SendBackRunProcess(handleProcess, backProcess); }
/// <summary> /// 处理并创建新节点 /// </summary> public void HandleCreateRunProcess(Modules.OA_FlowRunProcess handleProcess, Modules.OA_FlowRunProcess create) { dal.HandleCreateRunProcess(handleProcess, create); }
/// <summary> /// 下一流程 /// </summary> /// <param name="handleProcess"></param> /// <param name="create"></param> public void HandleCreateRunProcess(Modules.OA_FlowRunProcess handleProcess, Modules.OA_FlowRunProcess create) { using (DataContext cxt = ContextFactory.CreateContext()) { cxt.Connection.Open(); using (DbTransaction tran = cxt.Connection.BeginTransaction()) { cxt.Transaction = tran; Table <FineOffice.Entity.OA_FlowRunProcess> runProcess = cxt.GetTable <FineOffice.Entity.OA_FlowRunProcess>(); Table <FineOffice.Entity.OA_FlowRunTransmit> transmit = cxt.GetTable <FineOffice.Entity.OA_FlowRunTransmit>(); try { FineOffice.Entity.OA_FlowRunProcess createProcess = new Entity.OA_FlowRunProcess { ID = create.ID, ProcessID = create.ProcessID, Remark = create.Remark, AcceptID = create.AcceptID, AcceptTime = create.AcceptTime, HandleTime = create.HandleTime, Pattern = create.Pattern, IsEntrance = create.IsEntrance, PreviousID = create.PreviousID, SendID = create.SendID, Version = create.Version, TransmitAdvice = create.TransmitAdvice, RunID = create.RunID, State = create.State, TransmitFrom = handleProcess.TransmitFrom, }; runProcess.InsertOnSubmit(createProcess); cxt.SubmitChanges(); runProcess.Attach(new Entity.OA_FlowRunProcess { ID = handleProcess.ID, ProcessID = handleProcess.ProcessID, Remark = handleProcess.Remark, AcceptID = handleProcess.AcceptID, AcceptTime = handleProcess.AcceptTime, HandleTime = handleProcess.HandleTime, Pattern = handleProcess.Pattern, PreviousID = handleProcess.PreviousID, SendID = handleProcess.SendID, Version = handleProcess.Version, IsEntrance = handleProcess.IsEntrance, TransmitAdvice = handleProcess.TransmitAdvice, RunID = handleProcess.RunID, State = handleProcess.State, TransmitFrom = handleProcess.TransmitFrom, }, true); transmit.InsertOnSubmit(new Entity.OA_FlowRunTransmit { Pattern = 1, RunProcessID = handleProcess.ID, TransmitTo = createProcess.ID }); transmit.InsertOnSubmit(new Entity.OA_FlowRunTransmit { Pattern = 2, RunProcessID = handleProcess.ID, TransmitTo = createProcess.ID }); cxt.SubmitChanges(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw new Exception(ex.Message); } } } }
/// <summary> /// 退回流程 /// </summary> /// <param name="handleProcess"></param> /// <param name="backProcess"></param> public void SendBackRunProcess(Modules.OA_FlowRunProcess handleProcess, Modules.OA_FlowRunProcess backProcess) { using (DataContext cxt = ContextFactory.CreateContext()) { cxt.Connection.Open(); using (DbTransaction tran = cxt.Connection.BeginTransaction()) { cxt.Transaction = tran; Table <FineOffice.Entity.OA_FlowRunProcess> runProcess = cxt.GetTable <FineOffice.Entity.OA_FlowRunProcess>(); Table <FineOffice.Entity.OA_FlowRunTransmit> transmit = cxt.GetTable <FineOffice.Entity.OA_FlowRunTransmit>(); try { FineOffice.Entity.OA_FlowRunProcess createProcess = new Entity.OA_FlowRunProcess { ID = backProcess.ID, ProcessID = backProcess.ProcessID, Remark = backProcess.Remark, AcceptID = backProcess.AcceptID, AcceptTime = backProcess.AcceptTime, HandleTime = backProcess.HandleTime, Pattern = backProcess.Pattern, PreviousID = backProcess.PreviousID, SendID = backProcess.SendID, IsEntrance = backProcess.IsEntrance, Version = backProcess.Version, TransmitFrom = handleProcess.ID, TransmitAdvice = backProcess.TransmitAdvice, RunID = backProcess.RunID, State = backProcess.State, }; runProcess.InsertOnSubmit(createProcess); cxt.SubmitChanges(); bool isEntrance = false; if (handleProcess.IsEntrance != null && handleProcess.IsEntrance.Value) { isEntrance = true; handleProcess.IsEntrance = false; } if (backProcess.IsEntrance == null || !backProcess.IsEntrance.Value) { FineOffice.Entity.OA_FlowRunTransmit previous = transmit.Where(p => p.RunProcessID == createProcess.PreviousID && p.TransmitTo == handleProcess.PreviousID && p.Pattern == 1).FirstOrDefault(); } else if (!isEntrance) { FineOffice.Entity.OA_FlowRunProcess tempProcess = runProcess.Where(p => p.RunID == backProcess.RunID && p.IsEntrance == true).FirstOrDefault(); tempProcess.IsEntrance = null; } runProcess.Attach(new Entity.OA_FlowRunProcess { ID = handleProcess.ID, ProcessID = handleProcess.ProcessID, Remark = handleProcess.Remark, AcceptID = handleProcess.AcceptID, AcceptTime = handleProcess.AcceptTime, HandleTime = handleProcess.HandleTime, Pattern = handleProcess.Pattern, PreviousID = handleProcess.PreviousID, SendID = handleProcess.SendID, IsEntrance = handleProcess.IsEntrance, Version = handleProcess.Version, TransmitAdvice = handleProcess.TransmitAdvice, RunID = handleProcess.RunID, State = handleProcess.State }, true); transmit.InsertOnSubmit(new Entity.OA_FlowRunTransmit { Pattern = 2, RunProcessID = handleProcess.ID, TransmitTo = createProcess.ID }); cxt.SubmitChanges(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw new Exception(ex.Message); } } } }