📄 modigy.pas
字号:
unit modigy;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DB, DBTables, System.ComponentModel;
type
Tmodigy_Form = class(TForm)
xh_LEdit: TLabeledEdit;
xm_LEdit: TLabeledEdit;
gybh_LEdit: TLabeledEdit;
cmdok: TButton;
cmdclose: TButton;
Label1: TLabel;
gyjb_CBox: TComboBox;
procedure cmdokClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cmdcloseClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
modigy_Form: Tmodigy_Form;
implementation
uses gygl, main;
{$R *.dfm}
procedure Tmodigy_Form.cmdokClick(Sender: TObject);
var
gyjb,gybh,xh,sqlstr:string;
begin
gybh:=trim(gybh_LEdit.Text);
if length(gybh)<1 then
begin
ShowMessage('公寓编号不能为空!');
exit;
end;
xh:=gygl_form.Query1.fieldbyname('xh').AsString;
if gyjb_CBox.ItemIndex=0 then
begin
ShowMessage('请选择公寓级别!');
exit;
end;
gyjb:=inttostr(gyjb_CBox.ItemIndex);
if gygl_Form.modi then
sqlstr:='select * from [xsb] where (gybh='''+gybh+''')and(xh<>'''+xh+''')'
else
sqlstr:='select * from [xsb] where (gybh='''+gybh+''')';
with tquery.Create(nil) do
begin
try
sessionName:=main_Form.Database1.SessionName;
DatabaseName:=main_Form.Database1.DatabaseName;
Close;
SQL.Clear;
SQL.Add(sqlstr);
Open;
if recordcount > 0 then
begin
ShowMessage('输入的公寓号已经安排给其他同学,请重新安排!');
exit;
end;
sqlstr:='update [xsb] set zt=2,gydm='''+gyjb+''',gybh='''+gybh;
sqlstr:=sqlstr+''' where (xh='''+xh+''')';
Close;
SQL.Clear;
SQL.Add(sqlstr);
ExecSQL;
finally
Free;
end;
end;
Close;
gygl_Form.cmdok.Click;
end;
procedure Tmodigy_Form.FormCreate(Sender: TObject);
begin
xm_ledit.Text:=gygl_form.Query1.fieldbyname('xm').AsString;
xh_ledit.Text:=gygl_form.Query1.fieldbyname('xh').AsString;
with tquery.Create(nil) do
begin
try
sessionName:=main_Form.Database1.SessionName;
DatabaseName:=main_Form.Database1.DatabaseName;
Close;
SQL.Clear;
SQL.Add('select * from [gydm] order by gydm');
Open;
gyjb_cbox.Items.Add('选择公寓级别');
while not Eof do
begin
gyjb_CBox.Items.Add(fieldbyname('jbmc').AsString);
Next;
end;
gyjb_cbox.ItemIndex:=0;
finally
Free;
end;
end;
if gygl_form.modi then
begin
gyjb_CBox.ItemIndex:=gygl_form.Query1.fieldbyname('gydm').AsInteger;
gybh_LEdit.Text:=gygl_form.Query1.fieldbyname('gybh').AsString;
end;
end;
procedure Tmodigy_Form.cmdcloseClick(Sender: TObject);
begin
close;
end;
procedure Tmodigy_Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -