protected void btnSave_Click(object sender, EventArgs e) { string strTips = ValidateData(); if (!string.IsNullOrEmpty(strTips)) { Alert(strTips); return; } //构建节点记录 TWfSettingTaskVo setStep = new TWfSettingTaskVo(); BindControlsToObjectMode(setStep); setStep.WF_ID = WF_ID.Value; setStep.WF_TASK_ID = WF_TASK_ID.Value == "" ? this.GetGUID() : WF_TASK_ID.Value; setStep.ID = setStep.WF_TASK_ID; setStep.TASK_AND_OR = rdbtnlstAndOr.SelectedValue; //暂时指定为01,后续扩展 setStep.TASK_TYPE = "01"; setStep.OPER_TYPE = rdbtnlstOperType.SelectedValue; //构建操作人类型和数值 foreach (ListItem li in lsbStep.Items) { setStep.OPER_VALUE += li.Value + "|"; } //构建排序的数值 //构建附加功能值 foreach (ListItem li in ckbxlstPowerList.Items) { if (li.Selected) { setStep.FUNCTION_LIST += li.Value + "|"; } } //如果是空,则说明不附加任何功能,直接置空 setStep.FUNCTION_LIST = setStep.FUNCTION_LIST == "" ? "###" : setStep.FUNCTION_LIST; //构建节点命令集合 List <TWfSettingTaskCmdVo> cmdSetpList = new List <TWfSettingTaskCmdVo>(); foreach (ListItem li in ckbxlstCMDList.Items) { if (li.Selected) { TWfSettingTaskCmdVo cmdTemp = new TWfSettingTaskCmdVo(); cmdTemp.ID = this.GetGUID(); cmdTemp.WF_CMD_ID = cmdTemp.ID; cmdTemp.WF_ID = WF_ID.Value; cmdTemp.WF_TASK_ID = setStep.WF_TASK_ID; cmdTemp.CMD_NAME = li.Value; cmdTemp.CMD_NOTE = li.Text; cmdSetpList.Add(cmdTemp); //在节点表中存储一个字符串 setStep.COMMAND_NAME += cmdTemp.CMD_NAME + "|"; } } //构建节点表单页面记录 TWfSettingTaskFormVo formStep = new TWfSettingTaskFormVo(); formStep.WF_ID = setStep.WF_ID; formStep.WF_TASK_ID = setStep.WF_TASK_ID; formStep.ID = this.GetGUID(); formStep.WF_TF_ID = formStep.ID; formStep.UCM_ID = UCM_ID.Text; formStep.UCM_TYPE = UCM_TYPE.SelectedValue; //保存按钮的处理 if (string.IsNullOrEmpty(WF_TASK_ID.Value)) { //新增 TWfSettingTaskLogic taskLogic = new TWfSettingTaskLogic(); TWfSettingTaskCmdLogic cmdLogic = new TWfSettingTaskCmdLogic(); TWfSettingTaskFormLogic formLogic = new TWfSettingTaskFormLogic(); //新增是构建 TASK_ORDER setStep.TASK_ORDER = (taskLogic.GetSelectResultCount(new TWfSettingTaskVo() { WF_ID = setStep.WF_ID }) + 1).ToString(); bool bIsSucess = taskLogic.Create(setStep); if (bIsSucess) { cmdLogic.Create(cmdSetpList); formLogic.Create(formStep); } this.Alert("添加成功"); //日志记录 } else { //修改 TWfSettingTaskLogic taskLogic = new TWfSettingTaskLogic(); TWfSettingTaskCmdLogic cmdLogic = new TWfSettingTaskCmdLogic(); TWfSettingTaskFormLogic formLogic = new TWfSettingTaskFormLogic(); bool bIsSucess = taskLogic.Edit(setStep); if (bIsSucess) { cmdLogic.Delete(new TWfSettingTaskCmdVo() { WF_TASK_ID = setStep.WF_TASK_ID, WF_ID = setStep.WF_ID }); cmdLogic.Create(cmdSetpList); formLogic.Delete(new TWfSettingTaskFormVo() { WF_TASK_ID = setStep.WF_TASK_ID, WF_ID = setStep.WF_ID }); formLogic.Create(formStep); } this.Alert("修改成功"); } }
public static string SaveData(string strid, string stWF_ID, string strWF_TASK_ID, string strTASK_CAPTION, string strTASK_NOTE, string strCOMMAND_NAME, string strCOMMAND_NAME_Text, string strFUNCTION_LIST, string strTASK_AND_OR, string strPOSITION_IX, string strPOSITION_IY, string strOPER_VALUE) { bool isSuccess = true; //构建节点记录 TWfSettingTaskVo setStep = new TWfSettingTaskVo(); setStep.WF_ID = stWF_ID; setStep.WF_TASK_ID = strWF_TASK_ID == "0" ? new PageBaseForWF().GetGUID() : strWF_TASK_ID; setStep.ID = strid == "0" ? setStep.WF_TASK_ID : strid; setStep.TASK_CAPTION = strTASK_CAPTION; setStep.TASK_NOTE = strTASK_NOTE; setStep.COMMAND_NAME = strCOMMAND_NAME.Replace(";", "|"); setStep.FUNCTION_LIST = strFUNCTION_LIST.Length == 0 ? "###" : strFUNCTION_LIST.Replace(";", "|"); setStep.TASK_AND_OR = strTASK_AND_OR; setStep.TASK_TYPE = "01"; //暂时指定为01,后续扩展 setStep.OPER_TYPE = "01"; //暂时指定为用户,屏蔽用户类型“职位”,因为工作流设计无法适应用户、职位同时选的情况 setStep.OPER_VALUE = strOPER_VALUE.Replace(";", "|"); //构建节点命令集合 List <TWfSettingTaskCmdVo> cmdSetpList = new List <TWfSettingTaskCmdVo>(); string[] arrCMDName = strCOMMAND_NAME.Split(';'); string[] arrCMDNameText = strCOMMAND_NAME_Text.Split(';'); for (int i = 0; i < arrCMDName.Length; i++) { TWfSettingTaskCmdVo cmdTemp = new TWfSettingTaskCmdVo(); cmdTemp.ID = new PageBaseForWF().GetGUID(); cmdTemp.WF_CMD_ID = cmdTemp.ID; cmdTemp.WF_ID = stWF_ID; cmdTemp.WF_TASK_ID = setStep.WF_TASK_ID; cmdTemp.CMD_NAME = arrCMDName[i]; cmdTemp.CMD_NOTE = arrCMDNameText[i]; cmdSetpList.Add(cmdTemp); } //构建节点表单页面记录 TWfSettingTaskFormVo formStep = new TWfSettingTaskFormVo(); formStep.WF_ID = setStep.WF_ID; formStep.WF_TASK_ID = setStep.WF_TASK_ID; formStep.ID = new PageBaseForWF().GetGUID(); formStep.WF_TF_ID = formStep.ID; formStep.UCM_ID = strPOSITION_IY; formStep.UCM_TYPE = strPOSITION_IX; TWfSettingTaskLogic taskLogic = new TWfSettingTaskLogic(); TWfSettingTaskCmdLogic cmdLogic = new TWfSettingTaskCmdLogic(); TWfSettingTaskFormLogic formLogic = new TWfSettingTaskFormLogic(); if (strid == "0") { //新增是构建 TASK_ORDER setStep.TASK_ORDER = (taskLogic.GetSelectResultCount(new TWfSettingTaskVo() { WF_ID = setStep.WF_ID }) + 1).ToString(); bool bIsSucess = taskLogic.Create(setStep); if (bIsSucess) { cmdLogic.Create(cmdSetpList); formLogic.Create(formStep); } string strMessage = new PageBase().LogInfo.UserInfo.USER_NAME + "增加环节:" + setStep.WF_TASK_ID + " 成功"; new PageBase().WriteLog("增加环节", "", strMessage); } else { bool bIsSucess = taskLogic.Edit(setStep); if (bIsSucess) { cmdLogic.Delete(new TWfSettingTaskCmdVo() { WF_TASK_ID = setStep.WF_TASK_ID, WF_ID = setStep.WF_ID }); cmdLogic.Create(cmdSetpList); formLogic.Delete(new TWfSettingTaskFormVo() { WF_TASK_ID = setStep.WF_TASK_ID, WF_ID = setStep.WF_ID }); formLogic.Create(formStep); } string strMessage = new PageBase().LogInfo.UserInfo.USER_NAME + "修改环节:" + setStep.WF_TASK_ID + " 成功"; new PageBase().WriteLog("修改环节", "", strMessage); } if (isSuccess) { return("1"); } else { return("0"); } }