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