unit EditFormUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, DBCtrls, Mask, Grids, DBGrids;

type
  TEditRecordForm = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBEdit4: TDBEdit;
    DBLookupComboBox1: TDBLookupComboBox;
    DBEdit5: TDBEdit;
    DBGrid1: TDBGrid;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    procedure BitBtn1Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  EditRecordForm: TEditRecordForm;

implementation

uses DataModuleUnit, PhoneEditUnit;

{$R *.dfm}

procedure TEditRecordForm.BitBtn1Click(Sender: TObject);
begin
 if DataModule1.BookTable.Modified then
  DataModule1.BookTable.Post;
 if DataModule1.TelephonTable.Modified then
  DataModule1.TelephonTable.Post;
end;

procedure TEditRecordForm.SpeedButton1Click(Sender: TObject);
begin
 DataModule1.TelephonTable.Insert;
 PhoneEditForm.ShowModal;
end;

procedure TEditRecordForm.SpeedButton2Click(Sender: TObject);
begin
 PhoneEditForm.ShowModal;
end;

procedure TEditRecordForm.SpeedButton3Click(Sender: TObject);
begin
 if Application.MessageBox(PChar('Ты действительно хочешь удалить '+DataModule1.TelephonTableDSDesigner.AsString), 'Внимание!!!', MB_OKCANCEL)=id_OK then
  DataModule1.TelephonTable.Delete;
end;

end.
