Copied remotely
[mono.git] / mcs / class / System.Web / System.Web.UI / DataSourceSelectArguments.cs
1 //
2 // System.Web.UI.DataSourceSelectArguments.cs
3 //
4 // Author:
5 //   Sanjay Gupta <gsanjay@novell.com>
6 //
7 // (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 #if NET_2_0
32 using System;
33
34 namespace System.Web.UI
35 {
36         public sealed class DataSourceSelectArguments
37         {
38                 string sortExpression = string.Empty;
39                 int startingRowIndex = 0;
40                 int maxRows = 0;
41                 bool isEmpty;
42                 bool getTotalRowCount = false;
43                 int totalRowCount = -1;
44                 DataSourceCapabilities dsc = DataSourceCapabilities.None;
45
46                 public static readonly DataSourceSelectArguments Empty = new DataSourceSelectArguments ();
47
48                 public DataSourceSelectArguments ()
49                 {
50                         this.isEmpty = true;
51                 }
52
53                 public DataSourceSelectArguments (string sortExpression)
54                 {
55                         this.sortExpression = sortExpression;
56                         this.isEmpty = false;
57                 }
58
59                 public DataSourceSelectArguments (int startingRowIndex, int maxRows)
60                 {
61                         this.startingRowIndex = startingRowIndex;
62                         this.maxRows = maxRows;
63                         this.isEmpty = false;
64                 }
65
66                 public DataSourceSelectArguments (string sortExpression, int startingRowIndex, int maxRows)
67                 {
68                         this.sortExpression = sortExpression; 
69                         this.startingRowIndex = startingRowIndex;
70                         this.maxRows = maxRows;
71                         this.isEmpty = false;
72                 }
73
74                 public void AddSupportedCapabilities (DataSourceCapabilities srcCapabilities)
75                 {
76                         this.dsc = this.dsc | srcCapabilities;
77                 }
78
79                 [MonoTODO]
80                 public override bool Equals (object obj)
81                 {
82                         if (!(obj is DataSourceSelectArguments))
83                                 return false;
84                         return false;
85                 }
86
87                 [MonoTODO]
88                 public override int GetHashCode ()
89                 {
90                         return sortExpression.GetHashCode ();
91                 }
92
93                 public void RaiseUnsupportedCapabilitiesError (DataSourceView view)
94                 {
95                         view.RaiseUnsupportedCapabilityError (this.dsc);
96                 }
97
98                 public bool IsEmpty {
99                         get { return this.isEmpty; }
100                 }
101
102                 public int MaximumRows {
103                         get { return this.MaximumRows; }
104                         set {
105                                 this.maxRows = value;
106                                 this.isEmpty = false;
107                         }
108                 }
109
110                 public bool RetrieveTotalRowCount  {
111                         get { return this.getTotalRowCount; }
112                         set { this.getTotalRowCount = value; }
113                 }
114
115                 public string SortExpression {
116                         get { return this.sortExpression; }
117                         set {
118                                 this.sortExpression = value;
119                                 this.isEmpty = false;
120                         }
121                 }
122
123                 public int StartRowIndex {
124                         get { return this.startingRowIndex; }
125                         set {
126                                 this.startingRowIndex = value;
127                                 this.isEmpty = false;
128                         }
129                 }
130
131                 public int TotalRowCount {
132                         get { return this.totalRowCount; }
133                         set {
134                                 this.totalRowCount = value;
135                                 this.isEmpty = false;
136                         }
137                 }
138         }
139 }
140 #endif