📄 userdelete.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UserDelete.h"
#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TUserDeleteForm *UserDeleteForm;
//---------------------------------------------------------------------------
__fastcall TUserDeleteForm::TUserDeleteForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::BitBtn2Click(TObject *Sender)
{
StringGrid1->Cells[1][1]="";
StringGrid1->Cells[1][2]="";
StringGrid1->Cells[1][3]="";
StringGrid1->Cells[1][4]="";
StringGrid1->Cells[1][5]="";
StringGrid1->Cells[1][6]="";
StringGrid1->Cells[1][7]="";
BitBtn1->Enabled=false;
BitBtn2->Enabled=false;
Edit1->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::BitBtn3Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::StringGrid1SelectCell(TObject *Sender,
int ACol, int ARow, bool &CanSelect)
{
if(ACol==1)
{
if(StringGrid1->Cells[ACol][ARow]!="X")
{ StringGrid1->Cells[ACol][ARow]="X";}
else
{StringGrid1->Cells[ACol][ARow]=""; }
}
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::Edit1Exit(TObject *Sender)
{
if(Edit1->Text.Trim()!="")
{
StringGrid1->Enabled=true;
BitBtn1->Enabled=true;
BitBtn2->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::Edit1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(int(Key)==13 && Edit1->Text.Trim()!="")
{
StringGrid1->Enabled=true;
BitBtn1->Enabled=true;
BitBtn2->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::FormShow(TObject *Sender)
{
Query1->Open();
StringGrid1->Cells[0][0]=" 用 户 组";
StringGrid1->Cells[1][0]="选择";
StringGrid1->Cells[2][0]=" 说 明";
StringGrid1->Cells[0][1]="SYSTEM";
StringGrid1->Cells[2][1]="超级用户,所有删除修增加查询权限";
StringGrid1->Cells[0][2]="PPE";
StringGrid1->Cells[2][2]="新增,查询,修改未审核MI权限";
StringGrid1->Cells[0][3]="PPEAPP";
StringGrid1->Cells[2][3]="审核查询MI权限";
StringGrid1->Cells[0][4]="QACHECK";
StringGrid1->Cells[2][4]="查询MI,检查MI权限";
StringGrid1->Cells[0][5]="QAAPP";
StringGrid1->Cells[2][5]="查询MI,QA审查MI权限";
StringGrid1->Cells[0][6]="SAMPLE";
StringGrid1->Cells[2][6]="样板组";
StringGrid1->Cells[0][7]="Guest";
StringGrid1->Cells[2][7]="普通用户";
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::BitBtn1Click(TObject *Sender)
{
try
{
for(int i=1;i<=StringGrid1->RowCount-1;i++)
{
if(StringGrid1->Cells[1][i]=="X")
{
StoredProc1->Params->Items[1]->AsString=Edit1->Text.Trim();
StoredProc1->Params->Items[2]->AsString=StringGrid1->Cells[0][i];
StoredProc1->Params->Items[3]->AsString=0;
StoredProc1->ExecProc();
if(StoredProc1->Params->Items[3]->AsString==0)
{ StringGrid1->Cells[1][i]="删除成功"; }
if(StoredProc1->Params->Items[3]->AsString==1)
{ StringGrid1->Cells[1][i]="无此用户";}
if(StoredProc1->Params->Items[3]->AsString==-1)
{ StringGrid1->Cells[1][i]="删除不成功"; }
}
}
}
catch(...)
{
Application->MessageBox("您的权限不够!","提示",MB_OK);
}
Query1->Close();
Query1->Open();
}
//---------------------------------------------------------------------------
void __fastcall TUserDeleteForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
Query1->Close();
Edit1->Text="";
for(int i=0;i<=2;i++)
{
for(int j=0;j<=7;j++)
{
StringGrid1->Cells[i][j]="";
}
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -