//-----------------------------------------------------------------------------
void TAdministradora :: LoadDomainsNacionales(AnsiString pDomainNacional)
{
  TFile* TreeFile = new TFile(pDomainNacional);
  TreeFile->Open("rb+");
  TreeFile->SeekTo(0);

  if(TreeFile->IsOpen())
  {
    TSDomainInfo SDominio;
    TreeFile->Read(&SDominio,sizeof(TSServerInfo));

    while(!TreeFile->Eof())
    {
      TPreOrderNode* node = new  TPreOrderNode();
      TDomain* domain = new TDomain();
      node->End(SDominio.End);
      node->RightLink(SDominio.LinkedRight);
      domain->NameDomain(SDominio.Name);
      node->Info(domain);
      aDomainsPreOrderList->Insert(node);
      TreeFile->Read(&SDominio,sizeof(TSDomainInfo));
    }
  }
  TreeFile->Close();
  delete TreeFile;
}
//-----------------------------------------------------------------------------
//::::::::::::::::::::::::::::CREADORES DE CUENTAS:::::::::::::::::::::::::::::::::::::
//-----------------------------------------------------------------------------
AnsiString TAdministradora :: CreateDirection(TBinTreeNode* pServer,AnsiString pUserNameServer)
{
  AnsiString email = pUserNameServer;
   while(pServer != aTree->Root())
   {
     TDomain* Domain = (TDomain*)pServer->Info();
     email = email + "." + Domain->NameDomain();
     pServer=aTree->GetFather(pServer);
   }
   return email= email +  "." + ( (TDomain*)aTree->Root()->Info() )->NameDomain();
}
//-----------------------------------------------------------------------------
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::::::::::::::::::: METODOS DE GUARDAR/CARGAR EN FICHEROS:::::::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//-----------------------------------------------------------------------------
//Nacionales Domains
void TAdministradora :: SaveDominioTree(AnsiString pNameDomain)
{
  TFile* TreeFile = new TFile(pNameDomain);
  TreeFile->Open("wb");
  TreeFile->SeekTo(0);

  TSeqPreOrderTree* preorder = new TSeqPreOrderTree(aTree);

  if(TreeFile->IsOpen())
  {
    TSDomainInfo SDominio;
    for(int i = 0; i < preorder->Length(); i++)
    {
      TPreOrderNode* node = (TPreOrderNode*)preorder->ItemInfo(i);
      SDominio.End = node->End();
      SDominio.LinkedRight = node->RightLink();
      TDomain* domain = (TDomain*)node->Info();
      strcpy(SDominio.Name,domain->NameDomain().c_str());
      TreeFile->Write(&SDominio,sizeof(TSDomainInfo));
    }
  }
  TreeFile->Close();
  delete TreeFile;
}