Skip to content

Commit

Permalink
Initial solution check in
Browse files Browse the repository at this point in the history
  • Loading branch information
Kitsula committed Dec 7, 2012
0 parents commit fb5013e
Show file tree
Hide file tree
Showing 15 changed files with 1,032 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
*.dll

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
build.cmd
[Dd]eploy
[Ii]cons
MvcPager1.5Src3en.rar
YUICompressor
MvcAjaxPagerSample
20 changes: 20 additions & 0 deletions MvcAjaxPager.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcAjaxPager", "MvcAjaxPager\MvcAjaxPager.csproj", "{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions MvcAjaxPager/IPagedList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* ASP .NET MVC AJAX Pager control
* http://kitsula.com/MvcAjaxPager
*
* Copyright (c) 2012 Igor KitsulaCopyright (c) 2012 Igor Kitsula (http://kitsula.com)
* Copyright (c) 2009-2010 Webdiyer (http://en.webdiyer.com)
* Source code released under MIT license
* http://kitsula.com/MvcAjaxPager/license
*
*/
namespace MvcAjaxPager {

public interface IPagedList {

int CurrentPageIndex { get; set; }
int PageSize { get; set; }
int TotalItemCount { get; set; }
}
}
8 changes: 8 additions & 0 deletions MvcAjaxPager/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2012 Igor Kitsula

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
72 changes: 72 additions & 0 deletions MvcAjaxPager/MvcAjaxPager.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{71DCE177-5227-4D7E-A5CB-298AFE33ABE1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MvcAjaxPager</RootNamespace>
<AssemblyName>MvcAjaxPager</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="IPagedList.cs" />
<Compile Include="PagedList.cs" />
<Compile Include="PageLinqExtensions.cs" />
<Compile Include="PagerBuilder.cs" />
<Compile Include="PagerHelper.cs" />
<Compile Include="PagerItem.cs" />
<Compile Include="PagerItemType.cs" />
<Compile Include="PagerOptions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="jquery.pager-1.0.1.js" />
<Content Include="License.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
26 changes: 26 additions & 0 deletions MvcAjaxPager/PageLinqExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* ASP .NET MVC AJAX Pager control
* http://kitsula.com/MvcAjaxPager
*
* Copyright (c) 2012 Igor KitsulaCopyright (c) 2012 Igor Kitsula (http://kitsula.com)
* Copyright (c) 2009-2010 Webdiyer (http://en.webdiyer.com)
* Source code released under MIT license
* http://kitsula.com/MvcAjaxPager/license
*
*/
using System.Linq;

namespace MvcAjaxPager {

public static class PageLinqExtensions {

public static PagedList<T> ToPagedList<T> (this IQueryable<T> allItems, int pageIndex, int pageSize) {
if (pageIndex < 1)
pageIndex = 1;
var itemIndex = (pageIndex - 1) * pageSize;
var pageOfItems = allItems.Skip(itemIndex).Take(pageSize);
var totalItemCount = allItems.Count();
return new PagedList<T>(pageOfItems, pageIndex, pageSize, totalItemCount);
}
}
}
47 changes: 47 additions & 0 deletions MvcAjaxPager/PagedList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* ASP .NET MVC AJAX Pager control
* http://kitsula.com/MvcAjaxPager
*
* Copyright (c) 2012 Igor KitsulaCopyright (c) 2012 Igor Kitsula (http://kitsula.com)
* Copyright (c) 2009-2010 Webdiyer (http://en.webdiyer.com)
* Source code released under MIT license
* http://kitsula.com/MvcAjaxPager/license
*
*/
using System;
using System.Collections.Generic;

namespace MvcAjaxPager {

public class PagedList<T> : List<T>, IPagedList {

public PagedList(IList<T> items,int pageIndex,int pageSize) {
PageSize = pageSize;
TotalItemCount = items.Count;
TotalPageCount = (int)Math.Ceiling(TotalItemCount / (double)PageSize);
CurrentPageIndex = pageIndex;
StartRecordIndex=(CurrentPageIndex - 1) * PageSize + 1;
EndRecordIndex = TotalItemCount > pageIndex * pageSize ? pageIndex * pageSize : TotalItemCount;
for (int i = StartRecordIndex-1; i < EndRecordIndex;i++ ) {
Add(items[i]);
}
}

public PagedList(IEnumerable<T> items, int pageIndex, int pageSize, int totalItemCount) {
AddRange(items);
TotalItemCount = totalItemCount;
TotalPageCount = (int)Math.Ceiling(totalItemCount / (double)pageSize);
CurrentPageIndex = pageIndex;
PageSize = pageSize;
StartRecordIndex = (pageIndex - 1) * pageSize + 1;
EndRecordIndex = TotalItemCount > pageIndex * pageSize ? pageIndex * pageSize : totalItemCount;
}

public int CurrentPageIndex { get; set; }
public int PageSize { get; set; }
public int TotalItemCount { get; set; }
public int TotalPageCount{get; private set;}
public int StartRecordIndex{get; private set;}
public int EndRecordIndex{get; private set;}
}
}
Loading

0 comments on commit fb5013e

Please sign in to comment.