Good day. I am currently using diagram in our application. I use Server-Side Programming and bring all data from database. It builds diagram when I add a new shape to it, but when I added connection to existing shape (from 3 to 2) I've gotten the error( see attached files)
private void BuildProcess()
{
ProcessDiagram.ShapesCollection.Clear();
ProcessDiagram.ConnectionsCollection.Clear();
string primaryEventGUID = SetPrimaryEvent();
if (primaryEventGUID != string.Empty)
{
ProcessEvent primary = new ProcessEvent(primaryEventGUID);
List<ProcessConnection> connecList = new List<ProcessConnection>();
string vSQL = "SELECT ProcessConnectionGUID FROM tblBPM_ProcessConnections WHERE ProcessGUID='" + processGUID + "' ORDER BY OrderNumber";
IDataReader getList = DB.GetRS(vSQL);
while (getList.Read())
{
connecList.Add(new ProcessConnection(DB.RSFieldGUID(getList, "ProcessConnectionGUID")));
}
getList.Close();
if (connecList.Count > 0)
{
foreach (ProcessConnection conn in connecList)
{
DiagramConnection connection = new DiagramConnection();
connection.FromSettings.ShapeId = conn.eventGUID;
connection.ToSettings.ShapeId = conn.nextEventGUID;
connection.ContentSettings.FontWeight = "bold";
connection.Editable = false;
connection.EndCap = Telerik.Web.UI.Diagram.ConnectionEndCap.ArrowEnd;
connection.StrokeSettings.Width = 8;
connection.HoverSettings.StrokeSettings.DashType = Telerik.Web.UI.Diagram.StrokeDashType.DashDot;
connection.Id = conn.guid;
connection.ContentSettings.Text = conn.connection;
connection.FromSettings.Connector = "Bottom";
connection.ToSettings.Connector = "Top";
ProcessDiagram.ConnectionsCollection.Add(connection);
}
}
List<ProcessEvent> eventList = new List<ProcessEvent>();
vSQL = "SELECT ProcessEventGUID FROM tblBPM_ProcessEvents WHERE ProcessGUID='" + processGUID + "'";
getList = DB.GetRS(vSQL);
while (getList.Read())
{
eventList.Add(new ProcessEvent(DB.RSFieldGUID(getList, "ProcessEventGUID")));
}
getList.Close();
if (eventList.Count > 0)
{
foreach (ProcessEvent item in eventList)
{
EventType type;
if (item.guid == primary.guid)
{
type = EventType.PRIMARYEVENT;
}
else if (item.type == 3)
{
type = EventType.EVENT;
}
else
{
type = EventType.TERMINATE;
}
DiagramShape shape = GetShape(type, item.events, item.guid);
ProcessDiagram.ShapesCollection.Add(shape);
}
}
}
}
private string SetPrimaryEvent()
{
string primaryGUID = string.Empty;
string vSQL = "SELECT StartEventGUID FROM tblBPM_Processes WHERE ProcessGUID='" + processGUID + "'";
IDataReader getPrimary = DB.GetRS(vSQL);
if (getPrimary.Read())
{
primaryGUID = DB.RSField(getPrimary, "StartEventGUID");
}
getPrimary.Close();
StartEventGUID = primaryGUID;
ViewState["StartEvent"] = primaryGUID;
return primaryGUID;
}
private DiagramShape GetShape(EventType type, string text, string value)
{
if (text.Length > 25)
{
text = text.Substring(0, 25) + "...";
}
if (type == EventType.TERMINATE)
{
text = "Ending Event";
}
DiagramShape shape = new DiagramShape();
shape.Id = value;
shape.ContentSettings.Text = text;
shape.MinWidth = 10;
shape.Width = 275;
shape.Selectable = false;
shape.ContentSettings.FontFamily = CobbleStoneCommon.AppLogic.AppConfig("UI_AppFontName");
shape.Editable = false;
shape.ContentSettings.Color = "#fff";
shape.ContentSettings.FontStyle = "fill:white";
switch (type)
{
case EventType.PRIMARYEVENT:
{
shape.FillSettings.Color = "#4286f4";
break;
}
case EventType.EVENT:
{
shape.FillSettings.Color = "#F18100";
break;
}
case EventType.TERMINATE:
{
shape.FillSettings.Color = "#13d86f";
break;
}
}
return shape;
}
If it is possible to connect existing shape and what cause this error? Thank you.