public static JWorkFlow[] GetAllNodes(string pClassName, int pDynamicClassCode) { JDataBase DB = new JDataBase(); try { DB.setQuery("SELECT * FROM WorkFlowNode WHERE ClassName='" + pClassName + "' AND DynamicClassCode=" + pDynamicClassCode.ToString()); DataTable _DT = DB.Query_DataTable(); List <JWorkFlow> WF = new List <JWorkFlow>(); foreach (DataRow _DR in _DT.Rows) { JWorkFlow tempWF = new JWorkFlow(); JTable.SetToClassProperty(tempWF, _DR); WF.Add(tempWF); } return(WF.ToArray()); } catch { return(null); } finally { DB.Dispose(); } }
public static bool AutoGoToNextNode(string pClassName, int pObjectCode, int pDynamicClassCode, DataTable pDataTable, JNodeType pGoNode) { JARefer Refer = new JARefer(); int _refCode = Refer.FindReferByExternalcode(pClassName, pObjectCode, pDynamicClassCode); Refer.GetData(_refCode); if (_refCode == 0) { return(false); } JWorkFlow workflow = new JWorkFlow(pDataTable, _refCode); workflow.GetData(Refer.WorkFlowCode, pClassName, pDynamicClassCode); JWorkFlow[] workflows = workflow.GetNextNodes(true); foreach (JWorkFlow _wf in workflows) { if (_wf.NodeType == pGoNode) { int[] RefCode = Refer.Send( _wf.PostCode.ToString().Split(new char[] { ';' }) , "", _wf.Code, pObjectCode, "", pClassName, pDynamicClassCode, pDataTable ); return(RefCode.Length > 0); } } return(false); }
public JWorkFlow[] GetNextNodes(bool pCheckCon) { JDataBase DB = new JDataBase(); try { DB.setQuery("SELECT * FROM WorkFlowNode WHERE ClassName='" + ClassName + "' AND DynamicClassCode='" + DynamicClassCode.ToString() + "' AND Ordered in(" + NextNodes + ")"); DataTable _DT = DB.Query_DataTable(); JWorkFlow[] WF = new JWorkFlow[0]; foreach (DataRow _DR in _DT.Rows) { JWorkFlow tempWF = new JWorkFlow(_PublicDataRow, ReferCode); JTable.SetToClassProperty(tempWF, _DR); tempWF.SetWorkFlowCondition(); if (!pCheckCon || tempWF.CheckCondition()) { Array.Resize(ref WF, WF.Length + 1); WF[WF.Length - 1] = tempWF; } } return(WF); } catch { return(null); } finally { DB.Dispose(); } }