Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic On Node Created Method (Read 1948 times)
charu
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jul 6th, 2009
On Node Created Method
Jul 6th, 2009 at 8:11pm
Print Post  
Hi,

I am using flowcharter type application ( the sample code in wpf diagram) I need to make an entry in database when a node is created. I found out that I can use On Node created method for the same. Can you please give me a sample code snipette which I can reuse for making different entries in database ( depending on node shape) .

Thank you very much in advance and hope to see a response soon.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: On Node Created Method
Reply #1 - Jul 7th, 2009 at 3:48pm
Print Post  
Hi,

If you have a database table called Node, create a LINQ class for it by dragging the table from the Server Explorer to the LINK to SQL design surface. Then you’ll be able to create a new record corresponding to the node  like this:

Code
Select All
ShapeNode shape = e.Node as ShapeNode;
if (shape != null)
{
	var data = new DataClasses1DataContext();
	data.Nodes.InsertOnSubmit(
		new Node() { label = shape.Text; });
	data.SubmitChanges();
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: On Node Created Method
Reply #2 - Jul 7th, 2009 at 3:49pm
Print Post  
"label" above is the name of a field in the Node table.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint