ComponentOne GanttView for WinForms is a complete project management tool that delivers an MS Project-like user experience with its support for the .NET platform. It is a data-visualization and editing control for project planning data and different types of task and time scheduling. It provides a graphical diagram of a schedule that helps to plan, coordinate, and track specific tasks in a project. Let's go through the features of GanttView and the ways of implementing them one by one so as to make the project management easier and more efficient.
C1GanttView basically supports two types of tasks - Automatic and Manual.
Manual Task can be created at both Design Time and Run Time. C1GanttView provides a Task class to create a Task in code. You will also need to set the ‘Name’, ‘Start’, ‘Finish’, ‘PercentComplete’ and ‘Mode’ properties to define a task. The Mode property is used to distinguish if a task is automatic or manual.
c1GanttView1.Tasks.Clear(); Task task = new Task(); task.Name = "Production"; task.PercentComplete = 0.40; task.Start = new DateTime(2015, 06, 5); task.Finish = new DateTime(2015, 06, 9); task.Mode = TaskMode.Manual; task.SetFieldValue("Office", "China"); c1GanttView1.Tasks.Add(task);
Once the task has been created, it can be added to the TaskCollection of GanttView using the 'Add' method.
Similarly, Automatic Task can also be created by setting the Mode property to ‘Automatic’. It is needed to set its ‘Duration’ and ‘DurationUnits’ properties in order to define the task period.
Task task = new Task(); task.PercentComplete = 0.26; task.Name = "Production"; task.Mode = TaskMode.Automatic; task.Duration = 5; task.SetFieldValue("Office", "U.S.A."); task.DurationUnits = DurationUnits.Days; c1GanttView1.Tasks.Add(task);
Automatic task does not have Start and Finish Dates as Manual Task. However, the start (finish) date for a start (finish) date constraint and the ConstraintType can be set using the ConstraintDate and ConstraintType properties of Task class.
Task task = new Task(); task.PercentComplete = 0.76; task.Name = "Marketing"; task.Mode = TaskMode.Automatic; //To assign the Start Date and Finish Date like Manual Tasks.. //..ConstraintDate and ConstraintType properties are used along with the Duration Property. task.ConstraintDate = new DateTime(2015, 06, 7); task.ConstraintType = ConstraintType.MustStartOn; task.Duration = 4; task.SetFieldValue("Office", "Japan"); c1GanttView1.Tasks.Add(task);
C1GanttView also provides an excellent feature of adding a Summary Task. Using Summary Tasks, the task list can be broken down to make it appear more organized and readable. It is done by just indenting and outdenting the project's tasks to create an outline of the summary tasks and subtasks. Summary tasks summarize the data of their subtasks. By default, the summary tasks are bold and outdented, and the subtasks are indented beneath them. To create a Summary Task in the project, it is needed to create a Task which is going to be a parent task and then add other tasks as the children of this task. A task can be added as a child by using the OulineParentID property.
Task SummaryTask = new Task(); SummaryTask.Mode = TaskMode.Automatic; SummaryTask.Name = "Summary Task"; SummaryTask.SetFieldValue("Country", "SummaryTask"); this.c1GanttView1.ProjectSummary = SummaryTask; c1GanttView1.Tasks.Add(SummaryTask); Task ChildTask = new Task(); ChildTask.Name = "Child Task"; ChildTask.Mode = TaskMode.Automatic; ChildTask.PercentComplete = 0.50; ChildTask.Duration = 6; ChildTask.DurationUnits = DurationUnits.Days; ChildTask.SetFieldValue("Country", "China"); ChildTask.OutlineParentID = SummaryTask.ID; ChildTask.BarStyles.Add(automaticStyle); c1GanttView1.Tasks.Add(ChildTask);
Filtering refers to the operation of restricting the result set to contain only those elements that satisfy a specified condition. C1GanttView provides flexibility to create filters through code using AdvancedFilter and ConditionTaskFilter classes. The Field, Operator and Value can be assigned to the custom filter and can then be implemented in the Grid of C1GanttView using the ApplyFilter method.
AdvancedFilter advancedFilter = new AdvancedFilter(); ConditionTaskFilter filterCondition = new ConditionTaskFilter(); filterCondition.FilterField = FilterField.Duration; filterCondition.TestOperator = TestOperators.IsGreaterThanOrEqualTo; filterCondition.FilterValue = 6; advancedFilter.Conditions.Add(filterCondition); this.c1GanttView1.ApplyFilter(advancedFilter);
Grouping refers to the operation of putting data into groups so that the elements in each group share a common attribute. By using the group feature, an outline tree can be built. In C1GanttView, grouping can be performed with respect to any column available in the Grid using BaseGroup class and Group method of C1GanttView. In order to implement the grouping feature, first a base group is to be created using BaseGroup class for the column according to which data is to be grouped. Then the base group will be used in the Group method of C1GanttView to perform the grouping.
BaseGroup baseGroup = new C1.Win.C1GanttView.DurationGroup(true); c1GanttView1.Group(baseGroup); c1GanttView1.GroupDefinition.MaintainHierarchy = true;
However, if there is a need for the grouping on a column field which is not available in this list, then you can use another BaseGroup attribute i.e. CustomFieldGroup. In the CustomField basegroup, Column Name is to be assigned and then a base group will be created according to the column.
BaseGroup baseGroup = new C1.Win.C1GanttView.CustomFieldGroup("Country", true); c1GanttView1.Group(baseGroup); c1GanttView1.GroupDefinition.MaintainHierarchy = true;
Just like all the other grids, grid of GanttView also provides Sorting functionality. Sorting means ordering the set of elements based on one or more attributes. In C1GanttView, sorting can be performed at design time by clicking the Sort button of the built-in Toolstrip shown at the top of the C1GanttView. However, this sorting can also be performed through code. C1GanttView provides a method ClickButton to click any button of the built-in Toolstrip through code. This method accepts an argument CommandButton enumeration which defines which button is to be clicked. So the Sort operation can be performed by passing the ‘Sort’ command button as an argument in the ‘ClickButton’ method.
The CommandButton enumeration has five sort options, four of which are specific to attributes like Duration, Start Date, Finish Data and Name but one sort option is ‘SortBy’ which is used to perform sorting on the rest of the attributes. The ClickButton method with ‘SortBy’ CommandButton opens a dialog where the field can be entered on which sorting is to be performed and using this dialog, multiple sorting can also be performed. To summarize, this is how C1GanttView provides all the basic features which can be used to ease out Project Management. It can be used along-side many of our other controls to create a complete task scheduling application. Enhance the built-in Toolstrip with an Office-inspired one using ComponentOne Ribbon for WinForms. Or extend the view functionality by combining it with ComponentOne Scheduler for WinForms.