// ------------------------------------------------------------------ /// <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 ) ); } } }
/// <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; } } }
/// <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 ) ); } } }
/// <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 ) ); } } }
/// <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 ) ); } } }
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(); } } }
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(); } }