unit DOsoba;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls, ComCtrls, Mask, DBCtrls;

type
  TDlgOsoba = class(TForm)
    Bevel1: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label8: TLabel;
    dbeNazwisko: TDBEdit;
    dbeImie: TDBEdit;
    dbeDataUr: TDBEdit;
    dbeMcowosc: TDBEdit;
    dbeUlicaINr: TDBEdit;
    dbeKodp: TDBEdit;
    dbeMiasto: TDBEdit;
    dbePesel: TDBEdit;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
    idosoby   : Integer;
  public
    { Public declarations }

    // pobiera dane z tabeli OSOBY
    function   get_idosoby() : Integer;
    function   get_nazwisko() : String;
    function   get_dataur() : TDateTime;
    function   get_mcowosc() : String;
    function   get_ulicainr() : String;
    function   get_kodp : String;
    function   get_miasto() : String;
    function   get_pesel() : String;

    constructor Create(AOwner: TComponent; tryb: Boolean);
  end;

var
  DlgOsoba: TDlgOsoba;

implementation
{$R *.dfm}

uses
   DataModule;

constructor TDlgOsoba.Create(AOwner: TComponent; tryb: Boolean);
begin
   inherited Create(AOwner);

end;

function TDlgOsoba.get_idosoby() : Integer;
var
   ret : integer;

begin
   ret := DM.TableOsoby.FieldByName('IDOSOBY').AsInteger;
   Result := ret;
end;

function TDlgOsoba.get_nazwisko() : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('NAZWISKO').AsString;
   Result := ret;
end;

function TDlgOsoba.get_dataur() : TDateTime;
var
   ret : TDateTime;
begin
   ret := DM.TableOsoby.FieldByName('DATAUR').AsDateTime;
   Result := ret;
end;

function TDlgOsoba.get_mcowosc() : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('MCOWOSC').AsString;
   Result := ret;
end;

function TDlgOsoba.get_ulicainr() : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('ULICAINR').AsString;
   Result := ret;
end;

function TDlgOsoba.get_kodp : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('KODP').AsString;
   Result := ret;
end;

function TDlgOsoba.get_miasto() : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('MIASTO').AsString;
   Result := ret;
end;

function TDlgOsoba.get_pesel() : String;
var
   ret : String;

begin
   ret := DM.TableOsoby.FieldByName('PESEL').AsString;
   Result := ret;
end;

procedure TDlgOsoba.BitBtn2Click(Sender: TObject);
begin
   DM.TableOsoby.Edit;
   DM.TableOsoby.Post;
end;

procedure TDlgOsoba.BitBtn1Click(Sender: TObject);
begin
   DM.TableOsoby.Cancel;
end;

end.
