Esempio n. 1
0
        public JsonResult GetIdeas(int mod, int page, string text, short?filter, bool?active)
        {
            StringBuilder strbl = new StringBuilder();

            IdeaRepository objidea   = new IdeaRepository(SessionCustom);
            PaginInfo      paginInfo = new PaginInfo()
            {
                PageIndex = page
            };

            objidea.Entity.Text   = text;
            objidea.Entity.Active = active;

            IEnumerable <Domain.Entities.Idea> ideas = objidea.GetAllPaging(filter, paginInfo);

            foreach (Domain.Entities.Idea idea in ideas)
            {
                strbl.AppendLine("<li id=\"li" + idea.IdeaId + "\" ondblclick=\"ctnback.editcontent(" + idea.IdeaId + ")\" onclick=\"if(ctnback.clicOk) { ctnback.contentselect(this, " + idea.IdeaId + "); } else { ctnback.clicOk = true; }\">");
                if (string.IsNullOrEmpty(idea.Image))
                {
                    strbl.AppendLine("<img id=\"" + idea.IdeaId + "\" class=\"handle\" src=\"" + Business.Utils.GetImageContent(idea.Image, idea.IdeaId.Value, 44, 44) + "\" width=\"44\" height=\"44\" />");
                }
                else
                {
                    strbl.AppendLine("<img id=\"" + idea.IdeaId + "\" class=\"handle\" src=\"/files/ideas/560x515-" + idea.Image + "\" width=\"44\" height=\"44\" />");
                }

                strbl.AppendLine("<div class=\"info-content\"><span title=\"Arrastre hacia una sección para cambiarla.\" class=\"sptitle cursor\">" + Business.Utils.TruncateWord(idea.Text, 85) + "</span><br />");
                strbl.AppendLine("<span class=\"spdate\">" + idea.Creationdate.Value.ToString("F") + "</span></div><div class=\"clear\"></div>");
                strbl.AppendLine("</li>");
            }

            return(this.Json(new { html = strbl.ToString(), count = ideas.Count(), total = paginInfo.TotalCount }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        /// <summary>
        /// gets the index of the idea report module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            IdeaReportRepository ideaReport = new IdeaReportRepository(SessionCustom);
            ModulRepository      modul      = new ModulRepository(SessionCustom);

            modul.Entity.ModulId    = 56;
            modul.Entity.LanguageId = CurrentLanguage.LanguageId;
            modul.Load();

            PaginInfo paginInfo = new PaginInfo()
            {
                PageIndex = 1
            };

            return(this.View(new Models.IdeaReport()
            {
                UserPrincipal = CustomUser,
                Module = modul.Entity,
                CollIdeaReport = ideaReport.GetAllPaging(null, paginInfo),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                Total = paginInfo.TotalCount,
                Controller = modul.Entity.Controller,
                CurrentLanguage = CurrentLanguage
            }));
        }
Esempio n. 3
0
        public JsonResult GetContent(int mod, int page, int?sectionId, string name, short?filter, bool?active)
        {
            StringBuilder strbl = new StringBuilder();

            ContentRepository content   = new ContentRepository(SessionCustom);
            PaginInfo         paginInfo = new PaginInfo()
            {
                PageIndex = page
            };

            content.Entity.Name       = name;
            content.Entity.Active     = active;
            content.Entity.SectionId  = sectionId;
            content.Entity.ModulId    = mod;
            content.Entity.LanguageId = CurrentLanguage.LanguageId;

            IEnumerable <Domain.Entities.Content> contents = content.GetAllPaging(filter, paginInfo);

            foreach (Domain.Entities.Content item in contents)
            {
                strbl.AppendLine("<li id=\"li" + item.ContentId + "\" ondblclick=\"ctnback.editcontent(" + item.ContentId + ")\" onclick=\"if(ctnback.clicOk) { ctnback.contentselect(this, " + item.ContentId + "); } else { ctnback.clicOk = true; }\">");
                ////strbl.AppendLine("<input style=\"float:right;\" onclick=\"ctnback.clicOk=false;\" type=\"checkbox\" value=\"" + item.ContentId + "\" />");
                strbl.AppendLine("<img order=\"" + item.Orderliness + "\" id=\"" + item.ContentId + "\" class=\"handle\" src=\"" + Business.Utils.GetImageContent(item.Image, item.ContentId.Value, 44, 44) + "\" width=\"44\" height=\"44\" />");
                strbl.AppendLine("<div class=\"info-content\"><span title=\"Arrastre hacia una sección para cambiarla.\" class=\"sptitle cursor\">" + Business.Utils.TruncateWord(item.Name, 85) + "</span><br />");
                strbl.AppendLine("<span class=\"spdate\">" + item.Joindate.Value.ToString("F") + "</span></div><div class=\"clear\"></div>");
                strbl.AppendLine("</li>");
            }

            return(this.Json(new { html = strbl.ToString(), count = contents.Count(), total = paginInfo.TotalCount }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public JsonResult GetIdeaReports(int mod, int page, string text, short?filter, bool?active)
        {
            StringBuilder strbl = new StringBuilder();

            IdeaReportRepository objideaReport = new IdeaReportRepository(SessionCustom);
            PaginInfo            paginInfo     = new PaginInfo()
            {
                PageIndex = page
            };

            objideaReport.Entity.Text   = text;
            objideaReport.Entity.Status = active;

            IEnumerable <Domain.Entities.FrontEnd.IdeaReportPaging> ideaReports = objideaReport.GetAllPaging(filter, paginInfo);

            foreach (Domain.Entities.FrontEnd.IdeaReportPaging ideaReport in ideaReports)
            {
                string ideaActive       = ideaReport.IdeaActive.Value ? "block" : "none";
                string ideaInActive     = !ideaReport.IdeaActive.Value ? "block" : "none";
                string ideaUserActive   = ideaReport.IdeaUserActive.Value ? "none" : "block";
                string ideaUserInActive = !ideaReport.IdeaUserActive.Value ? "none" : "block";
                strbl.AppendLine("<tr id=\"li" + ideaReport.IdeaReportId + "\" >");
                strbl.AppendLine("<td onclick=\"if(ctnback.clicOk) { ctnback.contentselect(this, " + ideaReport.IdeaReportId + "); } else { ctnback.clicOk = true; }\">" + Business.Utils.TruncateWord(ideaReport.IdeaText, 45) + "</td>");
                strbl.AppendLine("<td onclick=\"if(ctnback.clicOk) { ctnback.contentselect(this, " + ideaReport.IdeaReportId + "); } else { ctnback.clicOk = true; }\">" + ideaReport.Motive + "</td>");
                strbl.AppendLine("<td onclick=\"if(ctnback.clicOk) { ctnback.contentselect(this, " + ideaReport.IdeaReportId + "); } else { ctnback.clicOk = true; }\">" + Business.Utils.TruncateWord(ideaReport.Text, 45) + "</td>");
                strbl.AppendLine("<td>");
                if (!ideaReport.Status.Value)
                {
                    strbl.AppendLine("<a class=\"check-report\" data-id=\"" + ideaReport.IdeaReportId + "\">" + Resources.Global.Messages.CHECKED + "</a>");
                }
                else
                {
                    strbl.AppendLine("<img src=\"" + Url.Content("~/resources/images/25check.png") + "\" />");
                }

                strbl.AppendLine("</td>");
                strbl.AppendLine("<td data-id=\"" + ideaReport.IdeaId + "\">");
                strbl.AppendLine("<a class=\"block-idea\" style=\"display:" + ideaActive + ";\">" + Resources.Extend.Messages.BLOCK_IDEA + "</a>");
                strbl.AppendLine("<a class=\"unblock-idea\" style=\"display:" + ideaInActive + ";\">" + Resources.Extend.Messages.UNBLOCK_IDEA + "</a>");
                strbl.AppendLine("</td>");
                strbl.AppendLine("<td data-id=\"" + ideaReport.IdeaUserId + "\">");
                strbl.AppendLine("<a class=\"block-idea-user\" style=\"display:" + ideaUserActive + ";\">" + Resources.Extend.Messages.BLOCK_USER + "</a>");
                strbl.AppendLine("<a class=\"unblock-idea-user\" style=\"display:" + ideaUserInActive + ";\">" + Resources.Extend.Messages.UNBLOCK_USER + "</a>");
                strbl.AppendLine("</td></tr>");
            }

            return(this.Json(new { html = strbl.ToString(), count = ideaReports.Count(), total = paginInfo.TotalCount }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public void Can_Generate_Page_Links()
        {
            var paginInfo = new PaginInfo
            {
                CurrentPage  = 2,
                TotalItems   = 28,
                ItemsPerPage = 10
            };

            Func <int, string> pageUrlDelegate = i => "Page " + i;

            HtmlString result = _htmlHelper.PageLinks(paginInfo, pageUrlDelegate);

            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Page 1"">1</a>"
                            + @"<a class=""btn btn-default btn-primary selected"" href=""Page 2"">2</a>"
                            + @"<a class=""btn btn-default"" href=""Page 3"">3</a>", result.ToString());
        }
Esempio n. 6
0
        /// <summary>
        /// gets the home of tag module
        /// </summary>
        /// <param name="page">page index</param>
        /// <param name="name">criteria search</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Index(int?page, string name)
        {
            TagRepository objtag    = new TagRepository(SessionCustom);
            PaginInfo     paginInfo = new PaginInfo()
            {
                PageIndex = page != null ? page.Value : 1
            };

            return(this.View(new Tags()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                CollTags = objtag.GetAllPaging(name, paginInfo, CurrentLanguage.LanguageId.Value),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                Pagininfo = paginInfo,
                CurrentLanguage = CurrentLanguage
            }));
        }
Esempio n. 7
0
        /// <summary>
        /// obtains a list of users according to criteria search
        /// </summary>
        /// <param name="name">criteria search</param>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <returns>returns a list of users</returns>
        public List <User> GetAllPaging(string name, PaginInfo paginInfo)
        {
            List <User> col = new List <User>();

            this.Session.CreateCommand("CTUserpagin", true);
            this.Session.AddParameter("@Name", name, DbType.String);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);

            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                col.Add(new User(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));
            return(col);
        }
Esempio n. 8
0
        public static MvcHtmlString PageLinks(this HtmlHelper html, PaginInfo pagingInfo, Func <int, string> pageUrl)
        {
            StringBuilder result = new StringBuilder();

            for (int i = 1; i <= pagingInfo.TotalPages; i++)
            {
                TagBuilder tag = new TagBuilder("a");
                tag.MergeAttribute("href", pageUrl(i));
                tag.InnerHtml = i.ToString();
                if (i == pagingInfo.CurrentPage)
                {
                    tag.AddCssClass("selected");
                    tag.AddCssClass("btn-primary");
                }
                tag.AddCssClass("btn btn-default");
                result.Append(tag.ToString());
            }
            return(MvcHtmlString.Create(result.ToString()));
        }
Esempio n. 9
0
        /// <summary>
        /// fills the object's fields
        /// </summary>
        /// <param name="context">HTTP context</param>
        /// <param name="session">framework that establishes communication between the application and the database</param>
        /// <param name="id">identifier of section</param>
        /// <param name="userId">current user ID</param>
        public void Bind(HttpContextBase context, ISession session, int?id, int?userId, int?LanguageId)
        {
            ContentRepository content = new ContentRepository(session);

            this.Paginator = new PaginInfo()
            {
                PageIndex = 1, Size = 10
            };

            content.Entity.SectionId = id;

            this.Contentlast = content.GetContentSectionLast();

            if (this.Contentlast != null)
            {
                content.Entity.ContentId = this.Contentlast.ContentId;
                this.Contents            = content.GetNewsHome(this.Paginator, 1);
            }
        }
Esempio n. 10
0
        public ActionResult ContentRelation(int contentId, int?page, string name)
        {
            ContentRepository objcontent = new ContentRepository(SessionCustom);
            PaginInfo         paginInfo  = new PaginInfo()
            {
                Size      = 7,
                PageIndex = page != null ? page.Value : 1
            };

            objcontent.Entity.ContentId = contentId;
            objcontent.Entity.Name      = name;

            return(this.View(new ContentsRelations()
            {
                CollContentNoRel = objcontent.GetContentNoRelation(paginInfo, CurrentLanguage.LanguageId.Value),
                CollContentRel = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                Pagininfo = paginInfo
            }));
        }
Esempio n. 11
0
        /// <summary>
        /// get a list of unrelated content
        /// </summary>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <param name="languageId">identifier of language</param>
        /// <returns>returns a list of content</returns>
        public IEnumerable <ContentRel> GetContentNoRelation(PaginInfo paginInfo, int languageId)
        {
            List <ContentRel> col = new List <ContentRel>();

            this.Session.CreateCommand("CTContentrelationselect", true);
            this.Session.AddParameter("@ContentId", this.Entity.ContentId, DbType.Int32);
            this.Session.AddParameter("@Name", this.Entity.Name, DbType.String);
            this.Session.AddParameter("@LanguageId", languageId, DbType.Int32);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);
            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                col.Add(new ContentRel(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));
            return(col);
        }
Esempio n. 12
0
        /// <summary>
        /// obtains a list of tags according criteria search
        /// </summary>
        /// <param name="name">criteria search</param>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <param name="languageId">identifier of language</param>
        /// <returns>returns a list of labels</returns>
        public List <Label> GetAllPaging(string name, string translation, PaginInfo paginInfo, int languageId)
        {
            List <Label> col = new List <Label>();

            this.Session.CreateCommand("CTLabelpagin", true);
            this.Session.AddParameter("@LanguageId", languageId, DbType.Int32);
            this.Session.AddParameter("@Name", name, DbType.String);
            this.Session.AddParameter("@Translation", translation, DbType.String);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);
            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                col.Add(new Label(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));
            return(col);
        }
Esempio n. 13
0
        public void Can_Generate_Page_Links()
        {
            //arrange
            HtmlHelper myHelper = null;

            PaginInfo paginInfo = new PaginInfo
            {
                CurrentPage  = 2,
                TotalItems   = 30,
                ItemsPerPage = 10
            };

            Func <int, string> pageUrlDelegate = i => "Strona" + i;

            //act
            MvcHtmlString result = myHelper.PageLinks(paginInfo, pageUrlDelegate);

            //assert
            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Strona1"">1</a>" + @"<a class=""btn btn-default btn-primary selected"" href=""Strona2"">2</a>" + @"<a class=""btn btn-default"" href=""Strona3"">3</a>", result.ToString());
        }
Esempio n. 14
0
        public void TestMethod_PageLinks()
        {
            //arrange
            HtmlHelper helper    = null;
            PaginInfo  paginInfo = new PaginInfo
            {
                Current_Page  = 2,
                Total_Items   = 28,
                Items_On_Page = 10
            };

            Func <int, string> func = i => "Page" + i;

            //act
            MvcHtmlString rez = helper.Page_Links(paginInfo, func);

            //assert
            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Page1"">1</a>"
                            + @"<a class=""btn btn-default btn-primary selected"" href=""Page2"">2</a>"
                            + @"<a class=""btn btn-default"" href=""Page3"">3</a>", rez.ToString());
        }
Esempio n. 15
0
        /// <summary>
        /// obtains a list of content according to parameters
        /// </summary>
        /// <param name="filter">search filter</param>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <returns>returns a list of content</returns>
        public IEnumerable <IdeaReportPaging> GetAllPaging(short?filter, PaginInfo paginInfo)
        {
            List <IdeaReportPaging> col = new List <IdeaReportPaging>();

            this.Session.CreateCommand("CTIdeaReportgeneralpaging", true);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);
            this.Session.AddParameter("@Text", this.Entity.Text, DbType.String);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@Status", this.Entity.Status, DbType.Boolean);
            this.Session.AddParameter("@Filter", filter, DbType.Int32);

            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                col.Add(new IdeaReportPaging(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));
            return(col);
        }
Esempio n. 16
0
        /// <summary>
        /// obtains a list of content according to the section
        /// </summary>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <param name="action">filter to select</param>
        /// <returns>returns a list of content</returns>
        public List <Content> GetNewsHome(PaginInfo paginInfo, short action)
        {
            List <Content> coll = new List <Content>();

            this.Session.CreateCommand("CTContentNewshome", true);
            this.Session.AddParameter("@SectionId", this.Entity.SectionId, DbType.Int32);
            this.Session.AddParameter("@ContentId", this.Entity.ContentId, DbType.Int32);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@Action", action, DbType.Int16);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);
            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                coll.Add(new Content(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));

            return(coll);
        }
Esempio n. 17
0
        public static HtmlString PageLinks(this IHtmlHelper html,
                                           PaginInfo paginInfo, Func <int, string> pageUrl)
        {
            var result = new System.IO.StringWriter();

            for (int i = 1; i <= paginInfo.TotalPages; i++)
            {
                var tagBuilder = new TagBuilder("a");
                tagBuilder.MergeAttribute("href", pageUrl(i));
                tagBuilder.InnerHtml.Append(i.ToString());

                if (i == paginInfo.CurrentPage)
                {
                    tagBuilder.AddCssClass("selected");
                    tagBuilder.AddCssClass("btn-primary");
                }

                tagBuilder.AddCssClass("btn btn-default");
                tagBuilder.WriteTo(result, HtmlEncoder.Default);
            }
            return(new HtmlString(result.ToString()));
        }
Esempio n. 18
0
        public void Can_Send_Pagination_Model_View()
        {
            Mock <IProductRepository> mock = new Mock <IProductRepository>();

            mock.Setup(m => m.Products).Returns((new Product[] {
                new Product {
                    ProductID = 1, Name = "P1"
                },
                new Product {
                    ProductID = 2, Name = "P2"
                },
                new Product {
                    ProductID = 3, Name = "P3"
                },
                new Product {
                    ProductID = 4, Name = "P4"
                },
                new Product {
                    ProductID = 5, Name = "P5"
                }
            }).AsQueryable <Product>());

            ProductController controller =
                new ProductController(mock.Object)
            {
                PageSize = 3
            };


            ProductListViewModel result =
                controller.List(null, 2).ViewData.Model as ProductListViewModel;

            PaginInfo pageInfo = result.PaginInfo;

            Assert.Equal(2, pageInfo.CurrentPage);
            Assert.Equal(3, pageInfo.ItemsPerPage);
            Assert.Equal(5, pageInfo.TotalItems);
            Assert.Equal(2, pageInfo.TotalPages);
        }
Esempio n. 19
0
        public void Can_Send_Pagination_View_Model()
        {
            //arrange
            Mock <IProductRepository> mock = new Mock <IProductRepository>();

            mock.Setup(m => m.Products).Returns(new Product[] {
                new Product {
                    ProductID = 1, Name = "P1"
                },
                new Product {
                    ProductID = 2, Name = "P2"
                },
                new Product {
                    ProductID = 3, Name = "P3"
                },
                new Product {
                    ProductID = 4, Name = "P4"
                },
                new Product {
                    ProductID = 5, Name = "P5"
                }
            }
                                                );

            ProductController controller = new ProductController(mock.Object);

            controller.PageSize = 3;

            //act
            ProductListViewModel result = (ProductListViewModel)controller.List(null, 2).Model;

            //assert
            PaginInfo paginInfo = result.PaginInfo;

            Assert.AreEqual(paginInfo.CurrentPage, 2);
            Assert.AreEqual(paginInfo.ItemsPerPage, 3);
            Assert.AreEqual(paginInfo.TotalItems, 5);
            Assert.AreEqual(paginInfo.TotalPages, 2);
        }
Esempio n. 20
0
        public void TestMethod_PaginationViewModel()
        {
            //arrange
            Mock <IPartRepository> mock = new Mock <IPartRepository>();

            mock.Setup(m => m.Parts).Returns(new List <Part>
            {
                new Part {
                    Part_Id = 1, Name = "Part1"
                },
                new Part {
                    Part_Id = 2, Name = "Part2"
                },
                new Part {
                    Part_Id = 3, Name = "Part3"
                },
                new Part {
                    Part_Id = 4, Name = "Part4"
                },
                new Part {
                    Part_Id = 5, Name = "Part5"
                }
            });
            PartController controller = new PartController(mock.Object);

            controller.pageSize = 3;

            //act
            PartListViewModel rez = (PartListViewModel)controller.List(null, 2).Model;

            //assert
            PaginInfo paginInfo = rez.PaginInfo;

            Assert.AreEqual(paginInfo.Current_Page, 2);
            Assert.AreEqual(paginInfo.Items_On_Page, 3);
            Assert.AreEqual(paginInfo.Total_Items, 5);
            Assert.AreEqual(paginInfo.Total_Pages, 2);
        }
Esempio n. 21
0
        public ActionResult Index(int mod)
        {
            ContentRepository content    = new ContentRepository(SessionCustom);
            ModulRepository   modul      = new ModulRepository(SessionCustom);
            SectionRepository objsection = new SectionRepository(SessionCustom);

            PaginInfo paginInfo = new PaginInfo()
            {
                PageIndex = 1
            };

            content.Entity.ModulId    = mod;
            modul.Entity.ModulId      = content.Entity.ModulId = mod;
            content.Entity.LanguageId = modul.Entity.LanguageId = CurrentLanguage.LanguageId;
            modul.Load();

            ////objsection.Entity.Active = true;
            objsection.Entity.LanguageId = CurrentLanguage.LanguageId;

            if (HttpContext.Session["CollClones"] != null)
            {
                ViewBag.CollClone = (List <int>)HttpContext.Session["CollClones"];
            }

            return(this.View(new Models.Content()
            {
                UserPrincipal = CustomUser,
                Module = modul.Entity,
                CollSection = objsection.GetAll().Where(t => t.ParentId == null),
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollContent = content.GetAllPaging(null, paginInfo),
                Total = paginInfo.TotalCount,
                Controller = modul.Entity.Controller,
                CurrentLanguage = CurrentLanguage
            }));
        }
Esempio n. 22
0
        /// <summary>
        /// obtains a list of content according to parameters
        /// </summary>
        /// <param name="filter">search filter</param>
        /// <param name="paginInfo"><c>PaginInfo</c> object</param>
        /// <returns>returns a list of content</returns>
        public IEnumerable <Content> GetAllPaging(short?filter, PaginInfo paginInfo)
        {
            List <Content> col = new List <Content>();

            this.Session.CreateCommand("CTContentgeneralpagin", true);
            this.Session.AddParameter("@Name", this.Entity.Name, DbType.String);
            this.Session.AddParameter("@Active", this.Entity.Active, DbType.Boolean);
            this.Session.AddParameter("@SectionId", this.Entity.SectionId, DbType.Int32);
            this.Session.AddParameter("@LanguageId", this.Entity.LanguageId, DbType.Int32);
            this.Session.AddParameter("@ModulId", this.Entity.ModulId, DbType.Int32);
            this.Session.AddParameter("@Filter", filter, DbType.Int32);
            this.Session.AddParameter("@PageSize", paginInfo.Size, DbType.Int32);
            this.Session.AddParameter("@PageIndex", paginInfo.ActualRow, DbType.Int32);
            this.Session.AddParameter("@TotalCount", null, ParameterDirection.InputOutput, DbType.Int32);

            this.Session.ExecuteReader();
            while (this.Session.Read())
            {
                col.Add(new Content(this.Session.Reader));
            }

            paginInfo.TotalCount = Convert.ToInt32(this.Session.GetOutParameter("@TotalCount"));
            return(col);
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Paginator"/> class
 /// </summary>
 /// <param name="context">HTTP context</param>
 /// <param name="paginInfo">object <c>PaginInfo</c></param>
 public Paginator(HttpContext context, PaginInfo paginInfo)
 {
     this.context   = context;
     this.pagininfo = paginInfo;
 }