예제 #1
0
    private void GetAllRows()
    {
        string oCol = OwnerColumn;
        string oID  = OwnerID;

        if (func.IsAdminUser() || func.GetsAdvSecurityMethod(strTableName) == "2")
        {
            oCol = string.Empty;
            oID  = string.Empty;
        }
        {
            collection = controller.FetchAllPaged((PageNumber - 1) * PageSize, PageSize, OrderBy, oCol, oID);
            numrows    = controller.FetchAllCount(oCol, oID);
        }
    }
예제 #2
0
    private void GetSearchRows()
    {
        string oCol = OwnerColumn;
        string oID  = OwnerID;
        IDictionary <string, object> par = new Dictionary <string, object>();

        if (func.IsAdminUser() || func.GetsAdvSecurityMethod(strTableName) == "2")
        {
            oCol = string.Empty;
            oID  = string.Empty;
        }
        if (string.IsNullOrEmpty(SearchField))
        {
            if (par.Count > 0)
            {
                collection = controller.FetchByAllParameters(SearchOption, SearchFor, (PageNumber - 1) * PageSize, PageSize, OrderBy, OwnerColumn, OwnerID, par);
                numrows    = controller.FetchByAllParametersCount(SearchOption, SearchFor, oCol, oID, par);
            }
            else
            {
                collection = controller.FetchByAllParameters(SearchOption, SearchFor, (PageNumber - 1) * PageSize, PageSize, OrderBy, OwnerColumn, OwnerID);
                numrows    = controller.FetchByAllParametersCount(SearchOption, SearchFor, oCol, oID);
            }
        }
        else
        {
            if (par.Count > 0)
            {
                collection = controller.FetchByParameter(SearchField, SearchOption, SearchFor, (PageNumber - 1) * PageSize, PageSize, OrderBy, OwnerColumn, OwnerID, par);
                numrows    = controller.FetchByParameterCount(SearchField, SearchOption, SearchFor, oCol, oID, par);
            }
            else
            {
                collection = controller.FetchByParameter(SearchField, SearchOption, SearchFor, (PageNumber - 1) * PageSize, PageSize, OrderBy, OwnerColumn, OwnerID);
                numrows    = controller.FetchByParameterCount(SearchField, SearchOption, SearchFor, oCol, oID);
            }
        }
    }
예제 #3
0
    private void GetData()
    {
        bool bNoRecordsFirstPage = false;

        if (bNoRecordsFirstPage)
        {
            collection = new Data.DOKUMENCollection();
            numrows    = 0;
        }
        else
        {
            if (Search == 0)
            {
                GetSearchRows();
            }
            else if (Search == 2)
            {
                GetAdvancedSearchRows();
            }
            else
            {
                GetAllRows();
            }
        }


        Data.KELENGKAPANController KELENGKAPAN_detailController = new Data.KELENGKAPANController();
        //foreach @TABLE.arrKeyFields as @tk
        ArrayList KELENGKAPAN_masterids = new ArrayList();

        for (int i = 0; i < collection.Count; ++i)
        {
            try{
                KELENGKAPAN_masterids.Add(collection[i].KODEDOKUMEN.ToString());
            }
            catch
            {
            }
        }
        KELENGKAPAN_detailCollection = KELENGKAPAN_detailController.FetchForDetails("KODEDOKUMEN", KELENGKAPAN_masterids.ToArray(), OwnerColumn, OwnerID);
        //	save SQL for use in "Export" and "Printer-friendly" pages
        //	select and display records
        if (allow_search)
        {
            //	 Pagination:
            if (numrows == 0)
            {
                rowsfound = false;
                message   = "No records found";
                IDictionary message_block = array();
                message_block["begin"] = "<span name=\"notfound_message\">";
                message_block["end"]   = "</span>";
                smarty.Add("message_block", message_block);
                smarty.Add("message", message);
            }
            else
            {
                rowsfound = true;
                int maxRecords = numrows;
                smarty.Add("records_found", numrows);
                int maxpages = (int)Math.Ceiling((double)maxRecords / PageSize);
                if (mypage > maxpages)
                {
                    mypage = maxpages;
                }
                if (mypage < 1)
                {
                    mypage = 1;
                }
                smarty.Add("page", mypage);
                smarty.Add("maxpages", maxpages);


                //	write pagination
                if (maxpages > 1)
                {
                    smarty.Add("pagination_block", true);
                    string pagination = string.Format("<script language=\"JavaScript\">WritePagination({0},{1});function GotoPage(nPageNumber)", mypage, maxpages);
                    pagination += "{window.location='DOKUMEN_list.aspx?goto=' + nPageNumber;}</script>";
                    smarty.Add("pagination", pagination);
                }
            }

            //	hide colunm headers if needed
            int recordsonpage = numrows - (mypage - 1) * PageSize;
            if (recordsonpage > PageSize)
            {
                recordsonpage = PageSize;
            }
            colsonpage = 1;
            if (colsonpage > recordsonpage)
            {
                colsonpage = recordsonpage;
            }
            if (colsonpage < 1)
            {
                colsonpage = 1;
            }
        }
    }
예제 #4
0
    private void GetAdvancedSearchRows()
    {
        string[] asearchfield = this.Request.Form.GetValues("asearchfield[]");
        if (asearchfield == null)
        {
            asearchfield = Asearchfield;
        }
        IDictionary <string, object> par = new Dictionary <string, object>();
        string oCol = OwnerColumn;
        string oID  = OwnerID;

        if (func.IsAdminUser() || func.GetsAdvSecurityMethod(strTableName) == "2")
        {
            oCol = string.Empty;
            oID  = string.Empty;
        }
        if (par.Count > 0)
        {
            collection = controller.FetchForAdvancedSearch(asearchfield,
                                                           Asearchopt,
                                                           Asearchfor,
                                                           Asearchfor2,
                                                           Asearchnot,
                                                           (Asearchtype == "and"),
                                                           (PageNumber - 1) * PageSize,
                                                           PageSize,
                                                           OrderBy,
                                                           oCol, oID, par);

            numrows = controller.FetchForAdvancedSearchCount(asearchfield,
                                                             Asearchopt,
                                                             Asearchfor,
                                                             Asearchfor2,
                                                             Asearchnot,
                                                             (Asearchtype == "and"),
                                                             (PageNumber - 1) * PageSize,
                                                             PageSize,
                                                             OrderBy,
                                                             oCol, oID, par);
        }
        else
        {
            collection = controller.FetchForAdvancedSearch(asearchfield,
                                                           Asearchopt,
                                                           Asearchfor,
                                                           Asearchfor2,
                                                           Asearchnot,
                                                           (Asearchtype == "and"),
                                                           (PageNumber - 1) * PageSize,
                                                           PageSize,
                                                           OrderBy,
                                                           oCol, oID);

            numrows = controller.FetchForAdvancedSearchCount(asearchfield,
                                                             Asearchopt,
                                                             Asearchfor,
                                                             Asearchfor2,
                                                             Asearchnot,
                                                             (Asearchtype == "and"),
                                                             (PageNumber - 1) * PageSize,
                                                             PageSize,
                                                             OrderBy,
                                                             oCol, oID);
        }
    }