├── Controlle ├── __history │ ├── uClienteControl.pas.~10~ │ ├── uClienteControl.pas.~11~ │ ├── uClienteControl.pas.~12~ │ ├── uClienteControl.pas.~13~ │ ├── uClienteControl.pas.~14~ │ ├── uClienteControl.pas.~15~ │ ├── uClienteControl.pas.~6~ │ ├── uClienteControl.pas.~7~ │ ├── uClienteControl.pas.~8~ │ ├── uClienteControl.pas.~9~ │ ├── uSistemaControl.pas.~18~ │ ├── uSistemaControl.pas.~19~ │ ├── uSistemaControl.pas.~20~ │ ├── uSistemaControl.pas.~21~ │ ├── uSistemaControl.pas.~22~ │ ├── uSistemaControl.pas.~23~ │ ├── uSistemaControl.pas.~24~ │ ├── uSistemaControl.pas.~25~ │ ├── uSistemaControl.pas.~26~ │ └── uSistemaControl.pas.~27~ ├── uClienteControl.pas └── uSistemaControl.pas ├── DB_MVC.FDB ├── Dao ├── __history │ ├── uClienteDao.pas.~16~ │ ├── uClienteDao.pas.~17~ │ ├── uClienteDao.pas.~18~ │ ├── uClienteDao.pas.~19~ │ ├── uClienteDao.pas.~20~ │ ├── uClienteDao.pas.~21~ │ ├── uClienteDao.pas.~22~ │ ├── uClienteDao.pas.~23~ │ ├── uClienteDao.pas.~24~ │ ├── uClienteDao.pas.~25~ │ ├── uConexao.pas.~1~ │ ├── uConexao.pas.~2~ │ ├── uConexao.pas.~3~ │ ├── uConexao.pas.~4~ │ ├── uConexao.pas.~5~ │ ├── uConexao.pas.~6~ │ ├── uConexao.pas.~7~ │ ├── uConexao.pas.~8~ │ ├── uConexao.pas.~9~ │ ├── uEmpresaDao.pas.~1~ │ ├── uEmpresaDao.pas.~2~ │ ├── uEmpresaDao.pas.~3~ │ ├── uEmpresaDao.pas.~4~ │ ├── uEmpresaDao.pas.~5~ │ ├── uEmpresaDao.pas.~6~ │ ├── uEmpresaDao.pas.~7~ │ ├── uEmpresaDao.pas.~8~ │ └── uEmpresaDao.pas.~9~ ├── uClienteDao.pas ├── uConexao.pas └── uEmpresaDao.pas ├── Model ├── __history │ ├── uClienteModel.pas.~10~ │ ├── uClienteModel.pas.~11~ │ ├── uClienteModel.pas.~12~ │ ├── uClienteModel.pas.~13~ │ ├── uClienteModel.pas.~14~ │ ├── uClienteModel.pas.~15~ │ ├── uClienteModel.pas.~16~ │ ├── uClienteModel.pas.~17~ │ ├── uClienteModel.pas.~18~ │ ├── uClienteModel.pas.~9~ │ ├── uEmpresaModel.pas.~10~ │ ├── uEmpresaModel.pas.~11~ │ ├── uEmpresaModel.pas.~12~ │ ├── uEmpresaModel.pas.~3~ │ ├── uEmpresaModel.pas.~4~ │ ├── uEmpresaModel.pas.~5~ │ ├── uEmpresaModel.pas.~6~ │ ├── uEmpresaModel.pas.~7~ │ ├── uEmpresaModel.pas.~8~ │ ├── uEmpresaModel.pas.~9~ │ ├── uEnumerado.pas.~1~ │ ├── uEnumerado.pas.~2~ │ └── uEnumerado.pas.~3~ ├── uClienteModel.pas ├── uEmpresaModel.pas └── uEnumerado.pas ├── PrjMVC.dpr ├── PrjMVC.dproj ├── PrjMVC.dproj.local ├── PrjMVC.res └── View ├── __history ├── FPrincipal.dfm.~1~ ├── FPrincipal.pas.~1~ ├── FPrincipalView.dfm.~10~ ├── FPrincipalView.dfm.~11~ ├── FPrincipalView.dfm.~12~ ├── FPrincipalView.dfm.~13~ ├── FPrincipalView.dfm.~14~ ├── FPrincipalView.dfm.~15~ ├── FPrincipalView.dfm.~16~ ├── FPrincipalView.dfm.~17~ ├── FPrincipalView.dfm.~8~ ├── FPrincipalView.dfm.~9~ ├── FPrincipalView.pas.~19~ ├── FPrincipalView.pas.~20~ ├── FPrincipalView.pas.~21~ ├── FPrincipalView.pas.~22~ ├── FPrincipalView.pas.~23~ ├── FPrincipalView.pas.~24~ ├── FPrincipalView.pas.~25~ ├── FPrincipalView.pas.~26~ ├── FPrincipalView.pas.~27~ ├── FPrincipalView.pas.~28~ ├── uFrmCliente.dfm.~29~ ├── uFrmCliente.dfm.~30~ ├── uFrmCliente.dfm.~31~ ├── uFrmCliente.dfm.~32~ ├── uFrmCliente.dfm.~33~ ├── uFrmCliente.dfm.~34~ ├── uFrmCliente.dfm.~35~ ├── uFrmCliente.dfm.~36~ ├── uFrmCliente.dfm.~37~ ├── uFrmCliente.dfm.~38~ ├── uFrmCliente.pas.~58~ ├── uFrmCliente.pas.~59~ ├── uFrmCliente.pas.~60~ ├── uFrmCliente.pas.~61~ ├── uFrmCliente.pas.~62~ ├── uFrmCliente.pas.~63~ ├── uFrmCliente.pas.~64~ ├── uFrmCliente.pas.~65~ ├── uFrmCliente.pas.~66~ ├── uFrmCliente.pas.~67~ ├── uFrmClienteView.dfm.~1~ ├── uFrmClienteView.dfm.~2~ ├── uFrmClienteView.dfm.~3~ ├── uFrmClienteView.dfm.~4~ ├── uFrmClienteView.pas.~10~ ├── uFrmClienteView.pas.~11~ ├── uFrmClienteView.pas.~12~ ├── uFrmClienteView.pas.~13~ ├── uFrmClienteView.pas.~14~ ├── uFrmClienteView.pas.~5~ ├── uFrmClienteView.pas.~6~ ├── uFrmClienteView.pas.~7~ ├── uFrmClienteView.pas.~8~ ├── uFrmClienteView.pas.~9~ ├── uFrmPrincipalView.dfm.~1~ ├── uFrmPrincipalView.dfm.~2~ ├── uFrmPrincipalView.pas.~1~ ├── uFrmPrincipalView.pas.~2~ └── uFrmPrincipalView.pas.~3~ ├── uFrmClienteView.dfm ├── uFrmClienteView.pas ├── uFrmPrincipalView.dfm └── uFrmPrincipalView.pas /Controlle/__history/uClienteControl.pas.~10~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Obter: TFDQuery; 18 | end; 19 | 20 | implementation 21 | 22 | { TClienteControl } 23 | 24 | constructor TClienteControl.Create; 25 | begin 26 | FClienteModel := TClienteModel.Create; 27 | end; 28 | 29 | destructor TClienteControl.Destroy; 30 | begin 31 | FreeAndNil(FClienteModel); 32 | 33 | inherited; 34 | end; 35 | 36 | function TClienteControl.Obter: TFDQuery; 37 | begin 38 | Result := FClienteModel.Obter; 39 | end; 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~11~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Obter: TFDQuery; 18 | end; 19 | 20 | implementation 21 | 22 | { TClienteControl } 23 | 24 | constructor TClienteControl.Create; 25 | begin 26 | FClienteModel := TClienteModel.Create; 27 | end; 28 | 29 | destructor TClienteControl.Destroy; 30 | begin 31 | FClienteModel.Free; 32 | 33 | inherited; 34 | end; 35 | 36 | function TClienteControl.Obter: TFDQuery; 37 | begin 38 | Result := FClienteModel.Obter; 39 | end; 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~12~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Obter: TFDQuery; 18 | end; 19 | 20 | implementation 21 | 22 | { TClienteControl } 23 | 24 | constructor TClienteControl.Create; 25 | begin 26 | FClienteModel := TClienteModel.Create; 27 | end; 28 | 29 | destructor TClienteControl.Destroy; 30 | begin 31 | FClienteModel.Free; 32 | 33 | inherited; 34 | end; 35 | 36 | function TClienteControl.Obter: TFDQuery; 37 | begin 38 | Result := FClienteModel.Obter; 39 | end; 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~13~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Salvar: Boolean; 18 | function Obter: TFDQuery; 19 | end; 20 | 21 | implementation 22 | 23 | { TClienteControl } 24 | 25 | constructor TClienteControl.Create; 26 | begin 27 | FClienteModel := TClienteModel.Create; 28 | end; 29 | 30 | destructor TClienteControl.Destroy; 31 | begin 32 | FClienteModel.Free; 33 | 34 | inherited; 35 | end; 36 | 37 | function TClienteControl.Obter: TFDQuery; 38 | begin 39 | Result := FClienteModel.Obter; 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~14~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Salvar: Boolean; 18 | function Obter: TFDQuery; 19 | end; 20 | 21 | implementation 22 | 23 | { TClienteControl } 24 | 25 | constructor TClienteControl.Create; 26 | begin 27 | FClienteModel := TClienteModel.Create; 28 | end; 29 | 30 | destructor TClienteControl.Destroy; 31 | begin 32 | FClienteModel.Free; 33 | 34 | inherited; 35 | end; 36 | 37 | function TClienteControl.Obter: TFDQuery; 38 | begin 39 | Result := FClienteModel.Obter; 40 | end; 41 | 42 | function TClienteControl.Salvar: Boolean; 43 | begin 44 | Result := FClienteModel.Salvar; 45 | end; 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~15~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Salvar: Boolean; 18 | function Obter: TFDQuery; 19 | 20 | property ClienteModel: TClienteModel read FClienteModel write FClienteModel; 21 | end; 22 | 23 | implementation 24 | 25 | { TClienteControl } 26 | 27 | constructor TClienteControl.Create; 28 | begin 29 | FClienteModel := TClienteModel.Create; 30 | end; 31 | 32 | destructor TClienteControl.Destroy; 33 | begin 34 | FClienteModel.Free; 35 | 36 | inherited; 37 | end; 38 | 39 | function TClienteControl.Obter: TFDQuery; 40 | begin 41 | Result := FClienteModel.Obter; 42 | end; 43 | 44 | function TClienteControl.Salvar: Boolean; 45 | begin 46 | Result := FClienteModel.Salvar; 47 | end; 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~6~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.sy; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | end; 17 | 18 | implementation 19 | 20 | { TClienteControl } 21 | 22 | constructor TClienteControl.Create; 23 | begin 24 | FClienteModel := TClienteModel.Create; 25 | end; 26 | 27 | destructor TClienteControl.Destroy; 28 | begin 29 | FreeAndNil(FClienteModel); 30 | 31 | inherited; 32 | end; 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~7~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | end; 17 | 18 | implementation 19 | 20 | { TClienteControl } 21 | 22 | constructor TClienteControl.Create; 23 | begin 24 | FClienteModel := TClienteModel.Create; 25 | end; 26 | 27 | destructor TClienteControl.Destroy; 28 | begin 29 | FreeAndNil(FClienteModel); 30 | 31 | inherited; 32 | end; 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~8~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | end; 17 | 18 | implementation 19 | 20 | { TClienteControl } 21 | 22 | constructor TClienteControl.Create; 23 | begin 24 | FClienteModel := TClienteModel.Create; 25 | end; 26 | 27 | destructor TClienteControl.Destroy; 28 | begin 29 | FreeAndNil(FClienteModel); 30 | 31 | inherited; 32 | end; 33 | 34 | end. 35 | -------------------------------------------------------------------------------- /Controlle/__history/uClienteControl.pas.~9~: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Obter: TFDQuery; 18 | end; 19 | 20 | implementation 21 | 22 | { TClienteControl } 23 | 24 | constructor TClienteControl.Create; 25 | begin 26 | FClienteModel := TClienteModel.Create; 27 | end; 28 | 29 | destructor TClienteControl.Destroy; 30 | begin 31 | FreeAndNil(FClienteModel); 32 | 33 | inherited; 34 | end; 35 | 36 | function TClienteControl.Obter: TFDQuery; 37 | begin 38 | //FClienteModel.O 39 | //Result := 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~18~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresa : TEmpresaModel; 13 | FCodigoEmpreda: Integer; 14 | 15 | class var FInstance: TSistemaControl; 16 | 17 | public 18 | constructor Create(); 19 | destructor Destroy; override; 20 | 21 | procedure SetEmpresa(ACodigoEmpresa: Integer); 22 | procedure CarregarEmpresa; 23 | 24 | class function GetInstance: TSistemaControl; 25 | 26 | property Conexao: TConexao read FConexao write FConexao; 27 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 28 | end; 29 | 30 | implementation 31 | 32 | { TSistemaControl } 33 | 34 | procedure TSistemaControl.CarregarEmpresa; 35 | begin 36 | 37 | end; 38 | 39 | constructor TSistemaControl.Create(); 40 | begin 41 | FConexao := TConexao.Create; 42 | FEmpresa := TEmpresaModel.Create(); 43 | end; 44 | 45 | destructor TSistemaControl.Destroy; 46 | begin 47 | FreeAndNil(FEmpresa); 48 | FreeAndNil(FConexao); 49 | 50 | inherited; 51 | end; 52 | 53 | class function TSistemaControl.GetInstance: TSistemaControl; 54 | begin 55 | if not Assigned(Self.FInstance) then 56 | begin 57 | Self.FInstance := TSistemaControl.Create(); 58 | end; 59 | 60 | Result := Self.FInstance; 61 | end; 62 | 63 | procedure TSistemaControl.SetEmpresa(ACodigoEmpresa: Integer); 64 | begin 65 | FCodigoEmpreda := ACodigoEmpresa; 66 | end; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~19~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresa : TEmpresaModel; 13 | FCodigoEmpreda: Integer; 14 | 15 | class var FInstance: TSistemaControl; 16 | 17 | public 18 | constructor Create(); 19 | destructor Destroy; override; 20 | 21 | procedure SetEmpresa(ACodigoEmpresa: Integer); 22 | procedure CarregarEmpresa; 23 | 24 | class function GetInstance: TSistemaControl; 25 | 26 | property Conexao: TConexao read FConexao write FConexao; 27 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 28 | end; 29 | 30 | implementation 31 | 32 | { TSistemaControl } 33 | 34 | procedure TSistemaControl.CarregarEmpresa; 35 | begin 36 | 37 | end; 38 | 39 | constructor TSistemaControl.Create(); 40 | begin 41 | FConexao := TConexao.Create; 42 | FEmpresa := TEmpresaModel.Create(); 43 | end; 44 | 45 | destructor TSistemaControl.Destroy; 46 | begin 47 | FreeAndNil(FEmpresa); 48 | FreeAndNil(FConexao); 49 | 50 | inherited; 51 | end; 52 | 53 | class function TSistemaControl.GetInstance: TSistemaControl; 54 | begin 55 | if not Assigned(Self.FInstance) then 56 | begin 57 | Self.FInstance := TSistemaControl.Create(); 58 | end; 59 | 60 | Result := Self.FInstance; 61 | end; 62 | 63 | procedure TSistemaControl.SetEmpresa(ACodigoEmpresa: Integer); 64 | begin 65 | FCodigoEmpreda := ACodigoEmpresa; 66 | end; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~20~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresa : TEmpresaModel; 13 | FCodigoEmpreda: Integer; 14 | 15 | class var FInstance: TSistemaControl; 16 | 17 | public 18 | constructor Create(); 19 | destructor Destroy; override; 20 | 21 | procedure SetEmpresa(ACodigoEmpresa: Integer); 22 | procedure CarregarEmpresa; 23 | 24 | class function GetInstance: TSistemaControl; 25 | 26 | property Conexao: TConexao read FConexao write FConexao; 27 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 28 | end; 29 | 30 | implementation 31 | 32 | { TSistemaControl } 33 | 34 | procedure TSistemaControl.CarregarEmpresa; 35 | begin 36 | FEmpresa.Carregar(); 37 | end; 38 | 39 | constructor TSistemaControl.Create(); 40 | begin 41 | FConexao := TConexao.Create; 42 | FEmpresa := TEmpresaModel.Create(); 43 | end; 44 | 45 | destructor TSistemaControl.Destroy; 46 | begin 47 | FreeAndNil(FEmpresa); 48 | FreeAndNil(FConexao); 49 | 50 | inherited; 51 | end; 52 | 53 | class function TSistemaControl.GetInstance: TSistemaControl; 54 | begin 55 | if not Assigned(Self.FInstance) then 56 | begin 57 | Self.FInstance := TSistemaControl.Create(); 58 | end; 59 | 60 | Result := Self.FInstance; 61 | end; 62 | 63 | procedure TSistemaControl.SetEmpresa(ACodigoEmpresa: Integer); 64 | begin 65 | FCodigoEmpreda := ACodigoEmpresa; 66 | end; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~21~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresa : TEmpresaModel; 13 | FCodigoEmpreda: Integer; 14 | 15 | class var FInstance: TSistemaControl; 16 | 17 | public 18 | constructor Create(); 19 | destructor Destroy; override; 20 | 21 | procedure SetEmpresa(ACodigoEmpresa: Integer); 22 | procedure CarregarEmpresa; 23 | 24 | class function GetInstance: TSistemaControl; 25 | 26 | property Conexao: TConexao read FConexao write FConexao; 27 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 28 | end; 29 | 30 | implementation 31 | 32 | { TSistemaControl } 33 | 34 | procedure TSistemaControl.CarregarEmpresa; 35 | begin 36 | FEmpresa.Carregar(FCodigoEmpreda); 37 | end; 38 | 39 | constructor TSistemaControl.Create(); 40 | begin 41 | FConexao := TConexao.Create; 42 | FEmpresa := TEmpresaModel.Create(); 43 | end; 44 | 45 | destructor TSistemaControl.Destroy; 46 | begin 47 | FreeAndNil(FEmpresa); 48 | FreeAndNil(FConexao); 49 | 50 | inherited; 51 | end; 52 | 53 | class function TSistemaControl.GetInstance: TSistemaControl; 54 | begin 55 | if not Assigned(Self.FInstance) then 56 | begin 57 | Self.FInstance := TSistemaControl.Create(); 58 | end; 59 | 60 | Result := Self.FInstance; 61 | end; 62 | 63 | procedure TSistemaControl.SetEmpresa(ACodigoEmpresa: Integer); 64 | begin 65 | FCodigoEmpreda := ACodigoEmpresa; 66 | end; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~22~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao: TConexao; 12 | FEmpresa: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure SetEmpresa(ACodigoEmpresa: Integer); 21 | procedure CarregarEmpresa; 22 | 23 | class function GetInstance: TSistemaControl; 24 | 25 | property Conexao: TConexao read FConexao write FConexao; 26 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 27 | end; 28 | 29 | implementation 30 | 31 | { TSistemaControl } 32 | 33 | constructor TSistemaControl.Create(); 34 | begin 35 | FConexao := TConexao.Create; 36 | FEmpresa := TEmpresaModel.Create(); 37 | end; 38 | 39 | destructor TSistemaControl.Destroy; 40 | begin 41 | FreeAndNil(FEmpresa); 42 | FreeAndNil(FConexao); 43 | 44 | inherited; 45 | end; 46 | 47 | class function TSistemaControl.GetInstance: TSistemaControl; 48 | begin 49 | if not Assigned(Self.FInstance) then 50 | begin 51 | Self.FInstance := TSistemaControl.Create(); 52 | end; 53 | 54 | Result := Self.FInstance; 55 | end; 56 | 57 | end. 58 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~23~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao: TConexao; 12 | FEmpresa: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property Empresa: TEmpresaModel read FEmpresa write FEmpresa; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | FEmpresa.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | FEmpresa := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FreeAndNil(FEmpresa); 46 | FreeAndNil(FConexao); 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~24~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresaModel: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property EmpresaModel: TEmpresaModel read FEmpresaModel write FEmpresaModel; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | FEmpresa.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | FEmpresa := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FreeAndNil(FEmpresa); 46 | FreeAndNil(FConexao); 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~25~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresaModel: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property EmpresaModel: TEmpresaModel read FEmpresaModel write FEmpresaModel; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | EmpresaModel.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | EmpresaModel := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FreeAndNil(EmpresaModel); 46 | FreeAndNil(FConexao); 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~26~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresaModel: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property EmpresaModel: TEmpresaModel read FEmpresaModel write FEmpresaModel; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | EmpresaModel.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | EmpresaModel := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FreeAndNil(FEmpresaModel); 46 | FreeAndNil(FConexao); 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Controlle/__history/uSistemaControl.pas.~27~: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresaModel: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property EmpresaModel: TEmpresaModel read FEmpresaModel write FEmpresaModel; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | EmpresaModel.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | EmpresaModel := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FreeAndNil(FEmpresaModel); 46 | FreeAndNil(FConexao); 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /Controlle/uClienteControl.pas: -------------------------------------------------------------------------------- 1 | unit uClienteControl; 2 | 3 | interface 4 | 5 | uses 6 | uClienteModel, System.SysUtils, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteControl = class 10 | private 11 | FClienteModel: TClienteModel; 12 | 13 | public 14 | constructor Create; 15 | destructor Destroy; override; 16 | 17 | function Salvar: Boolean; 18 | function Obter: TFDQuery; 19 | function GetId(AAutoIncrementar: Integer): Integer; 20 | 21 | property ClienteModel: TClienteModel read FClienteModel write FClienteModel; 22 | end; 23 | 24 | implementation 25 | 26 | { TClienteControl } 27 | 28 | constructor TClienteControl.Create; 29 | begin 30 | FClienteModel := TClienteModel.Create; 31 | end; 32 | 33 | destructor TClienteControl.Destroy; 34 | begin 35 | FClienteModel.Free; 36 | 37 | inherited; 38 | end; 39 | 40 | function TClienteControl.GetId(AAutoIncrementar: Integer): Integer; 41 | begin 42 | Result := FClienteModel.GetId(AAutoIncrementar); 43 | end; 44 | 45 | function TClienteControl.Obter: TFDQuery; 46 | begin 47 | Result := FClienteModel.Obter; 48 | end; 49 | 50 | function TClienteControl.Salvar: Boolean; 51 | begin 52 | Result := FClienteModel.Salvar; 53 | end; 54 | 55 | end. 56 | -------------------------------------------------------------------------------- /Controlle/uSistemaControl.pas: -------------------------------------------------------------------------------- 1 | unit uSistemaControl; 2 | 3 | interface 4 | 5 | uses 6 | uConexao, System.SysUtils, uEmpresaModel; 7 | 8 | type 9 | TSistemaControl = class 10 | private 11 | FConexao : TConexao; 12 | FEmpresaModel: TEmpresaModel; 13 | 14 | class var FInstance: TSistemaControl; 15 | 16 | public 17 | constructor Create(); 18 | destructor Destroy; override; 19 | 20 | procedure CarregarEmpresa(ACodigoEmpresa: Integer); 21 | 22 | class function GetInstance: TSistemaControl; 23 | 24 | property Conexao: TConexao read FConexao write FConexao; 25 | property EmpresaModel: TEmpresaModel read FEmpresaModel write FEmpresaModel; 26 | end; 27 | 28 | implementation 29 | 30 | { TSistemaControl } 31 | 32 | procedure TSistemaControl.CarregarEmpresa(ACodigoEmpresa: Integer); 33 | begin 34 | EmpresaModel.Carregar(ACodigoEmpresa); 35 | end; 36 | 37 | constructor TSistemaControl.Create(); 38 | begin 39 | FConexao := TConexao.Create; 40 | EmpresaModel := TEmpresaModel.Create(); 41 | end; 42 | 43 | destructor TSistemaControl.Destroy; 44 | begin 45 | FEmpresaModel.Free; 46 | FConexao.Free; 47 | 48 | inherited; 49 | end; 50 | 51 | class function TSistemaControl.GetInstance: TSistemaControl; 52 | begin 53 | if not Assigned(Self.FInstance) then 54 | begin 55 | Self.FInstance := TSistemaControl.Create(); 56 | end; 57 | 58 | Result := Self.FInstance; 59 | end; 60 | 61 | end. 62 | -------------------------------------------------------------------------------- /DB_MVC.FDB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/DB_MVC.FDB -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~16~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId: Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId: Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | Result := VQry.Open('select gen_id(gen_cliente_id, 0) from rdb$database'); 68 | finally 69 | VQry.Free; 70 | end; 71 | end; 72 | 73 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 74 | var 75 | VQry: TFDQuery; 76 | begin 77 | VQry := FConexao.CriarQuery(); 78 | try 79 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 80 | 81 | Result := True; 82 | finally 83 | VQry.Free; 84 | end; 85 | end; 86 | 87 | function TClienteDao.Obter: TFDQuery; 88 | var 89 | VQry: TFDQuery; 90 | begin 91 | VQry := FConexao.CriarQuery(); 92 | 93 | VQry.Open('select codigo, nome from cliente'); 94 | 95 | Result := VQry; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~17~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId: Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId: Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | Result := VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | finally 69 | VQry.Free; 70 | end; 71 | end; 72 | 73 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 74 | var 75 | VQry: TFDQuery; 76 | begin 77 | VQry := FConexao.CriarQuery(); 78 | try 79 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 80 | 81 | Result := True; 82 | finally 83 | VQry.Free; 84 | end; 85 | end; 86 | 87 | function TClienteDao.Obter: TFDQuery; 88 | var 89 | VQry: TFDQuery; 90 | begin 91 | VQry := FConexao.CriarQuery(); 92 | 93 | VQry.Open('select codigo, nome from cliente'); 94 | 95 | Result := VQry; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~18~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | function GetIdooo: Integer; 13 | public 14 | constructor Create; 15 | 16 | function Incluir(AClienteModel: TClienteModel): Boolean; 17 | function Alterar(AClienteModel: TClienteModel): Boolean; 18 | function Excluir(AClienteModel: TClienteModel): Boolean; 19 | function GetId: Integer; 20 | function Obter: TFDQuery; 21 | end; 22 | 23 | implementation 24 | 25 | { TClienteDao } 26 | 27 | uses uSistemaControl; 28 | 29 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 30 | var 31 | VQry: TFDQuery; 32 | begin 33 | VQry := FConexao.CriarQuery(); 34 | try 35 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 36 | 37 | Result := True; 38 | finally 39 | VQry.Free; 40 | end; 41 | end; 42 | 43 | constructor TClienteDao.Create; 44 | begin 45 | FConexao := TSistemaControl.GetInstance().Conexao; 46 | end; 47 | 48 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 49 | var 50 | VQry: TFDQuery; 51 | begin 52 | VQry := FConexao.CriarQuery(); 53 | try 54 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 55 | 56 | Result := True; 57 | finally 58 | VQry.Free; 59 | end; 60 | end; 61 | 62 | function TClienteDao.GetId: Integer; 63 | var 64 | VQry: TFDQuery; 65 | begin 66 | VQry := FConexao.CriarQuery(); 67 | try 68 | Result := VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 69 | finally 70 | VQry.Free; 71 | end; 72 | end; 73 | 74 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 75 | var 76 | VQry: TFDQuery; 77 | begin 78 | VQry := FConexao.CriarQuery(); 79 | try 80 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 81 | 82 | Result := True; 83 | finally 84 | VQry.Free; 85 | end; 86 | end; 87 | 88 | function TClienteDao.Obter: TFDQuery; 89 | var 90 | VQry: TFDQuery; 91 | begin 92 | VQry := FConexao.CriarQuery(); 93 | 94 | VQry.Open('select codigo, nome from cliente'); 95 | 96 | Result := VQry; 97 | end; 98 | 99 | end. 100 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~19~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | Result := 1;//VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | finally 69 | VQry.Free; 70 | end; 71 | end; 72 | 73 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 74 | var 75 | VQry: TFDQuery; 76 | begin 77 | VQry := FConexao.CriarQuery(); 78 | try 79 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 80 | 81 | Result := True; 82 | finally 83 | VQry.Free; 84 | end; 85 | end; 86 | 87 | function TClienteDao.Obter: TFDQuery; 88 | var 89 | VQry: TFDQuery; 90 | begin 91 | VQry := FConexao.CriarQuery(); 92 | 93 | VQry.Open('select codigo, nome from cliente'); 94 | 95 | Result := VQry; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~20~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | //Result := VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | finally 69 | VQry.Free; 70 | end; 71 | end; 72 | 73 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 74 | var 75 | VQry: TFDQuery; 76 | begin 77 | VQry := FConexao.CriarQuery(); 78 | try 79 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 80 | 81 | Result := True; 82 | finally 83 | VQry.Free; 84 | end; 85 | end; 86 | 87 | function TClienteDao.Obter: TFDQuery; 88 | var 89 | VQry: TFDQuery; 90 | begin 91 | VQry := FConexao.CriarQuery(); 92 | 93 | VQry.Open('select codigo, nome from cliente'); 94 | 95 | Result := VQry; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~21~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | try 69 | Result := 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~22~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | try 69 | Result := VQry.Fields[0].AsInteger; 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (nome) values (:nome)', [AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~23~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | try 69 | Result := VQry.Fields[0].AsInteger; 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (codigo, nome) values (:codigo, :nome)', [AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~24~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | try 69 | Result := VQry.Fields[0].AsInteger; 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (codigo, nome) values (:codigo, :nome)', [AClienteModel.Codigo, AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/__history/uClienteDao.pas.~25~: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, 1) from rdb$database'); 68 | try 69 | Result := VQry.Fields[0].AsInteger; 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (codigo, nome) values (:codigo, :nome)', [AClienteModel.Codigo, AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente order by 1'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~1~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | implementation 6 | 7 | end. 8 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~2~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | end; 22 | 23 | implementation 24 | 25 | { TConexao } 26 | 27 | procedure TConexao.ConfigurarConexao; 28 | begin 29 | 30 | end; 31 | 32 | constructor TConexao.Create; 33 | begin 34 | FConn := TFDConnection.Create(nil); 35 | end; 36 | 37 | function TConexao.CriarQuery: TFDQuery; 38 | begin 39 | 40 | end; 41 | 42 | destructor TConexao.Destroy; 43 | begin 44 | FreeAndNil(FConn); 45 | 46 | inherited; 47 | end; 48 | 49 | end. 50 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~3~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | end; 22 | 23 | const 24 | PATH_BANCO: string = 'E:\MVC\DB_MVC.FDB'; 25 | 26 | implementation 27 | 28 | { TConexao } 29 | 30 | procedure TConexao.ConfigurarConexao; 31 | begin 32 | FConn.Params.DriverID := 'FB'; 33 | FConn.Params.Database := PATH_BANCO; 34 | FConn.Params.UserName := 'SYSDBA'; 35 | FConn.Params.Password := 'masterkey'; 36 | FConn.LoginPrompt := False; 37 | end; 38 | 39 | constructor TConexao.Create; 40 | begin 41 | FConn := TFDConnection.Create(nil); 42 | 43 | Self.ConfigurarConexao(); 44 | end; 45 | 46 | function TConexao.CriarQuery: TFDQuery; 47 | var 48 | VQuery: TFDQuery; 49 | begin 50 | VQuery := TFDQuery.Create(nil); 51 | VQuery.Connection := FConn; 52 | 53 | Result := VQuery; 54 | end; 55 | 56 | destructor TConexao.Destroy; 57 | begin 58 | FreeAndNil(FConn); 59 | 60 | inherited; 61 | end; 62 | 63 | end. 64 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~4~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function GetConn: TFDConnection; 23 | end; 24 | 25 | const 26 | PATH_BANCO: string = 'E:\MVC\DB_MVC.FDB'; 27 | 28 | implementation 29 | 30 | { TConexao } 31 | 32 | procedure TConexao.ConfigurarConexao; 33 | begin 34 | FConn.Params.DriverID := 'FB'; 35 | FConn.Params.Database := PATH_BANCO; 36 | FConn.Params.UserName := 'SYSDBA'; 37 | FConn.Params.Password := 'masterkey'; 38 | FConn.LoginPrompt := False; 39 | end; 40 | 41 | constructor TConexao.Create; 42 | begin 43 | FConn := TFDConnection.Create(nil); 44 | 45 | Self.ConfigurarConexao(); 46 | end; 47 | 48 | function TConexao.CriarQuery: TFDQuery; 49 | var 50 | VQuery: TFDQuery; 51 | begin 52 | VQuery := TFDQuery.Create(nil); 53 | VQuery.Connection := FConn; 54 | 55 | Result := VQuery; 56 | end; 57 | 58 | destructor TConexao.Destroy; 59 | begin 60 | FreeAndNil(FConn); 61 | 62 | inherited; 63 | end; 64 | 65 | function TConexao.GetConn: TFDConnection; 66 | begin 67 | Result := FConn; 68 | end; 69 | 70 | end. 71 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~5~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function GetConn: TFDConnection; 23 | end; 24 | 25 | const 26 | PATH_BANCO: string = 'E:\MVC_DELPHI\DB_MVC.FDB'; 27 | 28 | implementation 29 | 30 | { TConexao } 31 | 32 | procedure TConexao.ConfigurarConexao; 33 | begin 34 | FConn.Params.DriverID := 'FB'; 35 | FConn.Params.Database := PATH_BANCO; 36 | FConn.Params.UserName := 'SYSDBA'; 37 | FConn.Params.Password := 'masterkey'; 38 | FConn.LoginPrompt := False; 39 | end; 40 | 41 | constructor TConexao.Create; 42 | begin 43 | FConn := TFDConnection.Create(nil); 44 | 45 | Self.ConfigurarConexao(); 46 | end; 47 | 48 | function TConexao.CriarQuery: TFDQuery; 49 | var 50 | VQuery: TFDQuery; 51 | begin 52 | VQuery := TFDQuery.Create(nil); 53 | VQuery.Connection := FConn; 54 | 55 | Result := VQuery; 56 | end; 57 | 58 | destructor TConexao.Destroy; 59 | begin 60 | FreeAndNil(FConn); 61 | 62 | inherited; 63 | end; 64 | 65 | function TConexao.GetConn: TFDConnection; 66 | begin 67 | Result := FConn; 68 | end; 69 | 70 | end. 71 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~6~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function GetConn: TFDConnection; 23 | end; 24 | 25 | const 26 | PATH_BANCO: string = 'E:\MVC_DELPH\DB_MVC.FDB'; 27 | 28 | implementation 29 | 30 | { TConexao } 31 | 32 | procedure TConexao.ConfigurarConexao; 33 | begin 34 | FConn.Params.DriverID := 'FB'; 35 | FConn.Params.Database := PATH_BANCO; 36 | FConn.Params.UserName := 'SYSDBA'; 37 | FConn.Params.Password := 'masterkey'; 38 | FConn.LoginPrompt := False; 39 | end; 40 | 41 | constructor TConexao.Create; 42 | begin 43 | FConn := TFDConnection.Create(nil); 44 | 45 | Self.ConfigurarConexao(); 46 | end; 47 | 48 | function TConexao.CriarQuery: TFDQuery; 49 | var 50 | VQuery: TFDQuery; 51 | begin 52 | VQuery := TFDQuery.Create(nil); 53 | VQuery.Connection := FConn; 54 | 55 | Result := VQuery; 56 | end; 57 | 58 | destructor TConexao.Destroy; 59 | begin 60 | FreeAndNil(FConn); 61 | 62 | inherited; 63 | end; 64 | 65 | function TConexao.GetConn: TFDConnection; 66 | begin 67 | Result := FConn; 68 | end; 69 | 70 | end. 71 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~7~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function GetConn: TFDConnection; 23 | end; 24 | 25 | const 26 | PATH_BANCO: string = 'E:\MVC_DELPHI\DB_MVC.FDB'; 27 | 28 | implementation 29 | 30 | { TConexao } 31 | 32 | procedure TConexao.ConfigurarConexao; 33 | begin 34 | FConn.Params.DriverID := 'FB'; 35 | FConn.Params.Database := PATH_BANCO; 36 | FConn.Params.UserName := 'SYSDBA'; 37 | FConn.Params.Password := 'masterkey'; 38 | FConn.LoginPrompt := False; 39 | end; 40 | 41 | constructor TConexao.Create; 42 | begin 43 | FConn := TFDConnection.Create(nil); 44 | 45 | Self.ConfigurarConexao(); 46 | end; 47 | 48 | function TConexao.CriarQuery: TFDQuery; 49 | var 50 | VQuery: TFDQuery; 51 | begin 52 | VQuery := TFDQuery.Create(nil); 53 | VQuery.Connection := FConn; 54 | 55 | Result := VQuery; 56 | end; 57 | 58 | destructor TConexao.Destroy; 59 | begin 60 | FreeAndNil(FConn); 61 | 62 | inherited; 63 | end; 64 | 65 | function TConexao.GetConn: TFDConnection; 66 | begin 67 | Result := FConn; 68 | end; 69 | 70 | end. 71 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~8~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | 17 | function CriarQuery: TFDQuery; 18 | public 19 | constructor Create; 20 | destructor Destroy; override; 21 | 22 | function GetConn: TFDConnection; 23 | end; 24 | 25 | const 26 | PATH_BANCO: string = 'E:\MVC_DELPHI\MVC_DELPHI\DB_MVC.FDB'; 27 | 28 | implementation 29 | 30 | { TConexao } 31 | 32 | procedure TConexao.ConfigurarConexao; 33 | begin 34 | FConn.Params.DriverID := 'FB'; 35 | FConn.Params.Database := PATH_BANCO; 36 | FConn.Params.UserName := 'SYSDBA'; 37 | FConn.Params.Password := 'masterkey'; 38 | FConn.LoginPrompt := False; 39 | end; 40 | 41 | constructor TConexao.Create; 42 | begin 43 | FConn := TFDConnection.Create(nil); 44 | 45 | Self.ConfigurarConexao(); 46 | end; 47 | 48 | function TConexao.CriarQuery: TFDQuery; 49 | var 50 | VQuery: TFDQuery; 51 | begin 52 | VQuery := TFDQuery.Create(nil); 53 | VQuery.Connection := FConn; 54 | 55 | Result := VQuery; 56 | end; 57 | 58 | destructor TConexao.Destroy; 59 | begin 60 | FreeAndNil(FConn); 61 | 62 | inherited; 63 | end; 64 | 65 | function TConexao.GetConn: TFDConnection; 66 | begin 67 | Result := FConn; 68 | end; 69 | 70 | end. 71 | -------------------------------------------------------------------------------- /Dao/__history/uConexao.pas.~9~: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | public 17 | constructor Create; 18 | destructor Destroy; override; 19 | 20 | function GetConn: TFDConnection; 21 | function CriarQuery: TFDQuery; 22 | end; 23 | 24 | const 25 | PATH_BANCO: string = 'E:\MVC_DELPHI\MVC_DELPHI\DB_MVC.FDB'; 26 | 27 | implementation 28 | 29 | { TConexao } 30 | 31 | procedure TConexao.ConfigurarConexao; 32 | begin 33 | FConn.Params.DriverID := 'FB'; 34 | FConn.Params.Database := PATH_BANCO; 35 | FConn.Params.UserName := 'SYSDBA'; 36 | FConn.Params.Password := 'masterkey'; 37 | FConn.LoginPrompt := False; 38 | end; 39 | 40 | constructor TConexao.Create; 41 | begin 42 | FConn := TFDConnection.Create(nil); 43 | 44 | Self.ConfigurarConexao(); 45 | end; 46 | 47 | function TConexao.CriarQuery: TFDQuery; 48 | var 49 | VQuery: TFDQuery; 50 | begin 51 | VQuery := TFDQuery.Create(nil); 52 | VQuery.Connection := FConn; 53 | 54 | Result := VQuery; 55 | end; 56 | 57 | destructor TConexao.Destroy; 58 | begin 59 | FreeAndNil(FConn); 60 | 61 | inherited; 62 | end; 63 | 64 | function TConexao.GetConn: TFDConnection; 65 | begin 66 | Result := FConn; 67 | end; 68 | 69 | end. 70 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~1~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | implementation 6 | 7 | end. 8 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~2~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses uEmpresaModel; 6 | 7 | type 8 | TEmpresaDao = class 9 | procedure carregar(AEmpresaModel: TEmpresa) 10 | end; 11 | 12 | implementation 13 | 14 | end. 15 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~3~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel); 18 | begin 19 | 20 | end; 21 | 22 | end. 23 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~4~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel); 18 | var 19 | VQuery: TFDQuery; 20 | begin 21 | VQuery := TSistemaControl.GetInstance().Conexao. 22 | 23 | end; 24 | 25 | end. 26 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~5~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel); 18 | var 19 | VQuery: TFDQuery; 20 | begin 21 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 22 | try 23 | 24 | finally 25 | FreeAndNil(VQuery); 26 | end; 27 | end; 28 | 29 | end. 30 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~6~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel); 18 | var 19 | VQuery: TFDQuery; 20 | begin 21 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 22 | try 23 | VQuery.Open('select codigo, rsocial from empresa'); 24 | try 25 | AEmpresaModel.Codigo := VQuery.Fields[0].AsInteger; 26 | AEmpresaModel.RSocial := VQuery.Fields[1].AsString; 27 | finally 28 | VQuery.Close; 29 | end; 30 | finally 31 | FreeAndNil(VQuery); 32 | end; 33 | end; 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~7~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 18 | var 19 | VQuery: TFDQuery; 20 | begin 21 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 22 | try 23 | VQuery.Open('select codigo, rsocial from empresa'); 24 | try 25 | AEmpresaModel.Codigo := VQuery.Fields[0].AsInteger; 26 | AEmpresaModel.RSocial := VQuery.Fields[1].AsString; 27 | finally 28 | VQuery.Close; 29 | end; 30 | finally 31 | FreeAndNil(VQuery); 32 | end; 33 | end; 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~8~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | procedure carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 11 | end; 12 | 13 | implementation 14 | 15 | { TEmpresaDao } 16 | 17 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 18 | var 19 | VQuery: TFDQuery; 20 | begin 21 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 22 | try 23 | VQuery.Open('select codigo, rsocial from empresa where codigo = :codigo ', [ACodigo]); 24 | try 25 | AEmpresaModel.Codigo := VQuery.Fields[0].AsInteger; 26 | AEmpresaModel.RSocial := VQuery.Fields[1].AsString; 27 | finally 28 | VQuery.Close; 29 | end; 30 | finally 31 | FreeAndNil(VQuery); 32 | end; 33 | end; 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /Dao/__history/uEmpresaDao.pas.~9~: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | public 11 | procedure carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 12 | end; 13 | 14 | implementation 15 | 16 | { TEmpresaDao } 17 | 18 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 19 | var 20 | VQuery: TFDQuery; 21 | begin 22 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 23 | try 24 | VQuery.Open('select codigo, rsocial from empresa where codigo = :codigo ', [ACodigo]); 25 | try 26 | AEmpresaModel.Codigo := VQuery.Fields[0].AsInteger; 27 | AEmpresaModel.RSocial := VQuery.Fields[1].AsString; 28 | finally 29 | VQuery.Close; 30 | end; 31 | finally 32 | FreeAndNil(VQuery); 33 | end; 34 | end; 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /Dao/uClienteDao.pas: -------------------------------------------------------------------------------- 1 | unit uClienteDao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Comp.Client, uConexao, uClienteModel, System.SysUtils; 7 | 8 | type 9 | TClienteDao = class 10 | private 11 | FConexao: TConexao; 12 | public 13 | constructor Create; 14 | 15 | function Incluir(AClienteModel: TClienteModel): Boolean; 16 | function Alterar(AClienteModel: TClienteModel): Boolean; 17 | function Excluir(AClienteModel: TClienteModel): Boolean; 18 | function GetId(AAutoIncrementar: Integer): Integer; 19 | function Obter: TFDQuery; 20 | end; 21 | 22 | implementation 23 | 24 | { TClienteDao } 25 | 26 | uses uSistemaControl; 27 | 28 | function TClienteDao.Alterar(AClienteModel: TClienteModel): Boolean; 29 | var 30 | VQry: TFDQuery; 31 | begin 32 | VQry := FConexao.CriarQuery(); 33 | try 34 | VQry.ExecSQL('update cliente set nome = :nome where (codigo = :codigo)', [AClienteModel.Nome, AClienteModel.Codigo]); 35 | 36 | Result := True; 37 | finally 38 | VQry.Free; 39 | end; 40 | end; 41 | 42 | constructor TClienteDao.Create; 43 | begin 44 | FConexao := TSistemaControl.GetInstance().Conexao; 45 | end; 46 | 47 | function TClienteDao.Excluir(AClienteModel: TClienteModel): Boolean; 48 | var 49 | VQry: TFDQuery; 50 | begin 51 | VQry := FConexao.CriarQuery(); 52 | try 53 | VQry.ExecSQL('delete from cliente where (codigo = :codigo)', [AClienteModel.Codigo]); 54 | 55 | Result := True; 56 | finally 57 | VQry.Free; 58 | end; 59 | end; 60 | 61 | function TClienteDao.GetId(AAutoIncrementar: Integer): Integer; 62 | var 63 | VQry: TFDQuery; 64 | begin 65 | VQry := FConexao.CriarQuery(); 66 | try 67 | VQry.Open('select gen_id(gen_cliente_id, ' + IntToStr(AAutoIncrementar) + ' ) from rdb$database'); 68 | try 69 | Result := VQry.Fields[0].AsInteger; 70 | finally 71 | VQry.Close; 72 | end; 73 | finally 74 | VQry.Free; 75 | end; 76 | end; 77 | 78 | function TClienteDao.Incluir(AClienteModel: TClienteModel): Boolean; 79 | var 80 | VQry: TFDQuery; 81 | begin 82 | VQry := FConexao.CriarQuery(); 83 | try 84 | VQry.ExecSQL('insert into cliente (codigo, nome) values (:codigo, :nome)', [AClienteModel.Codigo, AClienteModel.Nome]); 85 | 86 | Result := True; 87 | finally 88 | VQry.Free; 89 | end; 90 | end; 91 | 92 | function TClienteDao.Obter: TFDQuery; 93 | var 94 | VQry: TFDQuery; 95 | begin 96 | VQry := FConexao.CriarQuery(); 97 | 98 | VQry.Open('select codigo, nome from cliente order by 1'); 99 | 100 | Result := VQry; 101 | end; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Dao/uConexao.pas: -------------------------------------------------------------------------------- 1 | unit uConexao; 2 | 3 | interface 4 | 5 | uses 6 | FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, 7 | FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, Data.DB, FireDAC.Comp.Client, FireDAC.Phys.MySQLDef, 8 | FireDAC.Phys.FB, System.SysUtils, FireDAC.DApt, FireDAC.VCLUI.Wait; 9 | 10 | type 11 | TConexao = class 12 | private 13 | FConn: TFDConnection; 14 | 15 | procedure ConfigurarConexao; 16 | public 17 | constructor Create; 18 | destructor Destroy; override; 19 | 20 | function GetConn: TFDConnection; 21 | function CriarQuery: TFDQuery; 22 | end; 23 | 24 | const 25 | PATH_BANCO: string = 'E:\MVC_DELPHI\MVC_DELPHI\DB_MVC.FDB'; 26 | 27 | implementation 28 | 29 | { TConexao } 30 | 31 | procedure TConexao.ConfigurarConexao; 32 | begin 33 | FConn.Params.DriverID := 'FB'; 34 | FConn.Params.Database := PATH_BANCO; 35 | FConn.Params.UserName := 'SYSDBA'; 36 | FConn.Params.Password := 'masterkey'; 37 | FConn.LoginPrompt := False; 38 | end; 39 | 40 | constructor TConexao.Create; 41 | begin 42 | FConn := TFDConnection.Create(nil); 43 | 44 | Self.ConfigurarConexao(); 45 | end; 46 | 47 | function TConexao.CriarQuery: TFDQuery; 48 | var 49 | VQuery: TFDQuery; 50 | begin 51 | VQuery := TFDQuery.Create(nil); 52 | VQuery.Connection := FConn; 53 | 54 | Result := VQuery; 55 | end; 56 | 57 | destructor TConexao.Destroy; 58 | begin 59 | FConn.Free; 60 | 61 | inherited; 62 | end; 63 | 64 | function TConexao.GetConn: TFDConnection; 65 | begin 66 | Result := FConn; 67 | end; 68 | 69 | end. 70 | -------------------------------------------------------------------------------- /Dao/uEmpresaDao.pas: -------------------------------------------------------------------------------- 1 | unit uEmpresaDao; 2 | 3 | interface 4 | 5 | uses 6 | uEmpresaModel, FireDAC.Comp.Client, uSistemaControl, System.SysUtils; 7 | 8 | type 9 | TEmpresaDao = class 10 | public 11 | procedure carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 12 | end; 13 | 14 | implementation 15 | 16 | { TEmpresaDao } 17 | 18 | procedure TEmpresaDao.carregar(AEmpresaModel: TEmpresaModel; ACodigo: Integer); 19 | var 20 | VQuery: TFDQuery; 21 | begin 22 | VQuery := TSistemaControl.GetInstance().Conexao.CriarQuery; 23 | try 24 | VQuery.Open('select codigo, rsocial from empresa where codigo = :codigo ', [ACodigo]); 25 | try 26 | AEmpresaModel.Codigo := VQuery.Fields[0].AsInteger; 27 | AEmpresaModel.RSocial := VQuery.Fields[1].AsString; 28 | finally 29 | VQuery.Close; 30 | end; 31 | finally 32 | VQuery.Free; 33 | end; 34 | end; 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~10~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | VClienteDao := TClienteDao.Create; 50 | try 51 | case FAcao of 52 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 53 | end; 54 | finally 55 | VClienteDao.Free; 56 | end; 57 | end; 58 | 59 | procedure TClienteModel.SetAcao(const Value: TAcao); 60 | begin 61 | FAcao := Value; 62 | end; 63 | 64 | procedure TClienteModel.SetCodigo(const Value: Integer); 65 | begin 66 | FCodigo := Value; 67 | end; 68 | 69 | procedure TClienteModel.SetNome(const Value: string); 70 | begin 71 | FNome := Value; 72 | end; 73 | 74 | end. 75 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~11~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | VClienteDao := TClienteDao.Create; 50 | try 51 | case FAcao of 52 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 53 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 54 | uEnumerado.tacExcluir: Result := VClienteDao.Deletar(Self); 55 | end; 56 | finally 57 | VClienteDao.Free; 58 | end; 59 | end; 60 | 61 | procedure TClienteModel.SetAcao(const Value: TAcao); 62 | begin 63 | FAcao := Value; 64 | end; 65 | 66 | procedure TClienteModel.SetCodigo(const Value: Integer); 67 | begin 68 | FCodigo := Value; 69 | end; 70 | 71 | procedure TClienteModel.SetNome(const Value: string); 72 | begin 73 | FNome := Value; 74 | end; 75 | 76 | end. 77 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~12~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | Result := False; 50 | 51 | VClienteDao := TClienteDao.Create; 52 | try 53 | case FAcao of 54 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 55 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 56 | uEnumerado.tacExcluir: Result := VClienteDao.Deletar(Self); 57 | end; 58 | finally 59 | VClienteDao.Free; 60 | end; 61 | end; 62 | 63 | procedure TClienteModel.SetAcao(const Value: TAcao); 64 | begin 65 | FAcao := Value; 66 | end; 67 | 68 | procedure TClienteModel.SetCodigo(const Value: Integer); 69 | begin 70 | FCodigo := Value; 71 | end; 72 | 73 | procedure TClienteModel.SetNome(const Value: string); 74 | begin 75 | FNome := Value; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~13~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | Result := False; 50 | 51 | VClienteDao := TClienteDao.Create; 52 | try 53 | case FAcao of 54 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 55 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 56 | uEnumerado.tacExcluir: Result := VClienteDao.DeExcluirelf); 57 | end; 58 | finally 59 | VClienteDao.Free; 60 | end; 61 | end; 62 | 63 | procedure TClienteModel.SetAcao(const Value: TAcao); 64 | begin 65 | FAcao := Value; 66 | end; 67 | 68 | procedure TClienteModel.SetCodigo(const Value: Integer); 69 | begin 70 | FCodigo := Value; 71 | end; 72 | 73 | procedure TClienteModel.SetNome(const Value: string); 74 | begin 75 | FNome := Value; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~14~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | Result := False; 50 | 51 | VClienteDao := TClienteDao.Create; 52 | try 53 | case FAcao of 54 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 55 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 56 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 57 | end; 58 | finally 59 | VClienteDao.Free; 60 | end; 61 | end; 62 | 63 | procedure TClienteModel.SetAcao(const Value: TAcao); 64 | begin 65 | FAcao := Value; 66 | end; 67 | 68 | procedure TClienteModel.SetCodigo(const Value: Integer); 69 | begin 70 | FCodigo := Value; 71 | end; 72 | 73 | procedure TClienteModel.SetNome(const Value: string); 74 | begin 75 | FNome := Value; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~15~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | procedure Carregar(); 20 | 21 | function Obter: TFDQuery; 22 | function Salvar: Boolean; 23 | 24 | property Codigo: Integer read FCodigo write SetCodigo; 25 | property Nome: string read FNome write SetNome; 26 | property Acao: TAcao read FAcao write SetAcao; 27 | end; 28 | 29 | implementation 30 | 31 | { TCliente } 32 | 33 | uses uClienteDao; 34 | 35 | function TClienteModel.Obter: TFDQuery; 36 | var 37 | VClienteDao: TClienteDao; 38 | begin 39 | VClienteDao := TClienteDao.Create; 40 | try 41 | Result := VClienteDao.Obter; 42 | finally 43 | VClienteDao.Free; 44 | end; 45 | end; 46 | 47 | function TClienteModel.Salvar: Boolean; 48 | var 49 | VClienteDao: TClienteDao; 50 | begin 51 | Result := False; 52 | 53 | VClienteDao := TClienteDao.Create; 54 | try 55 | case FAcao of 56 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 57 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 58 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 59 | end; 60 | finally 61 | VClienteDao.Free; 62 | end; 63 | end; 64 | 65 | procedure TClienteModel.SetAcao(const Value: TAcao); 66 | begin 67 | FAcao := Value; 68 | end; 69 | 70 | procedure TClienteModel.SetCodigo(const Value: Integer); 71 | begin 72 | FCodigo := Value; 73 | end; 74 | 75 | procedure TClienteModel.SetNome(const Value: string); 76 | begin 77 | FNome := Value; 78 | end; 79 | 80 | end. 81 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~16~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | procedure Carregar(AMemTable: TFDMemTable); 20 | 21 | function Obter: TFDQuery; 22 | function Salvar: Boolean; 23 | 24 | property Codigo: Integer read FCodigo write SetCodigo; 25 | property Nome: string read FNome write SetNome; 26 | property Acao: TAcao read FAcao write SetAcao; 27 | end; 28 | 29 | implementation 30 | 31 | { TCliente } 32 | 33 | uses uClienteDao; 34 | 35 | function TClienteModel.Obter: TFDQuery; 36 | var 37 | VClienteDao: TClienteDao; 38 | begin 39 | VClienteDao := TClienteDao.Create; 40 | try 41 | Result := VClienteDao.Obter; 42 | finally 43 | VClienteDao.Free; 44 | end; 45 | end; 46 | 47 | function TClienteModel.Salvar: Boolean; 48 | var 49 | VClienteDao: TClienteDao; 50 | begin 51 | Result := False; 52 | 53 | VClienteDao := TClienteDao.Create; 54 | try 55 | case FAcao of 56 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 57 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 58 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 59 | end; 60 | finally 61 | VClienteDao.Free; 62 | end; 63 | end; 64 | 65 | procedure TClienteModel.SetAcao(const Value: TAcao); 66 | begin 67 | FAcao := Value; 68 | end; 69 | 70 | procedure TClienteModel.SetCodigo(const Value: Integer); 71 | begin 72 | FCodigo := Value; 73 | end; 74 | 75 | procedure TClienteModel.SetNome(const Value: string); 76 | begin 77 | FNome := Value; 78 | end; 79 | 80 | end. 81 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~17~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | 22 | property Codigo: Integer read FCodigo write SetCodigo; 23 | property Nome: string read FNome write SetNome; 24 | property Acao: TAcao read FAcao write SetAcao; 25 | end; 26 | 27 | implementation 28 | 29 | { TCliente } 30 | 31 | uses uClienteDao; 32 | 33 | function TClienteModel.Obter: TFDQuery; 34 | var 35 | VClienteDao: TClienteDao; 36 | begin 37 | VClienteDao := TClienteDao.Create; 38 | try 39 | Result := VClienteDao.Obter; 40 | finally 41 | VClienteDao.Free; 42 | end; 43 | end; 44 | 45 | function TClienteModel.Salvar: Boolean; 46 | var 47 | VClienteDao: TClienteDao; 48 | begin 49 | Result := False; 50 | 51 | VClienteDao := TClienteDao.Create; 52 | try 53 | case FAcao of 54 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 55 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 56 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 57 | end; 58 | finally 59 | VClienteDao.Free; 60 | end; 61 | end; 62 | 63 | procedure TClienteModel.SetAcao(const Value: TAcao); 64 | begin 65 | FAcao := Value; 66 | end; 67 | 68 | procedure TClienteModel.SetCodigo(const Value: Integer); 69 | begin 70 | FCodigo := Value; 71 | end; 72 | 73 | procedure TClienteModel.SetNome(const Value: string); 74 | begin 75 | FNome := Value; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~18~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | function GetId(AAutoIncrementar: Integer): Integer; 22 | 23 | property Codigo: Integer read FCodigo write SetCodigo; 24 | property Nome: string read FNome write SetNome; 25 | property Acao: TAcao read FAcao write SetAcao; 26 | end; 27 | 28 | implementation 29 | 30 | { TCliente } 31 | 32 | uses uClienteDao; 33 | 34 | function TClienteModel.GetId(AAutoIncrementar: Integer): Integer; 35 | var 36 | VClienteDao: TClienteDao; 37 | begin 38 | VClienteDao := TClienteDao.Create; 39 | try 40 | Result := VClienteDao.getiObter; 41 | finally 42 | VClienteDao.Free; 43 | end; 44 | end; 45 | 46 | function TClienteModel.Obter: TFDQuery; 47 | var 48 | VClienteDao: TClienteDao; 49 | begin 50 | VClienteDao := TClienteDao.Create; 51 | try 52 | Result := VClienteDao.Obter; 53 | finally 54 | VClienteDao.Free; 55 | end; 56 | end; 57 | 58 | function TClienteModel.Salvar: Boolean; 59 | var 60 | VClienteDao: TClienteDao; 61 | begin 62 | Result := False; 63 | 64 | VClienteDao := TClienteDao.Create; 65 | try 66 | case FAcao of 67 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 68 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 69 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 70 | end; 71 | finally 72 | VClienteDao.Free; 73 | end; 74 | end; 75 | 76 | procedure TClienteModel.SetAcao(const Value: TAcao); 77 | begin 78 | FAcao := Value; 79 | end; 80 | 81 | procedure TClienteModel.SetCodigo(const Value: Integer); 82 | begin 83 | FCodigo := Value; 84 | end; 85 | 86 | procedure TClienteModel.SetNome(const Value: string); 87 | begin 88 | FNome := Value; 89 | end; 90 | 91 | end. 92 | -------------------------------------------------------------------------------- /Model/__history/uClienteModel.pas.~9~: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | 21 | property Codigo: Integer read FCodigo write SetCodigo; 22 | property Nome: string read FNome write SetNome; 23 | property Acao: TAcao read FAcao write SetAcao; 24 | end; 25 | 26 | implementation 27 | 28 | { TCliente } 29 | 30 | uses uClienteDao; 31 | 32 | function TClienteModel.Obter: TFDQuery; 33 | var 34 | VClienteDao: TClienteDao; 35 | begin 36 | VClienteDao := TClienteDao.Create; 37 | try 38 | Result := VClienteDao.Obter; 39 | finally 40 | VClienteDao.Free; 41 | end; 42 | end; 43 | 44 | procedure TClienteModel.SetAcao(const Value: TAcao); 45 | begin 46 | FAcao := Value; 47 | end; 48 | 49 | procedure TClienteModel.SetCodigo(const Value: Integer); 50 | begin 51 | FCodigo := Value; 52 | end; 53 | 54 | procedure TClienteModel.SetNome(const Value: string); 55 | begin 56 | FNome := Value; 57 | end; 58 | 59 | end. 60 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~10~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils; 7 | 8 | type 9 | TEmpresaModel = class 10 | private 11 | FCodigo: Integer; 12 | FRSocial: string; 13 | 14 | procedure SetCodigo(const Value: Integer); 15 | procedure SetRSocial(const Value: string); 16 | public 17 | procedure Carregar; 18 | 19 | property Codigo: Integer read FCodigo write SetCodigo; 20 | property RSocial: string read FRSocial write SetRSocial; 21 | end; 22 | 23 | implementation 24 | 25 | { TEmpresa } 26 | 27 | uses uEmpresaDao; 28 | 29 | procedure TEmpresaModel.Carregar; 30 | var 31 | VEmpresaDao: TEmpresaDao; 32 | begin 33 | VEmpresaDao := TEmpresaDao.Create; 34 | try 35 | 36 | finally 37 | FreeAndNil(VEmpresaDao); 38 | end; 39 | end; 40 | 41 | procedure TEmpresaModel.SetCodigo(const Value: Integer); 42 | begin 43 | FCodigo := Value; 44 | end; 45 | 46 | procedure TEmpresaModel.SetRSocial(const Value: string); 47 | begin 48 | FRSocial := Value; 49 | end; 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~11~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils; 7 | 8 | type 9 | TEmpresaModel = class 10 | private 11 | FCodigo: Integer; 12 | FRSocial: string; 13 | 14 | procedure SetCodigo(const Value: Integer); 15 | procedure SetRSocial(const Value: string); 16 | public 17 | procedure Carregar; 18 | 19 | property Codigo: Integer read FCodigo write SetCodigo; 20 | property RSocial: string read FRSocial write SetRSocial; 21 | end; 22 | 23 | implementation 24 | 25 | { TEmpresa } 26 | 27 | uses uEmpresaDao; 28 | 29 | procedure TEmpresaModel.Carregar; 30 | var 31 | VEmpresaDao: TEmpresaDao; 32 | begin 33 | VEmpresaDao := TEmpresaDao.Create; 34 | try 35 | VEmpresaDao.carregar(Self); 36 | finally 37 | FreeAndNil(VEmpresaDao); 38 | end; 39 | end; 40 | 41 | procedure TEmpresaModel.SetCodigo(const Value: Integer); 42 | begin 43 | FCodigo := Value; 44 | end; 45 | 46 | procedure TEmpresaModel.SetRSocial(const Value: string); 47 | begin 48 | FRSocial := Value; 49 | end; 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~12~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils; 7 | 8 | type 9 | TEmpresaModel = class 10 | private 11 | FCodigo: Integer; 12 | FRSocial: string; 13 | 14 | procedure SetCodigo(const Value: Integer); 15 | procedure SetRSocial(const Value: string); 16 | public 17 | procedure Carregar(ACodigo: Integer); 18 | 19 | property Codigo: Integer read FCodigo write SetCodigo; 20 | property RSocial: string read FRSocial write SetRSocial; 21 | end; 22 | 23 | implementation 24 | 25 | { TEmpresa } 26 | 27 | uses uEmpresaDao; 28 | 29 | procedure TEmpresaModel.Carregar; 30 | var 31 | VEmpresaDao: TEmpresaDao; 32 | begin 33 | VEmpresaDao := TEmpresaDao.Create; 34 | try 35 | VEmpresaDao.carregar(Self, ACodigo); 36 | finally 37 | FreeAndNil(VEmpresaDao); 38 | end; 39 | end; 40 | 41 | procedure TEmpresaModel.SetCodigo(const Value: Integer); 42 | begin 43 | FCodigo := Value; 44 | end; 45 | 46 | procedure TEmpresaModel.SetRSocial(const Value: string); 47 | begin 48 | FRSocial := Value; 49 | end; 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~3~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresa = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | 14 | public 15 | constructor Create(ACodigo: Integer); 16 | property Codigo: Integer read FCodigo write SetCodigo; 17 | property RSocial: string read FRSocial write SetRSocial; 18 | end; 19 | 20 | implementation 21 | 22 | { TEmpresa } 23 | 24 | constructor TEmpresa.Create(ACodigo: Integer); 25 | begin 26 | FCodigo := ACodigo; 27 | end; 28 | 29 | procedure TEmpresa.SetCodigo(const Value: Integer); 30 | begin 31 | FCodigo := Value; 32 | end; 33 | 34 | procedure TEmpresa.SetRSocial(const Value: string); 35 | begin 36 | FRSocial := Value; 37 | end; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~4~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresa = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | 14 | public 15 | constructor Create(ACodigo: Integer); 16 | 17 | property Codigo: Integer read FCodigo write SetCodigo; 18 | property RSocial: string read FRSocial write SetRSocial; 19 | end; 20 | 21 | implementation 22 | 23 | { TEmpresa } 24 | 25 | constructor TEmpresa.Create(ACodigo: Integer); 26 | begin 27 | FCodigo := ACodigo; 28 | end; 29 | 30 | procedure TEmpresa.SetCodigo(const Value: Integer); 31 | begin 32 | FCodigo := Value; 33 | end; 34 | 35 | procedure TEmpresa.SetRSocial(const Value: string); 36 | begin 37 | FRSocial := Value; 38 | end; 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~5~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresa = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | 14 | public 15 | property Codigo: Integer read FCodigo write SetCodigo; 16 | property RSocial: string read FRSocial write SetRSocial; 17 | end; 18 | 19 | implementation 20 | 21 | { TEmpresa } 22 | 23 | procedure TEmpresa.SetCodigo(const Value: Integer); 24 | begin 25 | FCodigo := Value; 26 | end; 27 | 28 | procedure TEmpresa.SetRSocial(const Value: string); 29 | begin 30 | FRSocial := Value; 31 | end; 32 | 33 | end. 34 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~6~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresa = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | procedure Carregar(TEmpresa); 14 | 15 | public 16 | property Codigo: Integer read FCodigo write SetCodigo; 17 | property RSocial: string read FRSocial write SetRSocial; 18 | end; 19 | 20 | implementation 21 | 22 | { TEmpresa } 23 | 24 | procedure TEmpresa.Carregar(TEmpresa); 25 | begin 26 | 27 | end; 28 | 29 | procedure TEmpresa.SetCodigo(const Value: Integer); 30 | begin 31 | FCodigo := Value; 32 | end; 33 | 34 | procedure TEmpresa.SetRSocial(const Value: string); 35 | begin 36 | FRSocial := Value; 37 | end; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~7~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresa = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | procedure Carregar; 14 | 15 | public 16 | property Codigo: Integer read FCodigo write SetCodigo; 17 | property RSocial: string read FRSocial write SetRSocial; 18 | end; 19 | 20 | implementation 21 | 22 | { TEmpresa } 23 | 24 | procedure TEmpresa.Carregar; 25 | begin 26 | 27 | end; 28 | 29 | procedure TEmpresa.SetCodigo(const Value: Integer); 30 | begin 31 | FCodigo := Value; 32 | end; 33 | 34 | procedure TEmpresa.SetRSocial(const Value: string); 35 | begin 36 | FRSocial := Value; 37 | end; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~8~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresaModel = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | procedure Carregar; 14 | 15 | public 16 | property Codigo: Integer read FCodigo write SetCodigo; 17 | property RSocial: string read FRSocial write SetRSocial; 18 | end; 19 | 20 | implementation 21 | 22 | { TEmpresa } 23 | 24 | procedure TEmpresa.Carregar; 25 | begin 26 | 27 | end; 28 | 29 | procedure TEmpresa.SetCodigo(const Value: Integer); 30 | begin 31 | FCodigo := Value; 32 | end; 33 | 34 | procedure TEmpresa.SetRSocial(const Value: string); 35 | begin 36 | FRSocial := Value; 37 | end; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Model/__history/uEmpresaModel.pas.~9~: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | type 6 | TEmpresaModel = class 7 | private 8 | FCodigo: Integer; 9 | FRSocial: string; 10 | 11 | procedure SetCodigo(const Value: Integer); 12 | procedure SetRSocial(const Value: string); 13 | procedure Carregar; 14 | 15 | public 16 | property Codigo: Integer read FCodigo write SetCodigo; 17 | property RSocial: string read FRSocial write SetRSocial; 18 | end; 19 | 20 | implementation 21 | 22 | { TEmpresa } 23 | 24 | procedure TEmpresaModel.Carregar; 25 | begin 26 | 27 | end; 28 | 29 | procedure TEmpresaModel.SetCodigo(const Value: Integer); 30 | begin 31 | FCodigo := Value; 32 | end; 33 | 34 | procedure TEmpresaModel.SetRSocial(const Value: string); 35 | begin 36 | FRSocial := Value; 37 | end; 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Model/__history/uEnumerado.pas.~1~: -------------------------------------------------------------------------------- 1 | unit uEnumerado; 2 | 3 | interface 4 | 5 | implementation 6 | 7 | end. 8 | -------------------------------------------------------------------------------- /Model/__history/uEnumerado.pas.~2~: -------------------------------------------------------------------------------- 1 | unit uEnumerado; 2 | 3 | interface 4 | 5 | type 6 | TEnumerado = (tpIndefinido, tpIncluir, tpAlterar, tpExcluir) 7 | 8 | implementation 9 | 10 | end. 11 | -------------------------------------------------------------------------------- /Model/__history/uEnumerado.pas.~3~: -------------------------------------------------------------------------------- 1 | unit uEnumerado; 2 | 3 | interface 4 | 5 | type 6 | TEnumerado = (tpIndefinido, tpIncluir, tpAlterar, tpExcluir); 7 | 8 | implementation 9 | 10 | end. 11 | -------------------------------------------------------------------------------- /Model/uClienteModel.pas: -------------------------------------------------------------------------------- 1 | unit uClienteModel; 2 | 3 | interface 4 | 5 | uses 6 | uEnumerado, FireDAC.Comp.Client; 7 | 8 | type 9 | TClienteModel = class 10 | private 11 | FAcao: TAcao; 12 | FCodigo: Integer; 13 | FNome: string; 14 | 15 | procedure SetAcao(const Value: TAcao); 16 | procedure SetCodigo(const Value: Integer); 17 | procedure SetNome(const Value: string); 18 | public 19 | function Obter: TFDQuery; 20 | function Salvar: Boolean; 21 | function GetId(AAutoIncrementar: Integer): Integer; 22 | 23 | property Codigo: Integer read FCodigo write SetCodigo; 24 | property Nome: string read FNome write SetNome; 25 | property Acao: TAcao read FAcao write SetAcao; 26 | end; 27 | 28 | implementation 29 | 30 | { TCliente } 31 | 32 | uses uClienteDao; 33 | 34 | function TClienteModel.GetId(AAutoIncrementar: Integer): Integer; 35 | var 36 | VClienteDao: TClienteDao; 37 | begin 38 | VClienteDao := TClienteDao.Create; 39 | try 40 | Result := VClienteDao.GetId(AAutoIncrementar); 41 | finally 42 | VClienteDao.Free; 43 | end; 44 | end; 45 | 46 | function TClienteModel.Obter: TFDQuery; 47 | var 48 | VClienteDao: TClienteDao; 49 | begin 50 | VClienteDao := TClienteDao.Create; 51 | try 52 | Result := VClienteDao.Obter; 53 | finally 54 | VClienteDao.Free; 55 | end; 56 | end; 57 | 58 | function TClienteModel.Salvar: Boolean; 59 | var 60 | VClienteDao: TClienteDao; 61 | begin 62 | Result := False; 63 | 64 | VClienteDao := TClienteDao.Create; 65 | try 66 | case FAcao of 67 | uEnumerado.tacIncluir: Result := VClienteDao.Incluir(Self); 68 | uEnumerado.tacAlterar: Result := VClienteDao.Alterar(Self); 69 | uEnumerado.tacExcluir: Result := VClienteDao.Excluir(Self); 70 | end; 71 | finally 72 | VClienteDao.Free; 73 | end; 74 | end; 75 | 76 | procedure TClienteModel.SetAcao(const Value: TAcao); 77 | begin 78 | FAcao := Value; 79 | end; 80 | 81 | procedure TClienteModel.SetCodigo(const Value: Integer); 82 | begin 83 | FCodigo := Value; 84 | end; 85 | 86 | procedure TClienteModel.SetNome(const Value: string); 87 | begin 88 | FNome := Value; 89 | end; 90 | 91 | end. 92 | -------------------------------------------------------------------------------- /Model/uEmpresaModel.pas: -------------------------------------------------------------------------------- 1 | unit uEmpresaModel; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils; 7 | 8 | type 9 | TEmpresaModel = class 10 | private 11 | FCodigo: Integer; 12 | FRSocial: string; 13 | 14 | procedure SetCodigo(const Value: Integer); 15 | procedure SetRSocial(const Value: string); 16 | public 17 | procedure Carregar(ACodigo: Integer); 18 | 19 | property Codigo: Integer read FCodigo write SetCodigo; 20 | property RSocial: string read FRSocial write SetRSocial; 21 | end; 22 | 23 | implementation 24 | 25 | { TEmpresa } 26 | 27 | uses uEmpresaDao; 28 | 29 | procedure TEmpresaModel.Carregar; 30 | var 31 | VEmpresaDao: TEmpresaDao; 32 | begin 33 | VEmpresaDao := TEmpresaDao.Create; 34 | try 35 | VEmpresaDao.carregar(Self, ACodigo); 36 | finally 37 | VEmpresaDao.Free; 38 | end; 39 | end; 40 | 41 | procedure TEmpresaModel.SetCodigo(const Value: Integer); 42 | begin 43 | FCodigo := Value; 44 | end; 45 | 46 | procedure TEmpresaModel.SetRSocial(const Value: string); 47 | begin 48 | FRSocial := Value; 49 | end; 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /Model/uEnumerado.pas: -------------------------------------------------------------------------------- 1 | unit uEnumerado; 2 | 3 | interface 4 | 5 | type 6 | TAcao = (tacIndefinido, tacIncluir, tacAlterar, tacExcluir); 7 | 8 | implementation 9 | 10 | end. 11 | -------------------------------------------------------------------------------- /PrjMVC.dpr: -------------------------------------------------------------------------------- 1 | program PrjMVC; 2 | 3 | uses 4 | Vcl.Forms, 5 | uFrmPrincipalView in 'View\uFrmPrincipalView.pas' {frmPrincipal}, 6 | uConexao in 'Dao\uConexao.pas', 7 | uSistemaControl in 'Controlle\uSistemaControl.pas', 8 | uEmpresaModel in 'Model\uEmpresaModel.pas', 9 | uEmpresaDao in 'Dao\uEmpresaDao.pas', 10 | uEnumerado in 'Model\uEnumerado.pas', 11 | uClienteModel in 'Model\uClienteModel.pas', 12 | uFrmCliente in 'View\uFrmCliente.pas' {frmCadastroCliente}, 13 | uClienteDao in 'Dao\uClienteDao.pas', 14 | uClienteControl in 'Controlle\uClienteControl.pas'; 15 | 16 | {$R *.res} 17 | 18 | begin 19 | Application.Initialize; 20 | Application.MainFormOnTaskbar := True; 21 | Application.CreateForm(TfrmPrincipal, frmPrincipal); 22 | Application.Run; 23 | end. 24 | -------------------------------------------------------------------------------- /PrjMVC.dproj.local: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2016/05/23 22:04:15.000.188,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 5 | 2016/05/26 20:34:58.000.767,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 6 | 2016/05/26 20:47:17.000.134,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 7 | 2016/05/26 20:52:30.000.616,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 8 | 2016/06/12 21:24:16.000.127,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 9 | 2016/06/12 21:58:50.000.719,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 10 | 2016/10/28 23:36:10.000.502,=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 11 | 2016/10/28 23:36:30.000.427,E:\MVC\View\FPrincipal.pas=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.pas 12 | 2016/10/28 23:36:30.000.427,E:\MVC\View\FPrincipal.dfm=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Unit1.dfm 13 | 2016/10/28 23:36:35.000.196,E:\MVC\Project1.dproj=C:\Users\jorge\Documents\Embarcadero\Studio\Projects\Project1.dproj 14 | 2016/10/28 23:36:50.000.188,E:\MVC\PrjMVC.dproj=E:\MVC\Project1.dproj 15 | 2016/10/28 23:37:40.000.833,E:\MVC\View\FPrincipalView.pas=E:\MVC\View\FPrincipal.pas 16 | 2016/10/28 23:37:40.000.833,E:\MVC\View\FPrincipalView.dfm=E:\MVC\View\FPrincipal.dfm 17 | 2016/10/28 23:55:58.000.296,=E:\MVC\Unit1.pas 18 | 2016/10/28 23:56:10.000.778,E:\MVC\Dao\uConexao.pas=E:\MVC\Unit1.pas 19 | 2016/10/29 01:30:40.205,=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 20 | 2016/10/29 01:31:02.475,E:\MVC_Delphi\MVC_Delphi\Controlle\uSistemaControl.pas=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 21 | 2016/10/29 01:37:24.135,=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 22 | 2016/10/29 01:37:38.600,E:\MVC_Delphi\MVC_Delphi\Model\uEmpresaModel.pas=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 23 | 2016/10/29 02:10:51.048,=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 24 | 2016/10/29 02:11:03.867,E:\MVC_Delphi\MVC_Delphi\Dao\uEmpresaDao.pas=E:\MVC_Delphi\MVC_Delphi\Unit1.pas 25 | 26 | 27 | -------------------------------------------------------------------------------- /PrjMVC.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/PrjMVC.res -------------------------------------------------------------------------------- /View/__history/FPrincipal.dfm.~1~: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'Form1' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | end 17 | -------------------------------------------------------------------------------- /View/__history/FPrincipal.pas.~1~: -------------------------------------------------------------------------------- 1 | unit FPrincipal; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs; 8 | 9 | type 10 | TForm1 = class(TForm) 11 | private 12 | { Private declarations } 13 | public 14 | { Public declarations } 15 | end; 16 | 17 | var 18 | Form1: TForm1; 19 | 20 | implementation 21 | 22 | {$R *.dfm} 23 | 24 | end. 25 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~10~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 227 22 | Width = 494 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 50 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~11~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 227 22 | Width = 494 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~12~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 227 22 | Width = 494 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~13~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 227 22 | Width = 494 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~14~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 227 22 | Width = 494 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~15~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | ExplicitTop = 227 32 | ExplicitWidth = 494 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~16~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | ExplicitTop = 227 32 | ExplicitWidth = 494 33 | end 34 | object ActionManager1: TActionManager 35 | Left = 608 36 | Top = 104 37 | StyleName = 'Platform Default' 38 | object Action1: TAction 39 | Category = '&Cadastros' 40 | Caption = '&Cliente' 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~17~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | ExplicitTop = 227 32 | ExplicitWidth = 494 33 | end 34 | object ActionMainMenuBar1: TActionMainMenuBar 35 | Left = 0 36 | Top = 0 37 | Width = 702 38 | Height = 29 39 | ActionManager = ActionManager1 40 | Caption = 'ActionMainMenuBar1' 41 | Color = clMenuBar 42 | ColorMap.DisabledFontColor = 7171437 43 | ColorMap.HighlightColor = clWhite 44 | ColorMap.BtnSelectedFont = clBlack 45 | ColorMap.UnusedColor = clWhite 46 | Font.Charset = DEFAULT_CHARSET 47 | Font.Color = clWindowText 48 | Font.Height = -12 49 | Font.Name = 'Segoe UI' 50 | Font.Style = [] 51 | Spacing = 0 52 | ExplicitLeft = 288 53 | ExplicitTop = 192 54 | ExplicitWidth = 150 55 | end 56 | object ActionManager1: TActionManager 57 | ActionBars = < 58 | item 59 | Items = < 60 | item 61 | Items = < 62 | item 63 | Action = Action1 64 | end> 65 | Caption = '&Cadastros' 66 | end> 67 | ActionBar = ActionMainMenuBar1 68 | end> 69 | Left = 608 70 | Top = 104 71 | StyleName = 'Platform Default' 72 | object Action1: TAction 73 | Category = '&Cadastros' 74 | Caption = '&Cliente' 75 | end 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~8~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | OnDestroy = FormDestroy 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Button1: TButton 19 | Left = 202 20 | Top = 72 21 | Width = 75 22 | Height = 25 23 | Caption = 'Button1' 24 | TabOrder = 0 25 | OnClick = Button1Click 26 | end 27 | object StatusBar1: TStatusBar 28 | Left = 0 29 | Top = 227 30 | Width = 494 31 | Height = 19 32 | Panels = < 33 | item 34 | Width = 50 35 | end 36 | item 37 | Width = 50 38 | end> 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.dfm.~9~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Exemplo MVC' 5 | ClientHeight = 246 6 | ClientWidth = 494 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnCreate = FormCreate 15 | OnDestroy = FormDestroy 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object StatusBar1: TStatusBar 19 | Left = 0 20 | Top = 227 21 | Width = 494 22 | Height = 19 23 | Panels = < 24 | item 25 | Width = 50 26 | end 27 | item 28 | Width = 50 29 | end> 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~19~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | Button1: TButton; 12 | StatusBar1: TStatusBar; 13 | procedure Button1Click(Sender: TObject); 14 | procedure FormCreate(Sender: TObject); 15 | procedure FormDestroy(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | frmPrincipal: TfrmPrincipal; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TfrmPrincipal.Button1Click(Sender: TObject); 30 | var 31 | VConexao: TConexao; 32 | begin 33 | VConexao := TConexao.Create; 34 | VConexao.GetConn.Connected := True; 35 | try 36 | if VConexao.GetConn().Connected then 37 | ShowMessage('Conectado.'); 38 | finally 39 | FreeAndNil(VConexao); 40 | end; 41 | end; 42 | 43 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 44 | begin 45 | TSistemaControl.GetInstance().SetEmpresa(1); 46 | TSistemaControl.GetInstance().CarregarEmpresa(); 47 | 48 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().Empresa.Codigo.ToString() + ' ' + 49 | TSistemaControl.GetInstance().Empresa.RSocial; 50 | end; 51 | 52 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 53 | begin 54 | //TSistemaControl.GetInstance().Destroy(); 55 | end; 56 | 57 | initialization 58 | ReportMemoryLeaksOnShutdown := True; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~20~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | Button1: TButton; 12 | StatusBar1: TStatusBar; 13 | procedure Button1Click(Sender: TObject); 14 | procedure FormCreate(Sender: TObject); 15 | procedure FormDestroy(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | frmPrincipal: TfrmPrincipal; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TfrmPrincipal.Button1Click(Sender: TObject); 30 | var 31 | VConexao: TConexao; 32 | begin 33 | VConexao := TConexao.Create; 34 | VConexao.GetConn.Connected := True; 35 | try 36 | if VConexao.GetConn().Connected then 37 | ShowMessage('Conectado.'); 38 | finally 39 | FreeAndNil(VConexao); 40 | end; 41 | end; 42 | 43 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 44 | begin 45 | TSistemaControl.GetInstance().SetEmpresa(1); 46 | TSistemaControl.GetInstance().CarregarEmpresa(); 47 | 48 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().Empresa.Codigo.ToString() + ' ' + 49 | TSistemaControl.GetInstance().Empresa.RSocial; 50 | end; 51 | 52 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 53 | begin 54 | TSistemaControl.GetInstance().Destroy(); 55 | end; 56 | 57 | initialization 58 | ReportMemoryLeaksOnShutdown := True; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~21~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | Button1: TButton; 12 | StatusBar1: TStatusBar; 13 | procedure Button1Click(Sender: TObject); 14 | procedure FormCreate(Sender: TObject); 15 | procedure FormDestroy(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | frmPrincipal: TfrmPrincipal; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TfrmPrincipal.Button1Click(Sender: TObject); 30 | var 31 | VConexao: TConexao; 32 | begin 33 | VConexao := TConexao.Create; 34 | VConexao.GetConn.Connected := True; 35 | try 36 | if VConexao.GetConn().Connected then 37 | ShowMessage('Conectado.'); 38 | finally 39 | FreeAndNil(VConexao); 40 | end; 41 | end; 42 | 43 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 44 | begin 45 | TSistemaControl.GetInstance().SetEmpresa(1); 46 | TSistemaControl.GetInstance().CarregarEmpresa(); 47 | 48 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().Empresa.Codigo.ToString() + ' - ' + 49 | TSistemaControl.GetInstance().Empresa.RSocial; 50 | end; 51 | 52 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 53 | begin 54 | TSistemaControl.GetInstance().Destroy(); 55 | end; 56 | 57 | initialization 58 | ReportMemoryLeaksOnShutdown := True; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~22~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | Button1: TButton; 12 | StatusBar1: TStatusBar; 13 | procedure Button1Click(Sender: TObject); 14 | procedure FormCreate(Sender: TObject); 15 | procedure FormDestroy(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | frmPrincipal: TfrmPrincipal; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TfrmPrincipal.Button1Click(Sender: TObject); 30 | var 31 | VConexao: TConexao; 32 | begin 33 | VConexao := TConexao.Create; 34 | VConexao.GetConn.Connected := True; 35 | try 36 | if VConexao.GetConn().Connected then 37 | ShowMessage('Conectado.'); 38 | finally 39 | FreeAndNil(VConexao); 40 | end; 41 | end; 42 | 43 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 44 | begin 45 | TSistemaControl.GetInstance(); 46 | TSistemaControl.GetInstance().CarregarEmpresa(1); 47 | 48 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().Empresa.Codigo.ToString() + ' - ' + 49 | TSistemaControl.GetInstance().Empresa.RSocial; 50 | end; 51 | 52 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 53 | begin 54 | TSistemaControl.GetInstance().Destroy(); 55 | end; 56 | 57 | initialization 58 | ReportMemoryLeaksOnShutdown := True; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~23~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | Button1: TButton; 12 | StatusBar1: TStatusBar; 13 | procedure Button1Click(Sender: TObject); 14 | procedure FormCreate(Sender: TObject); 15 | procedure FormDestroy(Sender: TObject); 16 | private 17 | { Private declarations } 18 | public 19 | { Public declarations } 20 | end; 21 | 22 | var 23 | frmPrincipal: TfrmPrincipal; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | procedure TfrmPrincipal.Button1Click(Sender: TObject); 30 | var 31 | VConexao: TConexao; 32 | begin 33 | VConexao := TConexao.Create; 34 | VConexao.GetConn.Connected := True; 35 | try 36 | if VConexao.GetConn().Connected then 37 | ShowMessage('Conectado.'); 38 | finally 39 | FreeAndNil(VConexao); 40 | end; 41 | end; 42 | 43 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 44 | begin 45 | TSistemaControl.GetInstance(); 46 | TSistemaControl.GetInstance().CarregarEmpresa(1); 47 | 48 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().EmpresaModel.Codigo.ToString() + ' - ' + 49 | TSistemaControl.GetInstance().EmpresaModel.RSocial; 50 | end; 51 | 52 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 53 | begin 54 | TSistemaControl.GetInstance().Destroy(); 55 | end; 56 | 57 | initialization 58 | ReportMemoryLeaksOnShutdown := True; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~24~: -------------------------------------------------------------------------------- 1 | unit FPrincipalView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uConexao, Vcl.StdCtrls, uSistemaControl, Vcl.ComCtrls; 8 | 9 | type 10 | TfrmPrincipal = class(TForm) 11 | StatusBar1: TStatusBar; 12 | procedure FormCreate(Sender: TObject); 13 | procedure FormDestroy(Sender: TObject); 14 | private 15 | { Private declarations } 16 | public 17 | { Public declarations } 18 | end; 19 | 20 | var 21 | frmPrincipal: TfrmPrincipal; 22 | 23 | implementation 24 | 25 | {$R *.dfm} 26 | 27 | procedure TfrmPrincipal.FormCreate(Sender: TObject); 28 | begin 29 | TSistemaControl.GetInstance(); 30 | TSistemaControl.GetInstance().CarregarEmpresa(1); 31 | 32 | StatusBar1.Panels[1].Text := 'Empresa: ' + TSistemaControl.GetInstance().EmpresaModel.Codigo.ToString() + ' - ' + 33 | TSistemaControl.GetInstance().EmpresaModel.RSocial; 34 | end; 35 | 36 | procedure TfrmPrincipal.FormDestroy(Sender: TObject); 37 | begin 38 | TSistemaControl.GetInstance().Destroy(); 39 | end; 40 | 41 | initialization 42 | ReportMemoryLeaksOnShutdown := True; 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~25~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/FPrincipalView.pas.~25~ -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~26~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/FPrincipalView.pas.~26~ -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~27~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/FPrincipalView.pas.~27~ -------------------------------------------------------------------------------- /View/__history/FPrincipalView.pas.~28~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/FPrincipalView.pas.~28~ -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~29~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnShow = FormShow 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Label2: TLabel 19 | Left = 33 20 | Top = 38 21 | Width = 27 22 | Height = 13 23 | Caption = 'Nome' 24 | end 25 | object Label1: TLabel 26 | Left = 33 27 | Top = 8 28 | Width = 33 29 | Height = 13 30 | Caption = 'C'#243'digo' 31 | end 32 | object edtNome: TEdit 33 | Left = 72 34 | Top = 35 35 | Width = 121 36 | Height = 21 37 | TabOrder = 0 38 | end 39 | object DBGrid1: TDBGrid 40 | Left = 8 41 | Top = 130 42 | Width = 545 43 | Height = 193 44 | DataSource = dsClientes 45 | DrawingStyle = gdsGradient 46 | TabOrder = 1 47 | TitleFont.Charset = DEFAULT_CHARSET 48 | TitleFont.Color = clWindowText 49 | TitleFont.Height = -11 50 | TitleFont.Name = 'Tahoma' 51 | TitleFont.Style = [] 52 | Columns = < 53 | item 54 | Expanded = False 55 | FieldName = 'CODIGO' 56 | Visible = True 57 | end 58 | item 59 | Expanded = False 60 | FieldName = 'NOME' 61 | Visible = True 62 | end> 63 | end 64 | object Button1: TButton 65 | Left = 72 66 | Top = 85 67 | Width = 75 68 | Height = 25 69 | Caption = 'Incluir' 70 | TabOrder = 2 71 | end 72 | object edtCodigo: TEdit 73 | Left = 72 74 | Top = 8 75 | Width = 121 76 | Height = 21 77 | TabOrder = 3 78 | end 79 | object mmTableClientes: TFDMemTable 80 | FetchOptions.AssignedValues = [evMode] 81 | FetchOptions.Mode = fmAll 82 | ResourceOptions.AssignedValues = [rvSilentMode] 83 | ResourceOptions.SilentMode = True 84 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 85 | UpdateOptions.CheckRequired = False 86 | UpdateOptions.AutoCommitUpdates = True 87 | Left = 464 88 | Top = 16 89 | object mmTableClientesCODIGO: TIntegerField 90 | DisplayLabel = 'C'#243'digo' 91 | FieldName = 'CODIGO' 92 | end 93 | object mmTableClientesNOME: TStringField 94 | DisplayLabel = 'Nome' 95 | DisplayWidth = 40 96 | FieldName = 'NOME' 97 | end 98 | end 99 | object dsClientes: TDataSource 100 | DataSet = mmTableClientes 101 | Left = 528 102 | Top = 16 103 | end 104 | end 105 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~30~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnShow = FormShow 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Label2: TLabel 19 | Left = 33 20 | Top = 38 21 | Width = 27 22 | Height = 13 23 | Caption = 'Nome' 24 | end 25 | object Label1: TLabel 26 | Left = 33 27 | Top = 8 28 | Width = 33 29 | Height = 13 30 | Caption = 'C'#243'digo' 31 | end 32 | object edtNome: TEdit 33 | Left = 72 34 | Top = 35 35 | Width = 121 36 | Height = 21 37 | TabOrder = 0 38 | end 39 | object DBGrid1: TDBGrid 40 | Left = 8 41 | Top = 130 42 | Width = 545 43 | Height = 193 44 | DataSource = dsClientes 45 | DrawingStyle = gdsGradient 46 | TabOrder = 1 47 | TitleFont.Charset = DEFAULT_CHARSET 48 | TitleFont.Color = clWindowText 49 | TitleFont.Height = -11 50 | TitleFont.Name = 'Tahoma' 51 | TitleFont.Style = [] 52 | Columns = < 53 | item 54 | Expanded = False 55 | FieldName = 'CODIGO' 56 | Visible = True 57 | end 58 | item 59 | Expanded = False 60 | FieldName = 'NOME' 61 | Visible = True 62 | end> 63 | end 64 | object Button1: TButton 65 | Left = 72 66 | Top = 85 67 | Width = 75 68 | Height = 25 69 | Caption = 'Incluir' 70 | TabOrder = 2 71 | OnClick = Button1Click 72 | end 73 | object edtCodigo: TEdit 74 | Left = 72 75 | Top = 8 76 | Width = 121 77 | Height = 21 78 | TabOrder = 3 79 | end 80 | object mmTableClientes: TFDMemTable 81 | FetchOptions.AssignedValues = [evMode] 82 | FetchOptions.Mode = fmAll 83 | ResourceOptions.AssignedValues = [rvSilentMode] 84 | ResourceOptions.SilentMode = True 85 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 86 | UpdateOptions.CheckRequired = False 87 | UpdateOptions.AutoCommitUpdates = True 88 | Left = 464 89 | Top = 16 90 | object mmTableClientesCODIGO: TIntegerField 91 | DisplayLabel = 'C'#243'digo' 92 | FieldName = 'CODIGO' 93 | end 94 | object mmTableClientesNOME: TStringField 95 | DisplayLabel = 'Nome' 96 | DisplayWidth = 40 97 | FieldName = 'NOME' 98 | end 99 | end 100 | object dsClientes: TDataSource 101 | DataSet = mmTableClientes 102 | Left = 528 103 | Top = 16 104 | end 105 | end 106 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~31~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnShow = FormShow 16 | PixelsPerInch = 96 17 | TextHeight = 13 18 | object Label2: TLabel 19 | Left = 33 20 | Top = 38 21 | Width = 27 22 | Height = 13 23 | Caption = 'Nome' 24 | end 25 | object Label1: TLabel 26 | Left = 33 27 | Top = 8 28 | Width = 33 29 | Height = 13 30 | Caption = 'C'#243'digo' 31 | end 32 | object edtNome: TEdit 33 | Left = 72 34 | Top = 35 35 | Width = 121 36 | Height = 21 37 | TabOrder = 0 38 | end 39 | object DBGrid1: TDBGrid 40 | Left = 8 41 | Top = 130 42 | Width = 545 43 | Height = 193 44 | DataSource = dsClientes 45 | DrawingStyle = gdsGradient 46 | TabOrder = 1 47 | TitleFont.Charset = DEFAULT_CHARSET 48 | TitleFont.Color = clWindowText 49 | TitleFont.Height = -11 50 | TitleFont.Name = 'Tahoma' 51 | TitleFont.Style = [] 52 | Columns = < 53 | item 54 | Expanded = False 55 | FieldName = 'CODIGO' 56 | Visible = True 57 | end 58 | item 59 | Expanded = False 60 | FieldName = 'NOME' 61 | Visible = True 62 | end> 63 | end 64 | object Button1: TButton 65 | Left = 72 66 | Top = 85 67 | Width = 75 68 | Height = 25 69 | Caption = 'Incluir' 70 | TabOrder = 2 71 | OnClick = Button1Click 72 | end 73 | object edtCodigo: TEdit 74 | Left = 72 75 | Top = 8 76 | Width = 121 77 | Height = 21 78 | TabOrder = 3 79 | end 80 | object Button2: TButton 81 | Left = 168 82 | Top = 85 83 | Width = 75 84 | Height = 25 85 | Caption = 'Alterar' 86 | TabOrder = 4 87 | OnClick = Button2Click 88 | end 89 | object Button3: TButton 90 | Left = 264 91 | Top = 85 92 | Width = 75 93 | Height = 25 94 | Caption = 'Excluir' 95 | TabOrder = 5 96 | OnClick = Button3Click 97 | end 98 | object mmTableClientes: TFDMemTable 99 | FetchOptions.AssignedValues = [evMode] 100 | FetchOptions.Mode = fmAll 101 | ResourceOptions.AssignedValues = [rvSilentMode] 102 | ResourceOptions.SilentMode = True 103 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 104 | UpdateOptions.CheckRequired = False 105 | UpdateOptions.AutoCommitUpdates = True 106 | Left = 464 107 | Top = 16 108 | object mmTableClientesCODIGO: TIntegerField 109 | DisplayLabel = 'C'#243'digo' 110 | FieldName = 'CODIGO' 111 | end 112 | object mmTableClientesNOME: TStringField 113 | DisplayLabel = 'Nome' 114 | DisplayWidth = 40 115 | FieldName = 'NOME' 116 | end 117 | end 118 | object dsClientes: TDataSource 119 | DataSet = mmTableClientes 120 | Left = 528 121 | Top = 16 122 | end 123 | end 124 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~32~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnShow = FormShow 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object Label2: TLabel 20 | Left = 33 21 | Top = 38 22 | Width = 27 23 | Height = 13 24 | Caption = 'Nome' 25 | end 26 | object Label1: TLabel 27 | Left = 33 28 | Top = 8 29 | Width = 33 30 | Height = 13 31 | Caption = 'C'#243'digo' 32 | end 33 | object edtNome: TEdit 34 | Left = 72 35 | Top = 35 36 | Width = 121 37 | Height = 21 38 | TabOrder = 0 39 | end 40 | object DBGrid1: TDBGrid 41 | Left = 8 42 | Top = 130 43 | Width = 545 44 | Height = 193 45 | DataSource = dsClientes 46 | DrawingStyle = gdsGradient 47 | TabOrder = 1 48 | TitleFont.Charset = DEFAULT_CHARSET 49 | TitleFont.Color = clWindowText 50 | TitleFont.Height = -11 51 | TitleFont.Name = 'Tahoma' 52 | TitleFont.Style = [] 53 | Columns = < 54 | item 55 | Expanded = False 56 | FieldName = 'CODIGO' 57 | Visible = True 58 | end 59 | item 60 | Expanded = False 61 | FieldName = 'NOME' 62 | Visible = True 63 | end> 64 | end 65 | object Button1: TButton 66 | Left = 72 67 | Top = 85 68 | Width = 75 69 | Height = 25 70 | Caption = 'Incluir' 71 | TabOrder = 2 72 | OnClick = Button1Click 73 | end 74 | object edtCodigo: TEdit 75 | Left = 72 76 | Top = 8 77 | Width = 121 78 | Height = 21 79 | TabOrder = 3 80 | end 81 | object Button2: TButton 82 | Left = 168 83 | Top = 85 84 | Width = 75 85 | Height = 25 86 | Caption = 'Alterar' 87 | TabOrder = 4 88 | OnClick = Button2Click 89 | end 90 | object Button3: TButton 91 | Left = 264 92 | Top = 85 93 | Width = 75 94 | Height = 25 95 | Caption = 'Excluir' 96 | TabOrder = 5 97 | OnClick = Button3Click 98 | end 99 | object mmTableClientes: TFDMemTable 100 | FetchOptions.AssignedValues = [evMode] 101 | FetchOptions.Mode = fmAll 102 | ResourceOptions.AssignedValues = [rvSilentMode] 103 | ResourceOptions.SilentMode = True 104 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 105 | UpdateOptions.CheckRequired = False 106 | UpdateOptions.AutoCommitUpdates = True 107 | Left = 464 108 | Top = 16 109 | object mmTableClientesCODIGO: TIntegerField 110 | DisplayLabel = 'C'#243'digo' 111 | FieldName = 'CODIGO' 112 | end 113 | object mmTableClientesNOME: TStringField 114 | DisplayLabel = 'Nome' 115 | DisplayWidth = 40 116 | FieldName = 'NOME' 117 | end 118 | end 119 | object dsClientes: TDataSource 120 | DataSet = mmTableClientes 121 | Left = 528 122 | Top = 16 123 | end 124 | end 125 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~33~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 0 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 1 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | Columns = < 55 | item 56 | Expanded = False 57 | FieldName = 'CODIGO' 58 | Visible = True 59 | end 60 | item 61 | Expanded = False 62 | FieldName = 'NOME' 63 | Visible = True 64 | end> 65 | end 66 | object Button1: TButton 67 | Left = 72 68 | Top = 85 69 | Width = 75 70 | Height = 25 71 | Caption = 'Incluir' 72 | TabOrder = 2 73 | OnClick = Button1Click 74 | end 75 | object edtCodigo: TEdit 76 | Left = 72 77 | Top = 8 78 | Width = 121 79 | Height = 21 80 | TabOrder = 3 81 | end 82 | object Button2: TButton 83 | Left = 168 84 | Top = 85 85 | Width = 75 86 | Height = 25 87 | Caption = 'Alterar' 88 | TabOrder = 4 89 | OnClick = Button2Click 90 | end 91 | object Button3: TButton 92 | Left = 264 93 | Top = 85 94 | Width = 75 95 | Height = 25 96 | Caption = 'Excluir' 97 | TabOrder = 5 98 | OnClick = Button3Click 99 | end 100 | object mmTableClientes: TFDMemTable 101 | FetchOptions.AssignedValues = [evMode] 102 | FetchOptions.Mode = fmAll 103 | ResourceOptions.AssignedValues = [rvSilentMode] 104 | ResourceOptions.SilentMode = True 105 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 106 | UpdateOptions.CheckRequired = False 107 | UpdateOptions.AutoCommitUpdates = True 108 | Left = 464 109 | Top = 16 110 | object mmTableClientesCODIGO: TIntegerField 111 | DisplayLabel = 'C'#243'digo' 112 | FieldName = 'CODIGO' 113 | end 114 | object mmTableClientesNOME: TStringField 115 | DisplayLabel = 'Nome' 116 | DisplayWidth = 40 117 | FieldName = 'NOME' 118 | end 119 | end 120 | object dsClientes: TDataSource 121 | DataSet = mmTableClientes 122 | Left = 528 123 | Top = 16 124 | end 125 | end 126 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~34~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 0 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 1 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnDblClick = DBGrid1DblClick 55 | Columns = < 56 | item 57 | Expanded = False 58 | FieldName = 'CODIGO' 59 | Visible = True 60 | end 61 | item 62 | Expanded = False 63 | FieldName = 'NOME' 64 | Visible = True 65 | end> 66 | end 67 | object Button1: TButton 68 | Left = 72 69 | Top = 85 70 | Width = 75 71 | Height = 25 72 | Caption = 'Incluir' 73 | TabOrder = 2 74 | OnClick = Button1Click 75 | end 76 | object edtCodigo: TEdit 77 | Left = 72 78 | Top = 8 79 | Width = 121 80 | Height = 21 81 | TabOrder = 3 82 | end 83 | object Button2: TButton 84 | Left = 168 85 | Top = 85 86 | Width = 75 87 | Height = 25 88 | Caption = 'Alterar' 89 | TabOrder = 4 90 | OnClick = Button2Click 91 | end 92 | object Button3: TButton 93 | Left = 264 94 | Top = 85 95 | Width = 75 96 | Height = 25 97 | Caption = 'Excluir' 98 | TabOrder = 5 99 | OnClick = Button3Click 100 | end 101 | object mmTableClientes: TFDMemTable 102 | FetchOptions.AssignedValues = [evMode] 103 | FetchOptions.Mode = fmAll 104 | ResourceOptions.AssignedValues = [rvSilentMode] 105 | ResourceOptions.SilentMode = True 106 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 107 | UpdateOptions.CheckRequired = False 108 | UpdateOptions.AutoCommitUpdates = True 109 | Left = 464 110 | Top = 16 111 | object mmTableClientesCODIGO: TIntegerField 112 | DisplayLabel = 'C'#243'digo' 113 | FieldName = 'CODIGO' 114 | end 115 | object mmTableClientesNOME: TStringField 116 | DisplayLabel = 'Nome' 117 | DisplayWidth = 40 118 | FieldName = 'NOME' 119 | end 120 | end 121 | object dsClientes: TDataSource 122 | DataSet = mmTableClientes 123 | Left = 528 124 | Top = 16 125 | end 126 | end 127 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~35~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 0 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnDblClick = DBGrid1DblClick 55 | Columns = < 56 | item 57 | Expanded = False 58 | FieldName = 'CODIGO' 59 | Visible = True 60 | end 61 | item 62 | Expanded = False 63 | FieldName = 'NOME' 64 | Visible = True 65 | end> 66 | end 67 | object Button1: TButton 68 | Left = 72 69 | Top = 85 70 | Width = 75 71 | Height = 25 72 | Caption = 'Incluir' 73 | TabOrder = 3 74 | OnClick = Button1Click 75 | end 76 | object edtCodigo: TEdit 77 | Left = 72 78 | Top = 8 79 | Width = 121 80 | Height = 21 81 | TabOrder = 1 82 | end 83 | object Button2: TButton 84 | Left = 168 85 | Top = 85 86 | Width = 75 87 | Height = 25 88 | Caption = 'Alterar' 89 | TabOrder = 4 90 | OnClick = Button2Click 91 | end 92 | object Button3: TButton 93 | Left = 264 94 | Top = 85 95 | Width = 75 96 | Height = 25 97 | Caption = 'Excluir' 98 | TabOrder = 5 99 | OnClick = Button3Click 100 | end 101 | object mmTableClientes: TFDMemTable 102 | FetchOptions.AssignedValues = [evMode] 103 | FetchOptions.Mode = fmAll 104 | ResourceOptions.AssignedValues = [rvSilentMode] 105 | ResourceOptions.SilentMode = True 106 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 107 | UpdateOptions.CheckRequired = False 108 | UpdateOptions.AutoCommitUpdates = True 109 | Left = 464 110 | Top = 16 111 | object mmTableClientesCODIGO: TIntegerField 112 | DisplayLabel = 'C'#243'digo' 113 | FieldName = 'CODIGO' 114 | end 115 | object mmTableClientesNOME: TStringField 116 | DisplayLabel = 'Nome' 117 | DisplayWidth = 40 118 | FieldName = 'NOME' 119 | end 120 | end 121 | object dsClientes: TDataSource 122 | DataSet = mmTableClientes 123 | Left = 528 124 | Top = 16 125 | end 126 | end 127 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~36~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 0 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnKeyUp = DBGrid1KeyUp 55 | Columns = < 56 | item 57 | Expanded = False 58 | FieldName = 'CODIGO' 59 | Visible = True 60 | end 61 | item 62 | Expanded = False 63 | FieldName = 'NOME' 64 | Visible = True 65 | end> 66 | end 67 | object Button1: TButton 68 | Left = 72 69 | Top = 85 70 | Width = 75 71 | Height = 25 72 | Caption = 'Incluir' 73 | TabOrder = 3 74 | OnClick = Button1Click 75 | end 76 | object edtCodigo: TEdit 77 | Left = 72 78 | Top = 8 79 | Width = 121 80 | Height = 21 81 | TabOrder = 1 82 | end 83 | object Button2: TButton 84 | Left = 168 85 | Top = 85 86 | Width = 75 87 | Height = 25 88 | Caption = 'Alterar' 89 | TabOrder = 4 90 | OnClick = Button2Click 91 | end 92 | object Button3: TButton 93 | Left = 264 94 | Top = 85 95 | Width = 75 96 | Height = 25 97 | Caption = 'Excluir' 98 | TabOrder = 5 99 | OnClick = Button3Click 100 | end 101 | object mmTableClientes: TFDMemTable 102 | FetchOptions.AssignedValues = [evMode] 103 | FetchOptions.Mode = fmAll 104 | ResourceOptions.AssignedValues = [rvSilentMode] 105 | ResourceOptions.SilentMode = True 106 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 107 | UpdateOptions.CheckRequired = False 108 | UpdateOptions.AutoCommitUpdates = True 109 | Left = 464 110 | Top = 16 111 | object mmTableClientesCODIGO: TIntegerField 112 | DisplayLabel = 'C'#243'digo' 113 | FieldName = 'CODIGO' 114 | end 115 | object mmTableClientesNOME: TStringField 116 | DisplayLabel = 'Nome' 117 | DisplayWidth = 40 118 | FieldName = 'NOME' 119 | end 120 | end 121 | object dsClientes: TDataSource 122 | DataSet = mmTableClientes 123 | Left = 528 124 | Top = 16 125 | end 126 | end 127 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~37~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 0 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnKeyUp = DBGrid1KeyUp 55 | OnMouseUp = DBGrid1MouseUp 56 | Columns = < 57 | item 58 | Expanded = False 59 | FieldName = 'CODIGO' 60 | Visible = True 61 | end 62 | item 63 | Expanded = False 64 | FieldName = 'NOME' 65 | Visible = True 66 | end> 67 | end 68 | object Button1: TButton 69 | Left = 72 70 | Top = 85 71 | Width = 75 72 | Height = 25 73 | Caption = 'Incluir' 74 | TabOrder = 3 75 | OnClick = Button1Click 76 | end 77 | object edtCodigo: TEdit 78 | Left = 72 79 | Top = 8 80 | Width = 121 81 | Height = 21 82 | TabOrder = 1 83 | end 84 | object Button2: TButton 85 | Left = 168 86 | Top = 85 87 | Width = 75 88 | Height = 25 89 | Caption = 'Alterar' 90 | TabOrder = 4 91 | OnClick = Button2Click 92 | end 93 | object Button3: TButton 94 | Left = 264 95 | Top = 85 96 | Width = 75 97 | Height = 25 98 | Caption = 'Excluir' 99 | TabOrder = 5 100 | OnClick = Button3Click 101 | end 102 | object mmTableClientes: TFDMemTable 103 | FetchOptions.AssignedValues = [evMode] 104 | FetchOptions.Mode = fmAll 105 | ResourceOptions.AssignedValues = [rvSilentMode] 106 | ResourceOptions.SilentMode = True 107 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 108 | UpdateOptions.CheckRequired = False 109 | UpdateOptions.AutoCommitUpdates = True 110 | Left = 464 111 | Top = 16 112 | object mmTableClientesCODIGO: TIntegerField 113 | DisplayLabel = 'C'#243'digo' 114 | FieldName = 'CODIGO' 115 | end 116 | object mmTableClientesNOME: TStringField 117 | DisplayLabel = 'Nome' 118 | DisplayWidth = 40 119 | FieldName = 'NOME' 120 | end 121 | end 122 | object dsClientes: TDataSource 123 | DataSet = mmTableClientes 124 | Left = 528 125 | Top = 16 126 | end 127 | end 128 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.dfm.~38~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 0 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnKeyUp = DBGrid1KeyUp 55 | OnMouseUp = DBGrid1MouseUp 56 | Columns = < 57 | item 58 | Expanded = False 59 | FieldName = 'CODIGO' 60 | Visible = True 61 | end 62 | item 63 | Expanded = False 64 | FieldName = 'NOME' 65 | Visible = True 66 | end> 67 | end 68 | object Button1: TButton 69 | Left = 72 70 | Top = 85 71 | Width = 75 72 | Height = 25 73 | Caption = 'Incluir' 74 | TabOrder = 3 75 | OnClick = Button1Click 76 | end 77 | object edtCodigo: TEdit 78 | Left = 72 79 | Top = 8 80 | Width = 121 81 | Height = 21 82 | TabOrder = 1 83 | end 84 | object Button2: TButton 85 | Left = 168 86 | Top = 85 87 | Width = 75 88 | Height = 25 89 | Caption = 'Alterar' 90 | TabOrder = 4 91 | OnClick = Button2Click 92 | end 93 | object Button3: TButton 94 | Left = 264 95 | Top = 85 96 | Width = 75 97 | Height = 25 98 | Caption = 'Excluir' 99 | TabOrder = 5 100 | OnClick = Button3Click 101 | end 102 | object mmTableClientes: TFDMemTable 103 | FetchOptions.AssignedValues = [evMode] 104 | FetchOptions.Mode = fmAll 105 | ResourceOptions.AssignedValues = [rvSilentMode] 106 | ResourceOptions.SilentMode = True 107 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 108 | UpdateOptions.CheckRequired = False 109 | UpdateOptions.AutoCommitUpdates = True 110 | Left = 464 111 | Top = 16 112 | object mmTableClientesCODIGO: TIntegerField 113 | DisplayLabel = 'C'#243'digo' 114 | FieldName = 'CODIGO' 115 | end 116 | object mmTableClientesNOME: TStringField 117 | DisplayLabel = 'Nome' 118 | DisplayWidth = 40 119 | FieldName = 'NOME' 120 | end 121 | end 122 | object dsClientes: TDataSource 123 | DataSet = mmTableClientes 124 | Left = 528 125 | Top = 16 126 | end 127 | end 128 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~58~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | private 32 | FControleCliente: TClienteControl; 33 | 34 | procedure CarregarClientes; 35 | end; 36 | 37 | var 38 | frmCadastroCliente: TfrmCadastroCliente; 39 | 40 | implementation 41 | 42 | {$R *.dfm} 43 | 44 | { TfrmCadastroCliente } 45 | 46 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 47 | begin 48 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 49 | FControleCliente.ClienteModel.Nome := edtNome.Text; 50 | 51 | if FControleCliente.Salvar() then 52 | ShowMessage('Incluido com sucesso.'); 53 | 54 | Self.CarregarClientes(); 55 | end; 56 | 57 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 58 | begin 59 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 60 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 61 | FControleCliente.ClienteModel.Nome := edtNome.Text; 62 | 63 | if FControleCliente.Salvar() then 64 | ShowMessage('Alterado com sucesso.'); 65 | 66 | Self.CarregarClientes(); 67 | end; 68 | 69 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 70 | begin 71 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 72 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 73 | 74 | if FControleCliente.Salvar() then 75 | ShowMessage('Excluido com sucesso.'); 76 | 77 | Self.CarregarClientes(); 78 | end; 79 | 80 | procedure TfrmCadastroCliente.CarregarClientes; 81 | var 82 | VControleCliente: TClienteControl; 83 | VQry : TFDQuery; 84 | begin 85 | mmTableClientes.Close; 86 | 87 | VControleCliente := TClienteControl.Create; 88 | try 89 | VQry := VControleCliente.Obter; 90 | try 91 | VQry.FetchAll; 92 | mmTableClientes.Data := VQry.Data; 93 | finally 94 | VQry.Close; 95 | VQry.Free; 96 | end; 97 | finally 98 | VControleCliente.Free; 99 | end; 100 | end; 101 | 102 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 103 | begin 104 | FControleCliente := TClienteControl.Create; 105 | end; 106 | 107 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 108 | begin 109 | FControleCliente.Free; 110 | end; 111 | 112 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 113 | begin 114 | Self.CarregarClientes(); 115 | end; 116 | 117 | end. 118 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~59~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | private 32 | FControleCliente: TClienteControl; 33 | 34 | procedure CarregarClientes; 35 | end; 36 | 37 | var 38 | frmCadastroCliente: TfrmCadastroCliente; 39 | 40 | implementation 41 | 42 | {$R *.dfm} 43 | 44 | { TfrmCadastroCliente } 45 | 46 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 47 | begin 48 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 49 | FControleCliente.ClienteModel.Nome := edtNome.Text; 50 | 51 | if FControleCliente.Salvar() then 52 | ShowMessage('Incluido com sucesso.'); 53 | 54 | Self.CarregarClientes(); 55 | end; 56 | 57 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 58 | begin 59 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 60 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 61 | FControleCliente.ClienteModel.Nome := edtNome.Text; 62 | 63 | if FControleCliente.Salvar() then 64 | ShowMessage('Alterado com sucesso.'); 65 | 66 | Self.CarregarClientes(); 67 | end; 68 | 69 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 70 | begin 71 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 72 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 73 | 74 | if FControleCliente.Salvar() then 75 | ShowMessage('Excluido com sucesso.'); 76 | 77 | Self.CarregarClientes(); 78 | end; 79 | 80 | procedure TfrmCadastroCliente.CarregarClientes; 81 | var 82 | VQry: TFDQuery; 83 | begin 84 | mmTableClientes.Close; 85 | 86 | VQry := FControleCliente.Obter; 87 | try 88 | VQry.FetchAll; 89 | mmTableClientes.Data := VQry.Data; 90 | finally 91 | VQry.Close; 92 | VQry.Free; 93 | end; 94 | end; 95 | 96 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 97 | begin 98 | FControleCliente := TClienteControl.Create; 99 | end; 100 | 101 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 102 | begin 103 | FControleCliente.Free; 104 | end; 105 | 106 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 107 | begin 108 | Self.CarregarClientes(); 109 | end; 110 | 111 | end. 112 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~60~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1DblClick(Sender: TObject); 32 | private 33 | FControleCliente: TClienteControl; 34 | 35 | procedure CarregarClientes; 36 | end; 37 | 38 | var 39 | frmCadastroCliente: TfrmCadastroCliente; 40 | 41 | implementation 42 | 43 | {$R *.dfm} 44 | 45 | { TfrmCadastroCliente } 46 | 47 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 48 | begin 49 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 50 | FControleCliente.ClienteModel.Nome := edtNome.Text; 51 | 52 | if FControleCliente.Salvar() then 53 | ShowMessage('Incluido com sucesso.'); 54 | 55 | Self.CarregarClientes(); 56 | end; 57 | 58 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 59 | begin 60 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 61 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 62 | FControleCliente.ClienteModel.Nome := edtNome.Text; 63 | 64 | if FControleCliente.Salvar() then 65 | ShowMessage('Alterado com sucesso.'); 66 | 67 | Self.CarregarClientes(); 68 | end; 69 | 70 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 71 | begin 72 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 73 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 74 | 75 | if FControleCliente.Salvar() then 76 | ShowMessage('Excluido com sucesso.'); 77 | 78 | Self.CarregarClientes(); 79 | end; 80 | 81 | procedure TfrmCadastroCliente.CarregarClientes; 82 | var 83 | VQry: TFDQuery; 84 | begin 85 | mmTableClientes.Close; 86 | 87 | VQry := FControleCliente.Obter; 88 | try 89 | VQry.FetchAll; 90 | mmTableClientes.Data := VQry.Data; 91 | finally 92 | VQry.Close; 93 | VQry.Free; 94 | end; 95 | end; 96 | 97 | procedure TfrmCadastroCliente.DBGrid1DblClick(Sender: TObject); 98 | begin 99 | FControleCliente.ClienteModel.Codigo := mmTableClientes.Fields[0].AsInteger; 100 | FControleCliente.ClienteModel.Nome := mmTableClientes.Fields[1].AsString; 101 | end; 102 | 103 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 104 | begin 105 | FControleCliente := TClienteControl.Create; 106 | end; 107 | 108 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 109 | begin 110 | FControleCliente.Free; 111 | end; 112 | 113 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 114 | begin 115 | Self.CarregarClientes(); 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~61~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1DblClick(Sender: TObject); 32 | private 33 | FControleCliente: TClienteControl; 34 | 35 | procedure CarregarClientes; 36 | end; 37 | 38 | var 39 | frmCadastroCliente: TfrmCadastroCliente; 40 | 41 | implementation 42 | 43 | {$R *.dfm} 44 | 45 | { TfrmCadastroCliente } 46 | 47 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 48 | begin 49 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 50 | FControleCliente.ClienteModel.Nome := edtNome.Text; 51 | 52 | if FControleCliente.Salvar() then 53 | ShowMessage('Incluido com sucesso.'); 54 | 55 | Self.CarregarClientes(); 56 | end; 57 | 58 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 59 | begin 60 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 61 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 62 | FControleCliente.ClienteModel.Nome := edtNome.Text; 63 | 64 | if FControleCliente.Salvar() then 65 | ShowMessage('Alterado com sucesso.'); 66 | 67 | Self.CarregarClientes(); 68 | end; 69 | 70 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 71 | begin 72 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 73 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 74 | 75 | if FControleCliente.Salvar() then 76 | ShowMessage('Excluido com sucesso.'); 77 | 78 | Self.CarregarClientes(); 79 | end; 80 | 81 | procedure TfrmCadastroCliente.CarregarClientes; 82 | var 83 | VQry: TFDQuery; 84 | begin 85 | mmTableClientes.Close; 86 | 87 | VQry := FControleCliente.Obter; 88 | try 89 | VQry.FetchAll; 90 | mmTableClientes.Data := VQry.Data; 91 | finally 92 | VQry.Close; 93 | VQry.Free; 94 | end; 95 | end; 96 | 97 | procedure TfrmCadastroCliente.DBGrid1DblClick(Sender: TObject); 98 | begin 99 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 100 | edtNome.Text := mmTableClientes.Fields[1].AsString; 101 | end; 102 | 103 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 104 | begin 105 | FControleCliente := TClienteControl.Create; 106 | end; 107 | 108 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 109 | begin 110 | FControleCliente.Free; 111 | end; 112 | 113 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 114 | begin 115 | Self.CarregarClientes(); 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~62~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 32 | private 33 | FControleCliente: TClienteControl; 34 | 35 | procedure CarregarClientes; 36 | end; 37 | 38 | var 39 | frmCadastroCliente: TfrmCadastroCliente; 40 | 41 | implementation 42 | 43 | {$R *.dfm} 44 | 45 | { TfrmCadastroCliente } 46 | 47 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 48 | begin 49 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 50 | FControleCliente.ClienteModel.Nome := edtNome.Text; 51 | 52 | if FControleCliente.Salvar() then 53 | ShowMessage('Incluido com sucesso.'); 54 | 55 | Self.CarregarClientes(); 56 | end; 57 | 58 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 59 | begin 60 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 61 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 62 | FControleCliente.ClienteModel.Nome := edtNome.Text; 63 | 64 | if FControleCliente.Salvar() then 65 | ShowMessage('Alterado com sucesso.'); 66 | 67 | Self.CarregarClientes(); 68 | end; 69 | 70 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 71 | begin 72 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 73 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 74 | 75 | if FControleCliente.Salvar() then 76 | ShowMessage('Excluido com sucesso.'); 77 | 78 | Self.CarregarClientes(); 79 | end; 80 | 81 | procedure TfrmCadastroCliente.CarregarClientes; 82 | var 83 | VQry: TFDQuery; 84 | begin 85 | mmTableClientes.Close; 86 | 87 | VQry := FControleCliente.Obter; 88 | try 89 | VQry.FetchAll; 90 | mmTableClientes.Data := VQry.Data; 91 | finally 92 | VQry.Close; 93 | VQry.Free; 94 | end; 95 | end; 96 | 97 | procedure TfrmCadastroCliente.DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 98 | begin 99 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 100 | edtNome.Text := mmTableClientes.Fields[1].AsString; 101 | end; 102 | 103 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 104 | begin 105 | FControleCliente := TClienteControl.Create; 106 | end; 107 | 108 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 109 | begin 110 | FControleCliente.Free; 111 | end; 112 | 113 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 114 | begin 115 | Self.CarregarClientes(); 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~63~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 32 | procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 33 | private 34 | FControleCliente: TClienteControl; 35 | 36 | procedure CarregarClientes; 37 | end; 38 | 39 | var 40 | frmCadastroCliente: TfrmCadastroCliente; 41 | 42 | implementation 43 | 44 | {$R *.dfm} 45 | 46 | { TfrmCadastroCliente } 47 | 48 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 49 | begin 50 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 51 | FControleCliente.ClienteModel.Nome := edtNome.Text; 52 | 53 | if FControleCliente.Salvar() then 54 | ShowMessage('Incluido com sucesso.'); 55 | 56 | Self.CarregarClientes(); 57 | end; 58 | 59 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 60 | begin 61 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 62 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 63 | FControleCliente.ClienteModel.Nome := edtNome.Text; 64 | 65 | if FControleCliente.Salvar() then 66 | ShowMessage('Alterado com sucesso.'); 67 | 68 | Self.CarregarClientes(); 69 | end; 70 | 71 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 72 | begin 73 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 74 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 75 | 76 | if FControleCliente.Salvar() then 77 | ShowMessage('Excluido com sucesso.'); 78 | 79 | Self.CarregarClientes(); 80 | end; 81 | 82 | procedure TfrmCadastroCliente.CarregarClientes; 83 | var 84 | VQry: TFDQuery; 85 | begin 86 | mmTableClientes.Close; 87 | 88 | VQry := FControleCliente.Obter; 89 | try 90 | VQry.FetchAll; 91 | mmTableClientes.Data := VQry.Data; 92 | finally 93 | VQry.Close; 94 | VQry.Free; 95 | end; 96 | end; 97 | 98 | procedure TfrmCadastroCliente.DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 99 | begin 100 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 101 | edtNome.Text := mmTableClientes.Fields[1].AsString; 102 | end; 103 | 104 | procedure TfrmCadastroCliente.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 105 | begin 106 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 107 | edtNome.Text := mmTableClientes.Fields[1].AsString; 108 | end; 109 | 110 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 111 | begin 112 | FControleCliente := TClienteControl.Create; 113 | end; 114 | 115 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 116 | begin 117 | FControleCliente.Free; 118 | end; 119 | 120 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 121 | begin 122 | Self.CarregarClientes(); 123 | end; 124 | 125 | end. 126 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~64~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 32 | procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 33 | private 34 | FControleCliente: TClienteControl; 35 | 36 | procedure CarregarClientes; 37 | procedure CarregarEdits; 38 | end; 39 | 40 | var 41 | frmCadastroCliente: TfrmCadastroCliente; 42 | 43 | implementation 44 | 45 | {$R *.dfm} 46 | 47 | { TfrmCadastroCliente } 48 | 49 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 50 | begin 51 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 52 | FControleCliente.ClienteModel.Nome := edtNome.Text; 53 | 54 | if FControleCliente.Salvar() then 55 | ShowMessage('Incluido com sucesso.'); 56 | 57 | Self.CarregarClientes(); 58 | end; 59 | 60 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 61 | begin 62 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 63 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 64 | FControleCliente.ClienteModel.Nome := edtNome.Text; 65 | 66 | if FControleCliente.Salvar() then 67 | ShowMessage('Alterado com sucesso.'); 68 | 69 | Self.CarregarClientes(); 70 | end; 71 | 72 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 73 | begin 74 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 75 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 76 | 77 | if FControleCliente.Salvar() then 78 | ShowMessage('Excluido com sucesso.'); 79 | 80 | Self.CarregarClientes(); 81 | end; 82 | 83 | procedure TfrmCadastroCliente.CarregarClientes; 84 | var 85 | VQry: TFDQuery; 86 | begin 87 | mmTableClientes.Close; 88 | 89 | VQry := FControleCliente.Obter; 90 | try 91 | VQry.FetchAll; 92 | mmTableClientes.Data := VQry.Data; 93 | finally 94 | VQry.Close; 95 | VQry.Free; 96 | end; 97 | end; 98 | 99 | procedure TfrmCadastroCliente.CarregarEdits; 100 | begin 101 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 102 | edtNome.Text := mmTableClientes.Fields[1].AsString; 103 | end; 104 | 105 | procedure TfrmCadastroCliente.DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 106 | begin 107 | Self.CarregarEdits(); 108 | end; 109 | 110 | procedure TfrmCadastroCliente.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 111 | begin 112 | Self.CarregarEdits(); 113 | end; 114 | 115 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 116 | begin 117 | FControleCliente := TClienteControl.Create; 118 | end; 119 | 120 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 121 | begin 122 | FControleCliente.Free; 123 | end; 124 | 125 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 126 | begin 127 | Self.CarregarClientes(); 128 | end; 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /View/__history/uFrmCliente.pas.~67~: -------------------------------------------------------------------------------- 1 | unit uFrmCliente; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, 8 | FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, Vcl.Grids, Vcl.DBGrids, 9 | FireDAC.Comp.DataSet, FireDAC.Comp.Client, uClienteControl, uEnumerado; 10 | 11 | type 12 | TfrmCadastroCliente = class(TForm) 13 | edtNome: TEdit; 14 | Label2: TLabel; 15 | mmTableClientes: TFDMemTable; 16 | DBGrid1: TDBGrid; 17 | dsClientes: TDataSource; 18 | mmTableClientesCODIGO: TIntegerField; 19 | mmTableClientesNOME: TStringField; 20 | Button1: TButton; 21 | Label1: TLabel; 22 | edtCodigo: TEdit; 23 | Button2: TButton; 24 | Button3: TButton; 25 | procedure FormShow(Sender: TObject); 26 | procedure Button1Click(Sender: TObject); 27 | procedure Button2Click(Sender: TObject); 28 | procedure Button3Click(Sender: TObject); 29 | procedure FormCreate(Sender: TObject); 30 | procedure FormDestroy(Sender: TObject); 31 | procedure DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 32 | procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 33 | private 34 | FControleCliente: TClienteControl; 35 | 36 | procedure CarregarClientes; 37 | procedure CarregarEdits; 38 | end; 39 | 40 | var 41 | frmCadastroCliente: TfrmCadastroCliente; 42 | 43 | implementation 44 | 45 | {$R *.dfm} 46 | 47 | { TfrmCadastroCliente } 48 | 49 | procedure TfrmCadastroCliente.Button1Click(Sender: TObject); 50 | begin 51 | FControleCliente.ClienteModel.Acao := uEnumerado.tacIncluir; 52 | FControleCliente.ClienteModel.Nome := edtNome.Text; 53 | 54 | if FControleCliente.Salvar() then 55 | ShowMessage('Incluido com sucesso.'); 56 | 57 | Self.CarregarClientes(); 58 | end; 59 | 60 | procedure TfrmCadastroCliente.Button2Click(Sender: TObject); 61 | begin 62 | FControleCliente.ClienteModel.Acao := uEnumerado.tacAlterar; 63 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 64 | FControleCliente.ClienteModel.Nome := edtNome.Text; 65 | 66 | if FControleCliente.Salvar() then 67 | ShowMessage('Alterado com sucesso.'); 68 | 69 | Self.CarregarClientes(); 70 | end; 71 | 72 | procedure TfrmCadastroCliente.Button3Click(Sender: TObject); 73 | begin 74 | FControleCliente.ClienteModel.Acao := uEnumerado.tacExcluir; 75 | FControleCliente.ClienteModel.Codigo := StrToInt(edtCodigo.Text); 76 | 77 | if FControleCliente.Salvar() then 78 | ShowMessage('Excluido com sucesso.'); 79 | 80 | Self.CarregarClientes(); 81 | end; 82 | 83 | procedure TfrmCadastroCliente.CarregarClientes; 84 | var 85 | VQry: TFDQuery; 86 | begin 87 | mmTableClientes.Close; 88 | 89 | VQry := FControleCliente.Obter; 90 | try 91 | VQry.FetchAll; 92 | mmTableClientes.Data := VQry.Data; 93 | finally 94 | VQry.Close; 95 | VQry.Free; 96 | end; 97 | end; 98 | 99 | procedure TfrmCadastroCliente.CarregarEdits; 100 | begin 101 | edtCodigo.Text := mmTableClientes.Fields[0].AsString; 102 | edtNome.Text := mmTableClientes.Fields[1].AsString; 103 | end; 104 | 105 | procedure TfrmCadastroCliente.DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 106 | begin 107 | Self.CarregarEdits(); 108 | end; 109 | 110 | procedure TfrmCadastroCliente.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 111 | begin 112 | Self.CarregarEdits(); 113 | end; 114 | 115 | procedure TfrmCadastroCliente.FormCreate(Sender: TObject); 116 | begin 117 | FControleCliente := TClienteControl.Create; 118 | end; 119 | 120 | procedure TfrmCadastroCliente.FormDestroy(Sender: TObject); 121 | begin 122 | FControleCliente.Free; 123 | end; 124 | 125 | procedure TfrmCadastroCliente.FormShow(Sender: TObject); 126 | begin 127 | Self.CarregarClientes(); 128 | end; 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.dfm.~1~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | TabOrder = 0 49 | TitleFont.Charset = DEFAULT_CHARSET 50 | TitleFont.Color = clWindowText 51 | TitleFont.Height = -11 52 | TitleFont.Name = 'Tahoma' 53 | TitleFont.Style = [] 54 | OnKeyUp = DBGrid1KeyUp 55 | OnMouseUp = DBGrid1MouseUp 56 | Columns = < 57 | item 58 | Expanded = False 59 | FieldName = 'CODIGO' 60 | Visible = True 61 | end 62 | item 63 | Expanded = False 64 | FieldName = 'NOME' 65 | Visible = True 66 | end> 67 | end 68 | object Button1: TButton 69 | Left = 72 70 | Top = 85 71 | Width = 75 72 | Height = 25 73 | Caption = 'Incluir' 74 | TabOrder = 3 75 | OnClick = Button1Click 76 | end 77 | object edtCodigo: TEdit 78 | Left = 72 79 | Top = 8 80 | Width = 121 81 | Height = 21 82 | TabOrder = 1 83 | end 84 | object Button2: TButton 85 | Left = 168 86 | Top = 85 87 | Width = 75 88 | Height = 25 89 | Caption = 'Alterar' 90 | TabOrder = 4 91 | OnClick = Button2Click 92 | end 93 | object Button3: TButton 94 | Left = 264 95 | Top = 85 96 | Width = 75 97 | Height = 25 98 | Caption = 'Excluir' 99 | TabOrder = 5 100 | OnClick = Button3Click 101 | end 102 | object mmTableClientes: TFDMemTable 103 | FetchOptions.AssignedValues = [evMode] 104 | FetchOptions.Mode = fmAll 105 | ResourceOptions.AssignedValues = [rvSilentMode] 106 | ResourceOptions.SilentMode = True 107 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 108 | UpdateOptions.CheckRequired = False 109 | UpdateOptions.AutoCommitUpdates = True 110 | Left = 440 111 | Top = 16 112 | object mmTableClientesCODIGO: TIntegerField 113 | DisplayLabel = 'C'#243'digo' 114 | FieldName = 'CODIGO' 115 | end 116 | object mmTableClientesNOME: TStringField 117 | DisplayLabel = 'Nome' 118 | DisplayWidth = 40 119 | FieldName = 'NOME' 120 | end 121 | end 122 | object dsClientes: TDataSource 123 | DataSet = mmTableClientes 124 | Left = 528 125 | Top = 16 126 | end 127 | end 128 | -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.dfm.~2~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] 49 | TabOrder = 0 50 | TitleFont.Charset = DEFAULT_CHARSET 51 | TitleFont.Color = clWindowText 52 | TitleFont.Height = -11 53 | TitleFont.Name = 'Tahoma' 54 | TitleFont.Style = [] 55 | OnKeyUp = DBGrid1KeyUp 56 | OnMouseUp = DBGrid1MouseUp 57 | Columns = < 58 | item 59 | Expanded = False 60 | FieldName = 'CODIGO' 61 | Visible = True 62 | end 63 | item 64 | Expanded = False 65 | FieldName = 'NOME' 66 | Visible = True 67 | end> 68 | end 69 | object Button1: TButton 70 | Left = 72 71 | Top = 85 72 | Width = 75 73 | Height = 25 74 | Caption = 'Incluir' 75 | TabOrder = 3 76 | OnClick = Button1Click 77 | end 78 | object edtCodigo: TEdit 79 | Left = 72 80 | Top = 8 81 | Width = 121 82 | Height = 21 83 | TabOrder = 1 84 | end 85 | object Button2: TButton 86 | Left = 168 87 | Top = 85 88 | Width = 75 89 | Height = 25 90 | Caption = 'Alterar' 91 | TabOrder = 4 92 | OnClick = Button2Click 93 | end 94 | object Button3: TButton 95 | Left = 264 96 | Top = 85 97 | Width = 75 98 | Height = 25 99 | Caption = 'Excluir' 100 | TabOrder = 5 101 | OnClick = Button3Click 102 | end 103 | object mmTableClientes: TFDMemTable 104 | FetchOptions.AssignedValues = [evMode] 105 | FetchOptions.Mode = fmAll 106 | ResourceOptions.AssignedValues = [rvSilentMode] 107 | ResourceOptions.SilentMode = True 108 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 109 | UpdateOptions.CheckRequired = False 110 | UpdateOptions.AutoCommitUpdates = True 111 | Left = 440 112 | Top = 16 113 | object mmTableClientesCODIGO: TIntegerField 114 | DisplayLabel = 'C'#243'digo' 115 | FieldName = 'CODIGO' 116 | end 117 | object mmTableClientesNOME: TStringField 118 | DisplayLabel = 'Nome' 119 | DisplayWidth = 40 120 | FieldName = 'NOME' 121 | end 122 | end 123 | object dsClientes: TDataSource 124 | DataSet = mmTableClientes 125 | Left = 528 126 | Top = 16 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.dfm.~3~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] 49 | TabOrder = 0 50 | TitleFont.Charset = DEFAULT_CHARSET 51 | TitleFont.Color = clWindowText 52 | TitleFont.Height = -11 53 | TitleFont.Name = 'Tahoma' 54 | TitleFont.Style = [] 55 | OnKeyUp = DBGrid1KeyUp 56 | OnMouseUp = DBGrid1MouseUp 57 | Columns = < 58 | item 59 | Expanded = False 60 | FieldName = 'CODIGO' 61 | Visible = True 62 | end 63 | item 64 | Expanded = False 65 | FieldName = 'NOME' 66 | Visible = True 67 | end> 68 | end 69 | object Button1: TButton 70 | Left = 134 71 | Top = 85 72 | Width = 75 73 | Height = 25 74 | Caption = 'Incluir' 75 | TabOrder = 3 76 | OnClick = Button1Click 77 | end 78 | object edtCodigo: TEdit 79 | Left = 72 80 | Top = 8 81 | Width = 121 82 | Height = 21 83 | TabOrder = 1 84 | end 85 | object Button2: TButton 86 | Left = 215 87 | Top = 85 88 | Width = 75 89 | Height = 25 90 | Caption = 'Alterar' 91 | TabOrder = 4 92 | OnClick = Button2Click 93 | end 94 | object Button3: TButton 95 | Left = 296 96 | Top = 85 97 | Width = 75 98 | Height = 25 99 | Caption = 'Excluir' 100 | TabOrder = 5 101 | OnClick = Button3Click 102 | end 103 | object Button4: TButton 104 | Left = 53 105 | Top = 85 106 | Width = 75 107 | Height = 25 108 | Caption = 'Novo' 109 | TabOrder = 6 110 | end 111 | object mmTableClientes: TFDMemTable 112 | FetchOptions.AssignedValues = [evMode] 113 | FetchOptions.Mode = fmAll 114 | ResourceOptions.AssignedValues = [rvSilentMode] 115 | ResourceOptions.SilentMode = True 116 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 117 | UpdateOptions.CheckRequired = False 118 | UpdateOptions.AutoCommitUpdates = True 119 | Left = 440 120 | Top = 16 121 | object mmTableClientesCODIGO: TIntegerField 122 | DisplayLabel = 'C'#243'digo' 123 | FieldName = 'CODIGO' 124 | end 125 | object mmTableClientesNOME: TStringField 126 | DisplayLabel = 'Nome' 127 | DisplayWidth = 40 128 | FieldName = 'NOME' 129 | end 130 | end 131 | object dsClientes: TDataSource 132 | DataSet = mmTableClientes 133 | Left = 528 134 | Top = 16 135 | end 136 | end 137 | -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.dfm.~4~: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] 49 | TabOrder = 0 50 | TitleFont.Charset = DEFAULT_CHARSET 51 | TitleFont.Color = clWindowText 52 | TitleFont.Height = -11 53 | TitleFont.Name = 'Tahoma' 54 | TitleFont.Style = [] 55 | OnKeyUp = DBGrid1KeyUp 56 | OnMouseUp = DBGrid1MouseUp 57 | Columns = < 58 | item 59 | Expanded = False 60 | FieldName = 'CODIGO' 61 | Visible = True 62 | end 63 | item 64 | Expanded = False 65 | FieldName = 'NOME' 66 | Visible = True 67 | end> 68 | end 69 | object Button1: TButton 70 | Left = 134 71 | Top = 85 72 | Width = 75 73 | Height = 25 74 | Caption = 'Incluir' 75 | TabOrder = 3 76 | OnClick = Button1Click 77 | end 78 | object edtCodigo: TEdit 79 | Left = 72 80 | Top = 8 81 | Width = 121 82 | Height = 21 83 | TabOrder = 1 84 | end 85 | object Button2: TButton 86 | Left = 215 87 | Top = 85 88 | Width = 75 89 | Height = 25 90 | Caption = 'Alterar' 91 | TabOrder = 4 92 | OnClick = Button2Click 93 | end 94 | object Button3: TButton 95 | Left = 296 96 | Top = 85 97 | Width = 75 98 | Height = 25 99 | Caption = 'Excluir' 100 | TabOrder = 5 101 | OnClick = Button3Click 102 | end 103 | object Button4: TButton 104 | Left = 53 105 | Top = 85 106 | Width = 75 107 | Height = 25 108 | Caption = 'Novo' 109 | TabOrder = 6 110 | OnClick = Button4Click 111 | end 112 | object mmTableClientes: TFDMemTable 113 | FetchOptions.AssignedValues = [evMode] 114 | FetchOptions.Mode = fmAll 115 | ResourceOptions.AssignedValues = [rvSilentMode] 116 | ResourceOptions.SilentMode = True 117 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 118 | UpdateOptions.CheckRequired = False 119 | UpdateOptions.AutoCommitUpdates = True 120 | Left = 440 121 | Top = 16 122 | object mmTableClientesCODIGO: TIntegerField 123 | DisplayLabel = 'C'#243'digo' 124 | FieldName = 'CODIGO' 125 | end 126 | object mmTableClientesNOME: TStringField 127 | DisplayLabel = 'Nome' 128 | DisplayWidth = 40 129 | FieldName = 'NOME' 130 | end 131 | end 132 | object dsClientes: TDataSource 133 | DataSet = mmTableClientes 134 | Left = 528 135 | Top = 16 136 | end 137 | end 138 | -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.pas.~12~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmClienteView.pas.~12~ -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.pas.~13~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmClienteView.pas.~13~ -------------------------------------------------------------------------------- /View/__history/uFrmClienteView.pas.~14~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmClienteView.pas.~14~ -------------------------------------------------------------------------------- /View/__history/uFrmPrincipalView.dfm.~1~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | ExplicitTop = 227 32 | ExplicitWidth = 494 33 | end 34 | object ActionMainMenuBar1: TActionMainMenuBar 35 | Left = 0 36 | Top = 0 37 | Width = 702 38 | Height = 29 39 | ActionManager = ActionManager1 40 | Caption = 'ActionMainMenuBar1' 41 | Color = clMenuBar 42 | ColorMap.DisabledFontColor = 7171437 43 | ColorMap.HighlightColor = clWhite 44 | ColorMap.BtnSelectedFont = clBlack 45 | ColorMap.UnusedColor = clWhite 46 | Font.Charset = DEFAULT_CHARSET 47 | Font.Color = clWindowText 48 | Font.Height = -12 49 | Font.Name = 'Segoe UI' 50 | Font.Style = [] 51 | Spacing = 0 52 | ExplicitLeft = 288 53 | ExplicitTop = 192 54 | ExplicitWidth = 150 55 | end 56 | object ActionManager1: TActionManager 57 | ActionBars = < 58 | item 59 | Items = < 60 | item 61 | Items = < 62 | item 63 | Action = Action1 64 | end> 65 | Caption = '&Cadastros' 66 | end> 67 | ActionBar = ActionMainMenuBar1 68 | end> 69 | Left = 608 70 | Top = 104 71 | StyleName = 'Platform Default' 72 | object Action1: TAction 73 | Category = '&Cadastros' 74 | Caption = '&Cliente' 75 | end 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /View/__history/uFrmPrincipalView.dfm.~2~: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | ExplicitTop = 227 32 | ExplicitWidth = 494 33 | end 34 | object ActionMainMenuBar1: TActionMainMenuBar 35 | Left = 0 36 | Top = 0 37 | Width = 702 38 | Height = 29 39 | ActionManager = ActionManager1 40 | Caption = 'ActionMainMenuBar1' 41 | Color = clMenuBar 42 | ColorMap.DisabledFontColor = 7171437 43 | ColorMap.HighlightColor = clWhite 44 | ColorMap.BtnSelectedFont = clBlack 45 | ColorMap.UnusedColor = clWhite 46 | Font.Charset = DEFAULT_CHARSET 47 | Font.Color = clWindowText 48 | Font.Height = -12 49 | Font.Name = 'Segoe UI' 50 | Font.Style = [] 51 | Spacing = 0 52 | ExplicitLeft = 288 53 | ExplicitTop = 192 54 | ExplicitWidth = 150 55 | end 56 | object ActionManager1: TActionManager 57 | ActionBars = < 58 | item 59 | Items = < 60 | item 61 | Items = < 62 | item 63 | Action = Action1 64 | end> 65 | Caption = '&Cadastros' 66 | end> 67 | ActionBar = ActionMainMenuBar1 68 | end> 69 | Left = 608 70 | Top = 104 71 | StyleName = 'Platform Default' 72 | object Action1: TAction 73 | Category = '&Cadastros' 74 | Caption = '&Cliente' 75 | OnExecute = Action1Execute 76 | end 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /View/__history/uFrmPrincipalView.pas.~1~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmPrincipalView.pas.~1~ -------------------------------------------------------------------------------- /View/__history/uFrmPrincipalView.pas.~2~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmPrincipalView.pas.~2~ -------------------------------------------------------------------------------- /View/__history/uFrmPrincipalView.pas.~3~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/__history/uFrmPrincipalView.pas.~3~ -------------------------------------------------------------------------------- /View/uFrmClienteView.dfm: -------------------------------------------------------------------------------- 1 | object frmCadastroCliente: TfrmCadastroCliente 2 | Left = 0 3 | Top = 0 4 | Caption = 'Cadastro de Clientes' 5 | ClientHeight = 331 6 | ClientWidth = 569 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | Position = poScreenCenter 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | OnShow = FormShow 18 | PixelsPerInch = 96 19 | TextHeight = 13 20 | object Label2: TLabel 21 | Left = 33 22 | Top = 38 23 | Width = 27 24 | Height = 13 25 | Caption = 'Nome' 26 | end 27 | object Label1: TLabel 28 | Left = 33 29 | Top = 8 30 | Width = 33 31 | Height = 13 32 | Caption = 'C'#243'digo' 33 | end 34 | object edtNome: TEdit 35 | Left = 72 36 | Top = 35 37 | Width = 121 38 | Height = 21 39 | TabOrder = 2 40 | end 41 | object DBGrid1: TDBGrid 42 | Left = 8 43 | Top = 130 44 | Width = 545 45 | Height = 193 46 | DataSource = dsClientes 47 | DrawingStyle = gdsGradient 48 | Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgTitleClick, dgTitleHotTrack] 49 | TabOrder = 0 50 | TitleFont.Charset = DEFAULT_CHARSET 51 | TitleFont.Color = clWindowText 52 | TitleFont.Height = -11 53 | TitleFont.Name = 'Tahoma' 54 | TitleFont.Style = [] 55 | OnKeyUp = DBGrid1KeyUp 56 | OnMouseUp = DBGrid1MouseUp 57 | Columns = < 58 | item 59 | Expanded = False 60 | FieldName = 'CODIGO' 61 | Visible = True 62 | end 63 | item 64 | Expanded = False 65 | FieldName = 'NOME' 66 | Visible = True 67 | end> 68 | end 69 | object Button1: TButton 70 | Left = 134 71 | Top = 85 72 | Width = 75 73 | Height = 25 74 | Caption = 'Incluir' 75 | TabOrder = 3 76 | OnClick = Button1Click 77 | end 78 | object edtCodigo: TEdit 79 | Left = 72 80 | Top = 8 81 | Width = 121 82 | Height = 21 83 | TabOrder = 1 84 | end 85 | object Button2: TButton 86 | Left = 215 87 | Top = 85 88 | Width = 75 89 | Height = 25 90 | Caption = 'Alterar' 91 | TabOrder = 4 92 | OnClick = Button2Click 93 | end 94 | object Button3: TButton 95 | Left = 296 96 | Top = 85 97 | Width = 75 98 | Height = 25 99 | Caption = 'Excluir' 100 | TabOrder = 5 101 | OnClick = Button3Click 102 | end 103 | object Button4: TButton 104 | Left = 53 105 | Top = 85 106 | Width = 75 107 | Height = 25 108 | Caption = 'Novo' 109 | TabOrder = 6 110 | OnClick = Button4Click 111 | end 112 | object mmTableClientes: TFDMemTable 113 | FetchOptions.AssignedValues = [evMode] 114 | FetchOptions.Mode = fmAll 115 | ResourceOptions.AssignedValues = [rvSilentMode] 116 | ResourceOptions.SilentMode = True 117 | UpdateOptions.AssignedValues = [uvCheckRequired, uvAutoCommitUpdates] 118 | UpdateOptions.CheckRequired = False 119 | UpdateOptions.AutoCommitUpdates = True 120 | Left = 440 121 | Top = 16 122 | object mmTableClientesCODIGO: TIntegerField 123 | DisplayLabel = 'C'#243'digo' 124 | FieldName = 'CODIGO' 125 | end 126 | object mmTableClientesNOME: TStringField 127 | DisplayLabel = 'Nome' 128 | DisplayWidth = 40 129 | FieldName = 'NOME' 130 | end 131 | end 132 | object dsClientes: TDataSource 133 | DataSet = mmTableClientes 134 | Left = 528 135 | Top = 16 136 | end 137 | end 138 | -------------------------------------------------------------------------------- /View/uFrmClienteView.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/uFrmClienteView.pas -------------------------------------------------------------------------------- /View/uFrmPrincipalView.dfm: -------------------------------------------------------------------------------- 1 | object frmPrincipal: TfrmPrincipal 2 | Left = 0 3 | Top = 0 4 | Caption = 'Projeto MVC com conceitos de OOP.' 5 | ClientHeight = 379 6 | ClientWidth = 702 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | WindowState = wsMaximized 15 | OnCreate = FormCreate 16 | OnDestroy = FormDestroy 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object StatusBar1: TStatusBar 20 | Left = 0 21 | Top = 360 22 | Width = 702 23 | Height = 19 24 | Panels = < 25 | item 26 | Width = 70 27 | end 28 | item 29 | Width = 50 30 | end> 31 | end 32 | object ActionMainMenuBar1: TActionMainMenuBar 33 | Left = 0 34 | Top = 0 35 | Width = 702 36 | Height = 25 37 | UseSystemFont = False 38 | ActionManager = ActionManager1 39 | Caption = 'ActionMainMenuBar1' 40 | Color = clMenuBar 41 | ColorMap.DisabledFontColor = 7171437 42 | ColorMap.HighlightColor = clWhite 43 | ColorMap.BtnSelectedFont = clBlack 44 | ColorMap.UnusedColor = clWhite 45 | Font.Charset = DEFAULT_CHARSET 46 | Font.Color = clBlack 47 | Font.Height = -12 48 | Font.Name = 'Segoe UI' 49 | Font.Style = [] 50 | Spacing = 0 51 | end 52 | object ActionManager1: TActionManager 53 | ActionBars = < 54 | item 55 | Items = < 56 | item 57 | Items = < 58 | item 59 | Action = Action1 60 | end> 61 | Caption = '&Cadastros' 62 | end> 63 | ActionBar = ActionMainMenuBar1 64 | end> 65 | Left = 608 66 | Top = 104 67 | StyleName = 'Platform Default' 68 | object Action1: TAction 69 | Category = '&Cadastros' 70 | Caption = '&Cliente' 71 | OnExecute = Action1Execute 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /View/uFrmPrincipalView.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeduardovrb/MVC_Delphi/9e7e58dc13011f1d79abd0e0d510442751747f4b/View/uFrmPrincipalView.pas --------------------------------------------------------------------------------