예제 #1
0
		public static User GetByID(
			int id )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetUserByID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", id )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				User o = new User();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
예제 #2
0
		public static User GetByUserNameAndPassword(
			string samName,
			string password )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetUserBySamNameAndPassword",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@SamName", samName ),
				AdoNetSqlParamCollection.CreateParameter( "@Password", password )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				User o = new User();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
예제 #3
0
		/// <summary>
		/// Load all.
		/// </summary>
		public static User[] GetAll()
		{
			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetAllUsers",
				new AdoNetSqlParamCollection(
				) );

			if ( table == null )
			{
				return null;
			}
			else
			{
				ArrayList result = new ArrayList();

				foreach ( DataRow row in table.Rows )
				{
					User o = new User();
					o.Load( row );

					if ( !o.IsEmpty )
					{
						result.Add( o );
					}
				}

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (User[])result.ToArray(
						typeof( User ) );
				}
			}
		}
예제 #4
0
		public static User GetByEMail(
			string emailAddress )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetUserByEMailAddress",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@EMailAddress", emailAddress )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				User o = new User();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
예제 #5
0
		public static User GetBySamName(
			string samName )
		{
			if ( string.IsNullOrEmpty( samName ) )
			{
				return null;
			}
			else
			{
				DataRow row = AdoNetSqlHelper.ExecuteRow(
					"GetUserBySamName",
					new AdoNetSqlParamCollection(
					AdoNetSqlParamCollection.CreateParameter( "@SamName", samName )
					) );

				if ( row == null )
				{
					return null;
				}
				else
				{
					User o = new User();
					o.Load( row );

					if ( o.IsEmpty )
					{
						return null;
					}
					else
					{
						return o;
					}
				}
			}
		}
예제 #6
0
		public static User GetByRow(
			DataRow row )
		{
			User o = new User();
			o.Load( row );

			if ( o.IsEmpty )
			{
				return null;
			}
			else
			{
				return o;
			}
		}