├── .gitignore
├── Examples
├── App.config
├── AutoQueryWithEditableForm.Designer.cs
├── AutoQueryWithEditableForm.cs
├── AutoQueryWithEditableForm.resx
├── AutoQueryWithReadOnlyForm.Designer.cs
├── AutoQueryWithReadOnlyForm.cs
├── AutoQueryWithReadOnlyForm.resx
├── CustomQueryTextWithReadOnlyForm.Designer.cs
├── CustomQueryTextWithReadOnlyForm.cs
├── CustomQueryTextWithReadOnlyForm.resx
├── Examples.csproj
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── ManualQueryWithReadOnlyForm.Designer.cs
├── ManualQueryWithReadOnlyForm.cs
├── ManualQueryWithReadOnlyForm.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── chinook.db
└── packages.config
├── LICENSE
├── README.md
├── SimpleDataGridViewPaging.sln
├── SimpleDataGridViewPaging
├── DataGridViewPaging.Designer.cs
├── DataGridViewPaging.EventHandling.cs
├── DataGridViewPaging.Properties.cs
├── DataGridViewPaging.cs
├── DataGridViewPaging.resx
├── DbRequestHandler.cs
├── DbRequestHandlerHelper.cs
├── Exceptions
│ └── QuantityRangeException.cs
├── IDbRequestHandler.cs
├── NavigatorHorizontal.cs
├── Properties
│ └── AssemblyInfo.cs
├── ReadOnlyMode.cs
├── SimpleDataGridViewPaging.csproj
└── Statement
│ ├── AdapterStatement.cs
│ ├── Builder
│ ├── CountStatementBuilder.cs
│ ├── RowsStatementBuilder.cs
│ ├── StatementBuilder.cs
│ └── UpdatableRowsStatementBuilder.cs
│ ├── IStatement.cs
│ ├── ReaderStatement.cs
│ └── ScalarStatement.cs
└── nuget
├── SimpleDataGridViewPaging.1.0.0.nupkg
├── SimpleDataGridViewPaging.2.0.0.nupkg
├── SimpleDataGridViewPaging.2.0.1.nupkg
└── SimpleDataGridViewPaging.2.0.2.nupkg
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/Examples/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Examples/AutoQueryWithEditableForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
2 | {
3 | partial class AutoQueryWithEditableForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.dataGridViewPaging1 = new Code4Bugs.SimpleDataGridViewPaging.DataGridViewPaging();
32 | this.SuspendLayout();
33 | //
34 | // dataGridViewPaging1
35 | //
36 | this.dataGridViewPaging1.AutoHideNavigator = false;
37 | this.dataGridViewPaging1.DataSource = null;
38 | this.dataGridViewPaging1.DbRequestHandler = null;
39 | this.dataGridViewPaging1.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.dataGridViewPaging1.Location = new System.Drawing.Point(0, 0);
41 | this.dataGridViewPaging1.Margin = new System.Windows.Forms.Padding(5);
42 | this.dataGridViewPaging1.MaxRecords = 100;
43 | this.dataGridViewPaging1.Name = "dataGridViewPaging1";
44 | this.dataGridViewPaging1.Size = new System.Drawing.Size(616, 460);
45 | this.dataGridViewPaging1.TabIndex = 0;
46 | //
47 | // AutoQueryWithEditableForm
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.ClientSize = new System.Drawing.Size(616, 460);
52 | this.Controls.Add(this.dataGridViewPaging1);
53 | this.Margin = new System.Windows.Forms.Padding(4);
54 | this.Name = "AutoQueryWithEditableForm";
55 | this.Text = "Auto Query With Editable";
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private DataGridViewPaging dataGridViewPaging1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/Examples/AutoQueryWithEditableForm.cs:
--------------------------------------------------------------------------------
1 | using System.Data.SQLite;
2 | using System.Windows.Forms;
3 |
4 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
5 | {
6 | public partial class AutoQueryWithEditableForm : Form
7 | {
8 | public AutoQueryWithEditableForm()
9 | {
10 | InitializeComponent();
11 |
12 | dataGridViewPaging1.DbRequestHandler = DbRequestHandlerHelper.Create(
13 | new SQLiteConnection("Data Source=chinook.db"),
14 | "tracks",
15 | new SQLiteCommandBuilder(new SQLiteDataAdapter()));
16 |
17 | // OR
18 | // dataGridViewPaging1.DbRequestHandler = new DbRequestHandler
19 | // {
20 | // Connection = new SQLiteConnection("Data Source=chinook.db"),
21 | // TableName = "tracks",
22 | // RowsStatementBuilder = new UpdatableRowsStatementBuilder().CommandBuilder(new SQLiteCommandBuilder(new SQLiteDataAdapter()))
23 | // };
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Examples/AutoQueryWithEditableForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Examples/AutoQueryWithReadOnlyForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
2 | {
3 | partial class AutoQueryWithReadOnlyForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.dataGridViewPaging1 = new Code4Bugs.SimpleDataGridViewPaging.DataGridViewPaging();
32 | this.SuspendLayout();
33 | //
34 | // dataGridViewPaging1
35 | //
36 | this.dataGridViewPaging1.AutoHideNavigator = false;
37 | this.dataGridViewPaging1.DataSource = null;
38 | this.dataGridViewPaging1.DbRequestHandler = null;
39 | this.dataGridViewPaging1.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.dataGridViewPaging1.Location = new System.Drawing.Point(0, 0);
41 | this.dataGridViewPaging1.Margin = new System.Windows.Forms.Padding(5);
42 | this.dataGridViewPaging1.MaxRecords = 100;
43 | this.dataGridViewPaging1.Name = "dataGridViewPaging1";
44 | this.dataGridViewPaging1.Size = new System.Drawing.Size(616, 460);
45 | this.dataGridViewPaging1.TabIndex = 0;
46 | //
47 | // AutoQueryInReadOnlyForm
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.ClientSize = new System.Drawing.Size(616, 460);
52 | this.Controls.Add(this.dataGridViewPaging1);
53 | this.Margin = new System.Windows.Forms.Padding(4);
54 | this.Name = "AutoQueryInReadOnlyForm";
55 | this.Text = "Auto Query With ReadOnly";
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private DataGridViewPaging dataGridViewPaging1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/Examples/AutoQueryWithReadOnlyForm.cs:
--------------------------------------------------------------------------------
1 | using System.Data.SQLite;
2 | using System.Windows.Forms;
3 |
4 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
5 | {
6 | public partial class AutoQueryWithReadOnlyForm : Form
7 | {
8 | public AutoQueryWithReadOnlyForm()
9 | {
10 | InitializeComponent();
11 |
12 | dataGridViewPaging1.DbRequestHandler = DbRequestHandlerHelper.Create(
13 | new SQLiteConnection("Data Source=chinook.db"),
14 | "tracks");
15 |
16 | // OR
17 | // dataGridViewPaging1.DbRequestHandler = new DbRequestHandler
18 | // {
19 | // Connection = new SQLiteConnection("Data Source=chinook.db"),
20 | // TableName = "tracks"
21 | // };
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Examples/AutoQueryWithReadOnlyForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Examples/CustomQueryTextWithReadOnlyForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
2 | {
3 | partial class CustomQueryTextWithReadOnlyForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.dataGridViewPaging1 = new Code4Bugs.SimpleDataGridViewPaging.DataGridViewPaging();
32 | this.SuspendLayout();
33 | //
34 | // dataGridViewPaging1
35 | //
36 | this.dataGridViewPaging1.AutoHideNavigator = false;
37 | this.dataGridViewPaging1.DataSource = null;
38 | this.dataGridViewPaging1.DbRequestHandler = null;
39 | this.dataGridViewPaging1.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.dataGridViewPaging1.Location = new System.Drawing.Point(0, 0);
41 | this.dataGridViewPaging1.Margin = new System.Windows.Forms.Padding(5);
42 | this.dataGridViewPaging1.MaxRecords = 100;
43 | this.dataGridViewPaging1.Name = "dataGridViewPaging1";
44 | this.dataGridViewPaging1.Size = new System.Drawing.Size(616, 460);
45 | this.dataGridViewPaging1.TabIndex = 0;
46 | //
47 | // CustomQueryTextWithReadOnlyForm
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.ClientSize = new System.Drawing.Size(616, 460);
52 | this.Controls.Add(this.dataGridViewPaging1);
53 | this.Margin = new System.Windows.Forms.Padding(4);
54 | this.Name = "CustomQueryTextWithReadOnlyForm";
55 | this.Text = "Custom Query Text With ReadOnly";
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private DataGridViewPaging dataGridViewPaging1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/Examples/CustomQueryTextWithReadOnlyForm.cs:
--------------------------------------------------------------------------------
1 | using System.Data.SQLite;
2 | using System.Windows.Forms;
3 | using Code4Bugs.SimpleDataGridViewPaging.Statement.Builder;
4 |
5 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
6 | {
7 | public partial class CustomQueryTextWithReadOnlyForm : Form
8 | {
9 | public CustomQueryTextWithReadOnlyForm()
10 | {
11 | InitializeComponent();
12 |
13 | var countStatementBuilder = new CountStatementBuilder();
14 | countStatementBuilder.CommandText("SELECT COUNT(*) FROM tracks");
15 |
16 | var rowsStatementBuilder = new RowsStatementBuilder();
17 | rowsStatementBuilder.CommandText("SELECT * FROM tracks LIMIT {1} OFFSET {2}");
18 |
19 | dataGridViewPaging1.DbRequestHandler = new DbRequestHandler
20 | {
21 | Connection = new SQLiteConnection("Data Source=chinook.db"),
22 | CountStatementBuilder = countStatementBuilder,
23 | RowsStatementBuilder = rowsStatementBuilder
24 | };
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Examples/CustomQueryTextWithReadOnlyForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Examples/Examples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2CC3510C-DB0B-4D64-B3DC-221D32A8DD45}
8 | WinExe
9 | Properties
10 | Code4Bugs.SimpleDataGridViewPaging.Examples
11 | Examples
12 | v4.5
13 | 512
14 |
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | ..\packages\System.Data.SQLite.Core.1.0.108.0\lib\net45\System.Data.SQLite.dll
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | Form
56 |
57 |
58 | AutoQueryWithEditableForm.cs
59 |
60 |
61 | Form
62 |
63 |
64 | MainForm.cs
65 |
66 |
67 | Form
68 |
69 |
70 | ManualQueryWithReadOnlyForm.cs
71 |
72 |
73 | Form
74 |
75 |
76 | CustomQueryTextWithReadOnlyForm.cs
77 |
78 |
79 | Form
80 |
81 |
82 | AutoQueryWithReadOnlyForm.cs
83 |
84 |
85 |
86 |
87 | AutoQueryWithEditableForm.cs
88 |
89 |
90 | MainForm.cs
91 |
92 |
93 | ManualQueryWithReadOnlyForm.cs
94 |
95 |
96 | CustomQueryTextWithReadOnlyForm.cs
97 |
98 |
99 | AutoQueryWithReadOnlyForm.cs
100 |
101 |
102 | ResXFileCodeGenerator
103 | Resources.Designer.cs
104 | Designer
105 |
106 |
107 | True
108 | Resources.resx
109 | True
110 |
111 |
112 | PreserveNewest
113 |
114 |
115 |
116 | SettingsSingleFileGenerator
117 | Settings.Designer.cs
118 |
119 |
120 | True
121 | Settings.settings
122 | True
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | {8784a91a-10e1-4f2d-a233-eaf60275f2f0}
131 | SimpleDataGridViewPaging
132 |
133 |
134 |
135 |
136 |
137 |
138 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
139 |
140 |
141 |
142 |
149 |
--------------------------------------------------------------------------------
/Examples/MainForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
2 | {
3 | partial class MainForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.button2 = new System.Windows.Forms.Button();
33 | this.button3 = new System.Windows.Forms.Button();
34 | this.button4 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // button1
38 | //
39 | this.button1.Location = new System.Drawing.Point(40, 39);
40 | this.button1.Name = "button1";
41 | this.button1.Size = new System.Drawing.Size(237, 52);
42 | this.button1.TabIndex = 0;
43 | this.button1.Text = "Auto Query With Reaonly";
44 | this.button1.UseVisualStyleBackColor = true;
45 | this.button1.Click += new System.EventHandler(this.button1_Click);
46 | //
47 | // button2
48 | //
49 | this.button2.Location = new System.Drawing.Point(40, 97);
50 | this.button2.Name = "button2";
51 | this.button2.Size = new System.Drawing.Size(237, 52);
52 | this.button2.TabIndex = 0;
53 | this.button2.Text = "Auto Query With Editable";
54 | this.button2.UseVisualStyleBackColor = true;
55 | this.button2.Click += new System.EventHandler(this.button2_Click);
56 | //
57 | // button3
58 | //
59 | this.button3.Location = new System.Drawing.Point(40, 155);
60 | this.button3.Name = "button3";
61 | this.button3.Size = new System.Drawing.Size(237, 52);
62 | this.button3.TabIndex = 0;
63 | this.button3.Text = "Custom Query Text With ReadOnly";
64 | this.button3.UseVisualStyleBackColor = true;
65 | this.button3.Click += new System.EventHandler(this.button3_Click);
66 | //
67 | // button4
68 | //
69 | this.button4.Location = new System.Drawing.Point(40, 213);
70 | this.button4.Name = "button4";
71 | this.button4.Size = new System.Drawing.Size(237, 52);
72 | this.button4.TabIndex = 0;
73 | this.button4.Text = "Manual Query With ReadOnly";
74 | this.button4.UseVisualStyleBackColor = true;
75 | this.button4.Click += new System.EventHandler(this.button4_Click);
76 | //
77 | // MainForm
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(318, 299);
82 | this.Controls.Add(this.button4);
83 | this.Controls.Add(this.button3);
84 | this.Controls.Add(this.button2);
85 | this.Controls.Add(this.button1);
86 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
87 | this.MaximizeBox = false;
88 | this.MinimizeBox = false;
89 | this.Name = "MainForm";
90 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
91 | this.Text = "MainForm";
92 | this.ResumeLayout(false);
93 |
94 | }
95 |
96 | #endregion
97 |
98 | private System.Windows.Forms.Button button1;
99 | private System.Windows.Forms.Button button2;
100 | private System.Windows.Forms.Button button3;
101 | private System.Windows.Forms.Button button4;
102 | }
103 | }
--------------------------------------------------------------------------------
/Examples/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
5 | {
6 | public partial class MainForm : Form
7 | {
8 | public MainForm()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | private void button1_Click(object sender, EventArgs e)
14 | {
15 | using (var form = new AutoQueryWithReadOnlyForm())
16 | {
17 | form.ShowDialog(this);
18 | }
19 | }
20 |
21 | private void button2_Click(object sender, EventArgs e)
22 | {
23 | using (var form = new AutoQueryWithEditableForm())
24 | {
25 | form.ShowDialog(this);
26 | }
27 | }
28 |
29 | private void button3_Click(object sender, EventArgs e)
30 | {
31 | using (var form = new CustomQueryTextWithReadOnlyForm())
32 | {
33 | form.ShowDialog(this);
34 | }
35 | }
36 |
37 | private void button4_Click(object sender, EventArgs e)
38 | {
39 | using (var form = new ManualQueryWithReadOnlyForm())
40 | {
41 | form.ShowDialog(this);
42 | }
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Examples/MainForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
124 | True
125 |
126 |
127 | True
128 |
129 |
130 | True
131 |
132 |
133 | True
134 |
135 |
--------------------------------------------------------------------------------
/Examples/ManualQueryWithReadOnlyForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
2 | {
3 | partial class ManualQueryWithReadOnlyForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.dataGridViewPaging1 = new Code4Bugs.SimpleDataGridViewPaging.DataGridViewPaging();
32 | this.SuspendLayout();
33 | //
34 | // dataGridViewPaging1
35 | //
36 | this.dataGridViewPaging1.AutoHideNavigator = false;
37 | this.dataGridViewPaging1.DataSource = null;
38 | this.dataGridViewPaging1.DbRequestHandler = null;
39 | this.dataGridViewPaging1.Dock = System.Windows.Forms.DockStyle.Fill;
40 | this.dataGridViewPaging1.Location = new System.Drawing.Point(0, 0);
41 | this.dataGridViewPaging1.Margin = new System.Windows.Forms.Padding(5);
42 | this.dataGridViewPaging1.MaxRecords = 100;
43 | this.dataGridViewPaging1.Name = "dataGridViewPaging1";
44 | this.dataGridViewPaging1.Size = new System.Drawing.Size(616, 460);
45 | this.dataGridViewPaging1.TabIndex = 0;
46 | //
47 | // CustomQueryWithReadOnlyForm
48 | //
49 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.ClientSize = new System.Drawing.Size(616, 460);
52 | this.Controls.Add(this.dataGridViewPaging1);
53 | this.Margin = new System.Windows.Forms.Padding(4);
54 | this.Name = "CustomQueryWithReadOnlyForm";
55 | this.Text = "Custom Query With ReadOnly";
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private DataGridViewPaging dataGridViewPaging1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/Examples/ManualQueryWithReadOnlyForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data.Common;
3 | using System.Data.SQLite;
4 | using System.Windows.Forms;
5 | using Code4Bugs.SimpleDataGridViewPaging.Statement;
6 | using Code4Bugs.SimpleDataGridViewPaging.Statement.Builder;
7 |
8 | namespace Code4Bugs.SimpleDataGridViewPaging.Examples
9 | {
10 | public partial class ManualQueryWithReadOnlyForm : Form
11 | {
12 | public ManualQueryWithReadOnlyForm()
13 | {
14 | InitializeComponent();
15 |
16 | var rowsStatementBuilder = new RowsStatementBuilder();
17 | rowsStatementBuilder.CommandText("SELECT * FROM tracks LIMIT {1} OFFSET {2}");
18 |
19 | dataGridViewPaging1.DbRequestHandler = new DbRequestHandler
20 | {
21 | Connection = new SQLiteConnection("Data Source=chinook.db"),
22 | CountStatementBuilder = new CustomCountStatementBuilder(),
23 | RowsStatementBuilder = new CustomRowsStatementBuilder()
24 | };
25 | }
26 |
27 | private class CustomCountStatementBuilder : CountStatementBuilder
28 | {
29 | public override IStatement Build()
30 | {
31 | return new CountStatement {Connection = _connection};
32 | }
33 |
34 | private class CountStatement : IStatement
35 | {
36 | public DbConnection Connection { get; set; }
37 |
38 | public int Execute()
39 | {
40 | using (var command = Connection.CreateCommand())
41 | {
42 | command.CommandText = "SELECT COUNT(*) FROM tracks";
43 | var result = command.ExecuteScalar();
44 | return Convert.ToInt32(result);
45 | }
46 | }
47 | }
48 | }
49 |
50 | private class CustomRowsStatementBuilder : RowsStatementBuilder
51 | {
52 | public override IStatement