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"; if (cbxReturn.Checked) NowTask.haveback = true; else NowTask.haveback = false; NowTask.SaveUpdateTask(); WorkFlowTask.DeleteAllOperator(NowTask.TaskId); //保存处理者 foreach (ListViewItem lt in lvOper.Items) { Operator oper = new Operator(); oper.OperatorId = lt.SubItems[1].Text; oper.WorkFlowId = NowTask.WorkFlowId; oper.WorkTaskId = NowTask.TaskId; oper.Description = lt.Text; if (lt.SubItems[2].Text == "包含") { oper.InorExclude = true; } else if (lt.SubItems[2].Text == "排除") { oper.InorExclude = false; } 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; oper.InsertOperator(); } //保存任务变量 WorkFlowTask.DeleteAllTaskVar(NowTask.TaskId); foreach (ListViewItem lt in lvVar.Items) { bool isSysVar = SystemVarData.isSystemVar(lt.Text); if (isSysVar) continue;//跳过系统变量 TaskVar tmpTaskVar = new TaskVar(); tmpTaskVar.VarName = lt.Text; tmpTaskVar.WorkFlowId = NowTask.WorkFlowId; tmpTaskVar.WorkTaskId = NowTask.TaskId; tmpTaskVar.TaskVarId = lt.SubItems[1].Text; tmpTaskVar.VarType = lt.SubItems[2].Text; tmpTaskVar.VarModule = lt.SubItems[3].Text; tmpTaskVar.DataBaseName = lt.SubItems[4].Text; tmpTaskVar.TableName = lt.SubItems[5].Text; tmpTaskVar.TableField = lt.SubItems[6].Text; tmpTaskVar.InitValue = lt.SubItems[7].Text; tmpTaskVar.AccessType = lt.SubItems[8].Text; tmpTaskVar.InsertTaskVar(); } //保存任务命令 WorkFlowTask.DeleteAllCommands(NowTask.TaskId); foreach (ListViewItem lt in lvCommand.Items) { WorkTaskCommands taskCommand = new WorkTaskCommands(); taskCommand.WorkFlowId = NowTask.WorkFlowId; taskCommand.WorkTaskId = NowTask.TaskId; taskCommand.CommandName = lt.Text; taskCommand.CommandId =lt.SubItems[1].Text; taskCommand.Description = lt.SubItems[2].Text; taskCommand.InsertWorkTaskCommands(); } //保存关联表单 WorkFlowTask.DeleteAllControls(NowTask.TaskId); if (UserControlId != "") WorkFlowTask.SetTaskUserCtrls(UserControlId, NowTask.WorkFlowId, NowTask.TaskId); //保存关联模块 WorkFlowTask.DeleteAllModle(NowTask.TaskId); if (UserModleId!="") WorkFlowTask.SetTaskUserModle(UserModleId, NowTask.WorkFlowId, NowTask.TaskId); //保存控制权限 WorkFlowTask.DeleteAllPower(NowTask.WorkFlowId, NowTask.TaskId); if (cbxReturn.Checked) WorkFlowTask.SetTaskPower(WorkConst.WorkTask_Return, NowTask.WorkFlowId, NowTask.TaskId); if (cbxbindTable.Checked) WorkFlowTask.SetTaskPower(WorkConst.WorkTask_BindTable, NowTask.WorkFlowId, NowTask.TaskId); if (cbxbindTask.Checked) { WorkFlowTask.SetTaskPower(WorkConst.WorkTask_BindTask, NowTask.WorkFlowId, NowTask.TaskId); if (comTaskboBox.SelectedItem!=null) WorkFlowTask.SetTaskBindTaskContent(((ListItem)comTaskboBox.SelectedItem).ID, NowTask.WorkFlowId, NowTask.TaskId); } if (cbxAssign.Checked) WorkFlowTask.SetTaskPower(WorkConst.WorkTask_Assign, NowTask.WorkFlowId, NowTask.TaskId); if (cbxDyAssignNext.Checked) WorkFlowTask.SetTaskPower(WorkConst.WorkTask_DyAssignNext, NowTask.WorkFlowId, NowTask.TaskId); if (cbxRiZhi.Checked) { WorkFlowTask.SetTaskPower(WorkConst.WorkTask_WorkRiZhi, NowTask.WorkFlowId, NowTask.TaskId); SaveRiZhiData(); } if (cbxTaskExplore.Checked) { WorkFlowTask.SetTaskPower(WorkConst.WorkTask_WorkExplore, NowTask.WorkFlowId, NowTask.TaskId); } if (cbxTaskAllExplore.Checked) { WorkFlowTask.SetTaskPower(WorkConst.WorkTask_WorkAllExplore, NowTask.WorkFlowId, NowTask.TaskId); } //保存超时配置 WorkOutTime.Delete(NowTask.TaskId); WorkOutTime ot = new WorkOutTime(); ot.Guid = Guid.NewGuid().ToString(); ot.WorkFlowId = NowTask.WorkFlowId; ot.WorkTaskId = NowTask.TaskId; ot.Days =Convert.ToInt16(tbxDay1.Value); ot.Days1 = Convert.ToInt16(tbxDay2.Value); ot.Days2 = Convert.ToInt16(tbxDay3.Value); ot.Hours = Convert.ToInt16(tbxHour1.Value); ot.Hours1 = Convert.ToInt16(tbxHour2.Value); ot.Hours2 = Convert.ToInt16(tbxHour3.Value); ot.Minutes = Convert.ToInt16(tbxMinute1.Value); ot.Minutes1 = Convert.ToInt16(tbxMinute2.Value); ot.Minutes2 = Convert.ToInt16(tbxMinute3.Value); ot.Insert(); //保存事件 WorkFlowEvent.Delete(NowTask.TaskId); WorkFlowEvent ev = new WorkFlowEvent(); ev.Guid = Guid.NewGuid().ToString(); ev.WorkFlowId = NowTask.WorkFlowId; ev.WorkTaskId = NowTask.TaskId; ev.OtMsg = cbxOtMessage.Checked; ev.OtSms = cbxOtSms.Checked; ev.OtEmail = cbxOtMail.Checked; string us = ""; if (lbxOtMsgToUsers.Items.Count > 0) { for (int 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; ev.RmEmail = cbxRmMail.Checked; ev.RmSms = cbxRmSms.Checked; us = ""; if (lbxRmMsgToUsers.Items.Count > 0) { for (int 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; ev.Insert(); SaveFJ(); }
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(); WorkFlowTask.DeleteAllOperator(NowTask.TaskId); //保存处理者 foreach (ListViewItem lt in lvOper.Items) { Operator oper = new Operator(); oper.OperatorId = lt.SubItems[1].Text; oper.WorkFlowId = NowTask.WorkFlowId; oper.WorkTaskId = NowTask.TaskId; oper.Description = lt.Text; if (lt.SubItems[2].Text == "包含") { oper.InorExclude = true; } else if (lt.SubItems[2].Text == "排除") { oper.InorExclude = false; } 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; oper.InsertOperator(); } //保存任务命令 WorkFlowTask.DeleteAllCommands(NowTask.TaskId); foreach (ListViewItem lt in lvCommand.Items) { WorkTaskCommands taskCommand = new WorkTaskCommands(); taskCommand.WorkFlowId = NowTask.WorkFlowId; taskCommand.WorkTaskId = NowTask.TaskId; taskCommand.CommandName = lt.Text; taskCommand.CommandId = lt.SubItems[1].Text; taskCommand.Description = lt.SubItems[2].Text; taskCommand.InsertWorkTaskCommands(); } //保存关联表单 WorkFlowTask.DeleteAllControls(NowTask.TaskId); WorkFlowTask.SetTaskUserCtrls(UserControlId, NowTask.WorkFlowId, NowTask.TaskId); //保存事件 WorkFlowEvent.Delete(NowTask.TaskId); WorkFlowEvent ev = new WorkFlowEvent(); ev.Guid = Guid.NewGuid().ToString(); ev.WorkFlowId = NowTask.WorkFlowId; ev.WorkTaskId = NowTask.TaskId; string us = ""; ev.RmMsg = cbxRmMessage.Checked; ev.RmEmail = cbxRmMail.Checked; ev.RmSms = cbxRmSms.Checked; us = ""; if (lbxRmMsgToUsers.Items.Count > 0) { for (int 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; ev.Insert(); }