Example #1
0
        public bool CreateEntity(string wf_name, string Ser_Num = null/*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            WorkFlows wfs = new WorkFlows();

            XmlDocument doc = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);
            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            InstFromXmlNode((XmlNode)doc.DocumentElement);

           

            WorkFlow_Entity wfe = new WorkFlow_Entity();
            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(WriteToXmlNode().OuterXml);
            
                //wfe.Create_Info = SaveCreateRecord();
            //2016/2/12 --保证子工作流串号与父工作流相同
            if (Ser_Num == null)
                wfe.WE_Ser = "";
            else
                wfe.WE_Ser = Ser_Num;            

            if (!wfs.AddWorkEntity(wf_name, wfe))
                return false;

            m_entityID = wfe.WE_Id;
            m_entitySerial = wfe.WE_Ser;
            m_defineID = define.W_ID;

            RegEventsTimeOut(true);   
            return true;

        }
Example #2
0
        public static CWorkFlow CreateWFEntityModifiedTimeOut(string wf_name, string event_name, CTimeOutProperty property, string Ser_Num = null /*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            CWorkFlow wf = new CWorkFlow();

            WorkFlows wfs = new WorkFlows();

            XmlDocument     doc    = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);

            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            wf.InstFromXmlNode((XmlNode)doc.DocumentElement);

            //修改wf
            IEvent           ev_target   = wf.events[event_name];
            CTimeOutProperty timeout_pro = ev_target.GetTimeOutProperty();

            timeout_pro.ExactTime  = property.ExactTime;
            timeout_pro.StartTime  = property.StartTime;
            timeout_pro.TimeOffset = property.TimeOffset;

            WorkFlow_Entity wfe = new WorkFlow_Entity();

            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(wf.WriteToXmlNode().OuterXml);

            if (Ser_Num == null)
            {
                wfe.WE_Ser = "";
            }
            else
            {
                wfe.WE_Ser = Ser_Num;
            }

            if (!wfs.AddWorkEntity(wf_name, wfe))
            {
                return(null);
            }

            wf.EntityID     = wfe.WE_Id;
            wf.EntitySerial = wfe.WE_Ser;
            wf.DefineID     = define.W_ID;



            wf.RegEventsTimeOut(true);

            return(wf);
        }
Example #3
0
        //根据自身信息创建工作流
        //该函数调用要确保自身信息构建完善
        public bool CreateEntityBySelf(string Ser_Num = null)
        {
            WorkFlows wfs = new WorkFlows();

            WorkFlow_Entity wfe = new WorkFlow_Entity();
            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(WriteToXmlNode().OuterXml);

            //2016/2/12 --保证子工作流串号与父工作流相同
            if (Ser_Num == null)
                wfe.WE_Ser = "";
            else
                wfe.WE_Ser = Ser_Num;

            if (!wfs.AddWorkEntity(name, wfe))
                return false;

            m_entityID = wfe.WE_Id;
            m_entitySerial = wfe.WE_Ser;
            //m_defineID = define.W_ID;

            RegEventsTimeOut(true);
            return true;
        }