94 lines
2.7 KiB
C++
94 lines
2.7 KiB
C++
//---------------------------------------------------------------------------
|
|
#include <vcl\vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "agenda.h"
|
|
#include "busqueda.h"
|
|
#include "diario.h"
|
|
#include "dos.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma resource "*.dfm"
|
|
TForm6 *Form6;
|
|
int busca;
|
|
//---------------------------------------------------------------------------
|
|
__fastcall TForm6::TForm6(TComponent* Owner)
|
|
: TForm(Owner)
|
|
{
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button1Click(TObject *Sender)
|
|
{
|
|
Table1->FieldValues["Fecha"] = fecha;
|
|
Table1->Post();
|
|
Table1->Insert();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button3Click(TObject *Sender)
|
|
{
|
|
Table1->Prior();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button2Click(TObject *Sender)
|
|
{
|
|
Table1->Edit();
|
|
Table1->Delete();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button5Click(TObject *Sender)
|
|
{
|
|
Close();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button4Click(TObject *Sender)
|
|
{
|
|
TForm4 *Busqueda;
|
|
Busqueda = new TForm4(this);
|
|
busca = 0;
|
|
Busqueda->Table1->TableName = "agenda.db";
|
|
Busqueda->Table1->Active=true;
|
|
Busqueda->ShowModal();
|
|
delete Busqueda;
|
|
Table1->First();
|
|
Table1->MoveBy(direccion);
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Button6Click(TObject *Sender)
|
|
{
|
|
Table1->Next();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::FormClose(TObject *Sender, TCloseAction &Action)
|
|
{
|
|
if(Table1->State == dsInsert && DBMemo1 -> Modified )
|
|
{
|
|
switch(MessageBox(Handle,"No guardó los datos ¿Desea Guardarlos?", "Atención" ,MB_YESNOCANCEL))
|
|
{
|
|
case 6:
|
|
Table1->Post();
|
|
break;
|
|
|
|
default:
|
|
Table1->Cancel();
|
|
break;
|
|
|
|
}
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::Table1NewRecord(TDataSet *DataSet)
|
|
{
|
|
/* TLocateOptions SearchOptions;
|
|
SearchOptions << loPartialKey;
|
|
if(Table1->Locate("Fecha",Table1->FieldValues["Fecha"],SearchOptions)==true)
|
|
{
|
|
ShowMessage("Esta referencia ya existe");
|
|
Table1->Cancel();
|
|
}*/
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm6::FormCreate(TObject *Sender)
|
|
{
|
|
Table1->Insert();
|
|
}
|
|
//---------------------------------------------------------------------------
|