Esempio n. 1
0
        public IEnumerable <Company> GetAllByPaging(PagingItem pagingItem)
        {
            List <Company> list = new List <Company>();

            try
            {
                Database  db = this.GetDatabase();
                string    storeNameProcedure = "Company_GetAllByPaging";
                DbCommand dbCommand          = db.GetStoredProcCommand(storeNameProcedure);
                db.AddInParameter(dbCommand, "orderBy", DbType.String, pagingItem.OrderBy);
                db.AddInParameter(dbCommand, "directionSort", DbType.String, pagingItem.DirectionSort);
                db.AddInParameter(dbCommand, "pageIndex", DbType.Int32, pagingItem.PageIndex);
                db.AddInParameter(dbCommand, "pageSize", DbType.Int32, pagingItem.PageSize);
                db.AddOutParameter(dbCommand, "totalRows", DbType.Int32, 0x20);
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    list = FillCollection(dataReader);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(list);
        }
        public IEnumerable <Employees> GetAllByPaging(PagingItem pagingItem)
        {
            if (pagingItem == null)
            {
                pagingItem = new PagingItem();
            }
            IEnumerable <Employees> list = null;

            try
            {
                Database  db        = this.GetDatabase();
                string    storeName = "Employee_Get_All_By_Paging";
                DbCommand dbCommand = db.GetStoredProcCommand(storeName);
                db.AddInParameter(dbCommand, "orderBy", DbType.String, pagingItem.OrderBy);
                db.AddInParameter(dbCommand, "directionSort", DbType.String, pagingItem.DirectionSort);
                db.AddInParameter(dbCommand, "pageSize", DbType.Int32, pagingItem.PageSize);
                db.AddInParameter(dbCommand, "pageIndex", DbType.Int32, pagingItem.PageIndex);
                db.AddOutParameter(dbCommand, "totalRows", DbType.Int32, 0x20);
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    list = FillCollection(dataReader);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(list);
        }
 private static string GetClassName(PagingItem item)
 {
     if (!item.IsCurrent)
     {
         return(" class=\"paging-button\"");
     }
     else
     {
         return(" class=\"paging-button-current\"");
     }
 }
        /// <summary>
        ///     Gets the paginate text button.
        /// </summary>
        /// <param name="pagingItem">The paging item.</param>
        /// <returns>The button.</returns>
        private Button GetPaginateTextButton(PagingItem pagingItem)
        {
            var pagingView   = new BaseGridView();
            var foundButtons =
                pagingView.PageTextButtons.Where(button => button.Text.Equals(pagingItem.ToStringValue())).ToList();

            if (!foundButtons.Any())
            {
                throw new ArgumentException("The paginate button " + pagingItem.ToStringValue() + " is not displayed");
            }

            return(foundButtons.First());
        }
Esempio n. 5
0
        public ExcutionResult GetAllByPaging(PagingItem pagingItem)
        {
            ExcutionResult ex = new ExcutionResult();

            try
            {
                var p = FeedBackManager.GetAllByPaging(pagingItem);
                ex.Data     = p;
                ex.MetaData = pagingItem;
            }
            catch (Exception e)
            {
                ex.ErrorCode = 1;
                ex.Message   = e.Message;
            }
            return(ex);
        }
Esempio n. 6
0
        public ExcutionResult GetAllByPaging(PagingItem pagingItem)
        {
            ExcutionResult result = new ExcutionResult();

            try
            {
                var param = HolidayManager.GetAllByPaging(pagingItem);
                result.Data     = param;
                result.MetaData = pagingItem;
            }
            catch (Exception e)
            {
                result.ErrorCode = 1;
                result.Message   = e.Message;
                _iLogger.LogError(e.Message, e);
            }
            return(result);
        }
Esempio n. 7
0
        public IActionResult GetAllByPaging(PagingItem pagingItem)
        {
            var rs = _empService.GetAllByPaging(pagingItem);

            return(Ok(rs));
        }
Esempio n. 8
0
 public static IEnumerable <AppParam> GetAllByPaging(PagingItem pagingItem)
 {
     return(provider.GetAllByPaging(pagingItem));
 }
Esempio n. 9
0
 public IEnumerable <Trip> GetAllByPaging(PagingItem pagingItem)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 public static IEnumerable <Holiday> GetAllByPaging(PagingItem pagingItem)
 {
     return(provider.GetAllByPaging(pagingItem));
 }
Esempio n. 11
0
 /// <summary>
 ///     Determines whether paginate button disabled.
 /// </summary>
 /// <param name="pagingItem">The paging item.</param>
 /// <returns>The Flag.</returns>
 public bool IsPaginateTextButtonDisabled(PagingItem pagingItem)
 {
     return(GetPaginateTextButton(pagingItem).GetAttribute("class").Contains("disabled"));
 }
Esempio n. 12
0
 /// <summary>
 ///     Navigates to <see cref="PagingItem" />.
 /// </summary>
 /// <param name="pagingItem">The paging item.</param>
 /// <exception cref="System.ArgumentException">The paginate button  + pagingItem.ToStringValue() +  is not displayed.</exception>
 public void NavigateToItem(PagingItem pagingItem)
 {
     GetPaginateTextButton(pagingItem).Click();
 }
Esempio n. 13
0
 public static IEnumerable <Employees> GetAllByPaging(PagingItem pagingItem)
 {
     return(provider.GetAllByPaging(pagingItem));
 }
Esempio n. 14
0
        public void GetForumThread()
        {
            int    forumThreadID  = ProviderBase.Framework.Utility.GetFormValue <int>("ID", 0);
            int    pageCurrent    = ProviderBase.Framework.Utility.GetFormValue <int>("PageCurrent", 1);
            int    pageSize       = ProviderBase.Framework.Utility.GetFormValue <int>("PageSize", 10);
            string templatePrefix = ProviderBase.Framework.Utility.GetFormValue <string>("TemplatePrefix", "");
            string templateName   = "ForumThreadRepeat.htm";
            string templateFinal  = "";

            if (string.IsNullOrEmpty(templatePrefix))
            {
                templatePrefix = this.Website.WebsiteTemplatePrefix;
            }

            if (forumThreadID > 0)
            {
                ForumThread forumThreadItem     = null;
                DataProviderResultFilter paging = null;

                paging = new DataProviderResultFilter();
                paging.SetPaging(typeof(ForumArea), typeof(List <ForumThread>), pageCurrent, pageSize);

                forumThreadItem = DataProvider.SelectSingleFull(new ForumThread()
                {
                    ForumThreadID = forumThreadID
                }, this.Website.WebsiteConnection.ConnectionString, paging);

                if (forumThreadItem?.ForumThreadID > 0)
                {
                    ForumArea forumAreaItem = null;

                    forumAreaItem = ProviderBase.Data.Providers.DataProvider.SelectSingle <ForumArea>(new ForumArea()
                    {
                        ForumAreaID = forumThreadItem.ForumAreaID
                    }, this.Website.WebsiteConnection.ConnectionString);

                    if (forumAreaItem?.ForumAreaID > 0)
                    {
                        ForumGroupUserRoleLink forumGroupUserRoleLink = null;

                        forumGroupUserRoleLink = ProviderBase.Data.Providers.DataProvider.SelectSingleUsingDefault <ForumGroupUserRoleLink>(new ForumGroupUserRoleLink()
                        {
                            UserRoleTypeID = this.User.UserRoleTypeID,
                            ForumGroupID   = forumAreaItem.ForumGroupID
                        }, this.Website.WebsiteConnection.ConnectionString, "UserRoleTypeID", "ForumGroupID");

                        if (forumGroupUserRoleLink?.UserRoleLevelID > 0)
                        {
                            TemplateFile    templateFileTemp = null;
                            ForumThreadView forumThreadView  = null;

                            templateFileTemp = new TemplateFile(templatePrefix + templateName, this.Website.WebsiteTemplateFolder);

                            forumThreadItem.PageSize = pageSize; // Override page size so BindTemplateFileContentRepeat is correct

                            templateFileTemp.BindTemplateFileContent(forumAreaItem, "FORUMAREA");
                            templateFileTemp.BindTemplateFileContent(forumThreadItem);
                            templateFileTemp.BindTemplateFileContentRepeat(forumThreadItem);

                            if (forumThreadItem.ThreadMessageList?.Count > 0)
                            {
                                PagingItem pagingItem = null;

                                pagingItem = ProviderBase.Data.Utility.XMLDeseralize <PagingItem>(this.Context.Server.MapPath(@"/Resource/XML/") + "Conquest/ConquestGamingPaging.xml");

                                templateFileTemp.BindTemplateFileContentRepeatSingle("$PAGING$", Utility.GeneratePaging(pagingItem, forumThreadItem.ThreadMessageList[0].PageCurrent, forumThreadItem.ThreadMessageList[0].PageTotal));
                                templateFileTemp.BindTemplateFileContentRepeatSingle("$PAGESIZE$", pageSize);

                                foreach (ForumThreadMessage forumThreadMessageItem in forumThreadItem.ThreadMessageList)
                                {
                                    CharacterUser characterUser = null;

                                    characterUser = DataProvider.SelectSingleFull <CharacterUser>(new CharacterUser()
                                    {
                                        UserID = forumThreadMessageItem.CharacterUserID
                                    }, this.Website.WebsiteConnection.ConnectionString);

                                    templateFileTemp.BindTemplateFileContentRepeatItem(new List <object>()
                                    {
                                        forumThreadMessageItem, characterUser
                                    });
                                }

                                forumThreadView = new ForumThreadView();
                                forumThreadView.CharacterUserID   = this.User.UserID;
                                forumThreadView.ForumThreadID     = forumThreadID;
                                forumThreadView.CreateDate        = DateTime.Now;
                                forumThreadView.ForumThreadViewID = DataProvider.Insert <ForumThreadView>(forumThreadView, this.Website.WebsiteConnection.ConnectionString);
                            }
                            else
                            {
                                templateFileTemp.BindTemplateFileContentSingle("$PAGING$", "");
                            }

                            templateFinal += templateFileTemp.TemplateFinalise(this.User);

                            this.AjaxResult.Data.Add(templateFinal);
                            this.AjaxResult.Message = "Get forum thread success";
                            this.AjaxResult.Status  = AjaxResultStatus.Success;
                        }
                        else
                        {
                            this.AjaxResult.Redirect = Utility.GetRedirect(this.Context, RedirectReason.InvalidPermission);
                            this.AjaxResult.Status   = AjaxResultStatus.Redirect;
                        }
                    }
                }
                else
                {
                    this.AjaxResult.Message = "No forum thread found";
                    this.AjaxResult.Status  = AjaxResultStatus.Failed;
                }
            }
            else
            {
                this.AjaxResult.Message = "No forum thread ID supplied";
                this.AjaxResult.Status  = AjaxResultStatus.Failed;
            }
        }
Esempio n. 15
0
 public static IEnumerable <FeedBacks> GetAllByPaging(PagingItem pagingItem)
 {
     return(provider.GetAllByPaging(pagingItem));
 }
Esempio n. 16
0
        public static string GeneratePaging(PagingItem pagingItem, int pageCurrent, int pageTotal)
        {
            string template = "";

            if (pagingItem != null && pageTotal > 1)
            {
                string templateButton    = "";
                string templateUpperBand = "";
                string templateLowerBand = "";
                int    templateUpperLoop = 0;
                int    templateLowerLoop = 0;

                template += "<div class=\"paging\">";

                templateButton += "<button type=\"submit\" name=\"PageCurrent\"";
                templateButton += (string.IsNullOrEmpty(pagingItem.PagingItemCSSClass) == false) ? $" class=\"{pagingItem.PagingItemCSSClass}\"" : "";

                if (pagingItem.IncludeFirst && pageCurrent > 1)
                {
                    template += templateButton;
                    template += $"value=\"{1}\"> << </button>";
                }

                if (pagingItem.IncludePrevious && pageCurrent > 1)
                {
                    template += templateButton;
                    template += $"value=\"{pageCurrent - 1}\"> < </button>";
                }

                if (pagingItem.PagingLowerBand > 0)
                {
                    string pagingLowerBandTemp = "";

                    for (int i = 1; i < pagingItem.PagingLowerBand + 1; i++)
                    {
                        int    newPage      = (pageCurrent - i);
                        string templateTemp = "";

                        if (newPage >= 1)
                        {
                            templateTemp += templateButton;
                            templateTemp += $"value=\"{newPage}\"> {newPage} </button>";

                            pagingLowerBandTemp = templateTemp + pagingLowerBandTemp;
                        }
                        else
                        {
                            templateLowerLoop++;
                        }
                    }

                    template += pagingLowerBandTemp;
                }

                template += "<button type=\"submit\" name=\"Paging\"";
                template += (string.IsNullOrEmpty(pagingItem.PagingItemCSSClass) == false) ? $" class=\"{pagingItem.PagingItemCSSClass}" : "";
                template += (string.IsNullOrEmpty(pagingItem.pagingItemSelectedCSSClass) == false) ? $" {pagingItem.pagingItemSelectedCSSClass}\"" : "\"";
                template += $"value=\"{pageCurrent}\"> {pageCurrent} </button>";

                if (pagingItem.PagingUpperBand > 0)
                {
                    for (int i = 1; i < pagingItem.PagingUpperBand + 1; i++)
                    {
                        int newPage = (pageCurrent + i);

                        if (newPage <= pageTotal)
                        {
                            templateUpperBand += templateButton;
                            templateUpperBand += $"value=\"{newPage}\"> {newPage} </button>";
                        }
                        else
                        {
                            templateUpperLoop++;
                        }
                    }
                }

                if (pagingItem.LoopPaging)
                {
                    for (int i = 1; i < templateLowerLoop + 1; i++)
                    {
                        int newPage = ((pageCurrent - pagingItem.PagingLowerBand) - i);

                        if (newPage > 1)
                        {
                            templateUpperBand += templateButton;
                            templateUpperBand += $"value=\"{i}\"> {i} </button>";
                        }
                    }

                    for (int i = 1; i < templateUpperLoop + 1; i++)
                    {
                        int newPage = ((pageCurrent + pagingItem.PagingUpperBand) + i);

                        if (newPage < pageTotal && newPage != pageCurrent)
                        {
                            string temp = "";

                            temp += templateButton;
                            temp += $"value=\"{i}\"> {i} </button>";

                            templateLowerBand = temp + templateLowerBand;
                        }
                    }
                }

                template += templateLowerBand;
                template += templateUpperBand;

                if (pagingItem.IncludeNext && pageCurrent < pageTotal)
                {
                    template += templateButton;
                    template += $"value=\"{pageCurrent + 1}\"> > </button>";
                }

                if (pagingItem.IncludeLast && pageCurrent < pageTotal)
                {
                    template += templateButton;
                    template += $"value=\"{pageTotal}\"> >> </button>";
                }

                template += "</div>";
            }

            return(template);
        }