protected Object GetSingleListValue(VersionOne.SDK.APIClient.Attribute attribute)
        {
            if (attribute.Value != null && attribute.Value.ToString() != "NULL")
            {
                IAssetType assetType = _metaAPI.GetAssetType("List");
                Query      query     = new Query(assetType);

                IAttributeDefinition assetIDAttribute = assetType.GetAttributeDefinition("ID");
                query.Selection.Add(assetIDAttribute);

                IAttributeDefinition nameAttribute = assetType.GetAttributeDefinition("Name");
                query.Selection.Add(nameAttribute);

                FilterTerm assetName = new FilterTerm(assetIDAttribute);
                assetName.Equal(attribute.Value.ToString());
                query.Filter = assetName;

                QueryResult result = _dataAPI.Retrieve(query);
                return(result.Assets[0].GetAttribute(nameAttribute).Value.ToString());
            }
            else
            {
                return(DBNull.Value);
            }
        }
 protected Object GetScalerValue(VersionOne.SDK.APIClient.Attribute attribute)
 {
     if (attribute.Value != null)
     {
         return(attribute.Value.ToString());
     }
     else
     {
         return(DBNull.Value);
     }
 }
 protected Object GetSingleRelationValue(VersionOne.SDK.APIClient.Attribute attribute)
 {
     if (attribute.Value != null && attribute.Value.ToString() != "NULL")
     {
         return(attribute.Value.ToString());
     }
     else
     {
         return(DBNull.Value);
     }
 }
示例#4
0
        private object GetStateRelationValue(VersionOne.SDK.APIClient.Attribute attribute)
        {
            switch (attribute.Value.ToString())
            {
            case "State:100":
                return("Future");

            case "State:101":
                return("Active");

            case "State:102":
                return("Closed");

            default:
                return(DBNull.Value);
            }
        }
示例#5
0
        private Type FindType(AssetID id, bool validate)
        {
            Oid         oid = GetOid(id);
            List <Type> list;

            if (TypeMap.TryGetValue(oid.AssetType.Token, out list))
            {
                bool      attribChecked = false;
                Attribute attrib        = null;
                foreach (Type type in list)
                {
                    byte?filterState = GetAssetStateFilter(type);
                    if (filterState == null && (!validate || list.Count == 1))
                    {
//                        return ((!validate) || (GetAsset(oid) != null)) ? type : null;
                        if (!validate)
                        {
                            return(type);
                        }
                        Asset asset = GetAsset(oid);
                        if (null != asset)
                        {
                            _instance.SetAsset(id, asset);
                            return(type);
                        }
                        return(null);
                    }
                    if (!attribChecked)
                    {
                        attribChecked = true;
                        attrib        = ResolveAssetState(id, validate);
                    }
                    if (attrib == null)
                    {
                        continue;
                    }
                    byte state = (byte)attrib.Value;
                    if (filterState == null || state == filterState)
                    {
                        return(type);
                    }
                }
            }
            return(null);
        }
 private object CheckStoryState(VersionOne.SDK.APIClient.Attribute attribute)
 {
     if (attribute.Value != null)
     {
         if (attribute.Value.ToString() == "200")
         {
             return("Template");
         }
         else
         {
             return(attribute.Value.ToString());
         }
     }
     else
     {
         return(DBNull.Value);
     }
 }
示例#7
0
        private Attribute ResolveAssetState(AssetID id, bool validate)
        {
            Oid oid = GetOid(id);
            IAttributeDefinition assetStateDef = oid.AssetType.GetAttributeDefinition("AssetState");
            Asset asset = validate ? null : _instance.GetAsset(id);

            if (asset == null)
            {
                asset = GetAsset(oid);
                if (asset == null)
                {
                    return(null);
                }
                _instance.SetAsset(id, asset);
            }
            Attribute attrib = asset.GetAttribute(assetStateDef);

            if (attrib == null)
            {
                attrib = GetAsset(oid).GetAttribute(assetStateDef);
            }
            return(attrib);
        }
        protected Object GetMultiRelationValues(VersionOne.SDK.APIClient.Attribute attribute)
        {
            string values = String.Empty;

            if (attribute.ValuesList.Count > 0)
            {
                for (int i = 0; i < attribute.ValuesList.Count; i++)
                {
                    if (i == 0)
                    {
                        values = attribute.ValuesList[i].ToString();
                    }
                    else
                    {
                        values += ";" + attribute.ValuesList[i].ToString();
                    }
                }
                return(values);
            }
            else
            {
                return(DBNull.Value);
            }
        }
示例#9
0
 private bool IsMultiValueAndUnfilled(Attribute attribute)
 {
     return(attribute.Definition.IsMultiValue && attribute.ValuesList.Count < 1);
 }
示例#10
0
 private static bool IsSingleValueAndUnfilled(Attribute attribute)
 {
     return(!attribute.Definition.IsMultiValue &&
            ((attribute.Value is Oid && ((Oid)attribute.Value).IsNull) || attribute.Value == null));
 }
 private bool IsMultiValueAndUnfilled(Attribute attribute) {
     return (attribute.Definition.IsMultiValue && attribute.ValuesList.Count < 1);
 }
 private static bool IsSingleValueAndUnfilled(Attribute attribute) {
     return !attribute.Definition.IsMultiValue &&
             ((attribute.Value is Oid && ((Oid)attribute.Value).IsNull) || attribute.Value == null);
 }