コード例 #1
0
ファイル: Flow.ashx.cs プロジェクト: zhaowei2/wzgl
        /// <summary>
        /// 获取流程类型和流程列表
        /// </summary>
        /// <param name="context"></param>
        private void getTypeAndFlowList(HttpContext context)
        {
            try
            {
                List <WorkFlow.Model.FLOW_TYPE> typelist = WorkFlow.BLL.Operate.getFlowType();     //获取所有流程类别

                List <WorkFlow.Model.FLOW_DEFINE> lclist = WorkFlow.BLL.Operate.getDefineList(""); //获取所有流程定义

                List <FlowTypeData>         list        = new List <FlowTypeData>();               //结构树
                Dictionary <string, string> list_define = CFunctions.getMyFlowDefine(context);     //当前登录人有权限的流程
                foreach (WorkFlow.Model.FLOW_TYPE type in typelist)
                {
                    List <WorkFlow.Model.FLOW_DEFINE> lclist_temp = lclist.Where(p => (p.TYPE_CODE == type.TYPE_CODE) && (list_define.ContainsKey(p.DEFINE_CODE))).ToList <WorkFlow.Model.FLOW_DEFINE>();
                    FlowTypeData ftd = new FlowTypeData();
                    ftd.type = type;
                    foreach (WorkFlow.Model.FLOW_DEFINE fdi in lclist_temp)
                    {
                        ftd.list.Add(fdi);
                    }
                    list.Add(ftd);
                }

                string json = JsonConvert.SerializeObject(list);
                context.Response.ContentType = "application/json";
                context.Response.Write(json);
                context.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                string json = JsonConvert.SerializeObject("{'IsSuccess':'false','Message':'服务器交互失败!'}");
                context.Response.ContentType = "application/json";
                context.Response.Write(json);
                context.ApplicationInstance.CompleteRequest();
            }
        }