public void GetData(string sidx, string sord, int?_page)
        {
            int rows = Functions.GetGridNumberOfRows();
            int numberOfPagesToShow = Functions.GetGridNumberOfPagesToShow();
            int currentPage         = _page is null ? 1 : Convert.ToInt32(_page);
            int startRowIndex       = ((currentPage * rows) - rows);
            int totalRecords        = WorkflowMaster.GetRecordCount();
            int totalPages          = (int)Math.Ceiling((float)totalRecords / (float)rows);
            List <WorkflowMaster> objWorkflowMasterCol = WorkflowMaster.SelectSkipAndTake(rows, startRowIndex, sidx + " " + sord);

            // fields and titles
            string[,] fieldNames = new string[, ] {
                { "WorkflowId", "Workflow Id" },
                { "WorkflowName", "Workflow Name" },
                { "LevelOfApprovals", "Level Of Approvals" },
                { "CreatedBy", "Created By" },
                { "CreatedOn", "Created On" },
                { "Updatedby", "Updatedby" },
                { "Updatedon", "Updatedon" }
            };

            // assign properties
            WorkflowMasterData       = objWorkflowMasterCol;
            WorkflowMasterFieldNames = fieldNames;
            TotalPages           = totalPages;
            CurrentPage          = currentPage;
            FieldToSort          = String.IsNullOrEmpty(sidx) ? "WorkflowId" : sidx;
            FieldSortOrder       = String.IsNullOrEmpty(sord) ? "asc" : sord;
            FieldToSortWithOrder = String.IsNullOrEmpty(sidx) ? "WorkflowId" : (sidx + " " + sord).Trim();
            NumberOfPagesToShow  = numberOfPagesToShow;
            StartPage            = Functions.GetPagerStartPage(currentPage, numberOfPagesToShow, totalPages);
            EndPage = Functions.GetPagerEndPage(StartPage, currentPage, numberOfPagesToShow, totalPages);
        }
    /// <summary>
    /// Shows how to get a specific number of sorted records, starting from an index.  The total number of records are also retrieved when using the SelectSkipAndTake() method.
    /// For example, if there are 200 records take only 10 records (numberOfRecordsToRetrieve), starting from the first index (startRetrievalFromRecordIndex = 0)
    /// The example below uses some variables, here are their definitions:
    /// totalRecordCount - total number of records if you were to retrieve everything
    /// startRetrievalFromRecordIndex - the index to start taking records from. Zero (0) E.g. If you want to skip the first 20 records, then assign 19 here.
    /// numberOfRecordsToRetrieve - take n records starting from the startRetrievalFromRecordIndex
    /// sortBy - to sort in Ascending order by Field Name, just assign just the Field Name, do not pass 'asc'
    /// sortBy - to sort in Descending order by Field Name, use the Field Name, a space and the word 'desc'
    /// </summary>
    private void SelectSkipAndTake()
    {
        int    startRetrievalFromRecordIndex = 0;
        int    numberOfRecordsToRetrieve     = 10;
        string sortBy = "WorkflowId";
        //string sortBy = "WorkflowId desc";

        // 1. select a specific number of sorted records starting from the index you specify
        List <WorkflowMaster> objWorkflowMasterCol = WorkflowMaster.SelectSkipAndTake(numberOfRecordsToRetrieve, startRetrievalFromRecordIndex, sortBy);

        // to use objWorkflowMasterCol please see the SelectAll() method examples
        // No need for Examples 1 and 2 because the Collection here is already sorted
        // Example 2:  directly bind to a GridView - for ASP.NET Web Forms
        // Example 3:  loop through all the WorkflowMaster(s).  The example above will only loop for 10 items.
    }
        /// <summary>
        /// Gets the list of data for use by the jqgrid plug-in
        /// </summary>
        public IActionResult OnGetGridData(string sidx, string sord, int _page, int rows, bool isforJqGrid = true)
        {
            int totalRecords  = WorkflowMaster.GetRecordCount();
            int startRowIndex = ((_page * rows) - rows);
            List <WorkflowMaster> objWorkflowMasterCol = WorkflowMaster.SelectSkipAndTake(rows, startRowIndex, sidx + " " + sord);
            int totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows);

            if (objWorkflowMasterCol is null)
            {
                return(new JsonResult("{ total = 0, page = 0, records = 0, rows = null }"));
            }

            var jsonData = new
            {
                total = totalPages,
                _page,
                records = totalRecords,
                rows    = (
                    from objWorkflowMaster in objWorkflowMasterCol
                    select new
                {
                    id = objWorkflowMaster.WorkflowId,
                    cell = new string[] {
                        objWorkflowMaster.WorkflowId.ToString(),
                        objWorkflowMaster.WorkflowName,
                        objWorkflowMaster.LevelOfApprovals.HasValue ? objWorkflowMaster.LevelOfApprovals.Value.ToString() : "",
                        objWorkflowMaster.CreatedBy,
                        objWorkflowMaster.CreatedOn.ToString("d"),
                        objWorkflowMaster.Updatedby,
                        objWorkflowMaster.Updatedon.ToString("d")
                    }
                }).ToArray()
            };

            return(new JsonResult(jsonData));
        }