Exemplo n.º 1
0
        /// <summary>
        /// 加载法规列表
        /// </summary>
        public void loadLocalLawList()
        {
            //removeFromFlp(flp_lawLibrary);
            List <Law>    list             = db.getLaws(lawFilter.queryParam);
            List <string> addedLastVersion = new List <string>(); //已经添加过的法规id

            LawListItems = new List <LawListItem>();              //法规控件列表,已排除了多版本干扰
            foreach (Law law in list)
            {
                if (addedLastVersion.Contains(law.lastversion.ToString()))
                {
                    continue;
                }
                else
                {
                    addedLastVersion.Add(law.lastversion.ToString());
                    LawListItem item = new LawListItem();
                    //查找同一部法规的全部版本(包括本身)
                    var allVersionList = list.Where(l => l.lastversion == law.lastversion).OrderByDescending(l => l.version);
                    if (allVersionList.Count() > 1)
                    {
                        item.law = allVersionList.First();//如果有多个版本,取最新版本
                    }
                    else
                    {
                        item.law = law;
                    }
                    item.laws       = allVersionList.ToList();
                    item.parentForm = this;
                    item.addVerionDropDown();
                    LawListItems.Add(item);
                    //flp_lawLibrary.Controls.Add(item);
                }
            }
            pagingLawLibrary.sumPage          = LawListItems.Count % pagingLawLibrary.countPerPage == 0 ? LawListItems.Count / pagingLawLibrary.countPerPage : LawListItems.Count / pagingLawLibrary.countPerPage + 1;
            pagingLawLibrary.currentPage      = 0;
            pagingLawLibrary.lbl_page.Text    = "第" + (pagingLawLibrary.currentPage + 1) + "/" + pagingLawLibrary.sumPage + "页";
            pagingLawLibrary.nud_page.Maximum = pagingLawLibrary.sumPage;
            pagingLawLibrary.nud_page.Minimum = 1;
            pagingLawLibrary.ll_p.Enabled     = false;
            if (pagingLawLibrary.sumPage < 2)
            {
                pagingLawLibrary.ll_n.Enabled = false; pagingLawLibrary.ll_p.Enabled = false;
            }
            else
            {
                pagingLawLibrary.ll_n.Enabled = true;
            }
        }
Exemplo n.º 2
0
        public void LoadSearchResultLaw(List <string> lawIdList)
        {
            //tbc.SelectedIndex = 0;
            tbc.SelectedTabIndex = 0;
            removeFromFlp(flp_lawLibrary);
            List <Law> list = new List <Law>();

            foreach (string lawId in lawIdList)
            {
                Law law = db.getLawById(lawId);
                if (law != null)
                {
                    list.Add(law);
                }
            }
            List <string> addedLastVersion = new List <string>();//已经添加过的法规id

            foreach (Law law in list)
            {
                if (addedLastVersion.Contains(law.lastversion.ToString()))
                {
                    continue;
                }
                else
                {
                    addedLastVersion.Add(law.lastversion.ToString());
                    LawListItem item = new LawListItem();
                    //查找同一部法规的全部版本(包括本身)
                    var allVersionList = list.Where(l => l.lastversion == law.lastversion).OrderByDescending(l => l.version);
                    item.law        = law;
                    item.laws       = allVersionList.ToList();
                    item.parentForm = this;
                    item.addVerionDropDown();
                    flp_lawLibrary.Controls.Add(item);
                }
            }
        }