コード例 #1
0
    private void BindData(int CurrentPageIndex)
    {
        int nStatus = -1;
        string sKeyword ="";

        int nPageSize = 1000;
        int nPageCount = Constants.PAGECOUNT;

        DataTable dtbPage = new DataTable();
        StaticPages objPage = new StaticPages();

        dtbPage = objPage.Search(sKeyword, 0,0, nStatus, CurrentPageIndex, nPageSize, ref nPageCount);
        FlowCategory flow = new FlowCategory(dtbPage, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME);

        if (nStatus == -1 && sKeyword == string.Empty) // search all
        {
            DataTable objTable = new DataTable();
            StaticPages obj = new StaticPages();
            objTable = obj.Search("", 0,1,  -1, 1, 10000, ref nPageCount);

            FlowCategory objflow = new FlowCategory(objTable, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME);
            objflow.IDColumnName = "StaticPageID";
            objflow.ParentIDColumName = "[Parent]";
            flow.SortColumnName = "MenuName";

            objflow.SortColumnName = "Priority";
            objflow.ParentSortDirection = "ASC";

            if (objflow.Execute(0))
            {
                int iCurrIndex = 0;
                if (CurrentPageIndex > 0) iCurrIndex = CurrentPageIndex - 1;
                mCateData = objflow.DestinationData();
                FlowPager pager = new FlowPager(mCateData, nPageSize, "[Parent]");

                DataView vwPage = pager.GeneralPageByIndex(iCurrIndex, VERTICAL_COLUMN_NAME);
                hidSearchStatus.Value = "1";
                RpStaticPage.DataSource = vwPage;

                nPageCount = mCateData.Rows.Count;
                nPageSize = pager.TotalRecord;
            }

            mCateData = objflow.DestinationData();

            RpStaticPage.DataBind();
            //lblTotalRecord.Text = "Có" + " " + +nPageCount + " " + "Bản ghi được tìm thấy";

        }
        else // Search Active or Inactive
        {
            hidSearchStatus.Value = "0";
            RpStaticPage.DataBind();
            //lblTotalRecord.Text = ConvertData.ConvertToString(nPageCount);
        }
    }
コード例 #2
0
    private void BindDataToDropCategory()
    {
        int nPageCount = 0;
        ddlCategory.Items.Clear();
        DataTable objTable = new DataTable();
        StaticPages objStaticPages = new StaticPages();
        objTable = objStaticPages.Search("", 0,0, -1, 1, 10000, ref nPageCount);
        int nCount = objTable.Rows.Count;
        FlowCategory flow = new FlowCategory(objTable, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME);
        flow.IDColumnName = "StaticPageID";
        flow.ParentIDColumName = "[Parent]";
        flow.SortColumnName = "MenuName";

        flow.SortColumnName = "Priority";
        flow.ParentSortDirection = "ASC";
        if (flow.Execute(0))
        {
            mCateData = flow.DestinationData();
        }
        if (mCateData != null)
        {
            foreach (DataRow dr in mCateData.Rows)
            {
                if (dr != null)
                {
                    string sText = Convert.ToString(dr["MenuName"]);
                    Int16 iHolz = Convert.ToInt16(dr[HOLIZOTAL_COLUMN_NAME]);
                    textCreateMarginLeft(ref sText, iHolz);
                    ListItem item = new ListItem(sText, Convert.ToString(dr["StaticPageID"]));
                    ddlCategory.Items.Add(item);
                }
            }

            Utl1.SetNonSelectToControl(ddlCategory, MultipleLanguage.DDL_SELECTVALUE, "0");
        }
        else
        {
            ddlCategory.DataSource = mCateData;
            ddlCategory.DataTextField = "MenuName";

            ddlCategory.DataValueField = "StaticPageID";

            ddlCategory.DataBind();
            Utl1.SetNonSelectToControl(ddlCategory, "Tất cả", "0");

        }
    }