예제 #1
0
 public static void Delete(int statusCode)
 {
     if (FlowProcess.ExistStatusCodeInProcessStatusCode(statusCode))
     {
         throw new CustomException("流程码已经被使用,不可以被删除!");
     }
     dal.Delete(statusCode);
 }
예제 #2
0
        public static bool Copy(int flowId)
        {
            bool          flag          = false;
            WorkFlowsInfo workFlowsById = new WorkFlowsInfo();
            WorkFlowsInfo workFlowsInfo = new WorkFlowsInfo();

            workFlowsById             = GetWorkFlowsById(flowId);
            workFlowsInfo.FlowId      = GetMaxId() + 1;
            workFlowsInfo.FlowName    = workFlowsById.FlowName + "复制";
            workFlowsInfo.Description = workFlowsById.Description;
            if (!Add(workFlowsInfo))
            {
                return(flag);
            }
            string str = "";
            IList <FlowProcessInfo> flowProcessList = FlowProcess.GetFlowProcessList(flowId);

            for (int i = 0; i < flowProcessList.Count; i++)
            {
                FlowProcessInfo flowProcessInfo = new FlowProcessInfo();
                flowProcessInfo.FlowId             = workFlowsInfo.FlowId;
                flowProcessInfo.Description        = flowProcessList[i].Description;
                flowProcessInfo.PassActionName     = flowProcessList[i].PassActionName;
                flowProcessInfo.PassActionStatus   = flowProcessList[i].PassActionStatus;
                flowProcessInfo.ProcessId          = flowProcessList[i].ProcessId;
                flowProcessInfo.ProcessName        = flowProcessList[i].ProcessName;
                flowProcessInfo.RejectActionName   = flowProcessList[i].RejectActionName;
                flowProcessInfo.RejectActionStatus = flowProcessList[i].RejectActionStatus;
                IList <StatusInfo> processStatusCodeList = FlowProcess.GetProcessStatusCodeList(flowProcessList[i].FlowId, flowProcessList[i].ProcessId);
                StringBuilder      sb = new StringBuilder();
                for (int j = 0; j < processStatusCodeList.Count; j++)
                {
                    StringHelper.AppendString(sb, processStatusCodeList[j].StatusCode.ToString());
                }
                IList <RoleInfo> processRoleList = FlowProcess.GetProcessRoleList(flowProcessList[i].FlowId, flowProcessList[i].ProcessId);
                for (int k = 0; k < processRoleList.Count; k++)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        str = processRoleList[k].RoleId.ToString();
                    }
                    else
                    {
                        str = str + "," + processRoleList[k].RoleId;
                    }
                }
                if (!FlowProcess.Add(flowProcessInfo, sb.ToString(), str))
                {
                    break;
                }
            }
            return(true);
        }
예제 #3
0
        public static bool Delete(int workFlowsId)
        {
            bool flag = false;

            bool[] flagArray = new bool[] { true, true };
            if (FlowProcess.ExistWorkFlowInFlowProcess(workFlowsId))
            {
                flagArray[0] = FlowProcess.Delete(workFlowsId);
            }
            flagArray[1] = dal.Delete(workFlowsId);
            if (flagArray[0] && flagArray[1])
            {
                flag = true;
            }
            return(flag);
        }