Buscar

Controle de Gestão de mensagens por funções com parâmetro

Código

<!-- Criação de uma Unit para separar as mensagens
e deixar padronizado pois chama-se por parâmetro com IF ou CASE.
-->

unit Umsg;
interface
uses
        Dialogs;
function msg_valida_campos_obrigatorios(obr: Integer): string;

function msg_erro_inclusao(obr: Integer): string;
function msg_erro_alteracao(obr: Integer): string;
function msg_erro_exclusao(obr: Integer): string;

function msg_sucesso_inclusao(obr: Integer): string;
function msg_sucesso_alteracao(obr: Integer): string;
function msg_sucesso_exclusao(obr: Integer): string;

function msg_alert_cancelamento(obr: Integer): string;
function msg_alert_inclusao(obr: Integer): string;
function msg_alert_edicao(obr: Integer): string;
function msg_alert_exclusao(obr: Integer): string;

implementation

function msg_valida_campos_obrigatorios(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Os Campos em destaques são obrigatórios!';
      end;
end;
function msg_sucesso_inclusao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Registro Incluido com suscesso!';
      end;
end;

function msg_erro_inclusao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Ocorreram erros ao tentar Incluir registro!'+
                     #13+ 'Entre em contato com Administrador de sistema Ramal 245';
      end;
end;

function msg_sucesso_alteracao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Registro Alterado com suscesso!';
      end;
end;

function msg_erro_alteracao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Ocorreram erros ao tentar Alterar registro!'+
                     #13+' Entre em contato com Administrador de sistema Ramal 245';
      end;
end;

function msg_sucesso_exclusao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Registro Excluido com suscesso!';
      end;
end;

function msg_erro_exclusao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Ocorreram erros ao tentar Excluir registro!'+
                     #13+' Entre em contato com Administrador de sistema Ramal 245';
      end;
end;

function msg_alert_cancelamento(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Deseja Cancelar Operação?';
      end;
end;

function msg_alert_inclusao(obr: Integer): string;
begin
      Case obr of
        1 : result := 'Deseja Incluir o Registros?';
        2 : result := 'Não existe o produto! deseja fazer a inclusão agora? ou tentar pesquisar outro?';
        3 : result := 'Deseja incluir a Materia Prima?';
    else ShowMessage('Parametro Invalido! favor identificar o parametro e corrigir o problema');
    end;
end;

function msg_alert_edicao(obr: Integer): string;
begin
        if (obr = 1) then
      begin
           result := 'Deseja Alterar o Registros?';
      end;
end;

function msg_alert_exclusao(obr: Integer): string;
begin

    Case obr of
    1 : result := 'Deseja Excluir o Registros?';
    2 : result := 'Deve ser selecionado pelo menos 1 registro para exclusão!';
  else ShowMessage('Parametro Invalido! favor identificar o parametro e corrigir o problema');
  end;
end;

end.

<!--
Chamadas:
1) pode ser em um MessageDlg(msg_alert_inclusao(2),mtConfirmation,[mbYes,mbNo],0);
2) ou em um ShowMessage(msg_alert_exclusao(1));
-->

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Forms
Adicionada dia: 29/09/10
Por: Marcos Naves Calixto
Visualizada: 3732 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009