//--------------------------------------------------------------------------- #include #include #pragma hdrstop #include "CtrlCfg.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "CoolForm" #pragma link "FormularioREUSABLE" #pragma resource "*.dfm" TElementosCFG *ElementosCFG; //--------------------------------------------------------------------------- __fastcall TElementosCFG::TElementosCFG(TComponent* Owner) : TFormREUSABLE(Owner) { PosiblesCambios = false; TbAppl->Active = true; TbPrecios->Active = true; TbElementosCFG->Active = true; } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::FormClose(TObject *Sender, TCloseAction &Action) { try { TbElementosCFG->Post(); if ( PosiblesCambios ) { // Cambios en la CFG. if ( Application->MessageBox("Ha efectuado cambios en las listas de control.\n\nPara actualizar los clientes, ahora, siga estos pasos:\n\t-Active todos los clientes\n\t-Asegurese de que existe conexion\n\t-Pulse el boton ACEPTAR\n\n\nY espere unos minutos antes de operar con ningún terminal\nhasta que se concluya el envio completo de las listas.\n\nNO DESCONECTE NINGUN TERMINAL HASTA CONCLUIR EL ENVIO\nTanto CLIENTE y SERVIDOR prodrian quedar ALTAMENTE INESTABLE", "¡¡¡ ACTUALIZACION DE LISTAS !!!", MB_OKCANCEL + MB_DEFBUTTON1) == ID_CANCEL ) PosiblesCambios = false; } } catch(...) { // do nothing } } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::TbPreciosBeforeOpen(TDataSet *DataSet) { // Si la tabla no existe, la creamos if ( access( (TbPrecios -> TableName).c_str(), 0 ) != 0 ) { // Usamos la propiedad FielDefs para definir // las columnas que contendrá la tabla TbPrecios -> FieldDefs -> Clear(); TbPrecios -> FieldDefs -> Add("Tiempo", ftTime, 0, false ); TbPrecios -> FieldDefs -> Add("Precio", ftCurrency, 0, false ); TbPrecios -> IndexDefs -> Clear(); TbPrecios -> IndexDefs -> Add("Primary", "Tiempo", TIndexOptions() << ixPrimary << ixUnique ); // Creamos la base... TbPrecios -> CreateTable(); } } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::SpeedButton1Click(TObject *Sender) { Terminal->Caption = "Configuración de los Terminales"; DBGrid3->Enabled = false; DBGrid3->Visible = false; DBGrid2->Enabled = false; DBGrid2->Visible = false; DBGrid1->Enabled = true; DBGrid1->Visible = true; } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::SpeedButton2Click(TObject *Sender) { Terminal->Caption = "Configuración de Precios"; DBGrid3->Enabled = false; DBGrid3->Visible = false; DBGrid1->Enabled = false; DBGrid1->Visible = false; DBGrid2->Enabled = true; DBGrid2->Visible = true; } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::SpeedButton3Click(TObject *Sender) { Terminal->Caption = "Aplicaciones Protegidas"; DBGrid2->Enabled = false; DBGrid2->Visible = false; DBGrid1->Enabled = false; DBGrid1->Visible = false; DBGrid3->Enabled = true; DBGrid3->Visible = true; } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::TbApplBeforeOpen(TDataSet *DataSet) { // Si la tabla no existe, la creamos if ( access( (TbAppl -> TableName).c_str(), 0 ) != 0 ) { // Usamos la propiedad FielDefs para definir // las columnas que contendrá la tabla TbAppl -> FieldDefs -> Clear(); TbAppl -> FieldDefs -> Add("idTA", ftString, 14, false ); TbAppl -> FieldDefs -> Add("NAppl", ftString, 14, false ); // Creamos la base... TbAppl -> CreateTable(); } } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::TbApplBeforeInsert(TDataSet *DataSet) { if ( TbAppl->RecordCount > 100 ) { ShowMessage( "Esta versión posee limitaciones,\nrespecto al nº de aplicaciones a bloquear\n¡Sobrepaso el nº máximo permitido!"); TbAppl->Cancel(); } } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::TbApplAfterPost(TDataSet *DataSet) { PosiblesCambios = true; } //--------------------------------------------------------------------------- void __fastcall TElementosCFG::Button1Click(TObject *Sender) { ModalResult = mrCancel; } //---------------------------------------------------------------------------