Loyiha ishi. Mahalla kotibi avtomatlashtirilgan ishchi o’rni
Dastur kod qismi:
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "kotib.h"
#include "Unit2.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
PageControl1->TabWidth = PageControl1->Width/2;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(PageControl1->ActivePageIndex == 0)
{
ADOQuery1->Insert();
Form2->ShowModal();
}
else{
ADOQuery2->Insert();
ADOQuery2->FieldByName("date")->AsString = Date();
Form3->ShowModal();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(PageControl1->ActivePageIndex == 0)
{
ADOQuery1->Edit();
Form2->ShowModal();
}
else{
ADOQuery2->Edit();
Form3->ShowModal();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if (PageControl1->ActivePageIndex == 0) {
ADOQuery1->Delete();
}
else if(PageControl1->ActivePageIndex == 1)
{
ADOQuery2->Delete();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SearchBox1Change(TObject *Sender)
{
String ptr = SearchBox1->Text;
if (PageControl1->ActivePageIndex == 0) {
ADOQuery1->SQL->Text = "select * from people where firstname like '%"+ptr+"%' or lastname like '%"+ptr+"%'";
ADOQuery1->Open();
}
else{
ADOQuery2->SQL->Text = "select * from documents where doctype like '%"+ptr+"%' or comment like '%"+ptr+"%'";
ADOQuery2->Open();
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit3.h"
#include "kotib.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm3 *Form3;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button2Click(TObject *Sender)
{
Form1->ADOQuery2->Post();
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm3::FormClose(TObject *Sender, TCloseAction &Action)
{
Form1->ADOQuery2->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
Do'stlaringiz bilan baham: |