public
{ Public declarations }
function ff_int_Pegar_Nivel_Acesso(): Integer;
function ff_str_Pegar_Apelido_Usuario(): String;
procedure ff_voi_Especificar_Usuario(ff_str_usuario_apelido: String ; ff_int_nivel_acesso: Integer);
//==============================================================================
procedure TFrm_Princiapal.ff_voi_Especificar_Usuario(ff_str_usuario_apelido: String ; ff_int_nivel_acesso: Integer);
begin
self.ff_str_apelido_usuario:= ff_str_usuario_apelido;
elf.ff_int_nivel_acesso:= ff_int_nivel_acesso;
self.SBar_Principal.Panels[0].Text:= 'user: [ ' + ff_str_usuario_apelido + ']';
self.SBar_Principal.Panels[1].Text:= 'nivel: [' + inttostr(ff_int_nivel_acesso) + ']';
end;
//==============================================================================
function TFrm_Princiapal.ff_int_Pegar_Nivel_Acesso(): Integer;
begin
result:= self.ff_int_nivel_acesso;end;
//==============================================================================
function TFrm_Princiapal.ff_str_Pegar_Apelido_Usuario(): String;
begin
result:= self.ff_str_apelido_usuario;end;
//==============================================================================
Controlar Nivel de Acesso
Marcadores: Códigos Delphi
Habilitar edits
procedure FF_Habilitar_Edits(boo_habilitar: Boolean);
//------------------------------------------------------------------------------
procedure TF_Produtos.FF_Habilitar_Edits(boo_habilitar: Boolean);
begin
self.Edit2.ReadOnly:= true;
self.Edit3.ReadOnly:= not(boo_habilitar);
self.Edit4.ReadOnly:= not(boo_habilitar);
self.Edit5.ReadOnly:= not(boo_habilitar);
self.Edit6.ReadOnly:= not(boo_habilitar);
end;
procedure TF_Produtos.BitBtn1Click(Sender: TObject);
begin
self.Close();
end;
Marcadores: Códigos Delphi
Limpar edits
//------------------------------------------------------------------------------
procedure TF_Produtos.FF_Limpar_Edits();
begin
self.Edit2.Text:= '';
self.Edit3.Text:= '';
self.Edit4.Text:= '';
self.Edit5.Text:= '';
self.Edit6.Text:= '';
end;
Marcadores: Códigos Delphi
Procedure para Habilitar Botões
//------------------------------------------------------------------------------
procedure TF_Produtos.FF_Habilitar_Botoes_Insert(boo_habilitar: Boolean);
begin
self.BitBtn1.Enabled := True;
self.BitBtn2.Enabled := boo_habilitar;
self.BitBtn3.Enabled := boo_habilitar;
self.BitBtn4.Enabled := boo_habilitar;
self.BitBtn5.Enabled := boo_habilitar;
self.BitBtn6.Enabled := True; //...inserir
self.BitBtn7.Enabled := boo_habilitar; //...alterar
self.BitBtn8.Enabled := boo_habilitar;
self.BitBtn9.Enabled := True;
self.BitBtn10.Enabled:= boo_habilitar;
self.BitBtn11.Enabled:= boo_habilitar;
self.BitBtn12.Enabled:= boo_habilitar;
end;
//------------------------------------------------------------------------------
Marcadores: Códigos Delphi
Pegar Novo ID
Marcadores: Códigos Delphi
Rotina para Popular Grid
procedure FF_Popular_Grid_Produtos();
//------------------------------------------------------------------------------
procedure TF_Produtos.FF_Popular_Grid_Produtos();
varff_str_sql_texto: TStrings;
begin
try
ff_str_sql_texto:= TStringList.Create();
ff_str_sql_texto.Add('Select * from Produtos order by Prod_Nome ');
self.ADOQuery_Produtos.Active:= False;
self.ADOQuery_Produtos.SQL.Clear();
self.ADOQuery_Produtos.SQL := ff_str_sql_texto;
self.ADOQuery_Produtos.Active:= True;
except on
E:Exception do begin
ShowMessage('Ôpa, ocorreu um erro na busca por produtos! Veja: ' + E.Message);
end;
end;
end;
Marcadores: Códigos Delphi
Rotina para Inserção
procedure FF_Disparar_Processo_Insercao_Produto();
//------------------------------------------------------------------------------
procedure TF_Produtos.FF_Disparar_Processo_Insercao_Produto();
begin if(self.BitBtn6.Caption = 'Inserir novo produto') then begin
self.FF_Limpar_Edits(); //... limpar os edits ...
self.FF_Habilitar_Edits(true); //...habilitar os edits {3,4,5} ... self.FF_Habilitar_Botoes_Insert(False); //...impedir o funcionamento de todos os botões, com exceção do {fechar, cancelar, salvar}
self.BitBtn6.Caption:= 'Salvar novo produto';
self.Edit2.Text:= inttostr(self.FF_Pegar_Novo_Produto_Id); end else if ((self.BitBtn6.Caption = 'Salvar novo cliente') and (true)) then begin
self.FF_Popular_Grid_Produtos();
self.FF_Atualizar_Cartao_Produto();
self.FF_Habilitar_Edits(False); //...habilitar os edits {3,4,5} ...
self.FF_Habilitar_Botoes_Insert(True); //...impedir o funcionamento de todos os botões, com exceção do {fechar, cancelar, salvar}
self.BitBtn6.Caption:= 'Inserir novo cliente';
end;
end;
Marcadores: Códigos Delphi
