/// <summary>
        /// Returns Association View.
        /// </summary>
        private byte[] GetObjects()
        {
            GXByteBuffer data = new GXByteBuffer();

            data.SetUInt8((byte)DataType.Array);
            bool lnExists = ObjectList.FindByLN(ObjectType.AssociationLogicalName, this.LogicalName) != null;
            //Add count
            int cnt = ObjectList.Count();

            if (!lnExists)
            {
                ++cnt;
            }
            GXCommon.SetObjectCount(cnt, data);
            foreach (GXDLMSObject it in ObjectList)
            {
                data.SetUInt8((byte)DataType.Structure);
                data.SetUInt8((byte)4);                                       //Count
                GXCommon.SetData(data, DataType.UInt16, it.ObjectType);       //ClassID
                GXCommon.SetData(data, DataType.UInt8, it.Version);           //Version
                GXCommon.SetData(data, DataType.OctetString, it.LogicalName); //LN
                GetAccessRights(it, data);                                    //Access rights.
            }
            if (!lnExists)
            {
                data.SetUInt8((byte)DataType.Structure);
                data.SetUInt8((byte)4);                                         //Count
                GXCommon.SetData(data, DataType.UInt16, this.ObjectType);       //ClassID
                GXCommon.SetData(data, DataType.UInt8, this.Version);           //Version
                GXCommon.SetData(data, DataType.OctetString, this.LogicalName); //LN
                GetAccessRights(this, data);                                    //Access rights.
            }
            return(data.Array());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns Association View.
        /// </summary>
        private byte[] GetObjects()
        {
            List <byte> stream = new List <byte>();

            stream.Add((byte)DataType.Array);
            bool lnExists = ObjectList.FindByLN(ObjectType.AssociationLogicalName, this.LogicalName) != null;
            //Add count
            int cnt = ObjectList.Count();

            if (!lnExists)
            {
                ++cnt;
            }
            GXCommon.SetObjectCount(cnt, stream);
            foreach (GXDLMSObject it in ObjectList)
            {
                stream.Add((byte)DataType.Structure);
                stream.Add((byte)4);                                            //Count
                GXCommon.SetData(stream, DataType.UInt16, it.ObjectType);       //ClassID
                GXCommon.SetData(stream, DataType.UInt8, it.Version);           //Version
                GXCommon.SetData(stream, DataType.OctetString, it.LogicalName); //LN
                GetAccessRights(it, stream);                                    //Access rights.
            }
            if (!lnExists)
            {
                stream.Add((byte)DataType.Structure);
                stream.Add((byte)4);                                              //Count
                GXCommon.SetData(stream, DataType.UInt16, this.ObjectType);       //ClassID
                GXCommon.SetData(stream, DataType.UInt8, this.Version);           //Version
                GXCommon.SetData(stream, DataType.OctetString, this.LogicalName); //LN
                GetAccessRights(this, stream);                                    //Access rights.
            }
            return(stream.ToArray());
        }
Exemplo n.º 3
0
 /// <summary>
 /// calculates a plausibility rating based on the amount of allowed items on the model
 /// </summary>
 /// <returns>amount of allowed items</returns>
 public int CalculateRating()
 {
     if (AllowedItems != null)
     {
         return(ObjectList.Count(t => AllowedItems.Exists(x => x == t.GetType())));
     }
     else
     {
         return(ObjectList.Count);
     }
 }
Exemplo n.º 4
0
    private void LoadRolesCombo(ObjectList<RecordingActParty> parties) {
      this.cboRole.Items.Clear();

      if (parties.Count == 0 || parties.Count((x) => x.OwnershipMode == OwnershipMode.Owner) == 0) {
        HtmlSelectContent.LoadCombo(this.cboRole, this.recordingAct.RecordingActType.GetRoles(), "Id", "Name", "( Seleccionar rol )");
      } else {
        HtmlSelectContent.LoadCombo(this.cboRole, "( Seleccionar rol )", String.Empty, String.Empty);
      }

      List<RecordingActParty> bareOwnersList = parties.FindAll((x) => x.OwnershipMode == OwnershipMode.Bare);
      if (bareOwnersList.Count != 0) {
        this.cboRole.Items.Add(new ListItem(DomainActPartyRole.Usufructuary.Name, DomainActPartyRole.Usufructuary.Id.ToString()));
        HtmlSelectContent.LoadCombo<RecordingActParty>(cboUsufructuaryOf, bareOwnersList, (x) => x.Party.Id.ToString(),
                                                       (x) => x.Party.FullName, "( Seleccionar al nudo propietario )");
        if (cboUsufructuaryOf.Items.Count > 2) {
          cboUsufructuaryOf.Items.Add(new ListItem("( Selección múltiple )", "multiselect"));
        }
      }

      this.cboRole.Items.Add(new ListItem("( Secundarios )", String.Empty));
      HtmlSelectContent.AppendToCombo(this.cboRole, PartiesRole.GetList(), "Id", "Name");
    }