unit MainUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, Grids, DBGrids, Menus, ComCtrls, ToolWin, ImgList;

type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    CloseMenu: TMenuItem;
    N3: TMenuItem;
    TownBookMenuItem: TMenuItem;
    Help1: TMenuItem;
    AboutMenuItem: TMenuItem;
    ImageList1: TImageList;
    ToolBar1: TToolBar;
    NewButton: TToolButton;
    EditButton: TToolButton;
    DelButton: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    N4: TMenuItem;
    N5: TMenuItem;
    N6: TMenuItem;
    N7: TMenuItem;
    ToolButton6: TToolButton;
    procedure CloseMenuClick(Sender: TObject);
    procedure TownBookMenuItemClick(Sender: TObject);
    procedure AboutMenuItemClick(Sender: TObject);
    procedure NewButtonClick(Sender: TObject);
    procedure EditButtonClick(Sender: TObject);
    procedure DelButtonClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses DataModuleUnit, TownBookUnit, AboutUnit, EditFormUnit;

{$R *.dfm}

procedure TForm1.CloseMenuClick(Sender: TObject);
begin
 Close;
end;

procedure TForm1.TownBookMenuItemClick(Sender: TObject);
begin
 TownBookForm.ShowModal;
end;

procedure TForm1.AboutMenuItemClick(Sender: TObject);
begin
 AboutForm.ShowModal;
end;

procedure TForm1.NewButtonClick(Sender: TObject);
begin
 DataModule1.BookTable.Insert;
 EditRecordForm.ShowModal;
end;

procedure TForm1.EditButtonClick(Sender: TObject);
begin
 EditRecordForm.ShowModal;
end;

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

end.
