using System;
namespace AsterNET.FastAGI.Command
{
///
/// Deletes an entry in the Asterisk database for a given family and key.
/// Returns 1 if successful, 0 otherwise.
///
public class DatabaseDelTreeCommand : AGICommand
{
/// The family of the key to delete.
private string family;
/// The key to delete.
private string keyTree;
///
/// Get/Set the family of the key to delete.
///
public string Family
{
get { return family; }
set { this.family = value; }
}
///
/// Get/Set the the key to delete.
///
public string KeyTree
{
get { return keyTree; }
set { this.keyTree = value; }
}
///
/// Creates a new DatabaseDelCommand.
///
/// the family of the key to delete.
/// the key to delete.
public DatabaseDelTreeCommand(string family)
{
this.family = family;
}
///
/// Creates a new DatabaseDelCommand.
///
/// the family of the key to delete.
/// the key to delete.
public DatabaseDelTreeCommand(string family, string keytree)
{
this.family = family;
this.keyTree = keytree;
}
public override string BuildCommand()
{
if (family != null)
{
if (keyTree != null)
{
return "DATABASE DELTREE " + EscapeAndQuote(family) + " " + EscapeAndQuote(keyTree);
}
return "DATABASE DELTREE " + EscapeAndQuote(family);
}
throw new ArgumentNullException("Family");
}
}
}