GetNombrePantallaListadosCommand.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Data;
4 using System.Linq;
5 using System.Text;
6 using sage.ew.db;
7 using sage.ew.interficies;
8 
9 namespace Sage.ES.S50.Addons
10 {
11  internal class GetNombrePantallaListadosCommand : Command
12  {
13  private string ret = string.Empty;
14  public GetNombrePantallaListadosCommand(IAddonsManager addons) : base(addons)
15  {
16  Name = "GetNombrePantallaListados";
17  }
18 
19  protected override void CommandModulo(IModulo modulo, params object[] parameters)
20  {
21  if (DB._SQLExisteTablaBBDD(modulo._NombreConexion, "LISTADOS"))
22  {
23  string lcClase = parameters[0].ToString();
24  string lcAliasDb = modulo._AliasDB;
25  string lcSql = $@"SELECT * FROM { DB.SQLDatabase(lcAliasDb, "listados") }
26  WHERE clase = { DB.SQLString(lcClase) }";
27 
28  DataTable ldtResult = new DataTable();
29  if (DB.SQLExec(lcSql, ref ldtResult) &&
30  ldtResult.Rows.Count > 0)
31  {
32  // Revisar el nom en funció de les variables
33  ret = ldtResult.Rows[0]["pantalla"].ToString().Trim();
34  }
35  }
36  }
37  protected override ExpectedParameters GetExpectedParameters()
38  {
39  return new ExpectedParameters(new Type[] { typeof(string) });
40  }
41 
42  protected override object Return(params object[] parameters)
43  {
44  return ret;
45  }
46  protected override bool Exit()
47  {
48  return !string.IsNullOrEmpty(ret);
49  }
50  }
51 }
PE-93426 Interficie para los módulos de la aplicación
Definition: IModulo.cs:22
string _NombreConexion
Nombre real de la base de datos
Definition: IModulo.cs:59
string _AliasDB
Alias de la Base de datos
Definition: IModulo.cs:29