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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
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:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SmartestTableAdapters;
namespace RealTech
{
[System.ComponentModel.DataObject]
public class Users
{
//============================================================================//
// PROPERTIES
//============================================================================//
/// <summary>
/// Property
/// Name: Adapter
/// Type: TableAdapter
/// </summary>
private ST_USERSTableAdapter _Adapter = null;
protected ST_USERSTableAdapter Adapter
{
get
{
if (_Adapter == null)
_Adapter = new ST_USERSTableAdapter();
return _Adapter;
}
}
//============================================================================//
// FUNCTIONS
//============================================================================//
/// <summary>
/// Function
/// Name: SelectUsers
/// Desc: Select all
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public Smartest.ST_USERSDataTable SelectUsers()
{
return this.Adapter.SelectUsers();
}
/// <summary>
/// Function
/// Name: SelectUsers
/// Desc: Select by ID
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public Smartest.ST_USERSDataTable SelectUsers(int USER_ID)
{
return this.Adapter.SelectUserByID(USER_ID);
}
/// <summary>
/// Function
/// Name: SelectUsers
/// Desc: Select by Name
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public Smartest.ST_USERSDataTable SelectUsers(string USER_NAME)
{
return this.Adapter.SelectUsersByName(USER_NAME);
}
/// <summary>
/// Function
/// Name: SelectUsers
/// Desc: Select by Login
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
public Smartest.ST_USERSDataTable SelectUsers(string USER_EMAIL, string USER_PASSWORD)
{
return this.Adapter.SelectUserByLogin(USER_EMAIL, USER_PASSWORD);
}
/// <summary>
/// Function
/// Name: DeleteUser
/// Desc: Delete
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]
public bool DeleteUser(int USER_ID)
{
// Delete the record
int rowsAffected = this.Adapter.Delete(USER_ID);
// Return true if precisely one row was deleted, otherwise false
return rowsAffected == 1;
}
/// <summary>
/// Function
/// Name: InsertUser
/// Desc: Insert
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
public bool InsertUser( DateTime USER_CREATETIME,
int USER_CREATEBY,
DateTime USER_UPDATETIME,
int USER_UPDATEBY,
int USER_STATUS,
string USER_NAME,
string USER_DESC,
int USER_COUNTRY_ID,
int USER_CITY_ID,
string USER_ADDRESS,
string USER_ZIP,
string USER_PHONE,
string USER_MOBILE,
string USER_FAX,
string USER_EMAIL,
string USER_PASSWORD,
bool USER_ADMIN)
{
// Create a new row instance
Smartest.ST_USERSDataTable Users = new Smartest.ST_USERSDataTable();
Smartest.ST_USERSRow User = Users.NewST_USERSRow();
// Fill the parameters
User.USER_CREATETIME = USER_CREATETIME;
User.USER_CREATEBY = USER_CREATEBY;
User.USER_UPDATETIME = USER_UPDATETIME;
User.USER_UPDATEBY = USER_UPDATEBY;
User.USER_STATUS = USER_STATUS;
User.USER_NAME = USER_NAME;
User.USER_DESC = USER_DESC;
User.USER_COUNTRY_ID = USER_COUNTRY_ID;
User.USER_CITY_ID = USER_CITY_ID;
User.USER_ADDRESS = USER_ADDRESS;
User.USER_ZIP = USER_ZIP;
User.USER_PHONE = USER_PHONE;
User.USER_MOBILE = USER_MOBILE;
User.USER_FAX = USER_FAX;
User.USER_EMAIL = USER_EMAIL;
User.USER_PASSWORD = USER_PASSWORD;
User.USER_ADMIN = USER_ADMIN;
// Insert the record
Users.AddST_USERSRow(User);
int rowsAffected = this.Adapter.Update(Users);
// Return true if precisely one row was inserted, otherwise false
return rowsAffected == 1;
}
/// <summary>
/// Function
/// Name: UpdateUser
/// Desc: Update
/// </summary>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
public bool UpdateUser( int USER_ID,
DateTime USER_UPDATETIME,
int USER_UPDATEBY,
int USER_STATUS,
string USER_NAME,
string USER_DESC,
int USER_COUNTRY_ID,
int USER_CITY_ID,
string USER_ADDRESS,
string USER_ZIP,
string USER_PHONE,
string USER_MOBILE,
string USER_FAX,
string USER_EMAIL,
string USER_PASSWORD,
bool USER_ADMIN)
{
// Check if exist by id
Smartest.ST_USERSDataTable Users = this.Adapter.SelectUserByID(USER_ID);
if (Users.Count == 0)
return false;
// Create the row instance
Smartest.ST_USERSRow User = Users[0];
// Fill the parameters
User.USER_UPDATETIME = USER_UPDATETIME;
User.USER_UPDATEBY = USER_UPDATEBY;
User.USER_STATUS = USER_STATUS;
User.USER_NAME = USER_NAME;
User.USER_DESC = USER_DESC;
User.USER_COUNTRY_ID = USER_COUNTRY_ID;
User.USER_CITY_ID = USER_CITY_ID;
User.USER_ADDRESS = USER_ADDRESS;
User.USER_ZIP = USER_ZIP;
User.USER_PHONE = USER_PHONE;
User.USER_MOBILE = USER_MOBILE;
User.USER_FAX = USER_FAX;
User.USER_EMAIL = USER_EMAIL;
User.USER_PASSWORD = USER_PASSWORD;
User.USER_ADMIN = USER_ADMIN;
// Update the record
int rowsAffected = this.Adapter.Update(User);
// Return true if precisely one row was updated, otherwise false
return rowsAffected == 1;
}
}
}
|