Example #1
0
        //获取当前任务列表

        /*public static List<UI_MISSION> GetActiveMissions<T>(ObjectContext oc, string Entity_name="ALL", bool bAuthCheck = true)
         * {
         *  List<UI_MISSION> missions = new List<UI_MISSION>();
         *
         *  WorkFlows wfs = new WorkFlows();
         *  List<WorkFlow_Entity> wfes = wfs.GetActiveWorkFlowEntities(Entity_name);
         *
         *  foreach(WorkFlow_Entity wfe in wfes)
         *  {
         *
         *
         *      UI_MISSION mi = new UI_MISSION();
         *      mi.WE_Entity_Id = wfe.WE_Id;
         *      mi.WE_Name = wfs.GetWorkFlowEntityName(wfe.WE_Id);
         *
         *      //恢复工作流实体
         *      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;
         *      wf.EntitySerial = wfe.WE_Ser;
         *
         *      //if (wf.CurrentEventLink() == "")
         *      //    continue;
         *
         *      //权限验证
         *      if (bAuthCheck)
         *      {
         *          IEvent ev = wf.GetCurrentEvent();
         *          if (!ev.CheckAuthority<T>(authority_params, oc))
         *              continue;
         *      }
         *
         *
         *      mi.WE_Event_Name = wf.GetCurrentEvent().name;
         *      mi.WE_Event_Desc = wf.GetCurrentEvent().description;
         *      mi.Mission_Url = wf.CurrentEventLink();
         *      //读取参数的值
         *      foreach(var pa in wf.GetCurrentEvent().paramlist)
         *      {
         *          mi.Miss_Params[pa.Key] = pa.Value.value;
         *      }
         *
         *      missions.Add(mi);
         *  }
         *  return missions;
         * }*/
        public static List <UI_MISSION> GetActiveMissions <T>(ObjectContext oc, string Entity_name = "ALL", bool bAuthCheck = true)
        {
            List <UI_MISSION> missions = new List <UI_MISSION>();

            WorkFlows           wfs  = new WorkFlows();
            List <CURR_Mission> cMis = wfs.GetActiveMissionsOfEntity(Entity_name);

            foreach (CURR_Mission cm in cMis)
            {
                UI_MISSION mi = new UI_MISSION();
                mi.WE_Entity_Id = cm.WFE_ID;


                //if (wf.CurrentEventLink() == "")
                //    continue;

                //权限验证
                if (bAuthCheck)
                {
                    CAuthority author = new CAuthority();
                    author.auth_string = cm.Str_Authority;

                    //if (!author.CheckAuth<T>(new Dictionary<string, object>(), authority_params[HttpContext.Current.Session.SessionID], oc))
                    //    continue;
                    if (!author.CheckAuth <T>(new Dictionary <string, object>(), (Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                    {
                        continue;
                    }
                }


                mi.WE_Event_Name = cm.Miss_Name;
                mi.WE_Event_Desc = cm.Miss_Desc;
                mi.Mission_Url   = cm.Current_Action + @"/?wfe_id=" + mi.WE_Entity_Id;
                mi.WE_Event_Desc = cm.Miss_Desc;


                missions.Add(mi);
            }
            return(missions);
        }