Example #1
0
		// ------------------------------------------------------------------

		/// <summary>
		/// Load all.
		/// </summary>
		public static ProjectTask[] GetAllUnbilledBillableProjectTasksByProject(
			Project project,
			DateTime forMonth )
		{
			DateTime startDate = new DateTime( forMonth.Year, forMonth.Month, 1 );
			DateTime endDate = startDate.AddMonths( 1 );

			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetAllUnbilledBillableProjectTasksByProjectID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ProjectID", project.ID ),
				AdoNetSqlParamCollection.CreateParameter( "@StartDate", startDate ),
				AdoNetSqlParamCollection.CreateParameter( "@EndDate", endDate )
				) );

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

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

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

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (ProjectTask[])result.ToArray(
						typeof( ProjectTask ) );
				}
			}
		}
Example #2
0
		/// <summary>
		/// Load an object by a given ID.
		/// </summary>
		public static ProjectTask GetByID(
			int id )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetProjectTaskByID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", id )
				) );

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

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

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

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

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

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (ProjectTask[])result.ToArray(
						typeof( ProjectTask ) );
				}
			}
		}
Example #4
0
		/// <summary>
		/// Queries for projects with complex information.
		/// </summary>
		/// <param name="getInfo"></param>
		/// <returns></returns>
		public static ProjectTask[] Get(
			ProjectTaskGetInformation getInfo )
		{
			getInfo.Normalize();

			DataTable table = table = AdoNetSqlHelper.ExecuteTable(
				"GetProjectTasksByInfo",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ProjectID", getInfo.ProjectID ),
				AdoNetSqlParamCollection.CreateParameter( "@StateType", getInfo.ProjectTaskStateGetType.ToString() )
				) );

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

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

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

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (ProjectTask[])result.ToArray(
						typeof( ProjectTask ) );
				}
			}
		}
Example #5
0
		/// <summary>
		/// Load all for the given parent.
		/// </summary>
		public static ProjectTask[] GetForProject(
			Project parentObject )
		{
			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetProjectTasksByProjectID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID )
				) );

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

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

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

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (ProjectTask[])result.ToArray(
						typeof( ProjectTask ) );
				}
			}
		}