Выбор материала и расчет параметров обделок вертикальных стволов метрополитеновСтраница 25
begin
EditDataTub(TableDATA, False,
TableSTUFF.FieldByName('Code').AsInteger);
end;
end;
end;
procedure TEditDataForm.DBGrid1DblClick(Sender: TObject);
begin
EditDataTub(TableDATA, False,
TableSTUFF.FieldByName('Code').AsInteger);
end;
end.
unit Editform;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, Mask, DBCtrls, ExtCtrls, DB,
DBTables, Buttons;
type
TEdTubForm = class(TForm)
DataSource1: TDataSource;
Panel1: TPanel;
DBEdit1: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
Label8: TLabel;
Label9: TLabel;
Panel2: TPanel;
Panel3: TPanel;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Table1: TTable;
Label10: TLabel;
DBText1: TDBText;
DataSource2: TDataSource;
Query1: TQuery;
Query1Material: TStringField;
procedure FormCreate(Sender: TObject);
public
FCode: Integer;
function EditTub( Table: TTable; IsNew: Boolean; Code: Integer):
Boolean;
end;
var
EdTubForm: TEdTubForm;
function EditDataTub(Table: TTable; IsNew: Boolean; Code: Integer):
Boolean;
implementation
{$R *.DFM}
function EditDataTub(Table: TTable; IsNew: Boolean; Code: Integer):
Boolean;
begin
Result := False;
with TEdTubForm.Create(Application) do
try
FCode := Code;
Result := EditTub(Table, IsNew, Code);
finally
Free;
end;
end;
function TEdTubForm.EditTub(Table: TTable; IsNew: Boolean; Code:
Integer): Boolean;
begin
if Table <> nil then
DataSource1.DataSet := Table
else begin
Table1.Open;
DataSource1.DataSet := Table1;
end;
if IsNew then begin
DataSource1.DataSet.Append;
DataSource1.DataSet.FieldByName('Stuff').AsInteger := Code;
end
else DataSource1.DataSet.Edit;
Result := ShowModal = mrOk;
if Result then
DataSource1.DataSet.Post
else
DataSource1.DataSet.Cancel;
end;
procedure TEdTubForm.FormCreate(Sender: TObject);
begin
Query1.Active := False;
Query1.ParamByName('St').AsInteger := FCode;
Query1.Active := True;
end;
end.
unit EditUser;
interface
uses
SysUtils, WinTypes, WinProcs, Classes, Graphics, Forms, Controls,
Buttons, StdCtrls, ExtCtrls, DBCtrls, Mask, DB, DBTables;
type
TEditUserDialog = class(TForm)
OKBtn: TBitBtn;
CancelBtn: TBitBtn;
UsersTable: TTable;
dsUsers: TDataSource;
NameEdit: TDBEdit;
FullNameEdit: TDBEdit;
GroupBox: TGroupBox;
PasswordEdit: TDBEdit;
ConfirmPassword: TEdit;
Label1: TLabel;
Label2: TLabel;
LevelGroup: TDBRadioGroup;
procedure OKBtnClick(Sender: TObject);
procedure CancelBtnClick(Sender: TObject);
procedure FormHide(Sender: TObject);
private