public virtual PortCollection GetAllPorts()
        {
            PortCollection     pc   = new PortCollection();
            List <EventPortIn> list = DestinationPorts;

            if (list != null)
            {
                foreach (LinkLineNodeInPort p in list)
                {
                    pc.Add(p);
                }
            }
            if (_events != null)
            {
                if (IsRootClass)
                {
                    foreach (EventIcon ei in _events)
                    {
                        if (ei.CustomEvent != null)
                        {
                            List <EventPortIn> ports = ei.DestinationPorts;
                            if (ports != null && ports.Count > 0)
                            {
                                pc.AddRange(ports.ToArray());
                            }
                        }
                    }
                }
            }
            List <EventPortOut> l2 = SourcePorts;

            if (l2 != null)
            {
                foreach (LinkLineNodeOutPort p in l2)
                {
                    pc.Add(p);
                }
            }
            return(pc);
        }
Example #2
0
        public virtual PortCollection GetAllPorts()
        {
            PortCollection ports = new PortCollection();

            if (_newInport == null)
            {
                _newInport = new ProgramNewInPort(this);
            }
            if (_newOutport == null)
            {
                _newOutport = new ProgramNewOutPort(this);
            }
            ports.Add(_newInport);
            ports.Add(_newOutport);
            if (_inports != null)
            {
                ports.AddRange(_inports);
            }
            if (_outports != null)
            {
                ports.AddRange(_outports);
            }
            return(ports);
        }
Example #3
0
        private async void SaveAction()
        {
            ModelsShared.Models.port port = new ModelsShared.Models.port
            {
                CityID   = this.CityID,
                Code     = this.Code,
                PortType = this.PortType,
                Id       = this.Id,
                Name     = this.Name,
                CityName = CityCollection.SelectedItem.CityName
            };
            var res = await Collection.Add(port);

            if (res != null)
            {
                MessageBoxButton btn = MessageBoxButton.OK;
                var result           = ModernDialog.ShowMessage("Data Saved?", "Message Dialog", btn);
                Cancel.Execute(null);
            }
        }
        public DrawingTool()
        {
            InitializeComponent();
            if (Device.RuntimePlatform == Device.Android)
            {
                Xamarin.Forms.DependencyService.Get <IText>().GenerateFactor();
            }
            diagram.IsReadOnly = true;
            Node n1 = DrawNode(145, 110, 100, 55, ShapeType.Rectangle, "Node1");

            if (Device.RuntimePlatform == Device.UWP)
            {
                n1.ShapeType = ShapeType.Rectangle;
            }
            n1.Style.Brush       = new SolidBrush(Color.FromRgb(49, 162, 255));
            n1.Style.StrokeBrush = new SolidBrush(Color.FromRgb(23, 132, 206));
            PortCollection node1ports = new PortCollection();
            Port           port1      = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 0, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port2 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port3 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 1, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port4 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 1, ShapeType = ShapeType.Circle, IsVisible = true
            };

            node1ports.Add(port1);
            node1ports.Add(port2);
            node1ports.Add(port3);
            node1ports.Add(port4);
            n1.Ports = node1ports;
            Node n2 = DrawNode(30, 260, 100, 55, ShapeType.Rectangle, "Node2");

            if (Device.RuntimePlatform == Device.UWP)
            {
                n2.ShapeType = ShapeType.Rectangle;
            }
            n2.Style.Brush       = new SolidBrush(Color.FromRgb(239, 75, 93));
            n2.Style.StrokeBrush = new SolidBrush(Color.FromRgb(201, 32, 61));
            PortCollection node2ports = new PortCollection();
            Port           port5      = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 0, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port6 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port7 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 1, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port8 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 1, ShapeType = ShapeType.Circle, IsVisible = true
            };

            node2ports.Add(port5);
            node2ports.Add(port6);
            node2ports.Add(port7);
            node2ports.Add(port8);
            n2.Ports = node2ports;
            Node n3 = DrawNode(260, 260, 100, 55, ShapeType.Rectangle, "Node3");

            if (Device.RuntimePlatform == Device.UWP)
            {
                n3.ShapeType = ShapeType.Rectangle;
            }
            n3.Style.Brush       = new SolidBrush(Color.FromRgb(0, 194, 192));
            n3.Style.StrokeBrush = new SolidBrush(Color.FromRgb(14, 142, 135));
            PortCollection node3ports = new PortCollection();
            Port           port9      = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 0, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port10 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port11 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 1, NodeOffsetY = 0.5, ShapeType = ShapeType.Circle, IsVisible = true
            };
            Port port12 = new Port()
            {
                Width = 10, Height = 10, NodeOffsetX = 0.5, NodeOffsetY = 1, ShapeType = ShapeType.Circle, IsVisible = true
            };

            node3ports.Add(port9);
            node3ports.Add(port10);
            node3ports.Add(port11);
            node3ports.Add(port12);
            n3.Ports = node3ports;
            Connector con1 = new Connector()
            {
                SourcePort = port4, TargetPort = port5, SegmentType = SegmentType.StraightSegment, TargetDecoratorType = DecoratorType.None
            };
            Connector con2 = new Connector()
            {
                SourcePort = port4, TargetPort = port9, SegmentType = SegmentType.StraightSegment, TargetDecoratorType = DecoratorType.None
            };
            Connector con3 = new Connector()
            {
                SourcePort = port7, TargetPort = port10, SegmentType = SegmentType.StraightSegment, TargetDecoratorType = DecoratorType.None
            };

            diagram.AddNode(n1);
            diagram.AddNode(n2);
            diagram.AddNode(n3);
            diagram.AddConnector(con1);
            diagram.AddConnector(con2);
            diagram.AddConnector(con3);
        }
        private void SetupReferenceData()
        {
            var countries = new Country { CountryId = "1", Name = "USA", Code = "USA" };

            var states = new State { StateId = "2", CountryId = "1", Name = "Florida" };

            var ports = new Port { PortId = "1", City = "Florida", Name = "Miami", State = "Florida", StateId = "2", CountryId = "1" };

            var brands = new Brand { BrandId = "1", Name = "Carnival" };

            var personTypes = new PersonTypeEntity { PersonTypeId = "1001", Name = "Daniel" };

            var loyaltyLevelTypes = new LoyaltyLevelType { LoyaltyLevelTypeId = "1001", Name = "abc", BrandId = "1", NoOfCruiseNights = 3, LogoImageAddress = "abc" };

            var documentType = new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" };

            var brand = new BrandCollection();

            var country = new CountryCollection();
            country.Add(countries);

            var state = new StateCollection();
            state.Add(states);

            var documentTypes = new DocumentTypeCollection();
            documentTypes.Add(documentType);

            var port = new PortCollection();
            port.Add(ports);

            var personTypeEntity = new PersonTypeEntityCollection();
            personTypeEntity.Add(personTypes);

            var loyaltyLevelType = new LoyaltyLevelTypeCollection();
            loyaltyLevelType.Add(loyaltyLevelTypes);

            this.referenceData.AssignBrands(brand);
            this.referenceData.AssignCountries(country);
            this.referenceData.AssignStates(state);
            this.referenceData.AssignDocumentTypes(documentTypes);
            this.referenceData.AssignLoyaltyLevelTypes(loyaltyLevelType);
            this.referenceData.AssignPersonTypes(personTypeEntity);
            this.referenceData.AssignPorts(port);
        }
Example #6
0
    public static void Main()
    {
        ServiceDescription myServiceDescription = new ServiceDescription();

        myServiceDescription.Name            = "StockQuote";
        myServiceDescription.TargetNamespace = "http://www.contoso.com/stockquote.wsdl";

        // Generate the 'Types' element.
        XmlSchema myXmlSchema = new XmlSchema();

        myXmlSchema.AttributeFormDefault = XmlSchemaForm.Qualified;
        myXmlSchema.ElementFormDefault   = XmlSchemaForm.Qualified;
        myXmlSchema.TargetNamespace      = "http://www.contoso.com/stockquote.wsdl";

        //XmlSchemaElement myXmlSchemaElement;
        XmlSchemaComplexType myXmlSchemaComplexType = new XmlSchemaComplexType();

        myXmlSchemaComplexType.Name = "GetTradePriceInputType";
        XmlSchemaSequence myXmlSchemaSequence = new XmlSchemaSequence();

        myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement("1", "1", "tickerSymbol", true, new XmlQualifiedName("s:string")));
        myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement("1", "1", "time", true, new XmlQualifiedName("s:string")));
        myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
        myXmlSchema.Items.Add(myXmlSchemaComplexType);

        myXmlSchemaComplexType      = new XmlSchemaComplexType();
        myXmlSchemaComplexType.Name = "GetTradePriceOutputType";
        myXmlSchemaSequence         = new XmlSchemaSequence();
        myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement("1", "1", "result", true, new XmlQualifiedName("s:string")));
        myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
        myXmlSchema.Items.Add(myXmlSchemaComplexType);

        myXmlSchemaComplexType      = new XmlSchemaComplexType();
        myXmlSchemaComplexType.Name = "GetTradePriceStringFaultType";
        myXmlSchemaSequence         = new XmlSchemaSequence();
        myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement("1", "1", "error", true, new XmlQualifiedName("s:string")));
        myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
        myXmlSchema.Items.Add(myXmlSchemaComplexType);

        myXmlSchemaComplexType      = new XmlSchemaComplexType();
        myXmlSchemaComplexType.Name = "GetTradePriceStringIntType";
        myXmlSchemaSequence         = new XmlSchemaSequence();
        myXmlSchemaSequence.Items.Add(CreateComplexTypeXmlElement("1", "1", "error", true, new XmlQualifiedName("s:int")));
        myXmlSchemaComplexType.Particle = myXmlSchemaSequence;
        myXmlSchema.Items.Add(myXmlSchemaComplexType);

        myXmlSchema.Items.Add(CreateOtherXmlElement("GetTradePriceSoapIn", new XmlQualifiedName("s0:GetTradePriceInputType")));
        myXmlSchema.Items.Add(CreateOtherXmlElement("GetTradePriceSoapOut", new XmlQualifiedName("s0:GetTradePriceOutputType")));
        myXmlSchema.Items.Add(CreateOtherXmlElement("GetTradePriceSoapStringFault", new XmlQualifiedName("s0:GetTradePriceStringFaultType")));
        myXmlSchema.Items.Add(CreateOtherXmlElement("GetTradePriceSoapIntFault", new XmlQualifiedName("s0:GetTradePriceIntFaultType")));

        myServiceDescription.Types.Schemas.Add(myXmlSchema);

        // Generate the 'Message' element.
        MessageCollection myMessageCollection = myServiceDescription.Messages;

        myMessageCollection.Add(CreateMessage("GetTradePriceInput", "parameters", "GetTradePriceSoapIn", myServiceDescription.TargetNamespace));
        myMessageCollection.Add(CreateMessage("GetTradePriceOutput", "parameters", "GetTradePriceSoapOut", myServiceDescription.TargetNamespace));
        myMessageCollection.Add(CreateMessage("GetTradePriceStringFault", "parameters", "GetTradePriceStringSoapFault", myServiceDescription.TargetNamespace));
        myMessageCollection.Add(CreateMessage("GetTradePriceIntFault", "parameters", "GetTradePriceIntSoapFault", myServiceDescription.TargetNamespace));

        // Generate the 'Port Type' element.
        PortTypeCollection myPortTypeCollection = myServiceDescription.PortTypes;
        PortType           myPortType           = new PortType();

        myPortType.Name = "StockQuotePortType";
        OperationCollection myOperationCollection = myPortType.Operations;
        Operation           myOperation           = new Operation();

        myOperation.Name = "GetTradePrice";
        OperationMessage           myOperationMessage;
        OperationMessageCollection myOperationMessageCollection = myOperation.Messages;

        myOperationMessage         = (OperationMessage) new OperationInput();
        myOperationMessage.Message = new XmlQualifiedName("s0:GetTradePriceInput");
        myOperationMessageCollection.Add(myOperationMessage);
        myOperationMessage         = (OperationMessage) new OperationOutput();
        myOperationMessage.Message = new XmlQualifiedName("s0:GetTradePriceOutput");
        myOperationMessageCollection.Add(myOperationMessage);
        OperationFault myOperationFault = new OperationFault();

        myOperationFault.Name    = "ErrorString";
        myOperationFault.Message = new XmlQualifiedName("s0:GetTradePriceStringFault");
        myOperation.Faults.Add(myOperationFault);
        myOperationFault         = new OperationFault();
        myOperationFault.Name    = "ErrorInt";
        myOperationFault.Message = new XmlQualifiedName("s0:GetTradePriceIntFault");
        myOperation.Faults.Add(myOperationFault);
        myOperationCollection.Add(myOperation);
        myPortTypeCollection.Add(myPortType);

        // Generate the 'Binding' element.
        ServiceDescriptionFormatExtensionCollection myExtensions;
        BindingCollection myBindingCollection = myServiceDescription.Bindings;
        Binding           myBinding           = new Binding();

        myBinding.Name = "StockQuoteSoapBinding";
        myBinding.Type = new XmlQualifiedName("s0:StockQuotePortType");
        myExtensions   = myBinding.Extensions;
        SoapBinding mySoapBinding = new SoapBinding();

        mySoapBinding.Style     = SoapBindingStyle.Document;
        mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http";
        myExtensions.Add(mySoapBinding);
        OperationBindingCollection myOperationBindingCollection = myBinding.Operations;
        OperationBinding           myOperationBinding           = new OperationBinding();

        myExtensions = myOperationBinding.Extensions;
        SoapOperationBinding mySoapBindingOperation = new SoapOperationBinding();

        mySoapBindingOperation.SoapAction = "http://www.contoso.com/GetTradePrice";
        myExtensions.Add(mySoapBindingOperation);
        myOperationBinding.Name  = "GetTradePrice";
        myOperationBinding.Input = new InputBinding();
        myExtensions             = myOperationBinding.Input.Extensions;
        SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();

        mySoapBodyBinding.Use       = SoapBindingUse.Literal;
        mySoapBodyBinding.Namespace = "http://www.contoso.com/stockquote";
        myExtensions.Add(mySoapBodyBinding);
        myOperationBinding.Output = new OutputBinding();
        myExtensions                = myOperationBinding.Output.Extensions;
        mySoapBodyBinding           = new SoapBodyBinding();
        mySoapBodyBinding.Use       = SoapBindingUse.Literal;
        mySoapBodyBinding.Namespace = "http://www.contoso.com/stockquote";
        myExtensions.Add(mySoapBodyBinding);
// <Snippet1>
// <Snippet2>
// <Snippet3>
        FaultBindingCollection myFaultBindingCollection = myOperationBinding.Faults;
        FaultBinding           myFaultBinding           = new FaultBinding();

        myFaultBinding.Name = "ErrorString";
        // Associate SOAP fault binding to the fault binding of the operation.
        myExtensions = myFaultBinding.Extensions;
        SoapFaultBinding mySoapFaultBinding = new SoapFaultBinding();

        mySoapFaultBinding.Use       = SoapBindingUse.Literal;
        mySoapFaultBinding.Namespace = "http://www.contoso.com/stockquote";
        myExtensions.Add(mySoapFaultBinding);
        myFaultBindingCollection.Add(myFaultBinding);
// </Snippet3>
// </Snippet2>
// </Snippet1>
        myFaultBinding      = new FaultBinding();
        myFaultBinding.Name = "ErrorInt";
        // Associate SOAP fault binding to the fault binding of the operation.
        myExtensions                 = myFaultBinding.Extensions;
        mySoapFaultBinding           = new SoapFaultBinding();
        mySoapFaultBinding.Use       = SoapBindingUse.Literal;
        mySoapFaultBinding.Namespace = "http://www.contoso.com/stockquote";
        myExtensions.Add(mySoapFaultBinding);
        myFaultBindingCollection.Add(myFaultBinding);
        myOperationBindingCollection.Add(myOperationBinding);
        myBindingCollection.Add(myBinding);

        // Generate the 'Service' element.
        ServiceCollection myServiceCollection = myServiceDescription.Services;
// <Snippet4>
        Service myService = new Service();

        // Add a simple documentation for the service to ease the readability of the generated WSDL file.
        myService.Documentation = "A Simple Stock Quote Service";
        myService.Name          = "StockQuoteService";
        PortCollection myPortCollection = myService.Ports;
        Port           myPort           = new Port();

        myPort.Name    = "StockQuotePort";
        myPort.Binding = new XmlQualifiedName("s0:StockQuoteSoapBinding");
        myExtensions   = myPort.Extensions;
        SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();

        mySoapAddressBinding.Location = "http://www.contoso.com/stockquote";
        myExtensions.Add(mySoapAddressBinding);
        myPortCollection.Add(myPort);
// </Snippet4>
        myServiceCollection.Add(myService);

        // Display the WSDL generated to the console.
        myServiceDescription.Write(Console.Out);
    }
        /// <summary>
        /// Maps the ports.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>port collection.</returns>
        private static async Task<PortCollection> MapPorts(SqlDataReader dataReader)
        {
            var portCollection = new PortCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var port = new Port
                    {
                        PortId = dataReader.Int32Field(PortId).ToString(),
                        CountryId = dataReader.Int32Field(CountryId).ToString(),
                        Code = dataReader.StringField(Code),
                        City = dataReader.StringField(City),
                        State = dataReader.StringField(State),
                        StateId = dataReader.Int32NullableField(StateId).ToString(),
                        Description = dataReader.StringField(Description),
                        Name = dataReader.StringField(Name)
                    };

                    portCollection.Add(port);
                }
            }

            return portCollection;
        }