Inheritance: System.Item
Esempio n. 1
0
 public ConnectorObject(Connector connector)
 {
    this.Id = connector.Id;
    this.IsActive = connector.IsActive;
    this.Diameter = connector.Diameter;
    this.WallThickness = connector.WallThickness;
    this.Joint = connector.Joint;
 }
Esempio n. 2
0
        /// <summary>
        /// Creates the PartData element on the corresponding jointing 
        /// element Part and respective joint Id 
        /// </summary>
        /// <param name="part">Connected part of Joint</param>
        /// <param name="jointId">Guid of Joint</param>
        public PartData(Part part, Guid jointId)
            : this()
        {
            Id = part.Id;
            Number = part.Number;
            ConstructionStatus = part.ConstructionStatus;
            Connectors = new List<construction.Connector>();

            var connector = new construction.Connector();

            if (part is construction.Component)
            {
                PartType = PartType.Component;
                Length = part.Length;

                connector.Diameter = ((construction.Component)part)
                    .Connectors
                    .First<Connector>(x => x.Joint != null && x.Joint.Id == jointId)
                    .Diameter;
                connector.WallThickness = ((construction.Component)part)
                    .Connectors
                    .First<Connector>(x => x.Joint != null && x.Joint.Id == jointId)
                    .WallThickness;
               
                PartTypeDescription
                    = ((construction.Component)part).Type.Name;
            }
            else if (part is Pipe)
            {
                PartType = PartType.Pipe;
                Length = part.Length;

                connector.Diameter = ((Pipe)part).Diameter;
                connector.WallThickness = ((Pipe)part).WallThickness;
            }
            else
            {
                PartType = PartType.Spool;
                Length = part.Length;

                connector.Diameter = ((construction.Spool)part).Pipe.Diameter;
                connector.WallThickness = ((construction.Spool)part).Pipe.WallThickness;
            }

            Connectors.Add(connector);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the PartData element on the corresponding jointing
        /// element Part and respective joint Id
        /// </summary>
        /// <param name="part">Connected part of Joint</param>
        /// <param name="jointId">Guid of Joint</param>
        public PartData(Part part, Guid jointId)
            : this()
        {
            Id                 = part.Id;
            Number             = part.Number;
            ConstructionStatus = part.ConstructionStatus;
            Connectors         = new List <construction.Connector>();

            var connector = new construction.Connector();

            if (part is construction.Component)
            {
                PartType = PartType.Component;
                Length   = part.Length;

                connector.Diameter = ((construction.Component)part)
                                     .Connectors
                                     .First <Connector>(x => x.Joint != null && x.Joint.Id == jointId)
                                     .Diameter;
                connector.WallThickness = ((construction.Component)part)
                                          .Connectors
                                          .First <Connector>(x => x.Joint != null && x.Joint.Id == jointId)
                                          .WallThickness;

                PartTypeDescription
                    = ((construction.Component)part).Type.Name;
            }
            else if (part is Pipe)
            {
                PartType = PartType.Pipe;
                Length   = part.Length;

                connector.Diameter      = ((Pipe)part).Diameter;
                connector.WallThickness = ((Pipe)part).WallThickness;
            }
            else
            {
                PartType = PartType.Spool;
                Length   = part.Length;

                connector.Diameter      = ((construction.Spool)part).Pipe.Diameter;
                connector.WallThickness = ((construction.Spool)part).Pipe.WallThickness;
            }

            Connectors.Add(connector);
        }
Esempio n. 4
0
        /// <summary>
        /// Set the connector of PartData element by coresponding Row
        /// </summary>
        /// <param name="row">The Row gives the diameter of components connector</param>
        public void SetPartConnectors(DataRow row)
        {
            var cnt = new Connector();

            if (this.PartType == PartType.Component)
            {
                cnt.Diameter = row.Field<decimal>("diameter");
                cnt.WallThickness = row.Field<decimal>("wallThickness");

                this.Connectors.Add(cnt);

                SetConnectorsCountString(this);
            }
            else
            {
                cnt.Diameter = this.Diameter;
                cnt.WallThickness = this.WallThickness;

                this.Connectors.Add(cnt);

                if (this.ConstructionStatus != PartConstructionStatus.Welded)
                {
                    this.Connectors.Add(cnt);
                }

                SetConnectorsCountString(this);
            }
        }
 private Domain.Entity.Construction.Component CreateComponent(ComponentType componentType)
 {
     var component = new Domain.Entity.Construction.Component
     {
         ConstructionStatus = PartConstructionStatus.Pending,
         InspectionStatus = PartInspectionStatus.Pending,
         Certificate = RndString(12),
         Length = rnd.Next(1000),
         Number = RndString(14),
         Type = componentType,
         IsAvailableToJoint = true,
         ToExport = true,
         IsActive = true
     };
     for(int j = 0; j < componentType.ConnectorsCount; j++)
     {
         var con = new Connector
         {
             Component = component,
             Diameter = rnd.Next(1217, 1221),
             WallThickness = rnd.Next(40, 50),
             IsActive = true
         };
         component.Connectors.Add(con);
     }
     return component;
 }