private void OnVertexImported(NDataSourceImporter importer, NShape shape, INDataRecord dataRecord) { // Create a shape to host in the group based on the value of the "Type" column NShape innerShape = null; switch (dataRecord.GetColumnValue("Type").ToString()) { case "DB": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.Binder); break; case "File": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.SimpleFolder); break; case "Report": innerShape = m_FilesAndFoldersFactory.CreateShape(FilesAndFoldersShapes.BlankFile); break; } innerShape.Text = dataRecord.GetColumnValue("Id").ToString(); // Host the created shape in the group NGroup group = (NGroup)shape; group.Shapes.AddChild(innerShape); group.UpdateModelBounds(); }
/// <summary> /// Called when a vertex shape was created by the NGraphDataSourceImporter for the specified data record /// </summary> /// <param name="importer"></param> /// <param name="shape"></param> /// <param name="dataRecord"></param> private void OnVertexImported(NDataSourceImporter importer, NShape shape, INDataRecord dataRecord) { // display the page title in the shape object text = dataRecord.GetColumnValue("Title"); if (text == null) { shape.Text = "Title not specified"; } else { shape.Text = text.ToString(); } shape.SizeToText(new NMarginsF(10)); // make the URL a tooltip of the shape object url = dataRecord.GetColumnValue("URL"); if (url == null || url.ToString().Length == 0) { shape.Style.InteractivityStyle = new NInteractivityStyle("URL not specified"); } else { shape.Style.InteractivityStyle = new NInteractivityStyle(url.ToString()); } }
private void OnEdgeImported(NDataSourceImporter dataSourceImporter, NShape shape, INDataRecord dataRecord) { // Set the text of the edge shape.Text = dataRecord.GetColumnValue("Desc").ToString(); // Get the symbol name if any object symbol = dataRecord.GetColumnValue("Symbol"); if (symbol == null || Convert.IsDBNull(symbol)) { return; } // Add a logical line port NLogicalLinePort linePort = new NLogicalLinePort(20); shape.CreateShapeElements(ShapeElementsMask.Ports); shape.Ports.AddChild(linePort); // Attach a custom shape based on the symbol name NShape customShape = null; switch (symbol.ToString()) { case "Stop": customShape = m_BusinessProcessShapesFactory.CreateShape(BusinessProcessShapes.StopAccepted); break; case "Question": customShape = m_BusinessProcessShapesFactory.CreateShape(BusinessProcessShapes.Question); break; } ((NDrawingDocument)shape.Document).ActiveLayer.AddChild(customShape); // Protect the symbol from user interactions NAbilities protection = customShape.Protection; protection.All = true; customShape.Protection = protection; // Add an outward port to the shape NRotatedBoundsPort outwardPort = new NRotatedBoundsPort(new NContentAlignment(ContentAlignment.MiddleCenter)); outwardPort.Type = PortType.Outward; customShape.CreateShapeElements(ShapeElementsMask.Ports); customShape.Ports.AddChild(outwardPort); outwardPort.Connect(linePort); }
/// <summary> /// Called when a vertex shape was created by the NTreeDataSourceImporter for the specified data record /// </summary> /// <param name="importer"></param> /// <param name="shape"></param> /// <param name="dataRecord"></param> private void OnVertexImported(NDataSourceImporter importer, NShape shape, INDataRecord dataRecord) { // display the page title in the shape object text = dataRecord.GetColumnValue("Title"); if (text == null) { shape.Text = "Title not specified"; } else { shape.Text = text.ToString(); } shape.SizeToText(new NMarginsF(10)); }
public NEmployee(INDataRecord data) { Name = data.GetColumnValue("Name").ToString(); Position = data.GetColumnValue("Position").ToString(); BirthDate = (DateTime)data.GetColumnValue("BirthDate"); Salary = (decimal)data.GetColumnValue("Salary"); Biography = data.GetColumnValue("Biography").ToString(); string photoImage = data.GetColumnValue("Photo").ToString(); PhotoFileName = "~\\Images\\" + photoImage; }
public NEmployee(INDataRecord data) { Name = data.GetColumnValue("Name").ToString(); Position = data.GetColumnValue("Position").ToString(); BirthDate = (DateTime)data.GetColumnValue("BirthDate"); Salary = (decimal)data.GetColumnValue("Salary"); Biography = data.GetColumnValue("Biography").ToString(); byte[] imageData = data.GetColumnValue("Photo") as byte[]; if (imageData != null) { // Signature bytes of an OLE container header. const byte OLEbyte0 = 21; const byte OLEbyte1 = 28; // Number of bytes in an OLE container header. const int OLEheaderLength = 78; // Test for an OLE container header if ((imageData[0] == OLEbyte0) && (imageData[1] == OLEbyte1)) { // Use a second array to strip off the header. Make it big enough to hold // the bytes after the header. byte[] strippedData = new byte[imageData.Length - OLEheaderLength]; // Strip off the header by copying the bytes after the header. Array.Copy(imageData, OLEheaderLength, strippedData, 0, imageData.Length - OLEheaderLength); imageData = strippedData; } Photo = new Bitmap(new MemoryStream(imageData)); } else { Photo = new Bitmap(80, 100); } }