Exemple #1
0
        /// <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();
            }
        }
Exemple #2
0
        /// <summary>
        /// 获取我处理过的流程,经办跟踪
        /// </summary>
        /// <param name="context"></param>
        private void getMyHandledTypeList(HttpContext context)
        {
            try
            {
                List <WorkFlow.Model.FLOW_TYPE>   typelist   = WorkFlow.BLL.Operate.getFlowType();     //获取所有流程类别
                List <WorkFlow.Model.FLOW_DEFINE> definelist = WorkFlow.BLL.Operate.getDefineList(""); //获取所有的流程

                List <FlowTypeData> list = new List <FlowTypeData>();                                  //结构树

                IFlow_Derive_RelationBLL reBll = BLL.BllFactory.GetFlow_Derive_RelationBLL();

                foreach (WorkFlow.Model.FLOW_TYPE type in typelist)
                {
                    FlowTypeData ftd = new FlowTypeData();
                    ftd.type = type;//流程类型
                    int count = 0;
                    //找到该类型的流程模板
                    List <MODEL.Flow.FLOW_DERIVE_RELATION> list_relation = reBll.GetDistinctList(" and  b.type_code='" + type.TYPE_CODE + "' ").ToList <MODEL.Flow.FLOW_DERIVE_RELATION>();

                    foreach (MODEL.Flow.FLOW_DERIVE_RELATION relation in list_relation)
                    {
                        //1-----找到模板的流程信息
                        List <WorkFlow.Model.FLOW_DEFINE> lclist_mb = definelist.Where(p => p.DEFINE_CODE == relation.define_code_parent).ToList <WorkFlow.Model.FLOW_DEFINE>();
                        if (lclist_mb.Count > 0)
                        {
                            foreach (WorkFlow.Model.FLOW_DEFINE dmodel in lclist_mb)
                            {
                                FlowData fd = new FlowData();//
                                fd.Name  = dmodel.DEFINE_NAME;
                                fd.Code  = dmodel.DEFINE_CODE;
                                fd.Count = WorkFlow.BLL.Operate.getMyHandledTaskByParentCode(CFunctions.getUserId(context), CFunctions.getRoleId(context), ftd.type.TYPE_CODE, fd.Code).Count;
                                count   += fd.Count;
                                ftd.datalist.Add(fd);
                            }
                        }
                    }
                    ftd.Count = count;
                    list.Add(ftd);
                }

                //foreach (WorkFlow.Model.FLOW_TYPE type in typelist)
                //{
                //    List<WorkFlow.Model.FLOW_DEFINE> lclist_temp = definelist.Where(p => p.TYPE_CODE == type.TYPE_CODE).ToList<WorkFlow.Model.FLOW_DEFINE>();
                //    FlowTypeData ftd = new FlowTypeData();
                //    int count = 0;
                //    foreach (WorkFlow.Model.FLOW_DEFINE dmodel in lclist_temp)
                //    {
                //        FlowData fd = new FlowData();//
                //        fd.Name = dmodel.DEFINE_NAME;
                //        fd.Code = dmodel.DEFINE_CODE;
                //        //类别和名称下有多少流程
                //        fd.Count = WorkFlow.BLL.Operate.getMyHandledTaskByParentCode(CFunctions.getUserId(context), "", type.TYPE_CODE, dmodel.DEFINE_CODE).Count;
                //        count += fd.Count;
                //        ftd.datalist.Add(fd);

                //    }
                //    ftd.type = type;
                //    ftd.Count = count;

                //    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();
            }
        }