Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit CountyNumberAdd;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
- Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
- Vcl.ComCtrls, Vcl.NumberBox;
- type
- TCountyNumberAddFrame = class(TFrame)
- GroupBox: TGroupBox;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- EditName: TEdit;
- EditTownRegion: TEdit;
- NumberCountyNumber: TNumberBox;
- UpDown: TUpDown;
- BtnSave: TButton;
- procedure FrameEnter(Sender: TObject);
- procedure BtnSaveClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- Constructor Create(aOwner : TComponent); override;
- end;
- implementation
- {$R *.dfm}
- uses CountyNumber, BidirectionalCountyNumber, Main;
- procedure TCountyNumberAddFrame.BtnSaveClick(Sender: TObject);
- var
- NewCountyNumber : TCountyNumber;
- Key : Integer;
- begin
- if (EditName.Text <> '') AND (EditTownRegion.Text <> '') then
- begin
- try
- Key := TCountyNumberList.GetLastPrimaryKey(Main.CountyNumberList) + 1;
- NewCountyNumber := TCountyNumber.Create(Key, StrToInt(NumberCountyNumber.Text), EditName.Text, EditTownRegion.Text);
- Main.CountyNumberList.AddNewCountyNumber(NewCountyNumber);
- Application.MessageBox('Округ успешно добавлен!','Добавление округа',MB_OK + MB_ICONINFORMATION);
- except
- On E : Exception do
- Application.MessageBox(PChar(E.Message),'Ошибка добавления округа', MB_OK + MB_ICONWARNING);
- end;
- end
- else
- Application.MessageBox('Заполните все поля!','Добавление округа',MB_OK+MB_ICONWARNING);
- end;
- Constructor TCountyNumberAddFrame.Create(aOwner: TComponent);
- begin
- inherited Create(aOwner);
- UpDown.Associate := NumberCountyNumber;
- end;
- procedure TCountyNumberAddFrame.FrameEnter(Sender: TObject);
- begin
- // TODO: передать данные из основого фрейма.
- //CountyNumberList := Main.CountyNumberList;
- //PartyList := Main.PartyList;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement