📄 classroom.pas
字号:
unit classroom;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMenu;
type
TPSForm = class(TForm)
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
ComboBox2: TComboBox;
GroupBox2: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit1: TEdit;
Button3: TButton;
Label4: TLabel;
ComboBox3: TComboBox;
XPMenu1: TXPMenu;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PSForm: TPSForm;
implementation
uses input,md;
{$R *.dfm}
procedure TPSForm.FormCreate(Sender: TObject);
begin
with datamd.ADOhouse do
begin
close;
sql.Clear;
sql.Add('select 楼房号 from house group by 楼房号');
open;
while not eof do
begin
combobox3.Items.Add(fieldbyname('楼房号').AsString);
next;
end;
end;
combobox1.ItemIndex:=0;
end;
procedure TPSForm.Button3Click(Sender: TObject);
begin
//以下是自动获得寝室号
with datamd.ADOBTPd do
begin
close;
sql.Clear; //根据选择执行不同的查询
if checkbox1.Checked or checkbox2.Checked then
sql.Add('select tborder.专业,tborder.班级,tborder.寝室号,tbpd.* from tborder,tbpd where tborder.寝室号=tbpd.寝室号 and 价格='+trim(combobox2.Text)+' and 专业='''+combobox1.Text+''''+' and 居住性别='''+inputform.XPComboBox.Text+''''+' and 状态=''可以用''')
else
sql.Add('select * from tbpd where left(寝室号,'+inttostr(pos('栋',combobox3.Text)-1)+')='''+copy(combobox3.Text,1,pos('栋',combobox3.Text)-1)+''''+' and 价格='+trim(combobox2.Text)+'and 居住性别='''+inputform.XPComboBox.Text+''''+' and 状态=''可以用''');
open;
if eof then //查询所选择的几栋是否公配完
begin
showmessage('该栋公寓已公配完或者没有此价格的房间,请重新选择');
exit;
end;
while not Eof do //查询某一间房间是否已住满
begin
if ((fieldbyname('应住人数').AsInteger-fieldbyname('实住人数').AsInteger)>0) then
begin
edit1.Text:=fieldbyname('寝室号').AsString;
button1.Enabled:=true;
exit;
end
else
next;
if eof then showmessage('该栋公寓已公配完,请安排下一栋');
end;
end;
end;
procedure TPSForm.Button1Click(Sender: TObject);
begin
inputform.PSEdit.Text:=edit1.Text;
close;
end;
procedure TPSForm.Button2Click(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -