예제 #1
0
        public static List <UI_WFEntity_Info> GetWFEntityByHistoryDone(System.Linq.Expressions.Expression <Func <Mission, bool> > condition)
        {
            List <UI_WFEntity_Info> wfe_info = new List <UI_WFEntity_Info>();

            WorkFlows wfs = new WorkFlows();

            List <WorkFlow_Entity> wfes = null;

            //List<WorkFlow_Entity> wfes = wfs.GetWFEntityByConditon(s => s.Process_Info.wh );
            try
            {
                using (var db = new WorkFlowContext())
                {
                    wfes = db.mission.Where(condition).Select(a => a.Miss_WFentity).Distinct().Where(s => s.WE_Status == WE_STATUS.DONE).ToList();
                }
            }
            catch (Exception e)
            {
                return(null);
            }

            foreach (WorkFlow_Entity fe in wfes)
            {
                UI_WFEntity_Info fe_info = new UI_WFEntity_Info();
                fe_info.name        = wfs.GetWorkFlowEntityName(fe.WE_Id);
                fe_info.Status      = fe.WE_Status;
                fe_info.EntityID    = fe.WE_Id;
                fe_info.description = wfs.GetWorkFlowEntityDesc(fe.WE_Id);
                fe_info.serial      = fe.WE_Ser;
                wfe_info.Add(fe_info);
            }
            return(wfe_info);
        }
예제 #2
0
        //获得工作流实体的当前任务
        public static UI_MISSION GetActiveMission <T>(int entity_id, ObjectContext oc, bool bAuthCheck = true)
        {
            UI_MISSION miss = new UI_MISSION();

            WorkFlows wfs = new WorkFlows();

            WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(entity_id);

            miss.WE_Entity_Id  = wfe.WE_Id;
            miss.WE_Name       = wfs.GetWorkFlowEntityName(wfe.WE_Id);
            miss.WE_Entity_Ser = wfe.WE_Ser;

            //恢复工作流实体
            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
            wf.InstFromXmlNode(doc.DocumentElement);
            wf.EntityID = wfe.WE_Id;
            //权限验证
            if (bAuthCheck)
            {
                IEvent ev = wf.GetCurrentEvent();
                if (!ev.CheckAuthority <T>((Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                {
                    return(null);
                }
            }

            miss.WE_Event_Name = wf.GetCurrentEvent().name;
            miss.WE_Event_Desc = wf.GetCurrentEvent().description;
            miss.Mission_Url   = wf.CurrentEventLink();
            //读取参数的值
            foreach (var pa in wf.GetCurrentEvent().paramlist)
            {
                miss.Miss_Params[pa.Key]       = pa.Value.value;
                miss.Miss_ParamsAppRes[pa.Key] = wf.GetCurrentEvent().paramsApp_res[pa.Key];
            }

            return(miss);
        }