Пример #1
0
    public override void DataBind()
    {
        int    RecordCount   = 0;
        int    SelectedIndex = drpCategory.SelectedIndex;
        String SearchKey     = txtName.Text.Trim();
        int    DeptID        = Convert.ToInt32(Request.Params["DeptID"]);

        if (SelectedIndex == 0)
        {
            //团体体检或体检收费

            List <DepartmentGroupViewEntity> DataSource;
            //检索团体体检是否设置了套餐
            using (DepartmentGroupBusiness DeptGroup = new DepartmentGroupBusiness()) {
                DataSource = DeptGroup.GetDepartmentGroups(DeptID);
            }
            //团体客户有体检套餐设置
            if (DataSource.Count > 0)
            {
                PackageRepeater.DataSource = DataSource;
                Pager.RecordCount          = DataSource.Count;
            }
            //团体客户未设置体检套餐
            if (DataSource.Count <= 0)
            {
                using (PackageBusiness Package = new PackageBusiness()) {
                    PackageRepeater.DataSource = Package.GetPackages(Pager.CurrentPageIndex,
                                                                     Pager.PageSize, SearchKey, PackageSex, out RecordCount);;
                    Pager.RecordCount = RecordCount;
                }
            }

            Pager.Visible  = true;
            Pager1.Visible = false;
            Panel.Visible  = false;
        }
        if (SelectedIndex == 1)
        {
            using (ItemGroupBusiness ItemGroup = new ItemGroupBusiness()) {
                ItemGroupRepeater.DataSource = ItemGroup.GetItemGroups(Pager1.CurrentPageIndex, Pager1.PageSize,
                                                                       SearchKey, ItemGroupSex, out RecordCount);
                Pager1.RecordCount = RecordCount;
            }
            Pager.Visible  = false;
            Pager1.Visible = true;
            Panel.Visible  = true;
        }
        base.DataBind();
    }
 private void BindDepartmentGroup(int DeptID)
 {
     GroupRepeater.DataSource = m_DeptGroup.GetDepartmentGroups(DeptID);
     GroupRepeater.DataBind();
 }