示例#1
0
        /// <summary>
        /// Action <code>ActionPrivate_List_Navigation_GetPageNumbers</code> that represents the Service Studio
        ///  user action <code>Private_List_Navigation_GetPageNumbers</code> <p> Description: </p>
        /// </summary>
        public static void ActionPrivate_List_Navigation_GetPageNumbers(HeContext heContext, int inParamStartIndex, int inParamLineCount, int inParamTotalRowCount, int inParamMaxPageNumbers, out RLListNavigation_PageNumberRecordList outParamPageNumbers)
        {
            lcoPrivate_List_Navigation_GetPageNumbers result    = new lcoPrivate_List_Navigation_GetPageNumbers();
            lcvPrivate_List_Navigation_GetPageNumbers localVars = new lcvPrivate_List_Navigation_GetPageNumbers(inParamStartIndex, inParamLineCount, inParamTotalRowCount, inParamMaxPageNumbers);

            if (heContext != null && heContext.RequestTracer != null)
            {
                heContext.RequestTracer.RegisterInternalCall("NU0efdNzk06AYlO38KWVbg", "Private_List_Navigation_GetPageNumbers", "X0RMeX3yYU+0eg2nFEDfaA", "ContactManager");
            }
            try {
                if ((((localVars.inParamMaxPageNumbers > 0) && (localVars.inParamLineCount > 0))))
                {
                    // Init
                    // CurrentPageNumberMinus1 = Trunc
                    localVars.varLcCurrentPageNumberMinus1 = (((int)BuiltInFunction.Trunc(((decimal)(((decimal)localVars.inParamStartIndex)) /
                                                                                           (decimal)(((decimal)localVars.inParamLineCount))))));
                    // LastPageNumber = Trunc + TextToInteger
                    localVars.varLcLastPageNumber = (((int)(BuiltInFunction.Trunc(((decimal)(((decimal)localVars.inParamTotalRowCount)) /
                                                                                   (decimal)(((decimal)localVars.inParamLineCount)))) + (((decimal)BuiltInFunction.TextToInteger(Convert.ToString(((((((decimal)0)) == BuiltInFunction.Mod((((decimal)localVars.inParamTotalRowCount)), (((decimal)localVars.inParamLineCount))))) ?(0):(1)))))))));
                    // MorePageNumber.ListNavigation_PageNumber.Number = "..."
                    localVars.varLcMorePageNumber.ssSTListNavigation_PageNumber.ssNumber = "...";
                    // Not enough page numbers?
                    if (((localVars.inParamMaxPageNumbers < localVars.varLcLastPageNumber)))
                    {
                        // Start at Current - MaxPageNumbers/2
                        // CurrentPageNumberMinus1 = Max
                        localVars.varLcCurrentPageNumberMinus1 = (((int)BuiltInFunction.Max((((decimal)0)), ((((decimal)localVars.varLcCurrentPageNumberMinus1)) - BuiltInFunction.Trunc(((decimal)(((decimal)localVars.inParamMaxPageNumbers)) /
                                                                                                                                                                                          (decimal)(((decimal)2))))))));
                        // AppendMoreAtBeginning?
                        if (((localVars.varLcCurrentPageNumberMinus1 != 0)))
                        {
                            // AppendMoreAtBeginning
                            ExtendedActions.ListAppend(heContext, result.outParamPageNumbers, localVars.varLcMorePageNumber);
                        }
                    }
                    else
                    {
                        // Start at beginning
                        // CurrentPageNumberMinus1 = 0
                        localVars.varLcCurrentPageNumberMinus1 = 0;
                    }

                    // CurrentPageFirstShownRowIndex = CurrentPageNumberMinus1 * LineCount
                    localVars.varLcCurrentPageFirstShownRowIndex = (localVars.varLcCurrentPageNumberMinus1 * localVars.inParamLineCount);
                    // LastShownPageNumber = Min
                    localVars.varLcLastShownPageNumber = (((int)BuiltInFunction.Min((((decimal)(localVars.varLcCurrentPageNumberMinus1 + localVars.inParamMaxPageNumbers))), (((decimal)localVars.varLcLastPageNumber)))));
                    // All numbers done?
                    while ((!(((localVars.varLcCurrentPageNumberMinus1 + 1) > localVars.varLcLastShownPageNumber))))
                    {
                        // PageNumber
                        // PageNumber.ListNavigation_PageNumber.Number = CurrentPageNumberMinus1 + 1
                        localVars.varLcPageNumber.ssSTListNavigation_PageNumber.ssNumber = Convert.ToString((localVars.varLcCurrentPageNumberMinus1 + 1));
                        // PageNumber.ListNavigation_PageNumber.Index = CurrentPageFirstShownRowIndex
                        localVars.varLcPageNumber.ssSTListNavigation_PageNumber.ssIndex = localVars.varLcCurrentPageFirstShownRowIndex;
                        // PageNumber.ListNavigation_PageNumber.IsCurrent = StartIndex = CurrentPageFirstShownRowIndex
                        localVars.varLcPageNumber.ssSTListNavigation_PageNumber.ssIsCurrent = (localVars.inParamStartIndex == localVars.varLcCurrentPageFirstShownRowIndex);
                        // CurrentPageFirstShownRowIndex = CurrentPageFirstShownRowIndex + LineCount
                        localVars.varLcCurrentPageFirstShownRowIndex = (localVars.varLcCurrentPageFirstShownRowIndex + localVars.inParamLineCount);
                        // CurrentPageNumberMinus1 = CurrentPageNumberMinus1 + 1
                        localVars.varLcCurrentPageNumberMinus1 = (localVars.varLcCurrentPageNumberMinus1 + 1);
                        // AppendPage
                        ExtendedActions.ListAppend(heContext, result.outParamPageNumbers, localVars.varLcPageNumber);
                    }

                    // AppendMoreAtEnd?
                    if (((localVars.varLcCurrentPageNumberMinus1 < localVars.varLcLastPageNumber)))
                    {
                        // AppendMoreAtEnd
                        ExtendedActions.ListAppend(heContext, result.outParamPageNumbers, localVars.varLcMorePageNumber);
                    }
                }
            }             // try

            finally {
                outParamPageNumbers = result.outParamPageNumbers;
            }
        }