/
flogin.cpp
68 lines (62 loc) · 1.81 KB
/
flogin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "flogin.h"
#include "mform.h"
#include "dmform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TLogin *Login;
//---------------------------------------------------------------------------
__fastcall TLogin::TLogin(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TLogin::RGClick(TObject *Sender){
if(RG->ItemIndex==1){
Pass->Visible=1;
Name->Visible=1;
Label1->Visible=1;
Label2->Visible=1;
}
else{
Pass->Visible=0;
Name->Visible=0;
Label1->Visible=0;
Label2->Visible=0;
}
}
//---------------------------------------------------------------------------
void __fastcall TLogin::BitBtn1Click(TObject *Sender){
AnsiString sql;
int id, ver;
if(RG->ItemIndex==1){
sql.printf("select id, pass, version from login where login='%s'",Name->Text);
DM->dsLogin->Close();
DM->dsLogin->SelectSQL->Clear();
DM->dsLogin->SelectSQL->Add(sql);
DM->dsLogin->Open();
sql=DM->dsLogin->FieldByName("PASS")->AsString;
id=DM->dsLogin->FieldByName("ID")->AsInteger;
ver=DM->dsLogin->FieldByName("VERSION")->AsInteger;
if (ver!=104){
Application->MessageBox("Òåêóùàÿ âåðñèÿ ïðîãðàììû óñòàðåëà. Îáíîâèòå ïðîãðàììó.", "Îøèáêà", MB_OK);
return;
}
if(Pass->Text==sql){
Login->Tag=id;
Hide();
FirstForm->ShowModal();
Close();
}else{
Application->MessageBox("Íåïðàâèëüíûé ïàðîëü!", "Îøèáêà", MB_OK);
return;
}
}
Hide();
FirstForm->ShowModal();
Close();
}
//---------------------------------------------------------------------------