public static AssociationEN Convert(AssociationDTO dto) { AssociationEN newinstance = null; try { if (dto != null) { newinstance = new AssociationEN(); newinstance.Id = dto.Id; newinstance.Name = dto.Name; if (dto.RolOrigin_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityAttributesCAD entityAttributesCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityAttributesCAD(); newinstance.RolOrigin = entityAttributesCAD.ReadOIDDefault(dto.RolOrigin_oid); } if (dto.RolTarget_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityAttributesCAD entityAttributesCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityAttributesCAD(); newinstance.RolTarget = entityAttributesCAD.ReadOIDDefault(dto.RolTarget_oid); } newinstance.Type = dto.Type; newinstance.CardinalityOrigin = dto.CardinalityOrigin; newinstance.CardinalityTarget = dto.CardinalityTarget; if (dto.EntityOrigin_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.EntityOrigin = entityCAD.ReadOIDDefault(dto.EntityOrigin_oid); } if (dto.EntityTarget_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.EntityTarget = entityCAD.ReadOIDDefault(dto.EntityTarget_oid); } if (dto.IoTScenario_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IIoTScenarioCAD ioTScenarioCAD = new MoSIoTGenNHibernate.CAD.MosIoT.IoTScenarioCAD(); newinstance.IoTScenario = ioTScenarioCAD.ReadOIDDefault(dto.IoTScenario_oid); } newinstance.Description = dto.Description; } } catch (Exception ex) { throw ex; } return(newinstance); }
public static RuleEN Convert(RuleDTO dto) { RuleEN newinstance = null; try { if (dto != null) { newinstance = new RuleEN(); newinstance.Id = dto.Id; newinstance.Name = dto.Name; newinstance.IsEnabled = dto.IsEnabled; if (dto.Condition != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRuleConditionCAD ruleConditionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RuleConditionCAD(); newinstance.Condition = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RuleConditionEN>(); foreach (RuleConditionDTO entry in dto.Condition) { newinstance.Condition.Add(RuleConditionAssemblerDTO.Convert(entry)); } } if (dto.RuleAction != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRuleActionCAD ruleActionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RuleActionCAD(); newinstance.RuleAction = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RuleActionEN>(); foreach (RuleActionDTO entry in dto.RuleAction) { newinstance.RuleAction.Add(RuleActionAssemblerDTO.Convert(entry)); } } if (dto.IoTScenario_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IIoTScenarioCAD ioTScenarioCAD = new MoSIoTGenNHibernate.CAD.MosIoT.IoTScenarioCAD(); newinstance.IoTScenario = ioTScenarioCAD.ReadOIDDefault(dto.IoTScenario_oid); } newinstance.IntervalTime = dto.IntervalTime; newinstance.Description = dto.Description; } } catch (Exception ex) { throw ex; } return(newinstance); }
public static IMAppointmentEN Convert(IMAppointmentDTO dto) { IMAppointmentEN newinstance = null; try { if (dto != null) { newinstance = new IMAppointmentEN(); newinstance.Date = dto.Date; if (dto.Appointment_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IAppointmentCAD appointmentCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AppointmentCAD(); newinstance.Appointment = appointmentCAD.ReadOIDDefault(dto.Appointment_oid); } newinstance.Id = dto.Id; newinstance.Name = dto.Name; if (dto.OriginAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.OriginAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.OriginAssociation_oid) { newinstance.OriginAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.TargetAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.TargetAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.TargetAssociation_oid) { newinstance.TargetAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.Scenario_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IIoTScenarioCAD ioTScenarioCAD = new MoSIoTGenNHibernate.CAD.MosIoT.IoTScenarioCAD(); newinstance.Scenario = ioTScenarioCAD.ReadOIDDefault(dto.Scenario_oid); } newinstance.Description = dto.Description; if (dto.Operations != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityOperationCAD entityOperationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityOperationCAD(); newinstance.Operations = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN>(); foreach (EntityOperationDTO entry in dto.Operations) { newinstance.Operations.Add(EntityOperationAssemblerDTO.Convert(entry)); } } if (dto.Attributes != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityAttributesCAD entityAttributesCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityAttributesCAD(); newinstance.Attributes = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityAttributesEN>(); foreach (EntityAttributesDTO entry in dto.Attributes) { newinstance.Attributes.Add(EntityAttributesAssemblerDTO.Convert(entry)); } } if (dto.States != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD(); newinstance.States = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityStateEN>(); foreach (EntityStateDTO entry in dto.States) { newinstance.States.Add(EntityStateAssemblerDTO.Convert(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }
public static DeviceEN Convert(DeviceDTO dto) { DeviceEN newinstance = null; try { if (dto != null) { newinstance = new DeviceEN(); newinstance.DeviceSwitch = dto.DeviceSwitch; newinstance.Tag = dto.Tag; newinstance.IsSimulated = dto.IsSimulated; newinstance.SerialNumber = dto.SerialNumber; newinstance.FirmVersion = dto.FirmVersion; newinstance.Trademark = dto.Trademark; if (dto.DeviceTemplate_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IDeviceTemplateCAD deviceTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.DeviceTemplateCAD(); newinstance.DeviceTemplate = deviceTemplateCAD.ReadOIDDefault(dto.DeviceTemplate_oid); } newinstance.Id = dto.Id; newinstance.Name = dto.Name; if (dto.OriginAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.OriginAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.OriginAssociation_oid) { newinstance.OriginAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.TargetAssociation_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD(); newinstance.TargetAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>(); foreach (int entry in dto.TargetAssociation_oid) { newinstance.TargetAssociation.Add(associationCAD.ReadOIDDefault(entry)); } } if (dto.Scenario_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IIoTScenarioCAD ioTScenarioCAD = new MoSIoTGenNHibernate.CAD.MosIoT.IoTScenarioCAD(); newinstance.Scenario = ioTScenarioCAD.ReadOIDDefault(dto.Scenario_oid); } newinstance.Description = dto.Description; if (dto.Operations != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityOperationCAD entityOperationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityOperationCAD(); newinstance.Operations = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN>(); foreach (EntityOperationDTO entry in dto.Operations) { newinstance.Operations.Add(EntityOperationAssemblerDTO.Convert(entry)); } } if (dto.Attributes != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityAttributesCAD entityAttributesCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityAttributesCAD(); newinstance.Attributes = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityAttributesEN>(); foreach (EntityAttributesDTO entry in dto.Attributes) { newinstance.Attributes.Add(EntityAttributesAssemblerDTO.Convert(entry)); } } if (dto.States != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD(); newinstance.States = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityStateEN>(); foreach (EntityStateDTO entry in dto.States) { newinstance.States.Add(EntityStateAssemblerDTO.Convert(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }