Ejemplo n.º 1
0
 /// <summary>
 /// 获取控件相关的数据,不涉及界面(不读写界面元素)。
 /// </summary>
 protected override void OnLoadData()
 {
     if (!string.IsNullOrWhiteSpace(this.sdortmpltp))
     {
         this.viewModel.LoadOrTmplCaAndTmplData(this.sdortmpltp);
         this.treeModel = this.viewModel.GetTreeKeyModel();
     }
     isLoaded = true;
 }
        /// <summary>
        /// 获取树节点数据
        /// </summary>
        public void GetTreeKeyModel()
        {
            var adapter1 = new KeyNodeDataAdapterFactory <OrTmplCaDO>("Id_ortmplca", "Id_parent")
            {
                CustomCaptionFunc = x => x.Name
            };
            var adapter2 = new KeyNodeDataAdapterFactory <OrTmplDTO>("Id_ortmpl", null, "Id_ortmplca")
            {
                CustomCaptionFunc = x => x.Name
            };

            lazyLoadTreeModel = new LazyLoadTreeModel(CurrUdidocDO_SubOwnerType.Name);
            lazyLoadTreeModel.LazyLoadChildren = (oTree, bizNode) =>
            {
                if (bizNode.IsRoot)
                {
                    foreach (var caDO in LstOrTmplCaDOs)
                    {
                        if (caDO.Id_parent == null)
                        {
                            var data = adapter1.Wrap(caDO);
                            oTree.AppendBizNode(bizNode, data);
                        }
                    }
                }
                else
                {
                    OrTmplCaDO moduleDo = bizNode.UserObject as OrTmplCaDO;
                    if (moduleDo != null)
                    {
                        foreach (var caDO in LstOrTmplCaDOs)
                        {
                            if (caDO.Id_parent != null && moduleDo.Id_ortmplca == caDO.Id_parent)
                            {
                                var data = adapter1.Wrap(caDO);
                                oTree.AppendBizNode(bizNode, data);
                            }
                        }

                        foreach (var dto in LstOrTmplDTOs)
                        {
                            if ((strIpOp == "1" && (bool)dto.Fg_entp_ip) || (strIpOp == "0" && ((bool)dto.Fg_entp_op || (bool)dto.Fg_entp_er)))
                            {
                                if (dto.Id_ortmplca == moduleDo.Id_ortmplca)
                                {
                                    var data = adapter2.Wrap(dto);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                            }
                        }
                    }
                }
                return(true);
            };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取树节点数据
        /// </summary>
        public void GetTreeKeyModel()
        {
            var adapter1 = new KeyNodeDataAdapterFactory <UdidocDO>("Id_udidoc", "Id_udidoc")
            {
                CustomCaptionFunc = x => x.Name
            };
            var adapter2 = new KeyNodeDataAdapterFactory <EntDiProveDO>("Id_diprove", null, "Id_diprovetp")
            {
                CustomCaptionFunc = x => x.Name_emp + string.Format("{0}-{1:D2}-{2:D2}", ((DateTime)x.Dt_diprove).Date.Year, ((DateTime)x.Dt_diprove).Date.Month, ((DateTime)x.Dt_diprove).Date.Day)
            };

            lazyLoadTreeModel = new LazyLoadTreeModel("");
            lazyLoadTreeModel.LazyLoadChildren = (oTree, bizNode) =>
            {
                if (bizNode.IsRoot)
                {
                    //根节点下加载诊断证明分类
                    foreach (var udi in udidocDOs_DiceType)
                    {
                        var data = adapter1.Wrap(udi);
                        oTree.AppendBizNode(bizNode, data);
                    }
                }
                else
                {
                    //在非根节点下加载数据节点
                    UdidocDO moduleDo = bizNode.UserObject as UdidocDO;
                    if (moduleDo != null && "1" == moduleDo.Ctrl1)
                    {
                        //在分类节点下,加载数据节点(非数据独一模式,独一模式没必要显示数据节点)
                        foreach (var item in lstEntDiProveDOs)
                        {
                            if (item.Id_diprovetp != null && moduleDo.Id_udidoc == item.Id_diprovetp)
                            {
                                var data = adapter2.Wrap(item);
                                oTree.AppendBizNode(bizNode, data);
                            }
                        }
                    }
                }
                return(true);
            };
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取树懒加载数据源(模板分类和医嘱模板)
        /// </summary>
        public LazyLoadTreeModel GetTreeKeyModel()
        {
            var adapter1 = new KeyNodeDataAdapterFactory <OrTmplCaDO>("Id_ortmplca", "Id_parent")
            {
                CustomCaptionFunc = x => x.Name
            };
            var adapter2 = new KeyNodeDataAdapterFactory <OrTmplDTO>("Id_ortmpl", null, "Id_ortmplca")
            {
                CustomCaptionFunc = x => x.Name
            };

            String[]          nodesRoot         = new String[] { "全院", "科室", "个人" };
            LazyLoadTreeModel lazyLoadTreeModel = new LazyLoadTreeModel(nodesRoot);

            lazyLoadTreeModel.LazyLoadChildren = (oTree, bizNode) =>
            {
                if (bizNode.IsRoot)
                {
                    //判断是否根节点,第一级的分类没有父节点,加载第一级分类
                    foreach (var caDO in arryOrTmplCaDOs)
                    {
                        if (caDO.Id_parent == null)
                        {
                            switch (bizNode.UserObject.ToString())
                            {
                            case "全院":
                                if (caDO.Sd_srvorrt == BdSrvDictCodeConst.SD_OWTP_HOSPITAL)
                                {
                                    var data = adapter1.Wrap(caDO);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                                break;

                            case "科室":
                                if (caDO.Sd_srvorrt == BdSrvDictCodeConst.SD_OWTP_DEPT)
                                {
                                    var data = adapter1.Wrap(caDO);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                                break;

                            case "个人":
                                if (caDO.Sd_srvorrt == BdSrvDictCodeConst.SD_OWTP_PERSON)
                                {
                                    var data = adapter1.Wrap(caDO);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                                break;
                            }
                        }
                    }
                }
                else
                {
                    //在非根节点下加载节点
                    if (bizNode.UserObject is OrTmplCaDO)
                    {
                        OrTmplCaDO moduleDo = bizNode.UserObject as OrTmplCaDO;
                        if (moduleDo != null)
                        {
                            //非根节点下,加载分类节点
                            foreach (var caDO in arryOrTmplCaDOs)
                            {
                                if (caDO.Id_parent != null && moduleDo.Id_ortmplca == caDO.Id_parent)
                                {
                                    var data = adapter1.Wrap(caDO);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                            }
                            //非根节点下,加载模板节点
                            foreach (var dto in arrayOrTmplDTOs)
                            {
                                if (dto.Id_ortmplca == moduleDo.Id_ortmplca)
                                {
                                    var data = adapter2.Wrap(dto);
                                    oTree.AppendBizNode(bizNode, data);
                                }
                            }
                        }
                    }
                    else if (bizNode.UserObject is OrTmplDTO)
                    {//模板节点先加载“加载中...”
                        oTree.AppendBizNode(bizNode, "加载中...");
                    }
                }
                return(true);
            };
            return(lazyLoadTreeModel);
        }