PermitirCrearTareaProgramadaCommand.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 PermitirCrearTareaProgramadaCommand : Command
12  {
13  bool lRet = false;
14  bool salir = false;
15  public PermitirCrearTareaProgramadaCommand(IAddonsManager addons) : base(addons)
16  {
17  Name = "PermitirCrearTareaProgramada";
18  }
19 
20  protected override void CommandModulo(IModulo modulo, params object[] parameters)
21  {
22  string lcConexion = modulo._NombreConexion;
23  string lcNombre = modulo._Nombre;
24  string tcPantalla = parameters[0].ToString();
25  DataTable ldtResult = parameters[1] as DataTable;
26  if (DB._SQLExisteTablaBBDD(lcConexion, "LISTADOS"))
27  {
28  // Preparamos la consulta
29  string lcSql = $@"SELECT *
30  FROM { DB.SQLDatabase(lcNombre, "listados")}
31  WHERE pantalla = {DB.SQLString(tcPantalla.Trim().ToUpper())}";
32 
33  bool llOk = DB.SQLExec(lcSql, ref ldtResult);
34  if (llOk && ldtResult != null && ldtResult.Rows.Count > 0)
35  {
36  lRet = ldtResult.Columns.Contains("tarea") ?
37  Convert.ToBoolean(ldtResult.Rows[0]["tarea"]) : false;
38  salir = true;
39  }
40  }
41  }
42 
43  protected override ExpectedParameters GetExpectedParameters()
44  {
45  return new ExpectedParameters(new Type[] { typeof(string), typeof(DataTable) });
46  }
47  protected override bool Exit()
48  {
49  return salir;
50  }
51  protected override object Return(params object[] parameters)
52  {
53  return lRet;
54  }
55  }
56 }
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 _Nombre
Nombre interno del módulo y nombre del directorio de instación
Definition: IModulo.cs:49