This is a migrated thread and some comments may be shown as answers.

SQL Database

32 Answers 230 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Colin Wright
Top achievements
Rank 2
Colin Wright asked on 02 May 2012, 03:55 PM
Has anyone  got an example or tutorial of using SQL Tables to store Gantt View information?

32 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 08 May 2012, 12:59 PM
Hi,

We prepared a sample example how to populate the RadGanttView with a data from a SqlServer. In the attached zip file you can find the project plus db schema and backup which will restore the database with a sample data. Also, the connection string must be modified for the correct server name.

Please, note that the GanttView is still in CTP version and there could be some breaking changes with the official release, but they will be documented and the project will be modified. The attached sample works with the official Q1 SP1 assemblies.

Hope this helps.

Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kholisa
Top achievements
Rank 1
answered on 16 May 2012, 12:41 PM
Hi There

I was trying to use the example you uploaded example and i got an error that says GanttViewDBEntities is missing an assembly, how to I solve that as I urgently want to save information to database

Thanks 
0
George
Telerik team
answered on 16 May 2012, 02:47 PM
Hi,

Please, double check the connection string in the project. It must match the correct server and database.

Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kholisa
Top achievements
Rank 1
answered on 18 May 2012, 11:51 AM
Hi

I manage to connect to sql database but now the ganntt loads empty, where do you do your stored procedures (select,Insert,Update) as i want to perform those in my gannt

Thanks
0
Kholisa
Top achievements
Rank 1
answered on 22 May 2012, 03:46 PM
Hi George

I am connected to database but the form loads null, i have create the stored procedure on sql and imported to emdx funtion.
My SELECT Statement

SELECT

 

Title,Description

FROM

 

dbo.SqlTasks

looking forward to your response, really need your help
0
George
Telerik team
answered on 28 May 2012, 04:18 PM
Hello,

Please, double check whether the database contains any records. Moreover, check the VisibleRange of the GanttView and if there are any tasks what are visible in the ranged.

Kind regards,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Erik
Top achievements
Rank 1
answered on 30 Jul 2012, 08:03 PM
Hi George,

I'm interested in using the GanttView control and I downloaded the example you posted here but I can't try it. I attached the .bak file to my SQL Server 2008 and then I opened it in Visual Studio 2010 and change the ConnectionString so it match my server. First it says that there is no type known as IRelation (I solve this by adding the Telerik.Windows.Data reference). After that appears a lot of errors. I show you them in the attached image.
Could you help me and guide me to the solution? Sorry if I'm missing something evident.

Regards,

Erik
0
George
Telerik team
answered on 03 Aug 2012, 06:15 AM
Hello Erik,

With the Q2 release we introduced some breaking changes for the control which could cause the issues you faced with. Please, refer to our online documentation for more information about RadGanttView backward compatibility - http://www.telerik.com/help/silverlight/radganttview-backward-compatibility.html 

Hope this helps.

Regards,
George
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Eddie
Top achievements
Rank 1
answered on 30 May 2013, 11:56 PM
Hello everyone,

Is there any updated versión of this simple for the 2013 version of Silverligth? 

I mostly get issues in the SQLTask.cs here:

 

private IList relations;
IList IGanttTask.Relations
{
    get
    {
        if (this.relations == null)
        {
            using (var context = new GanttViewDBEntities())
            {
                this.relations = context.SqlTasks.Single(task => task.SqlTaskId == this.SqlTaskId).SqlRelations.ToList();
            }
        }
        return this.relations;
    }
}

 

I really would appreciate your help, on this matter.

0
Ventzi
Telerik team
answered on 31 May 2013, 07:32 AM
Hi Eddie,

I'm sending you attached a recently made sample project which demonstrates how to use RadGanttView with a DB as source. In the web project is also a sql script included which should help you to create the basic DB table which is needed for this example.

I hope this helps.

Regards,
Ventzi
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sebastien
Top achievements
Rank 1
answered on 25 Jul 2014, 08:54 AM
Hi Ventzi,

Thanks for this project. It clarifies a bit the way to store the data in a database. It seems there is an issue when I try to move a task on upper level or lower level (slide it up or down with the mouse). Silverlight crashes when it renders the page. Would it be possible to have a look?

More generally how to you save the order of tasks in the database and how you retried them in the correct order to display them ?

And is it possible later on to export Telerik tasks into Microsoft Project?

I want to use this Telerik control in order to offer to our user an easy tool to manage their tasks and to avoid the complexity of
Microsoft Project.

Thanks

Sebastien
0
George
Telerik team
answered on 29 Jul 2014, 12:43 PM
Hi Sebantien,

Can you send us a video of the exception? What type of exception is it? This will be helpful in order to reproduce the problem.

According to the saving/retrieving the tasks - they are retrieved in the way they are saved and this is automatically handled by EF. Note that the tasks are retrieved in a time range in the GanttViewDomainService.

Currently only importing from MS project is available for RadGanttView - example of that can be found here. Exporting to MS Project is not implemented yet. It is logged as future request here and you can vote for it. If it gets enough clients request, we will review it for our upcoming development. 

I am looking forward to your reply.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 31 Jul 2014, 12:45 PM
Hi Georges,

Thanks for your help. I did a little video that shows you the issue using Microsoft Expression Encoder. (Replace extension .jpg by .xesc and it should work). Hope you will be able to read it.

The video start by showing the db structure. Then the project itself that is a copy from Telerik example with a Master page.
I try to move up a task and the Gantt control crash.

Best regards
Sebastien

0
Kalin
Telerik team
answered on 04 Aug 2014, 01:33 PM
Hello Sebastien,

We managed to reproduce the issue with the example - it was caused by an improvement with the implementation of the GanttView control introduced after the example was posted in this thread. What you need to do in order to fix it is would be to also inherit from the IEditableHierarchical interface in the SqlTask class:

public partial class SqlTask : IGanttTask, IMilestone, ISummary, IDependant, IEditableHierarchical
{
   ...
}

Afterwards you have to implement the two methods coming from the interface the following way:

public void InsertChildAtIndex(object item, int index)
{
    var tasks = (ObservableCollection<SqlTask>)this.Children;
    var ganttTask = item as SqlTask;
    if (ganttTask != null && index <= tasks.Count)
    {
        tasks.Insert(index, ganttTask);
        var sqlParentChildTask = new SqlParentChildTask() { ParentTaskId = this.Id, ChildTaskId = ganttTask.Id };
        GanttViewRepository.Context.SqlParentChildTasks.Add(sqlParentChildTask);
    }
}
 
public void Remove(object item)
{
    var tasks = (ObservableCollection<SqlTask>)this.Children;
    var ganttItem = item as SqlTask;
    if (ganttItem != null)
    {
        tasks.Remove(ganttItem);
        var sqlParentChildTask = GanttViewRepository.Context.SqlParentChildTasks.FirstOrDefault(ct => ct.ChildTaskId == ganttItem.Id);
        if (sqlParentChildTask != null)
        {
            GanttViewRepository.Context.SqlParentChildTasks.Remove(sqlParentChildTask);
        }
    }
}

Please give it a try and let me know if it resolves the issue.

Hope this helps. I have also updated your Telerik points for your involvement.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 05 Aug 2014, 09:37 AM
Hi Kalin,

Thanks a lot for the fast reply. I tested it this morning and it works fine. I noticed one more issue that I can reproduce on the sample project. If you add more than one task in a row(not a child) , only the first task added is saved in the database.

Regards
Sebastien
0
Kalin
Telerik team
answered on 05 Aug 2014, 11:45 AM
Hi Sebastien,

Thanks for your feedback - I have managed to reproduce the issue. In order to fix it you will have to modify the InsertTask method of the GanttViewModel class the following way:

internal bool InsertTask(SqlTask task)
{
    if (!this.IsChild(task, this.tasks))
    {
        this.tasks.Add(task);
 
        if (task.EntityState == EntityState.Detached)
        {
            GanttViewRepository.Context.SqlTasks.Add(task);
            return true;
        }
    }
 
    return false;
}

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 05 Aug 2014, 12:15 PM
Thanks again Kalin. It works fine.
Greetings from Stockholm
Sebastien
0
Kalin
Telerik team
answered on 05 Aug 2014, 12:47 PM
Hi Sebastien,

I'm glad it helped. If you have any other question or concerns, please do not hesitate to contact us.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 06 Aug 2014, 03:35 PM
Hello Kalin,

I’m facing a new problem link to dependency between tasks. Prior to be saved all new tasks added have the same id = 0. If I add 3 new tasks in a row with dependency between them, then only the first task added will keep its dependency.

The work around is to save automatically after adding a new task and after all manipulation in the UI. I tried to implement the events ManipulationCompleted, ManipulationDelta, ManipulationStarted, I got the error message: Failed to assign to property 'System.Windows.UIElement.ManipulationCompleted'.

Best regards

Sebastien

0
Kalin
Telerik team
answered on 11 Aug 2014, 12:54 PM
Hello Sebastien,

I managed to reproduce the issue. After further investigation it appears that the easiest solution in this case would be to Save after each new Task is added. You will need to replace the InsertTast method with the following one:

internal bool InsertTask(SqlTask task)
{
    if (!this.IsChild(task, this.tasks))
    {
        this.tasks.Add(task);
 
        if (task.EntityState == EntityState.Detached || task.EntityState == EntityState.New)
        {
            GanttViewRepository.Context.SqlTasks.Add(task);
            GanttViewRepository.SaveData();
            return true;
        }
    }
 
    return false;
}

However we will think of the better solution later on when possible.

Please test and let me know if this works for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 12 Aug 2014, 08:52 AM
Hi kalin,

I also moved into that direction and auto-save all new tasks. Your code works fine. What annoy me with this solution is that users can drag and drop dependencies between tasks in the UI. There is no event handler to catch those changes, so a save button should remained. It will bring confusion to user that new tasks are automatically saved but new dependencies are not. For all other action like moving a task, changing the title etc… the event handler TaskEdited works fine.

Have a good day
Sebastien



0
Kalin
Telerik team
answered on 12 Aug 2014, 01:03 PM
Hi Sebastien,

When modifying the dependencies between the Tasks in the UI the AddDependency method in the SqlTask class is called - you can save there. You might need to save in RemoveDependency method as well.

Please test it and let me know if it works.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 12 Aug 2014, 01:19 PM
Hi Kalin,

Yes it works. My problem is solved. No save button and all actions are directly saved in the database.

Thanks
Sebastien

0
Kalin
Telerik team
answered on 13 Aug 2014, 12:38 PM
Hello Sebastien,

I'm glad it helped. If you have any further questions or concerns, please let us know.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sebastien
Top achievements
Rank 1
answered on 11 May 2015, 01:41 PM

Hi Kalin,

I'm coming back to the forum with a new question regarding import from Microsoft Project. We would like to have the possibility to import directly from Microsoft Project tasks into our Sql database. On Telerik demo website there is this example :

http://demos.telerik.com/silverlight/#GanttView/Import

This example show a method that convert XML from MSProject  into a task list that is an ObservableCollection<GanttTask>();

Would you have a method to convert XML from MSProject into an ObservableCollection<SqlTask> or would you have a method to convert GanttTask into SqlTask ?

Best regards

Sebastien

0
Polya
Telerik team
answered on 12 May 2015, 12:06 PM
Hello Sebastien,

In the mentioned example in MsProjectImportHelper we are generating GanttTasks from the provided xml. Similarly we can generate SqlTask instead of GanttTask as the SqlTask is also an IGanttTask.We should add the missing UniqueId property in the SqlTask class.
If you wish to convert each GanttTask generated from the MsProjectImportHelper.GetMsTasks() to SqlTask you can use something like that:
private static Dictionary<GanttTask, SqlTask> generatedTasks = new Dictionary<GanttTask, SqlTask>();
 
public SqlTask ConvertGanttTaskToSqlTask(GanttTask gTask)
{
    var sTask = new SqlTask()
    {
        Start = gTask.Start,
        End = gTask.End,
        Title = gTask.Title,
        Deadline = gTask.Deadline,
        UniqueId = gTask.UniqueId,
        Description = gTask.Description,
        Duration = gTask.Duration,
    };
 
    var currentSqlTaskChildTasks = (ObservableCollection<SqlTask>)sTask.Children;
 
    foreach (var childGanttTask in gTask.Children)
    {
        currentSqlTaskChildTasks.Add(this.ConvertGanttTaskToSqlTask((GanttTask)childGanttTask));
    }
 
    sTask.Children = currentSqlTaskChildTasks;
 
    generatedTasks.Add(gTask, sTask);
 
    return sTask;
}
 
//After all SqlTasks are Generated we should add their dependencies.
public void AddSqlDependenciesToGeneratedSqlTask(GanttTask gTask)
{
    var sTask = generatedTasks[gTask];
 
    foreach (var dependency in gTask.Dependencies)
    {
        sTask.Dependencies.Add(new SqlDependency() { FromTask = generatedTasks[(GanttTask)dependency.FromTask], DependencyType = dependency.Type });
    }
}

Hope this helps.

Regards,
Polya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Sebastien
Top achievements
Rank 1
answered on 12 May 2015, 03:37 PM

Hello Polya,

Thanks for the very quick reply. We will have a look at this solution.

Best regards

Sebastien

0
AbreuL
Top achievements
Rank 1
answered on 26 May 2015, 10:04 AM

Hello Polya, my name is Leonel, I'm working with Sebastien in the same project.

Sometimes when I change dates or add a child task (for example), silverlight exception are thrown, (see attached file), how can I debug that to see errors?

0
Polya
Telerik team
answered on 27 May 2015, 12:44 PM
Hi Leonel,

Are you using Internet Explorer to debug the Silverlight Application. There might be several things that can help you isolate the issue. You can check this article http://www.codeproject.com/Articles/238781/Why-Visual-Studio-Debugger-is-not-working-for-my-S for more information on how to debug Silverlight applications.

Also if you can isolate the issue in a sample project you can open a support ticket and attach it there so we can investigate it further.

Regards,
Polya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jenia
Top achievements
Rank 2
answered on 15 Aug 2017, 05:05 PM

Seems like there is not too much info over the Net regarding Gantt and SQL. In my case a have a tree column (should be task and sub task) but how do I set bind them to SQL table? There's only option to set binding for tree column.

<telerik:RadGanttView.Columns><telerik:TreeColumnDefinition MemberBinding="{Binding TaskId}" Header="Tasks" IsFrozenColumn="True"/><telerik:ColumnDefinition MemberBinding="{Binding StartTime}" Header="Start" /><telerik:ColumnDefinition MemberBinding="{Binding EndTime}" Header="End" /></telerik:RadGanttView.Columns>

Can someone please upload working WPF project.

 

 

0
David
Top achievements
Rank 1
answered on 01 Oct 2018, 08:02 PM
Hello, have problem with insert a new task or update the progress on SQL, i don't know how do it or who radgantt event added, someone that share me ur script? thank.
0
Martin Ivanov
Telerik team
answered on 02 Oct 2018, 06:59 AM
Hi David,

Can you please take a look at the ConnectToDatabase GanttView SDK example and let me know if it helps?

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GanttView
Asked by
Colin Wright
Top achievements
Rank 2
Answers by
George
Telerik team
Kholisa
Top achievements
Rank 1
Erik
Top achievements
Rank 1
Eddie
Top achievements
Rank 1
Ventzi
Telerik team
Sebastien
Top achievements
Rank 1
Kalin
Telerik team
Polya
Telerik team
AbreuL
Top achievements
Rank 1
Jenia
Top achievements
Rank 2
David
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or