Beispiel #1
0
    }//END AddParameter method

    // ==================================================================================
    /// <summary>
    /// This method add a parameter to the command's parameter list..
    /// </summary>
    /// <param name="Name">CommandHeaderElements: the name of the parameter.</param>
    /// <returns> String value of the header element</returns>
    /// <remarks>
    /// This method consists of following steps. 
    /// 
    /// 1. Iterate through parameter list then Search the parmeters for existing parameters
    ///     and exit if update the value.
    ///     
    /// 2. If parameter Name is equal to Name then return parameter Value.
    /// 
    /// 3.  Else return empty string 
    /// 
    /// </remarks>
    // ---------------------------------------------------------------------------------
    public String GetHeaderValue ( CommandHeaderElements Name )
    {
      if ( this.Header == null )
      {
        return String.Empty;
      }

      //
      // Search the parmeters for existing parameters.
      // and exit if update the value.
      // 
      foreach ( Parameter parameter in this.Header )
      {

        //
        // If parameter Name is equal to Name then return parameter Value.
        //
        if ( parameter.Name.ToLower ( ) == Name.ToString ( ).ToLower ( ) )
        {
          return parameter.Value;
        }
      }//END parameter iteration

      //
      // Else return empty string 
      //
      return String.Empty;

    }//END AddHeader method
Beispiel #2
0
    // ==================================================================================
    /// <summary>
    /// This method add a parameter to the command's header list.
    /// </summary>
    /// <param name="Name">String: the name of the parameter.</param>
    /// <param name="Value">String: the value of the parameter.</param>
    /// <remarks> 
    /// This method consists of following steps. 
    /// 
    /// 1. Iterate throgh parameter list
    /// 
    /// 2. If parameter Name is equal to Name update parameter value
    /// 
    /// 3. Else do nothing 
    /// 
    /// </remarks>
    // ---------------------------------------------------------------------------------
    public void AddHeader ( CommandHeaderElements Name, String Value )
    {
      if ( this.Header == null )
      {
        this.Header = new List<Parameter> ( );
      }

      //
      // Search the parmeters for existing parameters.
      // and exit if update the value.
      // 
      foreach ( Parameter parameter in this.Header )
      {
        if ( parameter.Name == Name.ToString ( ) )
        {
          parameter.Value = Value;

          return;
        }
      }

      this.Header.Add ( new Parameter ( Name.ToString ( ), Value ) );

    }//END AddParameter method