To create an application to enable the Gantt View functionality, follow the instructions below.
- Create a New Project
- Create a Database
- Connect to a Database
- Bind Data to the Scheduler
- Specify the ResourceTree Settings
- Modify the Table Adapter Settings
- Post Appointment Data Back to the Database
- Post Appointment Dependencies Data Back to the Database
- Save the Appointment Identifier
- Final Adjustment
- Result
Steps 1-4. Create a New Project.
- Create a new Visual C# Windows project.
- Drop the SplitContainerControl from the DX.18.1: Navigation & Layout tab in the Toolbox onto the form. Click Dock in Parent Container smart tag to fill the form.
- Drop the SchedulerControl control from the DX.18.1: Scheduling tab in the Toolbox onto the right panel of the SplitContainer. Use the smart tag to dock it to fill the container.
- Drop the ResourcesTree control from the DX.18.1: Scheduling tab in the Toolbox onto the left panel of the SplitContainer. Click its smart tag and select Dock in Parent Container.
Steps 5-9. Create a Database.
In the Tools menu of the Visual Studio IDE select Connect to Database.... The Add Connection dialog is invoked.
Type in a name of the new database file - GantTest, as illustrated in the picture above. Click OK to create a new database and a connection.
In the Server Explorer window right-click the newly created data connection and select New Query to open a Query editor window that allows you to enter and execute scripts for this database.
- Switch to the form with the SchedulerControl, select the Scheduler Control, and click the smart tag icon at the top right of the control (
) to display its actions list. Click the Create Sample Database for Gantt Viewitem to invoke a window that contains SQL script. Click the Copy to Clipboard and Close button.
- Switch to the SQLQuery window and paste the script in a window. Click Execute
- Next, fill the Resource table with sample data. To do this, copy the script from the Hierarchical Resource Specifics document starting from SET IDENTITY_INSERT. Delete the content of the previous script in the query window, paste the new one and click Execute.
Steps 9-12. Bind a SchedulerControl to a database.
- Use the Project/Add New Data Source menu command in Visual Studio to invoke a Data Source Configuration wizard. Specify the database connection string and include tables for resources, appointments and dependencies (Resources, Tasks and TaskDependencies tables in our example). Specify the name for the dataset - GantTestDataSet.
- Click the Scheduler control's smart tag and specify the Appointments table in the GantTestDataSet as the Appointments Data Source.
The Mappings Wizards (Setup Appointment Storage dialog) is invoked automatically. Select the Gantt view mappings checkbox to map fields containing the appointment identifier and Percent Complete value. Use Clear and Generate buttons to generate mappings automatically.
The picture below illustrates the Mappings Wizard window for appointment mappings.
Afterwards you can also click the Mappings Wizard... link for the data source to invoke the wizard to make sure that all required mappings are specified.
Click the Scheduler control's smart tag and specify the Resources table in the GantTestDataSet as the Resources Data Source.
The picture below illustrates the Wizard window invoked for resource mappings. The ParentID field contains the identifier of the parent resource node for the current resource node. It is used to build a resource tree.
- Click the Mappings Wizard... link for Resources data source and then Next to navigate to Custom Properties Mapping dialog. Map IdSort field to a corresponding custom property of a resource as illustrated below.
Click the Scheduler control's smart tag and specify the TaskDependencies table in the GantTestDataSet as the AppointmentDependencies Data Source.
The picture below illustrates the Wizard window invoked for dependency mappings. For more information on dependencies review the Dependencies article.
Steps 10-11. Adjust ResourcesTree settings.
- In Visual Studio Designer, open the ResourcesTree control's smart tag and click Run Designer. The Tree List Designer is invoked. Double-click IdSort, Id and Description fields in the field list to add them to the list of displayed columns.
- Move the IdSort field to the top of the list so it becomes the principal sort field, specify its sort order and hide the IdSort and Id fields by setting their Visible property to false.
If the field list is empty, set the Scheduler Control combo box in the ResourcesTree control's smart tag to (none), then to the schedulerControl1 again. This action forces the Resource Tree to retrieve field names form the SchedulerControl.
Step 12. Modify Table Adapter settings.
In this example, table adapters are created automatically using Visual Studio wizards. This technique ensures that all Insert, Update and Delete statements are generated automatically and the identity fields are treated properly. Nevertheless, XtraScheduler specifics require modification of the data set, as shown in the following picture.
- Set the Read-Only property to false for identity fields in the Appointments and TaskDependencies tables: namely, for the UniqueId field in the Appointments table and for the Id field in the TaskDependencies table.
Step 13. 스크립트는 아래와 같이.적용.
| |||
run.
'개발' 카테고리의 다른 글
[DELPHI] DEVEXPRESS BOUND 모드 연결. (0) | 2018.09.11 |
---|---|
[DELPHI] 데이터베이스 개발관련 요점 2 (0) | 2018.09.06 |
[DELPHI] 데이터베이스 개발관련 요점 1 (0) | 2018.09.06 |
분리기통 2인용 고전게임기 자작 (0) | 2017.10.25 |
아두이노 - 리코 GR 무선 리모컨 만들기 -_- (3) | 2017.10.25 |