2 using System.Collections.Generic;
12 internal class GetListadosModulosCommand : Command
14 string lcWhere =
string.Empty;
15 int lnAsesorContable = Convert.ToInt32(EW_GLOBAL._GetVariable(
"wn_AsesorContable"));
17 public GetListadosModulosCommand(IAddonsManager addons) : base(addons)
19 Name =
"GetListadosModulos";
21 protected override bool Condition(params
object[] parameters)
23 Func<string> Where_Mantes = parameters[1] as Func<string>;
24 lcWhere = Where_Mantes();
25 return base.Condition(parameters);
28 protected override void CommandModulo(
IModulo modulo, params
object[] parameters)
31 string lcNombre = modulo.
_Nombre;
32 DataTable tdtResultados = parameters[0] as DataTable;
33 Func<string, string> RevisarDescripcion = parameters[2] as Func<string, string>;
35 string tcTipo = parameters[3].ToString();
38 if (DB._SQLExisteTablaBBDD(lcConexion,
"LISTADOS") && DB._oAliasDB.ContainsKey(lcNombre))
41 string lcCampoUpdate = DB.SQLExisteCampo(lcNombre,
"LISTADOS",
"UPDATE") ?
" , [update] " :
" , '' as [update] ";
42 string lcCampoPers = DB.SQLExisteCampo(lcNombre,
"LISTADOS",
"PERS") ?
" , [pers] " :
" , "+DB.SQLFalse()+
" as [pers] ";
44 string lcSql = $
@"select id,pantalla,nombre, FORM, clase, tipo {lcCampoPers} {lcCampoUpdate} 45 from {DB.SQLDatabase(lcNombre, "listados
")} 53 if (!
string.IsNullOrWhiteSpace(tcTipo))
54 lcSql +=
" AND tipo=" + DB.SQLString(tcTipo);
58 if (lnAsesorContable > 0)
63 if (DB.SQLExisteCampo(lcNombre,
"LISTADOS",
"SMALLPROF"))
64 lcSql +=
" AND smallprof <= " + lnAsesorContable.ToString().Trim() +
" ";
69 if (DB.SQLExisteCampo(lcNombre,
"LISTADOS",
"SOLUCION"))
70 lcSql +=
" AND solucion <= " + DB.SQLString(EW_GLOBAL._Solucion) +
" ";
73 lcSql +=
" order by nombre";
75 DataTable ldtTemp =
new DataTable();
76 DB.SQLExec(lcSql, ref ldtTemp);
79 if (ldtTemp != null && ldtTemp.Rows.Count > 0)
81 foreach (DataRow row
in ldtTemp.Rows)
84 row[
"nombre"] = RevisarDescripcion(row[
"nombre"].ToString());
85 row[
"nombre"] = row[
"nombre"].ToString().Trim() +
" (" + lcNombre +
")";
88 DataRow[] foundListado = tdtResultados.Select(
"pantalla = '" + row[
"pantalla"].ToString().Trim() +
"'");
89 if (foundListado.Length != 0)
92 foundListado[0].Delete();
93 tdtResultados.AcceptChanges();
96 tdtResultados.Merge(ldtTemp);
101 protected override object Return(params
object[] parameters)
103 ((DataTable)parameters[0]).DefaultView.Sort =
"nombre asc";
104 ((DataTable)parameters[0]).DefaultView.ToTable();
105 return base.Return(parameters);
107 protected override ExpectedParameters GetExpectedParameters()
109 return new ExpectedParameters(
new Type[] { typeof(DataTable), typeof(Func<string>), typeof(Func<string, string>), typeof(
string) });
PE-93426 Interficie para los módulos de la aplicación
string _NombreConexion
Nombre real de la base de datos
string _Nombre
Nombre interno del módulo y nombre del directorio de instación