private void SaveData() { //保存任务 NowTask.TaskName = tbxTaskName.Text; NowTask.Description = tbxTaskDes.Text; if (rbtShareUser.Checked) { NowTask.OperRule = "1"; } else if (rbtEveryUser.Checked) { NowTask.OperRule = "2"; } NowTask.SaveUpdateTask(); //保存任务处理者 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllOperator(this.UserInfo, NowTask.TaskId); foreach (ListViewItem lt in lvExOper.Items) { var oper = new OperatorEntity { OperatorId = lt.SubItems[1].Text, WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, Description = lt.Text }; switch (lt.SubItems[2].Text) { case "包含": oper.InorExclude = 1; break; case "排除": oper.InorExclude = 0; break; } oper.OperType = Convert.ToInt16(lt.SubItems[3].Text); oper.Relation = Convert.ToInt16(lt.SubItems[4].Text); oper.OperContent = lt.SubItems[5].Text; oper.OperDisplay = lt.SubItems[6].Text; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertOperator(this.UserInfo, oper); } //保存任务变量 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllTaskVar(this.UserInfo, NowTask.TaskId); foreach (ListViewItem lt in lvExVar.Items) { var isSysVar = SystemVarData.IsSystemVar(lt.Text); if (isSysVar) { continue; //跳过系统变量 } var tmpTaskVar = new TaskVarEntity { VarName = lt.Text, WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, TaskVarId = lt.SubItems[1].Text, VarType = lt.SubItems[2].Text, VarModule = lt.SubItems[3].Text, DataBaseName = lt.SubItems[4].Text, TableName = lt.SubItems[5].Text, TableField = lt.SubItems[6].Text, InitValue = lt.SubItems[7].Text, AccessType = lt.SubItems[8].Text, SortField = lt.SubItems[9].Text }; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertTaskVar(this.UserInfo, tmpTaskVar); } //保存任务命令 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllCommands(this.UserInfo, NowTask.TaskId); foreach (ListViewItem lt in lvExCommand.Items) { var taskCommand = new WorkTaskCommandsEntity { WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, CommandName = lt.Text, CommandId = lt.SubItems[1].Text, Description = lt.SubItems[2].Text }; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkTaskCommands(this.UserInfo, taskCommand); } //保存关联表单 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllControls(this.UserInfo, NowTask.TaskId); RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskUserCtrls(this.UserInfo, UserControlId, NowTask.WorkFlowId, NowTask.TaskId); MessageBoxHelper.ShowSuccessMsg("保存成功!"); }
private void SaveData() { //保存任务 NowTask.TaskName = tbxTaskName.Text; NowTask.Description = tbxTaskDes.Text; NowTask.IsJumpSelf = cbxJumpSelf.Checked; if (rbtShareUser.Checked) { NowTask.OperRule = "1"; } else if (rbtEveryUser.Checked) { NowTask.OperRule = "2"; } NowTask.SaveUpdateTask(); RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllOperator(this.UserInfo, NowTask.TaskId); //保存处理者 foreach (ListViewItem lt in lvExOper.Items) { var oper = new OperatorEntity { OperatorId = lt.SubItems[1].Text, WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, Description = lt.Text, OperType = Convert.ToInt16(lt.SubItems[3].Text), Relation = Convert.ToInt16(lt.SubItems[4].Text), OperContent = lt.SubItems[5].Text, OperDisplay = lt.SubItems[6].Text }; switch (lt.SubItems[2].Text) { case "包含": oper.InorExclude = 1; break; case "排除": oper.InorExclude = 0; break; } RDIFrameworkService.Instance.WorkFlowTemplateService.InsertOperator(this.UserInfo, oper); } //保存任务变量 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllTaskVar(this.UserInfo, NowTask.TaskId); foreach (ListViewItem lt in lvExVar.Items) { var isSysVar = SystemVarData.IsSystemVar(lt.Text); if (isSysVar) { continue; //跳过系统变量 } var tmpTaskVar = new TaskVarEntity { VarName = lt.Text, WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, TaskVarId = lt.SubItems[1].Text, VarType = lt.SubItems[2].Text, VarModule = lt.SubItems[3].Text, DataBaseName = lt.SubItems[4].Text, TableName = lt.SubItems[5].Text, TableField = lt.SubItems[6].Text, InitValue = lt.SubItems[7].Text, AccessType = lt.SubItems[8].Text, SortField = lt.SubItems[9].Text }; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertTaskVar(this.UserInfo, tmpTaskVar); } //保存任务命令 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllCommands(this.UserInfo, NowTask.TaskId); foreach (ListViewItem lt in lvExCommand.Items) { var taskCommand = new WorkTaskCommandsEntity { WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, CommandName = lt.Text, CommandId = lt.SubItems[1].Text, Description = lt.SubItems[2].Text }; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkTaskCommands(this.UserInfo, taskCommand); } //保存关联表单 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllControls(this.UserInfo, NowTask.TaskId); RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskUserCtrls(this.UserInfo, UserControlId, NowTask.WorkFlowId, NowTask.TaskId); //保存控制权限 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllPower(this.UserInfo, NowTask.WorkFlowId, NowTask.TaskId); if (cbxReturn.Checked) { RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskPower(this.UserInfo, WorkConst.WorkTask_Return, NowTask.WorkFlowId, NowTask.TaskId); } if (cbxReturnry.Checked)//任意退回 { RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskPower(this.UserInfo, WorkConst.WorkTask_Returnry, NowTask.WorkFlowId, NowTask.TaskId); } if (cbxAssign.Checked) { RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskPower(this.UserInfo, WorkConst.WorkTask_Assign, NowTask.WorkFlowId, NowTask.TaskId); } if (cbxDyAssignNext.Checked) { RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskPower(this.UserInfo, WorkConst.WorkTask_DyAssignNext, NowTask.WorkFlowId, NowTask.TaskId); } //保存超时配置 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkOutTime(this.UserInfo, NowTask.TaskId); var ot = new WorkOutTimeEntity { Guid = BusinessLogic.NewGuid(), WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, Days = Convert.ToInt16(tbxDay1.Value), Days1 = Convert.ToInt16(tbxDay2.Value), Days2 = Convert.ToInt16(tbxDay3.Value), Hours = Convert.ToInt16(tbxHour1.Value), Hours1 = Convert.ToInt16(tbxHour2.Value), Hours2 = Convert.ToInt16(tbxHour3.Value), Minutes = Convert.ToInt16(tbxMinute1.Value), Minutes1 = Convert.ToInt16(tbxMinute2.Value), Minutes2 = Convert.ToInt16(tbxMinute3.Value), OverTime = chkEnableTimeOut.Checked ? 1 : 0 }; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkOutTime(this.UserInfo, ot); //保存事件 RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkFlowEvent(this.UserInfo, NowTask.TaskId); var ev = new WorkFlowEventEntity { Guid = BusinessLogic.NewGuid(), WorkFlowId = NowTask.WorkFlowId, WorkTaskId = NowTask.TaskId, OtMsg = cbxOtMessage.Checked ? 1 : 0, OtSms = cbxOtSms.Checked ? 1 : 0, OtEmail = cbxOtMail.Checked ? 1 : 0 }; var us = ""; if (lbxOtMsgToUsers.Items.Count > 0) { for (var i = 0; i < lbxOtMsgToUsers.Items.Count - 1; i++) { us = us + lbxOtMsgToUsers.Items[i].ToString() + ","; } us = us + lbxOtMsgToUsers.Items[lbxOtMsgToUsers.Items.Count - 1]; } ev.OtToUsers = us; ev.RmMsg = cbxRmMessage.Checked ? 1 : 0; ev.RmEmail = cbxRmMail.Checked ? 1 : 0; ev.RmSms = cbxRmSms.Checked ? 1 : 0; us = ""; if (lbxRmMsgToUsers.Items.Count > 0) { for (var i = 0; i < lbxRmMsgToUsers.Items.Count - 1; i++) { us = us + lbxRmMsgToUsers.Items[i].ToString() + ","; } us = us + lbxRmMsgToUsers.Items[lbxRmMsgToUsers.Items.Count - 1]; } ev.RmToUsers = us; RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkFlowEvent(this.UserInfo, ev); }