📄 dbprovframe.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Rights.h"
#include "DBProvFrame.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
__fastcall TDBProvFrameFrm::TDBProvFrameFrm(TComponent* Owner)
: TFrame(Owner), Rights()
{
DBProvIndex = 0;
}
//---------------------------------------------------------------------------
void __fastcall TDBProvFrameFrm::LoginClick(TObject *Sender)
{
Rights.Logout();
SecUser->Text = "[Not Logged]";
if (Rights.PrepareLogin() && Rights.Login(Parent->User->Text.c_str(), Parent->Passwd->Text.c_str() ))
SecUser->Text = Rights.UserFullName();
// no unprepare - assume user will try to login till he logs in succefully.
// if he logged in , PostLogin is called internally - but you can call it anyway
}
//---------------------------------------------------------------------------
void __fastcall TDBProvFrameFrm::LogoutClick(TObject *Sender)
{
if (Rights.Binded()) Rights.Logout();
SecUser->Text = "[Not Logged]";
}
//---------------------------------------------------------------------------
void __fastcall TDBProvFrameFrm::SmallDlgClick(TObject *Sender)
{
if (!Rights.Logged())
LoginClick(this);
Rights.ShowSmpDlg();
}
//---------------------------------------------------------------------------
void __fastcall TDBProvFrameFrm::SecurityAdmClick(TObject *Sender)
{
if (!Rights.Logged())
LoginClick(this);
Rights.ShowDlg();
}
//---------------------------------------------------------------------------
void __fastcall TDBProvFrameFrm::SetDBProvIndex(int value)
{
if (Rights.Binded()) Rights.Logout();
DBProv->ItemIndex = value;
if (!Rights.Bind(DBProv->Items->Strings[DBProv->ItemIndex].c_str()))
throw Exception("No Security" + DBProv->Items->Strings[DBProv->ItemIndex]);
}
int __fastcall TDBProvFrameFrm::GetDBProvIndex()
{
return DBProv->ItemIndex;
}
void __fastcall TDBProvFrameFrm::DBProvClick(TObject *Sender)
{
Rights.Logout();
if (!Rights.Bind(DBProv->Items->Strings[DBProv->ItemIndex].c_str()))
throw Exception("No Security" + DBProv->Items->Strings[DBProv->ItemIndex]);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -