コード例 #1
0
ファイル: ProjectTask.cs プロジェクト: mariamorillo02/Zeta2.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 ) );
				}
			}
		}
コード例 #2
0
ファイル: ProjectTask.cs プロジェクト: mariamorillo02/Zeta2.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;
				}
			}
		}
コード例 #3
0
ファイル: ProjectTask.cs プロジェクト: mariamorillo02/Zeta2.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 ) );
				}
			}
		}
コード例 #4
0
ファイル: ProjectTask.cs プロジェクト: mariamorillo02/Zeta2.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 ) );
				}
			}
		}
コード例 #5
0
ファイル: ProjectTask.cs プロジェクト: mariamorillo02/Zeta2.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 ) );
				}
			}
		}
コード例 #6
0
ファイル: MainForm.cs プロジェクト: mariamorillo02/Zeta2.0
		private void neweventToolStripMenuItem_Click( object sender, EventArgs e )
		{
			if ( projectListView.SelectedItems.Count == 1 )
			{
				DBObjects.Project project =
					projectListView.SelectedItems[0].Tag as DBObjects.Project;

				DBObjects.ProjectTask task = new DBObjects.ProjectTask();
				task.ProjectID = project.ID;

				ProjectTaskEditForm form = new ProjectTaskEditForm( project, task );
				if ( form.ShowDialog( this ) == DialogResult.OK )
				{
					UpdateProjectInfoPanel();
					UpdateUI();
				}
			}
		}
コード例 #7
0
		private void neweventToolStripMenuItem_Click( object sender, EventArgs e )
		{
			// Must store parent before adding child.
			Store();

			DBObjects.ProjectTask task = new DBObjects.ProjectTask();
			task.ProjectID = item.ID;

			ProjectTaskEditForm form = new ProjectTaskEditForm( item, task );
			if ( form.ShowDialog( this ) == DialogResult.OK )
			{
				FillProjectTaskList();
			}
		}