CopiaSeguridadCloudId.cs
1 using Newtonsoft.Json;
2 using sage.ew.db;
3 using System;
4 using System.Collections.Generic;
5 using System.Data;
6 using System.IO;
7 using System.Linq;
8 using System.Text;
9 
10 namespace sage.ew.ewbase.Clases
11 {
15  public class CopiaSeguridadCloudId
16  {
17  private DataTable _dtUsuarios = new DataTable();
18  private string _GrupoDestino;
19  private bool multiplesGrupos = false;
20 
24  private string idSage50 = DB.SQLValor("GRUPOSEMP", "CODIGO", GrupoEmpresa._CodigoGrupoActual().ToString().Trim(), "IDSAGE50", "EUROWINSYS").ToString().Trim();
25 
26  private DataTable _dtUniusers = null;
27  private DataTable _dtAccesoGrup = null;
28  private DataTable _dtOtrosGruposUsers = null;
29  internal string _RutaOrigenTempRestauracion = "";
30 
35  {
36  }
37 
42  internal void _ObtenerDatosUnificacionUsuariosActual(string tcGrupoDestino)
43  {
44  string lcSql = "SELECT uni.idusuario AS idusuario_uniuser, usu.* " +
45  "FROM " + DB.SQLDatabaseReal("EUROWINSYS", "UNIUSERS") + " AS uni " +
46  "LEFT JOIN " + DB.SQLDatabase("COMUNES", "USUARIOS") + " AS usu on uni.idusuario = usu.idusuario " +
47  "WHERE uni.idsage50 = " + DB.SQLString(idSage50) + " " +
48  "UNION ALL " +
49  "SELECT '' AS idusuario, usu.* " +
50  "FROM " + DB.SQLDatabase("COMUNES", "USUARIOS") + " AS usu " +
51  "WHERE idusuario = '' and cloudid = 0";
52 
53  DB.SQLExec(lcSql, ref _dtUsuarios);
54 
55  //Task 203077: Comprobar si tenemos en destino un solo grupo o más de uno
56  string lcGrupoPripal = GrupoempTools._Obtener_CodGrupoPripal(tcGrupoDestino);
57  DataTable ldtTempGrupos = GrupoempTools.ObtenerTodosLosGrupos(lcGrupoPripal);
58  if (ldtTempGrupos != null && ldtTempGrupos.Rows.Count > 1)
59  multiplesGrupos = true;
60  else
61  multiplesGrupos = false;
62  }
63 
68  internal void RestaurarProcesosUnificacionUsuarios(string tcGrupoDestino)
69  {
70  _GrupoDestino = tcGrupoDestino;
71 
72  DeserializarJSONs();
73 
74  if (multiplesGrupos)
75  {
76  var usuariosUnificadosDestino = _dtUsuarios
77  .AsEnumerable()
78  .Where(r => !string.IsNullOrWhiteSpace(r.Field<string>("idusuario")));
79 
80  if (usuariosUnificadosDestino.Count() > 0)
81  {
82  //Existen usuarios unificados en destino
83  ProcesosRevisionUsuarios();
84  }
85  else
86  {
87  //No existen usuarios unificados en destino
88  NingunUsuarioUnificadoDestino();
89  }
90  }
91  else
92  {
93  //Task 203077: Un único grupo en la instalación destino
94  ProcesoRevisionUsuarioUnicoGrupo();
95  }
96  }
97 
101  private void NingunUsuarioUnificadoDestino()
102  {
103  //Borrar idusuario y poner cloudId a false en todos los usuarios
104  string lcSql = "UPDATE " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS") + " SET idusuario = " + DB.SQLString("") + ", cloudid = 0 ";
105  DB.SQLExec(lcSql);
106  }
107 
111  private void ProcesosRevisionUsuarios()
112  {
113  DataTable ldtUsuarios = new DataTable();
114 
115  string lcSql = "SELECT codigo, nombre, idusuario, cloudid FROM " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS");
116  DB.SQLExec(lcSql, ref ldtUsuarios);
117  if (ldtUsuarios != null && ldtUsuarios.Rows.Count > 0)
118  {
119  //Recorremos los usuarios restaurados que son los que venían en la copia y comprobamos con los usuarios destino
120  foreach (DataRow ldr in ldtUsuarios.Rows)
121  {
122  var usuarioExiste = _dtUsuarios
123  .AsEnumerable()
124  .Where(r => r.Field<object>("codigo") != null && r.Field<object>("codigo") != DBNull.Value && r.Field<string>("codigo").Trim() == Convert.ToString(ldr["codigo"]).Trim());
125  if (usuarioExiste.Count() > 0)
126  {
127  //El usuario existe en destino
128  UsuarioExisteDestino(ldr);
129  }
130  else
131  {
132  //Bug Comprobar si el usuario existe en otros grupos de la instalación sin unificar
133  if (ComprobarUsuarioExisteOtrosGrupos(ldr))
134  {
135  UsuarioExisteOtrosGrupos(ldr);
136  }
137  else
138  {
139  //El usuario no existe en destino
140  UsuarioNOExisteDestino(ldr);
141  }
142  }
143  }
144  }
145 
146  //Revisión caso especial de usuarios que existan en destino y están unificados pero no existen en la copia
147  var usuariosUnificadosDestino = _dtUsuarios
148  .AsEnumerable()
149  .Where(r => !string.IsNullOrWhiteSpace(r.Field<string>("idusuario"))).ToList();
150 
151  foreach (DataRow ldr in usuariosUnificadosDestino)
152  {
153  DataRow[] usuario = ldtUsuarios.Select("codigo = '" + ldr["codigo"] + "'");
154  if (usuario.Length == 0)
155  {
156  //Si usuario existe en destino y está unificado pero no existe en origen
157  UsuarioExisteDestinoNOOrigen(ldr);
158  }
159  }
160 
161  //Bug 201786: Revision caso especial (y raro) que no existe en origen y en destino existe unificado pero no está el registro de usuario en la base de datos destino
162  //esto solo puede pasar si están mal los datos en destino, pero mediante esta comprobacion lo arreglaremos
163  var usuariosUnificadosDestinoFaltaUsuario = _dtUsuarios
164  .AsEnumerable()
165  .Where(r => r.Field<object>("codigo") == null || r.Field<object>("codigo") == DBNull.Value).ToList();
166  foreach (DataRow ldr in usuariosUnificadosDestinoFaltaUsuario)
167  {
168  //Obtener los datos de otro grupo
169  List<DataRow> usuarioDestino;
170  if (ComprobarOtrosGruposIdUsuario("", Convert.ToString(ldr["idusuario_uniuser"]).Trim(), out usuarioDestino))
171  {
172  DataTable ldtTemp = new DataTable();
173  lcSql = "SELECT * FROM " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS") + " WHERE codigo = " + DB.SQLString(Convert.ToString(usuarioDestino[0]["codigo"]).Trim());
174  DB.SQLExec(lcSql, ref ldtTemp);
175 
176  //Bug 203626: Mirar si no lo hemos insertado ya antes durante el proceso: en tal caso ya no tenemos que volverlo a insertar con el 0 porque realmente existía y el proceso ya lo ha arreglado
177  //sólo insertamos aquí y con accesogrup a 0 si en todo el proceso anterior no se había insertado
178  if (ldtTemp != null && ldtTemp.Rows.Count == 0)
179  {
180  UnificarUsuario(Convert.ToString(usuarioDestino[0]["codigo"]).Trim(), usuarioDestino, false, 0);
181  }
182  }
183  }
184  }
185 
190  private void UsuarioExisteDestino(DataRow ldr)
191  {
192  //Filtrar DataTable por el usuario que queremos comprobar
193  List<DataRow> usuarioDestino = _dtUsuarios
194  .AsEnumerable()
195  .Where(r => r.Field<object>("codigo") != null && r.Field<object>("codigo") != DBNull.Value && r.Field<string>("codigo").Trim() == Convert.ToString(ldr["codigo"]).Trim()).ToList();
196 
197  if (string.IsNullOrWhiteSpace(Convert.ToString(usuarioDestino[0]["idusuario"])))
198  //&& !string.IsNullOrWhiteSpace(Convert.ToString(ldr["idusuario"]))) //Es el mismo caso si está unificado en copia o no, quien manda es NO unificado en destino
199  {
200  //Unificado en copia y en destino no
201  //No unificado en copia y en destino no
202  LimpiarDatosUnificacionUsuario(Convert.ToString(ldr["codigo"]).Trim());
203  }
204  else if (!string.IsNullOrWhiteSpace(Convert.ToString(usuarioDestino[0]["idusuario"])))
205  //&& string.IsNullOrWhiteSpace(Convert.ToString(ldr["idusuario"]))) //Es el mismo caso unificado en copia o no, quien manda es unificado en destino
206  {
207  //No unificado en copia y en destino sí
208  //Sí Unificado en copia y en destino sí
209  //Añadimos un parámetro para indicar si estaba unificado en copia o no
210  UnificarUsuario(Convert.ToString(ldr["codigo"]).Trim(), usuarioDestino, !string.IsNullOrWhiteSpace(Convert.ToString(ldr["idusuario"])));
211  }
212  }
213 
218  private void UsuarioExisteOtrosGrupos(DataRow ldr)
219  {
220  //Task 203096: En condiciones normales si existe en otros grupos y en destino no se limpian los datos porque está sin unificar.
221  //Pero puede darse el caso que estuvieran mal los datos y en destino no existiera el registro pero si estuviera unificado (uniusers y otros grupos).
222  //Comprobamos si en uniusers tenemos un idusuario que en otros grupos se corresponda con este código. Si lo encontramos lo creamos unificado y
223  //con los datos que obtenemos de ese otro grupo. En caso contrario como siempre limpiamos los datos
224  List<DataRow> usuarioDestino;
225  if (ComprobarOtrosGruposIdUsuario(Convert.ToString(ldr["codigo"]).Trim(), "", out usuarioDestino))
226  {
227  UnificarUsuario(Convert.ToString(ldr["codigo"]).Trim(), usuarioDestino, !string.IsNullOrWhiteSpace(Convert.ToString(ldr["idusuario"])));
228  }
229  else
230  {
231  //Como el usuario existe en otros grupos pero no en el actual de destino no está unificado.
232  //Hacemos el mismo proceso que cuando existe en destino pero no está unificado. Limpiamos datos de unificación si los tenía en origen
233  LimpiarDatosUnificacionUsuario(Convert.ToString(ldr["codigo"]).Trim());
234  }
235  }
236 
241  private void LimpiarDatosUnificacionUsuario(string tcUsuario)
242  {
243  //Borrar idusuario y poner cloudId a false en dicho usuario
244  string lcSql = "UPDATE " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS") + " SET idusuario = " + DB.SQLString("") + ", cloudid = 0 " +
245  "WHERE codigo = " + DB.SQLString(tcUsuario);
246  DB.SQLExec(lcSql);
247  }
248 
256  private void UnificarUsuario(string tcUsuario, List<DataRow> usuarioDestino, bool tbUnificadoCopia, int nivelAccesogrup = 10)
257  {
258  //Task 202999: sobreescribir todos los campos con los del usuario destino
259  GuardarDatosUsuarioDestino(tcUsuario, usuarioDestino);
260 
261  string lcSql = "DELETE FROM " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") + " WHERE idsage50 = " + DB.SQLString(idSage50) +
262  " AND grupo = " + DB.SQLString(_GrupoDestino) + " AND usuario = " + DB.SQLString(tcUsuario);
263  DB.SQLExec(lcSql);
264 
265  string lcNivelAcceso;
266  if (tbUnificadoCopia)
267  {
268  List<DataRow> registroAccesogrup = _dtAccesoGrup
269  .AsEnumerable()
270  .Where(r => r.Field<string>("usuario").Trim() == tcUsuario).ToList();
271  if (registroAccesogrup != null && registroAccesogrup.Count() > 0)
272  {
273  if (nivelAccesogrup == 10)
274  {
275  lcNivelAcceso = Convert.ToString(registroAccesogrup[0]["nivel"]);
276  }
277  else
278  {
279  lcNivelAcceso = Convert.ToString(nivelAccesogrup);
280  }
281  //Insertar registro en AccesoGrup
282  lcSql = "INSERT INTO " + DB.SQLDatabase("EUROWINSYS", "ACCESOGRUP") + " (idsage50, grupo, modulo, usuario, nivel) " +
283  "VALUES (" + DB.SQLString(idSage50) + ", " + DB.SQLString(_GrupoDestino) + ", " + DB.SQLString("SEL_GRUPO") +
284  ", " + DB.SQLString(tcUsuario) + ", " + lcNivelAcceso + ")";
285  DB.SQLExec(lcSql);
286  }
287  }
288  else
289  {
290  if (nivelAccesogrup == 10)
291  {
292  lcNivelAcceso = "2";
293  }
294  else
295  {
296  lcNivelAcceso = Convert.ToString(nivelAccesogrup);
297  }
298  lcSql = "INSERT INTO " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") + " (idsage50, grupo, modulo, usuario, nivel) " +
299  " VALUES(" + DB.SQLString(idSage50) + ", " + DB.SQLString(_GrupoDestino) + ", " + DB.SQLString("SEL_GRUPO") + ", " + DB.SQLString(tcUsuario) + ", " + lcNivelAcceso + ")";
300  DB.SQLExec(lcSql);
301  }
302  }
303 
304  //Task 202999: sobreescribir todos los campos con los del usuario destino
305  private void GuardarDatosUsuarioDestino(string tcUsuario, List<DataRow> usuarioDestino, string tcGrupo = "")
306  {
307  string lcGrupoDestino;
308  if (!string.IsNullOrWhiteSpace(tcGrupo))
309  {
310  lcGrupoDestino = tcGrupo;
311  }
312  else
313  {
314  lcGrupoDestino = _GrupoDestino;
315  }
316 
317  DataTable ldtTemp = new DataTable();
318  string lcSql = "SELECT * FROM " + DB.SQLDatabaseReal("COMU" + lcGrupoDestino, "USUARIOS") + " WHERE codigo = " + DB.SQLString(tcUsuario);
319  DB.SQLExec(lcSql, ref ldtTemp);
320 
321  if (ldtTemp == null || ldtTemp.Rows.Count == 0)
322  {
323  //Puede que no exista preparar insert (cuando estamos arreglando datos y obteniendo el usuario de otro grupo
324  lcSql = "INSERT INTO " + DB.SQLDatabaseReal("COMU" + lcGrupoDestino, "USUARIOS") +
325  "(codigo, idusuario, cloudid, nombre, clave, r_pantalla, r_usuario, r_expulsar, entrada, mensaje, nombremail, mail, smtp, autenticado, usermail, clavemail, firma," +
326  " topinfo, leftinfo, maxinfo, verinfo, pag, propied, favoritos, pregunta, respuesta, ok, cifradossl, smtpport, ultopcion, fec_valida, dominio, usr_real," +
327  " pep, ult_fecha, terminal, dashboard, clientid, refreshtoken, resourceids, usercalendars, foto, guid_id, created, modified" +
328  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VISIBLE") ? ", visible" : "") +
329  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOVICAP") ? ", novicap" : "") +
330  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOMBREPER") ? ", nombreper" : "") +
331  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "APELLIDOS") ? ", apellidos" : "") +
332  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "TELEFONO") ? ", telefono" : "") +
333  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FECHAPWD") ? ", fechapwd" : "") +
334  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VALIDEZPWD") ? ", validezpwd" : "") +
335  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "OLDPWDS") ? ", oldpwds" : "") +
336  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CONFNOT") ? ", confnot" : "") +
337  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "ETICOMU") ? ", eticomu" : "") +
338  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOCAR") ? ", fbloqnocar" : "") +
339  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOEMA") ? ", fbloqnoema" : "") +
340  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUCAR") ? ", nocomucar" : "") +
341  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUEMA") ? ", nocomuema" : "") +
342  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUOBS") ? ", nocomuobs" : "") +
343  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CODPOST") ? ", codpost" : "") +
344  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "DIRECCION") ? ", direccion" : "") +
345  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PAIS") ? ", pais" : "") +
346  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "POBLACION") ? ", poblacion" : "") +
347  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PROVINCIA") ? ", provincia" : "") +
348  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "SINCUENTA") ? ", sincuenta" : "") +
349  ") VALUES (" +
350  DB.SQLString(tcUsuario) +
351  ", " + DB.SQLString(Convert.ToString(usuarioDestino[0]["idusuario"]).Trim()) +
352  ", 1" +
353  ", " + DB.SQLString(usuarioDestino[0]["nombre"]) +
354  ", " + DB.SQLString(usuarioDestino[0]["clave"]) +
355  ", " + DB.SQLString(usuarioDestino[0]["r_pantalla"]) +
356  ", " + DB.SQLString(usuarioDestino[0]["r_usuario"]) +
357  ", " + DB.SQLString(usuarioDestino[0]["r_expulsar"]) +
358  ", " + DB.SQLString(usuarioDestino[0]["entrada"]) +
359  ", " + DB.SQLString(usuarioDestino[0]["mensaje"]) +
360  ", " + DB.SQLString(usuarioDestino[0]["nombremail"]) +
361  ", " + DB.SQLString(usuarioDestino[0]["mail"]) +
362  ", " + DB.SQLString(usuarioDestino[0]["smtp"]) +
363  ", " + DB.SQLString(usuarioDestino[0]["autenticado"]) +
364  ", " + DB.SQLString(usuarioDestino[0]["usermail"]) +
365  ", " + DB.SQLString(usuarioDestino[0]["clavemail"]) +
366  ", " + DB.SQLString(usuarioDestino[0]["firma"]) +
367  ", " + DB.SQLString(usuarioDestino[0]["topinfo"]) +
368  ", " + DB.SQLString(usuarioDestino[0]["leftinfo"]) +
369  ", " + DB.SQLString(usuarioDestino[0]["maxinfo"]) +
370  ", " + DB.SQLString(usuarioDestino[0]["verinfo"]) +
371  ", " + DB.SQLString(usuarioDestino[0]["pag"]) +
372  ", " + DB.SQLString(usuarioDestino[0]["propied"]) +
373  ", " + DB.SQLString(usuarioDestino[0]["favoritos"]) +
374  ", " + DB.SQLString(usuarioDestino[0]["pregunta"]) +
375  ", " + DB.SQLString(usuarioDestino[0]["respuesta"]) +
376  ", " + DB.SQLString(usuarioDestino[0]["ok"]) +
377  ", " + DB.SQLString(usuarioDestino[0]["cifradossl"]) +
378  ", " + DB.SQLString(usuarioDestino[0]["smtpport"]) +
379  ", " + DB.SQLString(usuarioDestino[0]["ultopcion"]) +
380  ", " + DB.SQLString(usuarioDestino[0]["fec_valida"]) +
381  ", " + DB.SQLString(usuarioDestino[0]["dominio"]) +
382  ", " + DB.SQLString(usuarioDestino[0]["usr_real"]) +
383  ", " + DB.SQLString(usuarioDestino[0]["pep"]) +
384  ", " + DB.SQLString(usuarioDestino[0]["ult_fecha"]) +
385  ", " + DB.SQLString(usuarioDestino[0]["terminal"]) +
386  ", " + DB.SQLString(usuarioDestino[0]["dashboard"]) +
387  ", " + DB.SQLString(usuarioDestino[0]["clientid"]) +
388  ", " + DB.SQLString(usuarioDestino[0]["refreshtoken"]) +
389  ", " + DB.SQLString(usuarioDestino[0]["resourceids"]) +
390  ", " + DB.SQLString(usuarioDestino[0]["usercalendars"]) +
391  ", " + DB.SQLString(usuarioDestino[0]["foto"]) +
392  ", " + DB.SQLString(usuarioDestino[0]["guid_id"]) +
393  ", " + DB.SQLString(usuarioDestino[0]["created"]) +
394  ", " + DB.SQLString(usuarioDestino[0]["modified"]) +
395  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VISIBLE") ? ", " + DB.SQLString(usuarioDestino[0]["visible"]) : "") +
396  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOVICAP") ? ", " + DB.SQLString(usuarioDestino[0]["novicap"]) : "") +
397  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOMBREPER") ? ", " + DB.SQLString(usuarioDestino[0]["nombreper"]) : "") +
398  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "APELLIDOS") ? ", " + DB.SQLString(usuarioDestino[0]["apellidos"]) : "") +
399  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "TELEFONO") ? ", " + DB.SQLString(usuarioDestino[0]["telefono"]) : "") +
400  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FECHAPWD") ? ", " + DB.SQLString(usuarioDestino[0]["fechapwd"]) : "") +
401  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VALIDEZPWD") ? ", " + DB.SQLString(usuarioDestino[0]["validezpwd"]) : "") +
402  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "OLDPWDS") ? ", " + DB.SQLString(usuarioDestino[0]["oldpwds"]) : "") +
403  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CONFNOT") ? ", " + DB.SQLString(usuarioDestino[0]["confnot"]) : "") +
404  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "ETICOMU") ? ", " + DB.SQLString(usuarioDestino[0]["eticomu"]) : "") +
405  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOCAR") ? ", " + DB.SQLString(usuarioDestino[0]["fbloqnocar"]) : "") +
406  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOEMA") ? ", " + DB.SQLString(usuarioDestino[0]["fbloqnoema"]) : "") +
407  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUCAR") ? ", " + DB.SQLString(usuarioDestino[0]["nocomucar"]) : "") +
408  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUEMA") ? ", " + DB.SQLString(usuarioDestino[0]["nocomuema"]) : "") +
409  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUOBS") ? ", " + DB.SQLString(usuarioDestino[0]["nocomuobs"]) : "") +
410  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CODPOST") ? ", " + DB.SQLString(usuarioDestino[0]["codpost"]) : "") +
411  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "DIRECCION") ? ", " + DB.SQLString(usuarioDestino[0]["direccion"]) : "") +
412  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PAIS") ? ", " + DB.SQLString(usuarioDestino[0]["pais"]) : "") +
413  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "POBLACION") ? ", " + DB.SQLString(usuarioDestino[0]["poblacion"]) : "") +
414  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PROVINCIA") ? ", " + DB.SQLString(usuarioDestino[0]["provincia"]) : "") +
415  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "SINCUENTA") ? ", " + DB.SQLString(usuarioDestino[0]["sincuenta"]) : "") +
416  ")";
417 
418  DB.SQLExec(lcSql);
419  }
420  else
421  {
422  lcSql = "UPDATE " + DB.SQLDatabaseReal("COMU" + lcGrupoDestino, "USUARIOS") + " SET idusuario = " + DB.SQLString(Convert.ToString(usuarioDestino[0]["idusuario"]).Trim()) +
423  ", cloudid = 1 " +
424  ", nombre = " + DB.SQLString(usuarioDestino[0]["nombre"]) +
425  ", clave = " + DB.SQLString(usuarioDestino[0]["clave"]) +
426  ", r_pantalla = " + DB.SQLString(usuarioDestino[0]["r_pantalla"]) +
427  ", r_usuario = " + DB.SQLString(usuarioDestino[0]["r_usuario"]) +
428  ", r_expulsar = " + DB.SQLString(usuarioDestino[0]["r_expulsar"]) +
429  ", entrada = " + DB.SQLString(usuarioDestino[0]["entrada"]) +
430  ", mensaje = " + DB.SQLString(usuarioDestino[0]["mensaje"]) +
431  ", nombremail = " + DB.SQLString(usuarioDestino[0]["nombremail"]) +
432  ", mail = " + DB.SQLString(usuarioDestino[0]["mail"]) +
433  ", smtp = " + DB.SQLString(usuarioDestino[0]["smtp"]) +
434  ", autenticado = " + DB.SQLString(usuarioDestino[0]["autenticado"]) +
435  ", usermail = " + DB.SQLString(usuarioDestino[0]["usermail"]) +
436  ", clavemail = " + DB.SQLString(usuarioDestino[0]["clavemail"]) +
437  ", firma = " + DB.SQLString(usuarioDestino[0]["firma"]) +
438  ", topinfo = " + DB.SQLString(usuarioDestino[0]["topinfo"]) +
439  ", leftinfo = " + DB.SQLString(usuarioDestino[0]["leftinfo"]) +
440  ", maxinfo = " + DB.SQLString(usuarioDestino[0]["maxinfo"]) +
441  ", verinfo = " + DB.SQLString(usuarioDestino[0]["verinfo"]) +
442  ", pag = " + DB.SQLString(usuarioDestino[0]["pag"]) +
443  ", propied = " + DB.SQLString(usuarioDestino[0]["propied"]) +
444  ", favoritos = " + DB.SQLString(usuarioDestino[0]["favoritos"]) +
445  ", pregunta = " + DB.SQLString(usuarioDestino[0]["pregunta"]) +
446  ", respuesta = " + DB.SQLString(usuarioDestino[0]["respuesta"]) +
447  ", ok = " + DB.SQLString(usuarioDestino[0]["ok"]) +
448  ", cifradossl = " + DB.SQLString(usuarioDestino[0]["cifradossl"]) +
449  ", smtpport = " + DB.SQLString(usuarioDestino[0]["smtpport"]) +
450  ", ultopcion = " + DB.SQLString(usuarioDestino[0]["ultopcion"]) +
451  ", fec_valida = " + DB.SQLString(usuarioDestino[0]["fec_valida"]) +
452  ", dominio = " + DB.SQLString(usuarioDestino[0]["dominio"]) +
453  ", usr_real = " + DB.SQLString(usuarioDestino[0]["usr_real"]) +
454  ", pep = " + DB.SQLString(usuarioDestino[0]["pep"]) +
455  ", ult_fecha = " + DB.SQLString(usuarioDestino[0]["ult_fecha"]) +
456  ", terminal = " + DB.SQLString(usuarioDestino[0]["terminal"]) +
457  ", dashboard = " + DB.SQLString(usuarioDestino[0]["dashboard"]) +
458  ", clientid = " + DB.SQLString(usuarioDestino[0]["clientid"]) +
459  ", refreshtoken = " + DB.SQLString(usuarioDestino[0]["refreshtoken"]) +
460  ", resourceids = " + DB.SQLString(usuarioDestino[0]["resourceids"]) +
461  ", usercalendars = " + DB.SQLString(usuarioDestino[0]["usercalendars"]) +
462  ", foto = " + DB.SQLString(usuarioDestino[0]["foto"]) +
463  ", guid_id = " + DB.SQLString(usuarioDestino[0]["guid_id"]) +
464  ", created = " + DB.SQLString(usuarioDestino[0]["created"]) +
465  ", modified = " + DB.SQLString(usuarioDestino[0]["modified"]) +
466  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VISIBLE") ? ", visible = " + DB.SQLString(usuarioDestino[0]["visible"]) : "") +
467  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOVICAP") ? ", novicap = " + DB.SQLString(usuarioDestino[0]["novicap"]) : "") +
468  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOMBREPER") ? ", nombreper = " + DB.SQLString(usuarioDestino[0]["nombreper"]) : "") +
469  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "APELLIDOS") ? ", apellidos = " + DB.SQLString(usuarioDestino[0]["apellidos"]) : "") +
470  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "TELEFONO") ? ", telefono = " + DB.SQLString(usuarioDestino[0]["telefono"]) : "") +
471  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FECHAPWD") ? ", fechapwd = " + DB.SQLString(usuarioDestino[0]["fechapwd"]) : "") +
472  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "VALIDEZPWD") ? ", validezpwd = " + DB.SQLString(usuarioDestino[0]["validezpwd"]) : "") +
473  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "OLDPWDS") ? ", oldpwds = " + DB.SQLString(usuarioDestino[0]["oldpwds"]) : "") +
474  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CONFNOT") ? ", confnot = " + DB.SQLString(usuarioDestino[0]["confnot"]) : "") +
475  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "ETICOMU") ? ", eticomu = " + DB.SQLString(usuarioDestino[0]["eticomu"]) : "") +
476  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOCAR") ? ", fbloqnocar = " + DB.SQLString(usuarioDestino[0]["fbloqnocar"]) : "") +
477  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "FBLOQNOEMA") ? ", fbloqnoema = " + DB.SQLString(usuarioDestino[0]["fbloqnoema"]) : "") +
478  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUCAR") ? ", nocomucar = " + DB.SQLString(usuarioDestino[0]["nocomucar"]) : "") +
479  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUEMA") ? ", nocomuema = " + DB.SQLString(usuarioDestino[0]["nocomuema"]) : "") +
480  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "NOCOMUOBS") ? ", nocomuobs = " + DB.SQLString(usuarioDestino[0]["nocomuobs"]) : "") +
481  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "CODPOST") ? ", codpost = " + DB.SQLString(usuarioDestino[0]["codpost"]) : "") +
482  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "DIRECCION") ? ", direccion = " + DB.SQLString(usuarioDestino[0]["direccion"]) : "") +
483  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PAIS") ? ", pais = " + DB.SQLString(usuarioDestino[0]["pais"]) : "") +
484  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "POBLACION") ? ", poblacion = " + DB.SQLString(usuarioDestino[0]["poblacion"]) : "") +
485  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "PROVINCIA") ? ", provincia = " + DB.SQLString(usuarioDestino[0]["provincia"]) : "") +
486  (DB.SQLExisteCampo("COMUNES", "USUARIOS", "SINCUENTA") ? ", sincuenta = " + DB.SQLString(usuarioDestino[0]["sincuenta"]) : "") +
487  " WHERE codigo = " + DB.SQLString(tcUsuario);
488  DB.SQLExec(lcSql);
489  }
490  }
491 
500  private bool ComprobarOtrosGruposIdUsuario(string tcCodigoUsuario, string tcIdUsuario, out List<DataRow> usuarioDestino)
501  {
502  DataTable ldtTemp = new DataTable();
503  if (_dtOtrosGruposUsers == null)
504  {
505  ObtenerUsuariosOtrosGrupos();
506  }
507 
508  if (_dtOtrosGruposUsers != null)
509  {
510  //Task 203096: Buscamos los usuarios que tienen nulos los campos menos idusuario
511  var usuariosNulos = _dtUsuarios
512  .AsEnumerable()
513  .Where(r => r.Field<object>("codigo") == null || r.Field<object>("codigo") == DBNull.Value);
514  foreach (DataRow ldr in usuariosNulos)
515  {
516  EnumerableRowCollection<DataRow> usuarioExiste = null;
517  if (!string.IsNullOrWhiteSpace(tcCodigoUsuario))
518  {
519  usuarioExiste = _dtOtrosGruposUsers
520  .AsEnumerable()
521  .Where(r => r.Field<string>("usuario").Trim() == tcCodigoUsuario && r.Field<string>("idusuario").Trim() == Convert.ToString(ldr["idusuario_uniuser"]).Trim());
522  }
523  else if (!string.IsNullOrWhiteSpace(tcIdUsuario))
524  {
525  usuarioExiste = _dtOtrosGruposUsers
526  .AsEnumerable()
527  .Where(r => r.Field<string>("idusuario").Trim() == tcIdUsuario);
528  }
529  if (usuarioExiste != null && usuarioExiste.Count() > 0)
530  {
531  string lcGrupo = Convert.ToString(usuarioExiste.First()["grupo"]).Trim();
532  string lcUsuario = Convert.ToString(usuarioExiste.First()["usuario"]).Trim();
533  string lcIdusuario = Convert.ToString(usuarioExiste.First()["idusuario"]).Trim();
534 
535  string lcSql = "SELECT * FROM " + DB.SQLDatabaseReal("COMU" + lcGrupo, "USUARIOS") + " WHERE codigo = " + DB.SQLString(lcUsuario);
536  DB.SQLExec(lcSql, ref ldtTemp);
537  if (ldtTemp != null && ldtTemp.Rows.Count > 0)
538  {
539  usuarioDestino = new List<DataRow>() { ldtTemp.Rows[0] };
540  return true;
541  }
542  }
543  }
544  }
545 
546  usuarioDestino = null;
547  return false;
548  }
549 
553  private void DeserializarJSONs()
554  {
555  string lcTempJson;
556  try
557  {
558  if (Directory.Exists(_RutaOrigenTempRestauracion + "\\CLOUDID"))
559  {
560  if (File.Exists(_RutaOrigenTempRestauracion + "\\CLOUDID\\uniusers.json"))
561  {
562  lcTempJson = System.IO.File.ReadAllText(_RutaOrigenTempRestauracion + "\\CLOUDID\\uniusers.json");
563  _dtUniusers = JsonConvert.DeserializeObject<DataTable>(lcTempJson);
564  }
565  if (File.Exists(_RutaOrigenTempRestauracion + "\\CLOUDID\\accesogrup.json"))
566  {
567  lcTempJson = System.IO.File.ReadAllText(_RutaOrigenTempRestauracion + "\\CLOUDID\\accesogrup.json");
568  _dtAccesoGrup = JsonConvert.DeserializeObject<DataTable>(lcTempJson);
569  }
570  }
571  }
572  catch(Exception e)
573  {
574  //Si se produjera una excepcion deserializando los JSON, nos aseguramos que los datatables queden a null para gestionarlo más tarde
575  _dtUniusers = null;
576  _dtAccesoGrup = null;
577  DB.Registrar_Error(e);
578  }
579  }
580 
585  private void UsuarioNOExisteDestino(DataRow ldr)
586  {
587  string lcSql;
588 
589  //Comprobamos si en origen estaba unificado, sino no es necesario hacer nada (se habrá restaurado ya solo en este grupo y sin idusuario)
590  if (string.IsNullOrWhiteSpace(Convert.ToString(ldr["idusuario"])))
591  return;
592 
593  //Si está unificado obtenemos el idUsuario de la copia para este usuario y el código
594  string lcIdUsuario = Convert.ToString(ldr["idusuario"]).Trim();
595  string lcCodigoUsuario = Convert.ToString(ldr["codigo"]).Trim();
596  string lcIdUsuarioNuevo = Guid.NewGuid().ToString().ToUpper();
597 
598  //Obtener datos de uniusers del JSON
599  List<DataRow> registroUniuser = _dtUniusers
600  .AsEnumerable()
601  .Where(r => r.Field<string>("idusuario").Trim() == lcIdUsuario).ToList();
602  if (registroUniuser != null && registroUniuser.Count() > 0)
603  {
604  //Insertar registro en uniusers
605  lcSql = "INSERT INTO " + DB.SQLDatabaseReal("EUROWINSYS", "UNIUSERS") + " (idsage50, idusuario, idcloudid, email, rol) " +
606  "VALUES (" + DB.SQLString(idSage50) + ", " + DB.SQLString(lcIdUsuarioNuevo) + ", " + DB.SQLString(registroUniuser[0]["idcloudid"])
607  + ", " + DB.SQLString(registroUniuser[0]["email"]) + ", " + registroUniuser[0]["rol"] + ")";
608  DB.SQLExec(lcSql);
609 
610  //Actualizar idusuario regenerado en comunes!usuarios del grupo restaurado
611  lcSql = "UPDATE " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS") + " SET idusuario = " + DB.SQLString(lcIdUsuarioNuevo) + ", cloudid = 1 " +
612  "WHERE codigo = " + DB.SQLString(lcCodigoUsuario);
613  DB.SQLExec(lcSql);
614 
615  //Consultar registro en accesogrup del Json y insertarlo en accesogrup de esta instalacion
616  List<DataRow> registroAccesogrup = _dtAccesoGrup
617  .AsEnumerable()
618  .Where(r => r.Field<string>("usuario").Trim() == lcCodigoUsuario).ToList();
619  if (registroAccesogrup != null && registroAccesogrup.Count() > 0)
620  {
621  //Insertar registro en AccesoGrup
622  lcSql = "INSERT INTO " + DB.SQLDatabase("EUROWINSYS", "ACCESOGRUP") + " (idsage50, grupo, modulo, usuario, nivel) " +
623  "VALUES (" + DB.SQLString(idSage50) + ", " + DB.SQLString(_GrupoDestino) + ", " + DB.SQLString("SEL_GRUPO") +
624  ", " + DB.SQLString(lcCodigoUsuario) + ", " + registroAccesogrup[0]["nivel"] + ")";
625  DB.SQLExec(lcSql);
626  }
627 
628  //Insertar en resto de grupos usuario y con acceso denegado
629  InsertarUsuarioOtrosGrupos(lcCodigoUsuario);
630  }
631  }
632 
638  private void InsertarUsuarioOtrosGrupos(string tcUsuario)
639  {
640  List<DataRow> usuarioDestino = new List<DataRow>();
641  DataTable ldtUsuario = new DataTable();
642  string lcSql = "SELECT * FROM " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS") + " WHERE codigo = " + DB.SQLString(tcUsuario);
643  DB.SQLExec(lcSql, ref ldtUsuario);
644  if (ldtUsuario != null && ldtUsuario.Rows.Count > 0)
645  {
646  usuarioDestino = new List<DataRow>() { ldtUsuario.Rows[0] };
647  }
648 
649  DataTable ldtTemp = new DataTable();
650  lcSql = "SELECT codigo, nombre FROM " + DB.SQLDatabaseReal("EUROWINSYS", "GRUPOSEMP") + " WHERE idsage50 = " + DB.SQLString(idSage50);
651  DB.SQLExec(lcSql, ref ldtTemp);
652 
653  if (ldtTemp != null && ldtTemp.Rows.Count > 0)
654  {
655  foreach (DataRow ldr in ldtTemp.Rows)
656  {
657  if (DB._SQLExisteBBDD("COMU" + ldr["codigo"]) && Convert.ToString(ldr["codigo"]).Trim() != _GrupoDestino)
658  {
659  lcSql = "INSERT INTO " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") + " (idsage50, grupo, modulo, usuario, nivel) " +
660  "VALUES(" + DB.SQLString(idSage50) + ", " + DB.SQLString(ldr["codigo"]) + ", " + DB.SQLString("SEL_GRUPO") +
661  ", " + DB.SQLString(tcUsuario) + ", 0)";
662  DB.SQLExec(lcSql);
663 
664  GuardarDatosUsuarioDestino(tcUsuario, usuarioDestino, Convert.ToString(ldr["codigo"]).Trim());
665  }
666  }
667  }
668  }
669 
674  private void UsuarioExisteDestinoNOOrigen(DataRow ldr)
675  {
676  string lcCodigoUsuario = Convert.ToString(ldr["codigo"]).Trim();
677  string lcGrupoDatosUsuario = "";
678 
679  string lcSql = "DELETE FROM " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") +
680  " WHERE idsage50 = " + DB.SQLString(idSage50) + " AND grupo = " + DB.SQLString(_GrupoDestino) + " AND modulo = " + DB.SQLString("SEL_GRUPO") +
681  " AND usuario = " + DB.SQLString(lcCodigoUsuario);
682  DB.SQLExec(lcSql);
683 
684  lcSql = "INSERT INTO " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") + " (idsage50, grupo, modulo, usuario, nivel) " +
685  "VALUES(" + DB.SQLString(idSage50) + ", " + DB.SQLString(_GrupoDestino) + ", " + DB.SQLString("SEL_GRUPO") +
686  ", " + DB.SQLString(lcCodigoUsuario) + ", 0)";
687  DB.SQLExec(lcSql);
688 
689  if (_dtOtrosGruposUsers == null)
690  {
691  ObtenerUsuariosOtrosGrupos();
692  }
693 
694  if (_dtOtrosGruposUsers != null)
695  {
696  DataRow[] ldrGrupoUser = _dtOtrosGruposUsers.Select("usuario = '" + lcCodigoUsuario + "'");
697  if (ldrGrupoUser.Length > 0)
698  lcGrupoDatosUsuario = Convert.ToString(ldrGrupoUser[0]["grupo"]);
699  }
700 
701  if (!string.IsNullOrWhiteSpace(lcGrupoDatosUsuario))
702  {
703  List<DataRow> usuarioDestino = new List<DataRow>();
704  DataTable ldtUsuario = new DataTable();
705  lcSql = "SELECT * FROM " + DB.SQLDatabaseReal("COMU" + lcGrupoDatosUsuario, "USUARIOS") + " WHERE codigo = " + DB.SQLString(lcCodigoUsuario);
706  DB.SQLExec(lcSql, ref ldtUsuario);
707  if (ldtUsuario != null && ldtUsuario.Rows.Count > 0)
708  {
709  usuarioDestino = new List<DataRow>() { ldtUsuario.Rows[0] };
710  GuardarDatosUsuarioDestino(lcCodigoUsuario, usuarioDestino);
711  }
712  }
713  }
714 
720  private bool ComprobarUsuarioExisteOtrosGrupos(DataRow ldr)
721  {
722  if (_dtOtrosGruposUsers == null)
723  {
724  ObtenerUsuariosOtrosGrupos();
725  }
726 
727  if (_dtOtrosGruposUsers != null)
728  {
729  var usuarioExiste = _dtOtrosGruposUsers
730  .AsEnumerable()
731  .Where(r => r.Field<string>("usuario").Trim() == Convert.ToString(ldr["codigo"]).Trim());
732  return usuarioExiste.Count() > 0;
733  }
734  else
735  return false;
736 
737  }
738 
742  private void ObtenerUsuariosOtrosGrupos()
743  {
744  _dtOtrosGruposUsers = new DataTable();
745  _dtOtrosGruposUsers.Columns.Add("grupo", typeof(string));
746  _dtOtrosGruposUsers.Columns.Add("usuario", typeof(string));
747  _dtOtrosGruposUsers.Columns.Add("idusuario", typeof(string));
748  DataTable ldtTemp = new DataTable();
749  DataTable ldtTemp2;
750  string lcSql = "SELECT codigo, nombre FROM " + DB.SQLDatabaseReal("EUROWINSYS", "GRUPOSEMP") + " WHERE idsage50 = " + DB.SQLString(idSage50) +
751  " AND codigo <> " + DB.SQLString(_GrupoDestino);
752  DB.SQLExec(lcSql, ref ldtTemp);
753  if (ldtTemp != null && ldtTemp.Rows.Count > 0)
754  {
755  foreach (DataRow ldr in ldtTemp.Rows)
756  {
757  if (DB._SQLExisteBBDD("COMU" + Convert.ToString(ldr["codigo"]).Trim()))
758  {
759  ldtTemp2 = new DataTable();
760  lcSql = "SELECT codigo, idusuario FROM " + DB.SQLDatabaseReal("COMU" + Convert.ToString(ldr["codigo"]).Trim(), "USUARIOS");
761  DB.SQLExec(lcSql, ref ldtTemp2);
762  if (ldtTemp != null && ldtTemp2.Rows.Count > 0)
763  {
764  foreach (DataRow ldr2 in ldtTemp2.Rows)
765  {
766  DataRow _fila = _dtOtrosGruposUsers.NewRow();
767  _fila["grupo"] = Convert.ToString(ldr["codigo"]).Trim();
768  _fila["usuario"] = Convert.ToString(ldr2["codigo"]).Trim();
769  _fila["idusuario"] = Convert.ToString(ldr2["idusuario"]).Trim();
770  _dtOtrosGruposUsers.Rows.Add(_fila);
771  }
772  }
773  }
774  }
775  }
776  }
777 
781  private void ProcesoRevisionUsuarioUnicoGrupo()
782  {
783  DataTable ldtUsuarios = new DataTable();
784 
785  //Limpiar tablas UNIUSERS y ACCESOGRUP (sólo tenemos un grupo y rellenaremos con nuevos datos de la restauración)
786  string lcSql = "DELETE FROM " + DB.SQLDatabaseReal("EUROWINSYS", "UNIUSERS") + " WHERE idsage50 = " + DB.SQLString(idSage50);
787  DB.SQLExec(lcSql);
788  lcSql = "DELETE FROM " + DB.SQLDatabaseReal("EUROWINSYS", "ACCESOGRUP") + " WHERE idsage50 = " + DB.SQLString(idSage50);
789  DB.SQLExec(lcSql);
790 
791  lcSql = "SELECT codigo, nombre, idusuario, cloudid FROM " + DB.SQLDatabaseReal("COMU" + _GrupoDestino, "USUARIOS");
792  DB.SQLExec(lcSql, ref ldtUsuarios);
793  if (ldtUsuarios != null && ldtUsuarios.Rows.Count > 0)
794  {
795  //Recorremos los usuarios restaurados que son los que venían en la copia y lanzamos el método de que no existe en destino
796  //para que regenere el idusuario y guarde datos en uniusers y accesogrup
797  foreach (DataRow ldr in ldtUsuarios.Rows)
798  {
799  UsuarioNOExisteDestino(ldr);
800  }
801  }
802  }
803  }
804 }
Task 197705: Clase para gestionar los procesos específicos de copia de seguridad que tenemos con Clou...
static string _CodigoGrupoActual()
Obtención del código de grupo actual
Definition: GruposEmp.cs:1744
Clase para el control de grupos de empresa (nuevo enfoque en Sage50, desaparece el multiempresa...
Definition: GruposEmp.cs:40