protected void lbDel_Command(object sender, CommandEventArgs e) { SysContext.WF_Custom_TemplationItems.DeleteAllOnSubmit( SysContext.WF_Custom_TemplationItems.Where(x => x.TemplD.ToString() == e.CommandArgument.ToString()).ToList()); SysContext.WF_Custom_Templation.DeleteOnSubmit( SysContext.WF_Custom_Templation.Where(x => x.Id.ToString() == e.CommandArgument.ToString()).FirstOrDefault()); SysContext.SubmitChanges(); LoadData(); }
protected override bool AfterWorkflowApproval(string action, string option, bool isSuccess) { if (isSuccess) { ///对于加签 if (action == "提交") { return(true); } ///更新当前步骤审批人处理记录 var currentStep = SysContext.WF_Custom_InstanceItems.FirstOrDefault(x => x.StepID == CurrentStep); List <CustomWorkflowUserInfo> userinfos = currentStep.PartUsers.ToUserList(); var currentParter = userinfos.FirstOrDefault(x => x.UserInfo.LoginName == _BPMContext.CurrentUser.LoginId); if (currentParter != null) { currentParter.IsApproval = true; currentStep.PartUsers = userinfos.ToXml(); SysContext.SubmitChanges(); } if (userinfos.Count(x => !x.IsApproval) == 0) { //本步骤所有人已经执行审批 ///更新当前自定义实例步骤 if (action == "同意") { var list = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, FormId); var nextInfo = list.Where(x => x.StepID > CurrentStep && !string.IsNullOrEmpty(x.PartUsers)).OrderBy(x => x.OrderId).FirstOrDefault(); var updateInfo = BizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == FormId); if (nextInfo != null) { updateInfo.CurrentStepId = nextInfo.StepID; } else { updateInfo.CurrentStepId = -1;//没有后续节点,流程结束 } BizContext.SubmitChanges(); } else { var updateInfo = BizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == FormId); updateInfo.CurrentStepId = -1;//不同意,流程结束 BizContext.SubmitChanges(); } } } return(true); }
private bool SaveWorkItemsData(string instId) { string sessionKey = string.Format("Steps_{0}", FormId); List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = Session[sessionKey] as List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems>; if (itemInfos != null) { foreach (var item in itemInfos) { item.InstancelD = instId; } SysContext.WF_Custom_InstanceItems.DeleteAllOnSubmit(SysContext.WF_Custom_InstanceItems.Where(x => x.InstancelD == instId)); SysContext.WF_Custom_InstanceItems.InsertAllOnSubmit(itemInfos); SysContext.SubmitChanges(); //失效 //Session[sessionKey] = null; //LoadWorkItemsData(); return(true); } return(false); }
private void SaveWorkItemDataToTemplation()//Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems itemInfo) { int result = 0; string FormId = Request["FormId"]; try { var itemList = CustomWorkflowDataProcess.GetWorkItemsData(FormId); if (itemList == null) { DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result)); return; } string syncString = string.Empty; lock (syncString) { int maxId = 1; if (SysContext.WF_Custom_Templation.Count() > 0) { maxId = SysContext.WF_Custom_Templation.Max(x => x.Id) + 1; if (maxId <= 0) { maxId = 1; } } SysContext.WF_Custom_Templation.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_Templation() { Id = maxId, CreateTime = DateTime.Now, Name = tbStepName.Text, CreateUserID = _BPMContext.CurrentPWordUser.EmployeeCode, CreateUserDeptCode = _BPMContext.CurrentPWordUser.DepartCode, CreateUserName = _BPMContext.CurrentPWordUser.EmployeeName, LastUpdateTime = DateTime.Now, IsOpen = cbIsOpen.Checked ? 1 : 0, RelationDeptCode = GetCheckDept(), Des = tbDes.Text }); long stepId = 1; if (SysContext.WF_Custom_TemplationItems.Count() > 0) { stepId = SysContext.WF_Custom_TemplationItems.Max(x => x.StepID) + 1; } foreach (var item in itemList) { SysContext.WF_Custom_TemplationItems.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_TemplationItems() { TemplD = maxId, CreateTime = DateTime.Now, PartUsers = item.PartUsers, OrderId = item.OrderId, StepID = stepId++, StepName = item.StepName, Condition = item.Condition }); } SysContext.SubmitChanges(); } result = 1; } catch (Exception) { // } DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result)); }