示例#1
0
 public bool Exist(SDMXJsonValue Val)
 {
     if (this.Id == Val.Id && this.Descr == Val.Descr)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 public bool Exist (SDMXJsonValue Val)
 {
     if (this.Id == Val.Id && this.Descr == Val.Descr)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 public int GetLastIndex(SDMXJsonValue Val)
 {
     int Index = 0;
     foreach (var Value in this.Values)
     {
         if (Value.Index > Index && !(Value.Index == null))
         {
             Index = Value.Index;
         }
     }
     return Index;
 }
示例#4
0
        public int GetLastIndex(SDMXJsonValue Val)
        {
            int Index = 0;

            foreach (var Value in this.Values)
            {
                if (Value != null && Value.Index > Index)
                {
                    Index = Value.Index;
                }
            }
            return(Index);
        }
 public bool ExistValue(SDMXJsonValue Val)
 {
     bool Exists = false;
     foreach (var item in this.Values)
     {
         if (item.Id == Val.Id && item.Descr == Val.Descr)
         {
             Exists = true;
             break;
         }
     }
     return Exists;
 }
示例#6
0
        public bool ExistValue(SDMXJsonValue Val)
        {
            bool Exists = false;

            foreach (var item in this.Values)
            {
                if (item.Id == Val.Id && item.Descr == Val.Descr)
                {
                    Exists = true;
                    break;
                }
            }
            return(Exists);
        }
        public void AddObsValue(string TimeValue)
        {
            bool Exists = false;
            if (!(this.JsonStruct.Observation.Values == null))
            {
                foreach (var item in this.JsonStruct.Observation.Values)
                {
                    if (item.Id == TimeValue)
                    {
                        Exists = true;
                        break;
                    }
                }                
            }
            if (!Exists)
	        {
                SDMXJsonValue Val = new SDMXJsonValue();
                Val.Id = TimeValue;                
                if (!(this.JsonStruct.Observation.ExistValue(Val)))
                {
   
                        if (this.JsonStruct.Observation.Values.Count > 0)
                        {
                            Val.Index = this.JsonStruct.Observation.GetLastIndex(Val) + 1;
                        }
                        else
                        {
                            Val.Index = this.JsonStruct.Observation.GetLastIndex(Val);
                        }
                    
                    this.JsonStruct.Observation.Values.Add(Val);                    
                }
	        }
        }
 public void AddAttribute(string AttId, string Value, string AttachmentLevel)
 {
     bool Exists = false;
     foreach (var item in this.JsonStruct.Attributes)
     {
         if (item.Id == AttId)
         {
             Exists = true;
             SDMXJsonValue Val = new SDMXJsonValue();
             Val.Id = Value;
             if (!(item.ExistValue(Val)))
             {
                 item.Values.Add(Val);
                 break;
             }                   
         }
     }
     if (!Exists)
     {
         SDMXJsonAttributes Att = new SDMXJsonAttributes();
         Att.Id = AttId;
         Att.AttachmentLevel = AttachmentLevel;
         this.JsonStruct.Attributes.Add(Att);
         AddAttribute(AttId, Value, AttachmentLevel);
     }
 }
 public void AddSerie(string DimId, string Value, string KeyPosition, bool isFrequency)
 {
     bool Exists = false;
     foreach (var item in this.JsonStruct.Series)
     {
         if (item.Id == DimId)
         {
             Exists = true;
             SDMXJsonValue Val = new SDMXJsonValue();
             Val.Id = Value;                        
             if (!(item.ExistValue(Val)))
             {
                 if (item.Values.Count > 0)
                 {
                     Val.Index = item.GetLastIndex(Val) + 1;
                 }
                 else
                 {
                     Val.Index = item.GetLastIndex(Val);
                 }                        
                 
                 item.Values.Add(Val);
                 break;
             }
         }
     }
     if (!Exists)
     {
         SDMXJsonDimension Serie = new SDMXJsonDimension();
         Serie.Id = DimId;
         Serie.KeyPosition = KeyPosition;
         if (isFrequency)
         {
             Serie.Role = "frequency";
         }
         this.JsonStruct.Series.Add(Serie);
         AddSerie(DimId, Value, KeyPosition, isFrequency);
     }
 }