⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginunit.cpp

📁 16人格测试 16人格测试 16人格测试 16人格测试
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "LoginUnit.h"

#include "AdminUnit.h"
#include "WriteKeyUnit.h"
#include "DMUnit.h"
#include "global.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "AnimationEffect"
#pragma link "bsSkinCtrls"
#pragma link "EffectUtils"
#pragma link "GIFImage"
#pragma link "RzButton"
#pragma link "RzEdit"
#pragma link "RzLabel"
#pragma link "RzPanel"
#pragma link "RzRadChk"
#pragma link "wwdblook"
#pragma resource "*.dfm"
TLoginForm *LoginForm;

//---------------------------------------------------------------------------
__fastcall TLoginForm::TLoginForm(TComponent* Owner)
        : TForm(Owner)
{


}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::bsSkinButtonLabel2Click(TObject *Sender)
{
        Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::bsSkinButtonLabel1Click(TObject *Sender)
{

		TADOQuery *QRY_KEY = new TADOQuery(this);
		AnsiString tSQL;

	try{
		if(Com_Name->Text.IsEmpty())
		{
				Application->MessageBox("用户不能为空!!!",
					Application->Title.c_str(), MB_OK + MB_ICONWARNING);
				Com_Name->SetFocus();
				return;
		}

		QRY_KEY->Close();
		tSQL = "select * from Operator where LoginId like \"" + Com_Name->Text.Trim() + "\"";
		QRY_KEY->Connection = DM->conn;
		QRY_KEY->SQL->Clear();
		QRY_KEY->SQL->Add(tSQL);
		QRY_KEY->Open();
		if(QRY_KEY->RecordCount == 0)
		{
				MessageBox(0,
					"系统错误,请检查是否已初始化设置!返回错误“找不到该用户”。",
					Application->Title.c_str(), MB_OK + MB_ICONSTOP);
				Application->Terminate();
		}

		 if (QRY_KEY->FieldByName("Password")->AsString == edt_key->Text.Trim())
		 {

				AUser =  QRY_KEY->FieldByName("LoginId")->AsString;

				if(CheckBox->Checked)
				 {
						Tfrm_WriteKey *frm_WriteKey = new Tfrm_WriteKey(this);
						frm_WriteKey->ShowModal();
						delete frm_WriteKey;
				 }
			  //	this->ModalResult = mrOk;
           
			this->Hide();

			//	Tfrm_admin *frm_admin = new Tfrm_admin(this);
			frm_admin->Show();
			//	delete frm_admin;

		}
		else
		{
				MessageBox(0,
					"口令无效,请再重新输入一次。",
					Application->Title.c_str(),
					MB_OK + MB_ICONSTOP);

				edt_key->Text = "";
				edt_key->SetFocus();
				return;
		}
	}
	catch(...)
	{
		delete  QRY_KEY;
	}


}
//---------------------------------------------------------------------------
void __fastcall TLoginForm::edt_keyKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
        if(Key == 13)
                bsSkinButtonLabel1Click(this);       
}
//---------------------------------------------------------------------------

void __fastcall TLoginForm::Com_NameKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
        if(Key == 13)
                edt_key->SetFocus();        
}
//---------------------------------------------------------------------------

void __fastcall TLoginForm::img1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
    Refresh();
    if(Button == mbLeft)
    {
        ReleaseCapture();
        Perform(WM_SYSCOMMAND, 0xF017, 0);
    }    
        
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -