2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
15 using System.Text.RegularExpressions;
28 public static class NETVFP
37 [DllImport(
"user32.dll")]
38 public static extern IntPtr RegisterWindowMessageW([MarshalAs(UnmanagedType.LPTStr)]String lpString);
48 [DllImport(
"user32.dll")]
49 public static extern int SendMessage(IntPtr hWnd, IntPtr Msg,
int wParam,
int lParam);
59 [DllImport(
"user32.dll")]
60 public static extern int PostMessage(IntPtr hWnd, IntPtr Msg,
int wParam,
int lParam);
70 [DllImport(
"user32.dll")]
71 public static extern sbyte GetMessage(out Message lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
78 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Auto)]
79 public static extern ushort GlobalAddAtom(
string lpString);
86 [DllImport(
"kernel32.dll", SetLastError =
true, ExactSpelling =
true)]
87 public static extern ushort GlobalDeleteAtom(ushort nAtom);
96 [DllImport(
"kernel32.dll", SetLastError =
true, CharSet = CharSet.Auto)]
97 public static extern uint GlobalGetAtomName(ushort nAtom,
char[] lpBuffer,
int nSize);
104 [DllImport(
"user32.dll")]
105 [
return: MarshalAs(UnmanagedType.Bool)]
106 public static extern bool IsWindow(IntPtr hWnd);
114 [DllImport(
"user32.dll")]
115 public static extern bool EnableWindow(IntPtr hwnd, Boolean bEnable);
121 [DllImport(
"user32.dll")]
122 public static extern int GetForegroundWindow();
131 [DllImport(
"user32.dll")]
132 public static extern int GetWindowText(
int hWnd, StringBuilder text,
int count);
139 [DllImport(
"user32.dll")]
140 public static extern IntPtr GetTopWindow(IntPtr hWnd);
149 [DllImport(
"kernel32.dll")]
150 public static extern IntPtr CreateMutex(IntPtr lpMutexAttributes,
bool bInitialOwner,
string lpName);
157 [DllImport(
"kernel32.dll")]
158 public static extern bool ReleaseMutex(IntPtr hMutex);
167 [DllImport(
"kernel32.dll")]
168 public static extern IntPtr OpenMutex(uint dwDesiredAccess,
bool bInheritHandle,
string lpName);
175 [DllImport(
"kernel32.dll", SetLastError =
true)]
176 [
return: MarshalAs(UnmanagedType.Bool)]
177 static extern bool CloseHandle(IntPtr hObject);
187 [DllImport(
"User32.dll", CharSet = CharSet.Auto, ExactSpelling =
true)]
188 public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndParent);
197 [DllImport(
"user32.dll")]
198 public static extern int SetWindowLong(IntPtr hWnd,
int nIndex, uint dwNewLong);
205 [DllImport(
"user32.dll", CharSet = CharSet.Ansi, SetLastError =
true, ExactSpelling =
true)]
206 public static extern IntPtr SetFocus(IntPtr hwnd);
214 [DllImport(
"user32.dll")]
215 public static extern bool ShowWindowAsync(IntPtr hWnd,
int nCmdShow);
223 [DllImport(
"user32.dll", CharSet =
System.Runtime.InteropServices.CharSet.Auto)]
224 public static extern IntPtr FindWindow(
string lpClassName,
string lpWindowName);
235 [DllImport(
"user32.dll")]
236 private static extern int ShowWindow(IntPtr hWnd, uint Msg);
249 [DllImport(
"user32.dll")]
250 [
return: MarshalAs(UnmanagedType.Bool)]
251 public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
int X,
int Y,
int cx,
int cy, uint uFlags);
254 [DllImport(
"User32.dll")]
255 private static extern IntPtr GetParent(IntPtr hWnd);
263 [DllImport(
"user32.dll", SetLastError =
true)]
264 static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
266 #endregion DLLimports 274 public const char SEPARADOR =
'|';
276 private const string EWVFP_NOTIFICATION =
"SAGE_EW_VFP_NET";
277 private const string EWNET_NOTIFICATION =
"SAGE_EW_NET_VFP";
278 private const string SAGE50_NOTIFICATION =
"SAGE50_NOTIFICATION";
279 private const string SAGE50_NOTIFICATION2 =
"SAGE50_NOTIFICATION2";
280 private const string SAGE50_NOTIFICATION3 =
"SAGE50_NOTIFICATION3";
281 private const string SAGE50_NOTIFICATION4 =
"SAGE50_NOTIFICATION4";
282 private const string SAGE50_NOTIFICATION5 =
"SAGE50_NOTIFICATION5";
284 private const int MINIMO_PARAMETROS = 4;
285 private const int RESPONDER_INDEX = 0;
286 private const int OPCION_INDEX = 1;
287 private const int TIPO_INDEX = 2;
288 private const int VALOR_INDEX = 3;
290 private const int WM_SETREDRAW = 11;
292 private const uint SW_MAXIMIZE = 0x03;
293 private const uint SW_MINIMIZE = 0x06;
294 private const uint SW_RESTORE = 0x09;
296 #endregion CONSTANTES 312 public static bool _lNoComInterrupt =
false;
317 public static bool _plRespuesta =
false;
322 public static Dictionary<string, object> _Parametros;
325 private static IntPtr msgewvfp_Notification = IntPtr.Zero;
326 private static IntPtr msgewnet_Notification = IntPtr.Zero;
327 private static IntPtr msgSage50_Notification = IntPtr.Zero;
328 private static IntPtr msgSage50_Notification2 = IntPtr.Zero;
329 private static IntPtr msgSage50_Notification3 = IntPtr.Zero;
330 private static IntPtr msgSage50_Notification4 = IntPtr.Zero;
331 private static IntPtr msgSage50_Notification5 = IntPtr.Zero;
334 private static IntPtr _nhMutexNet = IntPtr.Zero;
337 private static int _Canales = 0;
342 private static readonly
string _cNameProd = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_nameproducto"));
348 private static bool _lCerrarFormulariosEWCanal2 =
false;
349 #endregion PROPIEDADES 358 RegisterWindowMessages();
366 _Parametros =
new Dictionary<string, object>();
381 #region METODOS PUBLICOS 382 public static bool _SendMessageToVfp()
388 bool llSage50 = Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_sage50"));
390 string lcMensaje =
string.Empty;
393 _plRespuesta =
false;
395 DB.Registrar_Traza(
"_SendMessageToVfp - Inicio");
398 if (!IsWindow((IntPtr)EW_GLOBAL._nHandleVfp))
401 DB.Registrar_Traza(
"_SendMessageToVfp - Handle FOX OK");
403 if (_Parametros == null || (_Parametros != null && _Parametros.Count <= 0))
406 DB.Registrar_Traza(
"_SendMessageToVfp - Parameters OK");
409 _plRespuesta = Convert.ToBoolean(_Parametros[
"responder"]);
412 foreach (KeyValuePair<string, object> loClave
in _Parametros)
414 if (!
string.IsNullOrEmpty(lcMensaje))
415 lcMensaje = lcMensaje + SEPARADOR;
417 lcMensaje = lcMensaje + loClave.Value.ToString().Trim();
420 DB.Registrar_Traza(
"_SendMessageToVfp - Mensaje= "+ lcMensaje);
428 IntPtr intPtrCanal = IntPtr.Zero;
431 _Canales = _lCerrarFormulariosEWCanal2 ? 2 : 1;
433 DB.Registrar_Traza(
"_SendMessageToVfp - Canal " + _Canales.ToString());
438 intPtrCanal = msgSage50_Notification;
442 intPtrCanal = msgSage50_Notification2;
446 intPtrCanal = msgSage50_Notification3;
450 intPtrCanal = msgSage50_Notification4;
454 intPtrCanal = msgSage50_Notification5;
458 intPtrCanal = msgSage50_Notification;
462 llOk = (PostMessage((IntPtr)EW_GLOBAL._nHandleVfp, intPtrCanal, GlobalAddAtom(lcMensaje), lcMensaje.Length) != -1);
466 llOk = (PostMessage((IntPtr)EW_GLOBAL._nHandleVfp, msgewvfp_Notification, GlobalAddAtom(lcMensaje), lcMensaje.Length) != -1);
474 DB.Registrar_Traza(
"_SendMessageToVfp - Inicio espera respuesta");
479 Application.DoEvents();
482 DB.Registrar_Traza(
"_SendMessageToVfp - Fin espera respuesta");
486 catch (Exception loEx)
489 System.Diagnostics.Debug.WriteLine(
"Error en SendEventToHostWindow: " + loEx.Message);
502 public static bool _ReceiveMessageFromVfpPasswordInforautFOX(
string tcEmpresa,
string tcFichero)
504 FUNCTIONS._PasswordInforaut(tcEmpresa, tcFichero);
513 public static bool _ReceiveMessageFromVfp(ref Message msgVfp)
518 if (((IntPtr)msgVfp.Msg == msgewvfp_Notification) || ((IntPtr)msgVfp.Msg == msgewnet_Notification) || ((IntPtr)msgVfp.Msg == msgSage50_Notification) || ((IntPtr)msgVfp.Msg == msgSage50_Notification2) ||
519 ((IntPtr)msgVfp.Msg == msgSage50_Notification3) || ((IntPtr)msgVfp.Msg == msgSage50_Notification4) || ((IntPtr)msgVfp.Msg == msgSage50_Notification5))
524 DB.Registrar_Traza(
"_ReceiveMessageFromVfp - Inicio");
527 string lcCadena = ObtenerCadenaMensaje(msgVfp);
528 llOk = (_ObtenerParametros(lcCadena));
535 string lcOpcion = Convert.ToString(_Parametros[
"opcion"]).ToLower().Trim();
536 string lcValor = Convert.ToString(_Parametros[
"valor"]).Trim();
537 string lcTipo = Convert.ToString(_Parametros[
"tipo"]).Trim();
540 DB.Registrar_Traza(
"_ReceiveMessageFromVfp - Opción: " + lcOpcion);
541 DB.Registrar_Traza(
"_ReceiveMessageFromVfp - Valor: " + lcValor);
542 DB.Registrar_Traza(
"_ReceiveMessageFromVfp - Tipo: " + lcTipo);
545 if (_lNoComInterrupt ==
false || (_lNoComInterrupt ==
true && llOk && lcOpcion !=
"resize"))
548 _plRespuesta =
false;
552 #region MENSAJES SAGE50 558 if (llOk && lcOpcion ==
"imprimirrecibos")
560 string lcXmlFile =
"", lcEmpresa =
"", lcFactura =
"";
561 int lnEjercicio = 0, lnOrden = 0, lnImpagado = 0, lnPendiente = 0, lnTipoReport= 0;
562 DataTable ldtRecibos =
new DataTable();
568 FUNCTIONS._Xml2Datatable(lcXmlFile, ref ldtRecibos);
569 File.Delete(lcXmlFile);
572 foreach (DataRow loRecibo
in ldtRecibos.Rows)
574 lcEmpresa = Convert.ToString(loRecibo[
"empresa"]).Trim();
575 lnEjercicio = Convert.ToInt16(loRecibo[
"periodo"]);
576 lcFactura = Convert.ToString(loRecibo[
"factura"]).Trim().PadLeft(10,
' ');
577 lnOrden = Convert.ToInt16(loRecibo[
"orden"]);
578 lnImpagado = Convert.ToInt16(loRecibo[
"impagado"]);
579 lnPendiente = Convert.ToInt16(loRecibo[
"pendiente"]);
580 lnTipoReport = Convert.ToInt16(loRecibo[
"tiporep"]);
582 FUNCTIONS._ImprimirRecibo(lcEmpresa,lnEjercicio,lcFactura,lnOrden,lnImpagado,lnPendiente,lnTipoReport);
587 if (llOk && lcOpcion ==
"tareaprog")
590 string lcFormParam = lcValor;
591 string lcNombre = lcTipo;
594 string lcForm = lcFormParam;
595 if (lcForm.IndexOf(
'@') > 0)
597 string[] loPartes = lcForm.Split(
'@');
598 lcForm = loPartes[0];
602 loSageSystem.
_Load();
603 formul._TiposAccesosPantalla loTipoAcceso = loSageSystem.
_Acceso(lcForm,
true);
604 if (loTipoAcceso != formul._TiposAccesosPantalla.Completo)
605 loSageSystem.
_Acceso_Pantalla(lcForm, formul._TiposAccesosPantalla.Completo,
true, EW_GLOBAL._GetVariable(
"wc_empresa").ToString().Trim());
608 string lcDescripcion =
"Tarea programada de "+_cNameProd+
" para el formulario " + lcForm;
609 string lcHora =
"22:00";
610 List<bool> lstDias =
new List<bool>() {
true,
true,
true,
true,
true,
false,
false };
617 if (llOk && lcOpcion ==
"albavenservicio")
619 string lcFormVfp =
"ALBAVEN";
620 string[] laParamsVfp = { lcValor };
621 string lcFileReturn = lcTipo;
623 FUNCTIONS._Obtener_Formulario_Net(
"",
"",
"", lcFormVfp, laParamsVfp, 0,
false);
625 GuardarFicheroXmlRespuesta(lcFileReturn,
new string[] {
"true" });
630 if (llOk && lcOpcion ==
"bajasuscripcion")
632 string lcModulo = lcValor;
633 string lcFileReturn = lcTipo;
635 bool llBaja = LICENCIAS._BajaSuscripcion(lcModulo);
637 GuardarFicheroXmlRespuesta(lcFileReturn,
new string[] { llBaja.ToString().Trim().ToLower() });
641 if (llOk && lcOpcion ==
"bajasuscripcionform")
643 string lcForm = lcValor;
644 string lcFileReturn = lcTipo;
646 bool llBaja = LICENCIAS._BajaSuscripcionForm(lcForm);
648 GuardarFicheroXmlRespuesta(lcFileReturn,
new string[] { llBaja.ToString().Trim().ToLower() });
652 if (llOk && lcOpcion ==
"retorno")
656 if (EW_GLOBAL._OpenForms != null)
661 if (EW_GLOBAL._OpenForms.Count == 1)
665 if (EW_GLOBAL._OpenForms.Count > 0)
667 Form loForm = EW_GLOBAL._OpenForms.Peek();
670 loForm.BringToFront();
676 catch (Exception loEx)
678 DB.Registrar_Error(loEx);
683 if (llOk && lcOpcion ==
"recalculoriesgo")
685 string lcClienteIni = lcTipo;
686 string lcClienteFin = lcValor;
696 bool llContacts = Convert.ToBoolean(DB.SQLValor(
"empresa",
"codigo", EW_GLOBAL._GetVariable(
"wc_empresa").ToString(),
"CONTACT"));
697 bool _lEsCentralOffline = Convert.ToBoolean(EW_GLOBAL._ModuloActivo(
"OFFLINE")) && Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_TipoOffline"));
699 if (llContacts || _lEsCentralOffline)
701 FUNCTIONS._RecalcularRiesgoDesdeFox(lcClienteIni, lcClienteFin);
707 if (llOk && lcOpcion ==
"emaildirecto")
709 string lcCampo =
"",lcValorCampo=
"";
710 string lcEmail =
"", lcFileReturn =
"", lcAsunto =
"", lcCuerpo =
"", lcAdjunto =
"";
712 DataTable ldtCampos =
new DataTable();
715 lcFileReturn = lcValor;
718 FUNCTIONS._Xml2Datatable(lcFileReturn, ref ldtCampos);
719 File.Delete(lcFileReturn);
723 foreach (DataRow loCampo
in ldtCampos.Rows)
725 lcCampo = Convert.ToString(loCampo[
"campo"]).Trim().ToLower();
726 lcValorCampo = Convert.ToString(loCampo[
"valor"]).Trim();
731 lcEmail = lcValorCampo;
735 lcAsunto = lcValorCampo;
739 lcCuerpo = lcValorCampo;
743 lcAdjunto = lcValorCampo;
753 object loCliente = EW_GLOBAL._GetVariable(
"tmpCliente" + Convert.ToString(EW_GLOBAL._GetVariable(
"wc_usuario")));
754 string lcCliente =
string.Empty;
755 if (loCliente != null && !
string.IsNullOrWhiteSpace(Convert.ToString(loCliente)))
757 lcCliente = Convert.ToString(loCliente);
758 EW_GLOBAL._SetVariable(
"tmpCliente" + Convert.ToString(EW_GLOBAL._GetVariable(
"wc_usuario")),
"");
761 object loProveed = EW_GLOBAL._GetVariable(
"tmpProveed" + Convert.ToString(EW_GLOBAL._GetVariable(
"wc_usuario")));
762 string lcProveed =
string.Empty;
763 if (loProveed != null && !
string.IsNullOrWhiteSpace(Convert.ToString(loProveed)))
765 lcProveed = Convert.ToString(loProveed);
766 EW_GLOBAL._SetVariable(
"tmpProveed" + Convert.ToString(EW_GLOBAL._GetVariable(
"wc_usuario")),
"");
771 llResp = FUNCTIONS._Send_Direct_Email(lcEmail, lcAsunto, lcCuerpo, ref lcError, lcAdjunto, lcCliente, lcProveed);
773 FUNCTIONS._MessageBox(lcError,
"Envío de correo directo", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
775 catch (Exception loEx)
777 MessageBox.Show(loEx.Message + Environment.NewLine + Environment.NewLine + loEx.InnerException,
"Envío de correo directo", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
782 GuardarFicheroXmlRespuesta(lcFileReturn,
new string[] { llResp.ToString().Trim().ToLower() });
786 if (llOk && lcOpcion ==
"comunidad50")
788 string lcOperacion = lcTipo;
789 string lcParametros = lcValor;
791 FUNCTIONS._Comunidad50_Ejecutar_Operacion(lcOperacion, lcParametros);
796 if (llOk && lcOpcion ==
"appshortcut")
798 string lcCaption = lcTipo;
799 string lcName = lcValor;
801 FUNCTIONS._CrearAccesoDirecto(lcCaption, lcName);
805 if (llOk && lcOpcion ==
"newcalendarnote")
808 string lcPantalla = lcTipo;
812 string lcParametrosDocFox = lcValor;
815 string[] laValoresPropiedades = lcParametrosDocFox.Split(
'@');
816 FUNCTIONS._CrearNuevoApunteCalendario(laValoresPropiedades, lcPantalla);
821 if (llOk && lcOpcion ==
"resize")
823 if (Application.OpenForms.Count > 0)
825 Form loForm = Application.OpenForms[
"frmPrincipal"];
828 int lnHeight = Convert.ToInt32(lcTipo);
829 int lnWidth = Convert.ToInt32(lcValor);
831 loForm.Size =
new Size(lnWidth,lnHeight);
841 if (llOk && lcOpcion ==
"podemos_cerrar_net")
843 if (Application.OpenForms.Count > 0)
845 dynamic loForm = Application.OpenForms[
"frmPrincipal"];
849 if (!loForm._CanClose(
true))
851 string lcFichero = lcValor;
854 StreamWriter swCargar_Perfil =
new StreamWriter(lcFichero);
855 swCargar_Perfil.Write(loForm.Text);
856 swCargar_Perfil.Close();
867 if (llOk && lcOpcion ==
"passwordinforaut")
869 _ReceiveMessageFromVfpPasswordInforautFOX(Convert.ToString(lcTipo), Convert.ToString(lcValor));
874 if (llOk && lcOpcion ==
"cerrar")
876 if (Application.OpenForms.Count > 0)
878 dynamic loForm = Application.OpenForms[
"frmPrincipal"];
882 if (!loForm._CanClose())
885 NETVFP.SetParent(loForm.Handle, IntPtr.Zero);
892 if (llOk && lcOpcion ==
"ejecutar")
894 dynamic loForm = null;
897 string[] laForms = lcTipo.Split(
'@');
898 string[] laParamsVfp = lcValor.Split(
'@');
901 string lcLibreriaNet =
"";
902 string lcFormNet = laForms[0].ToString().Trim();
903 string lcFormVfp = laForms[1].ToString().Trim().ToLower();
904 long lnHandleVfp = Convert.ToInt32(laForms[2]);
906 int lnPos = lcFormNet.IndexOf(
'.', lcFormNet.IndexOf(
'.', lcFormNet.IndexOf(
'.') + 1) + 1);
908 lcLibreriaNet = lcFormNet.Substring(0, lnPos);
911 loForm = FUNCTIONS._Obtener_Formulario_Net(lcLibreriaNet, lcFormNet,
"", lcFormVfp, laParamsVfp, lnHandleVfp);
921 #endregion MENSAJES SAGE50 926 if (llOk && lcOpcion ==
"newhandlevfp")
928 EW_GLOBAL._nHandleVfp = Convert.ToInt32(lcValor);
932 if (llOk && lcOpcion ==
"foco")
934 if (Application.OpenForms.Count > 0)
936 dynamic loForm = Application.OpenForms[0];
939 dynamic[] loControls = loForm.Controls.Find(
"txtNumDocVen",
true);
940 if (loControls.Length > 0)
942 loControls[0]._Pasar_Foco_Numero();
950 if (llOk && lcTipo.ToLower().Trim() ==
"carga_con_exe_abierto" && (lcOpcion ==
"albatpv" || lcOpcion ==
"albaven"))
952 if (lcValor.Contains(
"\\"))
954 object[] laParams = lcValor.Split(
'\\');
956 if (Application.OpenForms.Count > 0)
958 dynamic loForm = Application.OpenForms[0];
959 loForm._Init(laParams);
968 string lcTipoOp = (lcTipo.ToLower().Trim());
972 if (lcTipoOp ==
"escalar_perfil" || lcTipoOp ==
"integrar_vfp_net_ini" || lcTipoOp ==
"integrar_vfp_net_fin")
974 if (lcValor.Contains(
"#"))
976 object[] laParams = lcValor.Split(
'#');
979 if (laParams != null && laParams.Length >= 3)
982 if (Application.OpenForms.Count > 0)
984 dynamic loForm = Application.OpenForms[0];
987 loForm._Escalar_Perfil_Desde_VFP(laParams);
997 if (llOk && lcOpcion ==
"printmassivedocument")
999 string lcFileXml = lcValor;
1000 string lcTypePrint = lcTipo.ToLower().Trim();
1004 switch (lcTypePrint)
1009 case "deliverynotes":
1016 EW_GLOBAL.ValorEnClave_VarGlob(
"wl_printmassivedocument",
true);
1020 EW_GLOBAL.ValorEnClave_VarGlob(
"wl_printmassivedocument",
false);
1025 if (llOk && lcOpcion ==
"printdocument")
1028 string lcTypePrint = lcTipo.ToLower().Trim();
1029 string lcParametros = lcValor;
1030 switch (lcTypePrint)
1033 if (!
string.IsNullOrWhiteSpace(lcParametros))
1038 if (!
string.IsNullOrWhiteSpace(lcParametros))
1047 if (llOk && lcOpcion ==
"shownetbrowser")
1053 if (llOk && lcOpcion ==
"showgooglemaps")
1055 functions.FUNCTIONS._Show_GoogleMaps_From_VencaFox(lcValor);
1059 if (llOk && lcOpcion ==
"shownetfavoritos")
1061 object[] laParams = lcValor.Split(
'#');
1064 if (laParams != null && laParams.Length >= 2)
1070 if (llOk && lcOpcion ==
"shownetaccesos")
1072 object[] laParams = lcValor.Split(
'#');
1075 if (laParams != null && laParams.Length >= 2)
1081 if (llOk && lcOpcion ==
"cleanmesescerrados")
1082 EW_GLOBAL.ValorEnClave_VarGlob(
"wo_meses", null);
1087 string lcTipoOp = (lcTipo.ToLower().Trim());
1090 if (lcTipoOp ==
"llamada_skype")
1092 if (lcValor.Contains(
"#"))
1094 object[] laParams = lcValor.Split(
'#');
1097 if (laParams != null && laParams.Length >= 2)
1100 if (Application.OpenForms.Count > 0)
1102 skype.SkypePlugin loSkype = skype.SkypePlugin.Instance;
1103 loSkype._Call(laParams[1].ToString().Trim());
1113 object[] laParams = null;
1117 laParams = lcValor.Split(
'#');
1122 case "OneDrive_FolderDialog":
1124 if (laParams != null && laParams.Length >= 1)
1131 case "OneDrive_FileDialog":
1133 if (laParams != null && laParams.Length >= 1)
1141 case "OneDrive_Upload":
1143 if (laParams != null && laParams.Length >= 2)
1146 llOk = loFileDialog.
_UploadFile(Convert.ToString(laParams[0]), Convert.ToString(laParams[1]));
1156 string lcTipoOp = (lcTipo.ToLower().Trim());
1159 if (lcTipoOp ==
"offline_recstock")
1161 stocks.Recalculo_Stocks loRecalcul =
new stocks.Recalculo_Stocks();
1162 loRecalcul._Recalcular_Stocks();
1168 if (llOk && lcOpcion.ToLower().Trim() ==
"enviarusopantalla" && !
string.IsNullOrWhiteSpace(lcValor))
1170 FUNCTIONS._EnviarDatosUsoPantalla(lcValor, lcTipo);
1175 catch (Exception loEx)
1182 EliminarMensaje(ref msgVfp);
1194 public static bool _ObtenerParametros(
string tcParametros)
1197 string[] lcParametros = tcParametros.Split(SEPARADOR);
1200 if (lcParametros.Length < MINIMO_PARAMETROS)
1204 _Parametros.Clear();
1205 _Parametros[
"responder"] = lcParametros[RESPONDER_INDEX];
1206 _Parametros[
"opcion"] = lcParametros[OPCION_INDEX];
1207 _Parametros[
"tipo"] = lcParametros[TIPO_INDEX];
1208 _Parametros[
"valor"] = lcParametros[VALOR_INDEX];
1212 for (
int lnPar = 4; lnPar < lcParametros.Length; lnPar++)
1215 _Parametros[
"paradi" + i.ToString().Trim()] = lcParametros[lnPar];
1219 if (_Parametros[
"opcion"].ToString().ToLower().Trim() ==
"inicial")
1220 CargaInicial(_Parametros[
"valor"].ToString());
1232 public static string _Abrir_Formulario_VFP(
string tcFormulario,
object[] toParametros = null)
1234 return Ejecutar_VFP(
"crear", tcFormulario, toParametros,
true);
1244 public static string _Abrir_Formulario_VFP(
string tcFormulario,
object[] toParametros,
bool tlRespuesta=
true)
1246 return Ejecutar_VFP(
"crear", tcFormulario, toParametros, tlRespuesta);
1256 public static string _Abrir_Formulario_VFP(
string tcFormulario,
object[] toParametros, Form toForm)
1258 string lcRetorn =
"";
1261 if (!Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_sage50")))
1263 EnableWindow((IntPtr)EW_GLOBAL._nHandleVfp,
false);
1265 EnableWindow(toForm.Handle,
false);
1268 lcRetorn = Ejecutar_VFP(
"crear", tcFormulario, toParametros);
1271 if (!Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_sage50")))
1274 EnableWindow(toForm.Handle,
true);
1275 EnableWindow((IntPtr)EW_GLOBAL._nHandleVfp,
true);
1296 public static string _Ejecutar_Funcion_VFP(
string tcFuncion,
object[] toParametros,
bool tlArray, Form toForm)
1298 string lcRetorn =
"";
1301 EnableWindow(toForm.Handle,
false);
1302 EnableWindow((IntPtr)EW_GLOBAL._nHandleVfp,
false);
1306 string lcNombreXml = GenerarParametrosXml(tcFuncion, toParametros);
1307 lcRetorn = Ejecutar_VFP(
"funcion",
"EJECUTARXML",
new Object[] { lcNombreXml.ToString().Trim() });
1309 else lcRetorn = Ejecutar_VFP(
"funcion", tcFuncion, toParametros);
1312 EnableWindow(toForm.Handle,
true);
1313 EnableWindow((IntPtr)EW_GLOBAL._nHandleVfp,
true);
1319 toForm.BringToFront();
1333 public static string _Ejecutar_Funcion_VFP(
string tcFuncion,
object[] toParametros = null,
bool tlArray =
false)
1337 string lcNombreXml = GenerarParametrosXml(tcFuncion, toParametros);
1338 return Ejecutar_VFP(
"funcion",
"EJECUTARXML",
new Object[] { lcNombreXml.ToString().Trim() });
1340 else return Ejecutar_VFP(
"funcion", tcFuncion, toParametros);
1351 public static string _Ejecutar_Funcion_VFP(
string tcFuncion,
object[] toParametros,
bool tlArray,
bool tlRespuesta=
true)
1355 string lcNombreXml = GenerarParametrosXml(tcFuncion, toParametros);
1356 return Ejecutar_VFP(
"funcion",
"EJECUTARXML",
new Object[] { lcNombreXml.ToString().Trim() }, tlRespuesta);
1358 else return Ejecutar_VFP(
"funcion", tcFuncion, toParametros, tlRespuesta);
1368 public static string _Ejecutar_Funcion_VFP_Menu50(
string tcFuncion)
1370 string lcFunction =
string.Empty;
1371 object[] loParametros =
new object[0];
1373 if (!
string.IsNullOrWhiteSpace(tcFuncion) && tcFuncion.IndexOf(
"(") >= 0)
1377 if (tcFuncion ==
"opcAperNuevo()" || tcFuncion ==
"opcAperTraspDoc")
1379 if (!FUNCTIONS._ComprobarFormulariosAbiertos())
1381 MessageBox.Show(
"Para realizar cualquier operación de apertura es necesario cerrar los formularios abiertos.",
"Apertura", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
1389 Match loMatchFunc = Regex.Match(tcFuncion,
@"^\s*([\w\.]+)\s*\((.*)\)");
1390 if (!
string.IsNullOrWhiteSpace(loMatchFunc.Value))
1393 lcFunction = loMatchFunc.Groups[1].Value.ToString().Trim();
1394 if (!
string.IsNullOrWhiteSpace(loMatchFunc.Groups[2].Value))
1397 MatchCollection loMatchParams = Regex.Matches(loMatchFunc.Groups[2].Value,
@"([^,]+\(.+?\))|([^,]+)");
1398 if (loMatchParams.Count > 0)
1402 loParametros =
new object[loMatchParams.Count];
1403 foreach (var item
in loMatchParams)
1405 loParametros[lnPos] = item.ToString().Replace(
"\"",
"").Replace(
"'",
"");
1415 if (!
string.IsNullOrWhiteSpace(tcFuncion))
1416 lcFunction = tcFuncion;
1420 if (
string.IsNullOrWhiteSpace(lcFunction))
1427 return _Ejecutar_Funcion_VFP(lcFunction, loParametros);
1436 public static string _Obtener_Valor_VFP(
string tcValor,
object[] toParametros = null)
1438 return Ejecutar_VFP(
"valor", tcValor, toParametros);
1444 public static void _CerrarAplicacion()
1446 Application.ExitThread();
1455 public static void _CerrarHandle(
int lnHandle)
1457 if (!IsWindow((IntPtr)lnHandle))
1461 GetWindowThreadProcessId((IntPtr)lnHandle, out uint processId);
1462 Process processSage50 = Process.GetProcessById(Convert.ToInt32(processId));
1463 IntPtr lnHandleSage50 = processSage50.MainWindowHandle;
1464 if (lnHandleSage50 == IntPtr.Zero)
1468 Process[] runingProcess = Process.GetProcesses();
1469 for (
int i = 0; i < runingProcess.Length; i++)
1471 if (runingProcess[i].MainWindowHandle == lnHandleSage50)
1472 runingProcess[i].Kill();
1481 public static string _ToString(
object txValor)
1484 string lcValor =
string.Empty;
1489 string lcTipo = txValor.GetType().ToString().Trim().ToLower();
1493 case "system.boolean":
1494 if ((
bool)txValor ==
true)
1501 case "system.datetime":
1502 DateTime ltFecha = (DateTime)txValor;
1503 lcValor =
"{^" +ltFecha.Year.ToString().Trim() +
"-" + ltFecha.Month.ToString().Trim() +
"-" + ltFecha.Day.ToString().Trim() +
"}";
1506 case "system.decimal":
1507 case "system.double":
1508 case "system.int16":
1509 case "system.int32":
1510 case "system.int64":
1511 case "system.uint16":
1512 case "system.uint32":
1513 case "system.uint64":
1514 lcValor = txValor.ToString().Replace(
",",
".").Trim();
1517 case "system.string":
1518 lcValor =
"'" + txValor.ToString().Replace(
"'",
"''") +
"'";
1525 catch (Exception loEx)
1527 DB.Registrar_Error(loEx);
1528 return string.Empty;
1539 public static void _ComprobarReceptor(
long tnHwnd)
1541 if (!IsWindow((IntPtr)tnHwnd))
1542 _CerrarAplicacion();
1551 public static string _Abrir_Mante_VFP(
string tcFormulario,
string tcCodigo)
1553 string lcRetorno =
"";
1556 _Parametros[
"responder"] =
true;
1557 _Parametros[
"opcion"] =
"mante";
1558 _Parametros[
"tipo"] =
"valor";
1559 _Parametros[
"valor"] = tcFormulario + NETVFP.SEPARADOR + tcCodigo + NETVFP.SEPARADOR;
1562 if (_SendMessageToVfp())
1565 if (NETVFP._Parametros.ContainsKey(
"valor"))
1566 lcRetorno = NETVFP._Parametros[
"valor"].ToString();
1570 _Parametros.Clear();
1579 public static void _Set_Form_AlwaysOnTop(IntPtr tnHandle)
1581 IntPtr HWND_TOPMOST =
new IntPtr(-1);
1582 const UInt32 SWP_NOSIZE = 0x0001;
1583 const UInt32 SWP_NOMOVE = 0x0002;
1584 const UInt32 SWP_SHOWWINDOW = 0x0040;
1586 SetWindowPos(tnHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
1589 #endregion METODOS PUBLICOS 1592 #region METODOS PRIVADOS 1593 private static string Ejecutar_VFP(
string tcOpcion,
string tcFormFunc,
object[] toParametros = null,
bool tlRespuesta=
true)
1603 string lcRetorno =
"", lcParametros =
"";
1606 if (!
string.IsNullOrWhiteSpace(EW_GLOBAL._GetVariable(
"wc_iniservidor").ToString())
1607 && !
string.IsNullOrWhiteSpace(EW_GLOBAL._GetVariable(
"wc_pathinicio").ToString())
1608 && (tcFormFunc.ToUpper().Trim() ==
"FRM_NET"))
1610 string lcFuncion = toParametros[0].ToString().ToUpper().Trim();
1612 if (lcFuncion ==
"INTEGRAR")
1615 _nhMutexNet = CreateMutex(IntPtr.Zero,
true,
"SAGETPV_NET");
1618 IntPtr lnhMutexFox = IntPtr.Zero;
1619 uint MUTEX_ALL_ACCESS = 0x001F0001;
1620 bool llFoxOk =
false;
1623 int lnTempsEspera = 60;
1625 string lcPathInicio = EW_GLOBAL._GetVariable(
"wc_pathinicio").ToString();
1628 if (
string.IsNullOrWhiteSpace(lcPathInicio) ==
false)
1630 string lcEnlace_Net = FUNCTIONS.LeerConfigIni(
"[ENLACE_NET]", lcPathInicio).Trim();
1633 if (
string.IsNullOrWhiteSpace(lcEnlace_Net) ==
false)
1635 int lnTempsENLACE_NET = Convert.ToInt32(lcEnlace_Net);
1638 if (lnTempsENLACE_NET > 60)
1640 lnTempsEspera = lnTempsENLACE_NET;
1646 DateTime lnTempsIni = DateTime.Now;
1648 while (!llFoxOk && lnTemps < lnTempsEspera)
1651 lnhMutexFox = OpenMutex(MUTEX_ALL_ACCESS,
false,
"SAGETPV_FOX");
1652 llFoxOk = (lnhMutexFox != IntPtr.Zero);
1657 ReleaseMutex(lnhMutexFox);
1658 CloseHandle(lnhMutexFox);
1662 lnTemps = (DateTime.Now - lnTempsIni).Seconds;
1664 Application.DoEvents();
1668 _lCerrarFormulariosEWCanal2 = (lcFuncion ==
"CERRAR");
1670 if ((lcFuncion ==
"CERRAR") && (_nhMutexNet != IntPtr.Zero))
1673 ReleaseMutex(_nhMutexNet);
1674 CloseHandle(_nhMutexNet);
1679 if (tcOpcion ==
"crear")
1684 tcFormFunc =
"'" + tcFormFunc +
"'";
1688 if (tcOpcion ==
"crear" || CasosEspecialesMinimizar(tcFormFunc))
1689 MinimizarFormsNetAbiertos();
1692 if (toParametros != null)
1694 foreach (
object loPar
in toParametros)
1696 lcParametros = lcParametros + _ToString(loPar) + NETVFP.SEPARADOR;
1701 _Parametros[
"responder"] = (tlRespuesta ? true :
false);
1702 _Parametros[
"opcion"] = tcOpcion;
1703 _Parametros[
"tipo"] =
"valor";
1704 _Parametros[
"valor"] = tcFormFunc + NETVFP.SEPARADOR + lcParametros;
1707 if (_SendMessageToVfp())
1710 if (NETVFP._Parametros.ContainsKey(
"valor"))
1711 lcRetorno = NETVFP._Parametros[
"valor"].ToString();
1715 _Parametros.Clear();
1718 if (tcOpcion ==
"crear" || CasosEspecialesMinimizar(tcFormFunc))
1719 RestaurarFormsNetMinimizados();
1729 private static bool CasosEspecialesMinimizar(
string tcFormFunc)
1731 bool llCasoEspecial =
false;
1733 string lcCasosEspeciales =
"RIESGO_CLIENTE_NET,GENERAR_SEPA_REMCOBRO_NET,GENERAR_SEPA_REMPAGO_NET,SAGE50_ENLACE_COMUNICADOS";
1735 tcFormFunc = tcFormFunc.ToUpper().Trim();
1736 llCasoEspecial = lcCasosEspeciales.Contains(tcFormFunc);
1738 return llCasoEspecial;
1744 private static void MinimizarFormsNetAbiertos()
1747 string lcFormsExcluidos =
"frmprincipal,activemenuimpl";
1751 lcFormsExcluidos +=
",formtabs,browsertab";
1753 foreach (Form frm
in Application.OpenForms)
1755 string lcForm = frm.Name.ToLower().Trim();
1757 if (!lcFormsExcluidos.Contains(lcForm))
1758 ShowWindow(frm.Handle, SW_MINIMIZE);
1765 private static void RestaurarFormsNetMinimizados()
1768 string lcFormsExcluidos =
"frmprincipal,activemenuimpl,formtabs";
1769 foreach (Form frm
in Application.OpenForms)
1771 string lcForm = frm.Name.ToLower().Trim();
1773 if (!lcFormsExcluidos.Contains(lcForm) && frm.WindowState == FormWindowState.Minimized)
1774 ShowWindow(frm.Handle, SW_RESTORE);
1781 private static void RegisterWindowMessages()
1784 if (msgewvfp_Notification == IntPtr.Zero)
1785 msgewvfp_Notification = RegisterWindowMessageW(EWVFP_NOTIFICATION);
1788 if (msgewnet_Notification == IntPtr.Zero)
1789 msgewnet_Notification = RegisterWindowMessageW(EWNET_NOTIFICATION);
1792 if (msgSage50_Notification == IntPtr.Zero)
1793 msgSage50_Notification = RegisterWindowMessageW(SAGE50_NOTIFICATION);
1796 if (msgSage50_Notification2 == IntPtr.Zero)
1797 msgSage50_Notification2 = RegisterWindowMessageW(SAGE50_NOTIFICATION2);
1800 if (msgSage50_Notification3 == IntPtr.Zero)
1801 msgSage50_Notification3 = RegisterWindowMessageW(SAGE50_NOTIFICATION3);
1804 if (msgSage50_Notification4 == IntPtr.Zero)
1805 msgSage50_Notification4 = RegisterWindowMessageW(SAGE50_NOTIFICATION4);
1808 if (msgSage50_Notification5 == IntPtr.Zero)
1809 msgSage50_Notification5 = RegisterWindowMessageW(SAGE50_NOTIFICATION5);
1816 private static void EliminarMensaje(ref Message msgEliminar)
1818 GlobalDeleteAtom((ushort)msgEliminar.WParam);
1826 private static string ObtenerCadenaMensaje(Message msgParam)
1828 char[] swParam =
new char[(int)msgParam.LParam];
1829 GlobalGetAtomName((ushort)msgParam.WParam, swParam, (int)msgParam.LParam);
1830 string lcCadena =
new string(swParam);
1840 private static bool CargaInicial(
string tcRutaXml)
1843 bool llAlbatpv =
false;
1845 string lcMensaje =
string.Empty;
1846 string lcCopiaXml = tcRutaXml.Replace(
".xml",
"copia.xml");
1847 File.Copy(tcRutaXml, lcCopiaXml);
1850 if (!EW_GLOBAL._CargarVarExtra(tcRutaXml))
1852 MessageBox.Show(
"No se ha podido cargar en el diccionario las variables globales extra.",
"EW_GLOBAL._CargarVarExtra", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1857 string lcUsuario = EW_GLOBAL._GetVariable(
"wc_usuario").ToString().Trim();
1858 string lcEmpresa = EW_GLOBAL._GetVariable(
"wc_empresa").ToString().Trim();
1859 string lcCajaTpv = EW_GLOBAL._GetVariable(
"wc_cajatpv").ToString().Trim();
1860 string lcComunes = EW_GLOBAL._GetVariable(
"wc_concomunes").ToString().Trim();
1861 string lcServer = EW_GLOBAL._GetVariable(
"server").ToString().Trim();
1862 string lcUser = EW_GLOBAL._GetVariable(
"user").ToString().Trim();
1863 string lcPassword = EW_GLOBAL._GetVariable(
"password").ToString().Trim();
1864 string lcLibreria = EW_GLOBAL._GetVariable(
"libreria").ToString().Trim();
1865 string lcForm = EW_GLOBAL._GetVariable(
"formulario").ToString().Trim();
1866 string lcOpcion = EW_GLOBAL._GetVariable(
"opcion").ToString().Trim();
1871 if (lcForm ==
"sage.ew.Forms.VerGraficas")
1876 llAlbatpv = (lcOpcion ==
"albatpv" || lcOpcion ==
"albaven");
1879 if (
string.IsNullOrWhiteSpace(lcEmpresa) ||
string.IsNullOrWhiteSpace(lcComunes) ||
1880 string.IsNullOrWhiteSpace(lcServer) ||
string.IsNullOrWhiteSpace(lcUser) ||
string.IsNullOrWhiteSpace(lcPassword) ||
1881 string.IsNullOrWhiteSpace(lcLibreria) ||
string.IsNullOrWhiteSpace(lcForm) ||
string.IsNullOrWhiteSpace(lcUsuario) ||
1882 (llAlbatpv && (
string.IsNullOrWhiteSpace(lcCajaTpv))))
1886 lcMensaje =
" wc_cajatpv,";
1888 MessageBox.Show(
"Deben indicarse las siguientes etiquetas obligatoriamente:"+
System.Environment.NewLine+
1889 "wc_usuario, wc_empresa," + lcMensaje +
" wc_concomunes, server, user, password, libreria, formulario",
"Etiquetas obligatorias",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1894 if (!DB.SQLConnect(lcServer, lcUser, lcPassword, lcComunes, tcAliasConexion:
"eurowin"))
1896 MessageBox.Show(
"No se ha podido realizar la conexión a la base de datos.",
"DB.SQLConnect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1903 if (EW_GLOBAL._GetVariable(
"wc_any") != null)
1905 DB.SQLPredeterminarGestion(Convert.ToString(EW_GLOBAL._GetVariable(
"wc_any")));
1910 if (lcForm.ToLower().Trim().Contains(
"grafica") &&
string.IsNullOrWhiteSpace(lcCajaTpv))
1917 MessageBox.Show(
"No se han podido cargar los diccionario de variables globales.",
"EW_GLOBAL._CargarDiccionarios", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1923 if (!EW_GLOBAL._CargarVarExtra(lcCopiaXml))
1925 MessageBox.Show(
"No se ha podido cargar en el diccionario las variables globales extra.",
"EW_GLOBAL._CargarVarExtra", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1930 if ( !Convert.ToBoolean(EW_GLOBAL._GetVariable(
"wl_sage50")) && !LICENCIAS._Validar_Licencia_Suscripcion() )
1932 MessageBox.Show(LICENCIAS._MensajeError,
"LICENCIAS._Validar_Licencia_Suscripcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1938 string lcSqlLog = Convert.ToString(FUNCTIONS.LeerConfigIni(
"[SQL_LOG]")).ToUpper().Trim();
1940 EW_GLOBAL._SetVariable(
"wc_sql_log", lcSqlLog);
1946 string lcPrueva = Convert.ToString(FUNCTIONS.LeerConfigIni(
"[PRUEVAS]")).ToUpper();
1948 bool llPrueva = (lcPrueva ==
"SI" || lcPrueva ==
"PERMANENTE");
1950 EW_GLOBAL._SetVariable(
"wl_prueva", llPrueva);
1957 GetSage50PathLibrerias = FUNCTIONS.GetSage50PathLibrerias,
1958 CodigoLicencia = LICENCIAS._CodigoLicencia
1961 MessageBox.Show(
"Uno o más de los AddOn instalados no se han cargado correctamente.",
"EW_GLOBAL._CargarAddOns", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1974 private static string GenerarParametrosXml(
string tcFuncion,
object[] toParametros,
string tcNomCursor=
"net2vfp")
1978 string lcNombreFichero = Path.GetTempPath() +
System.Guid.NewGuid().ToString() +
".xml";
1981 if (toParametros != null)
1984 string lcNodo =
string.Empty, lcValor =
string.Empty;
1985 int lnTotalElementos = 0;
1986 int lnElementoActual = 0;
1991 XmlTextWriter xmlParan =
new XmlTextWriter(lcNombreFichero, Encoding.UTF8)
1993 Formatting = Formatting.Indented
1995 xmlParan.WriteStartDocument();
1996 xmlParan.WriteStartElement(
"VFPData");
1999 foreach (
object loPar
in toParametros)
2006 xmlParan.WriteStartElement(tcNomCursor.ToString().Trim());
2009 xmlParan.WriteElementString(
"funcion", tcFuncion.ToString().ToUpper());
2012 string lcTipo = loPar.GetType().ToString().Trim().ToLower();
2017 #region Matrices [x,y] 2019 #region MatrizStrings 2020 case "system.string[,]":
2023 lnXElem = ((
string[,])loPar).GetLength(0);
2024 lnYElem = ((
string[,])loPar).Length / lnXElem;
2027 xmlParan.WriteElementString(
"tipo_param",
"STRING:ARRAY[" + lnXElem.ToString() +
"," + lnYElem.ToString() +
"]");
2030 for (
int lnXindex = 0; lnXindex < lnXElem; lnXindex++)
2033 for (
int lnYIndex = 0; lnYIndex < lnYElem; lnYIndex++)
2035 lcValor = lcValor +
"'" + ((
string[,])loPar)[lnXindex, lnYIndex].ToString().Replace(
"'",
"''") +
"'";
2036 if (lnYIndex != lnYElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2039 if (lnXindex != lnXElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2044 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2048 lcValor =
string.Empty;
2049 lnTotalElementos = 0;
2050 lnXElem = lnYElem = 0;
2053 #endregion MatrizStrings 2055 #region MatrizDecimal 2056 case "system.decimal[,]":
2059 lnXElem = ((decimal[,])loPar).GetLength(0);
2060 lnYElem = ((decimal[,])loPar).Length / lnXElem;
2063 xmlParan.WriteElementString(
"tipo_param",
"DECIMAL:ARRAY[" + lnXElem.ToString() +
"," + lnYElem.ToString() +
"]");
2066 for (
int lnXindex = 0; lnXindex < lnXElem; lnXindex++)
2069 for (
int lnYIndex = 0; lnYIndex < lnYElem; lnYIndex++)
2071 lcValor = lcValor + ((decimal[,])loPar)[lnXindex, lnYIndex].ToString().Replace(
",",
".").Trim();
2072 if (lnYIndex != lnYElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2075 if (lnXindex != lnXElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2080 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2083 lcValor =
string.Empty;
2084 lnTotalElementos = 0;
2085 lnXElem = lnYElem = 0;
2088 #endregion MatrizDecimal 2091 case "system.int32[,]":
2094 lnXElem = ((Int32[,])loPar).GetLength(0);
2095 lnYElem = ((Int32[,])loPar).Length / lnXElem;
2098 xmlParan.WriteElementString(
"tipo_param",
"INT32:ARRAY[" + lnXElem.ToString() +
"," + lnYElem.ToString() +
"]");
2101 for (
int lnXindex = 0; lnXindex < lnXElem; lnXindex++)
2104 for (
int lnYIndex = 0; lnYIndex < lnYElem; lnYIndex++)
2106 lcValor = lcValor + ((Int32[,])loPar)[lnXindex, lnYIndex].ToString().Replace(
",",
".").Trim();
2107 if (lnYIndex != lnYElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2109 if (lnXindex != lnXElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2116 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2119 lcValor =
string.Empty;
2120 lnTotalElementos = 0;
2121 lnXElem = lnYElem = 0;
2124 #endregion MatrizInt32 2127 case "system.int16[,]":
2130 lnXElem = ((Int16[,])loPar).GetLength(0);
2131 lnYElem = ((Int16[,])loPar).Length / lnXElem;
2134 xmlParan.WriteElementString(
"tipo_param",
"INT16:ARRAY[" + lnXElem.ToString() +
"," + lnYElem.ToString() +
"]");
2137 for (
int lnXindex = 0; lnXindex < lnXElem; lnXindex++)
2140 for (
int lnYIndex = 0; lnYIndex < lnYElem; lnYIndex++)
2142 lcValor = lcValor + ((Int16[,])loPar)[lnXindex, lnYIndex].ToString().Replace(
",",
".").Trim();
2143 if (lnYIndex != lnYElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2145 if (lnXindex != lnXElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2151 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2154 lcValor =
string.Empty;
2155 lnTotalElementos = 0;
2156 lnXElem = lnYElem = 0;
2159 #endregion MatrizInt16 2162 case "system.int64[,]":
2165 lnXElem = ((Int64[,])loPar).GetLength(0);
2166 lnYElem = ((Int64[,])loPar).Length / lnXElem;
2169 xmlParan.WriteElementString(
"tipo_param",
"INT64:ARRAY[" + lnXElem.ToString() +
"," + lnYElem.ToString() +
"]");
2172 for (
int lnXindex = 0; lnXindex < lnXElem; lnXindex++)
2175 for (
int lnYIndex = 0; lnYIndex < lnYElem; lnYIndex++)
2177 lcValor = lcValor + ((Int64[,])loPar)[lnXindex, lnYIndex].ToString().Replace(
",",
".").Trim();
2178 if (lnYIndex != lnYElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2180 if (lnXindex != lnXElem - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2186 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2189 lcValor =
string.Empty;
2190 lnTotalElementos = 0;
2191 lnXElem = lnYElem = 0;
2194 #endregion MatrizInt64 2196 #endregion Matrices [x,y] 2200 #region ArrayStrings 2201 case "system.string[]":
2204 xmlParan.WriteElementString(
"tipo_param",
"STRING:ARRAY");
2207 lnTotalElementos = ((
string[])loPar).Length;
2209 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2211 lcValor = lcValor +
"'" + ((
string[])loPar)[lnIndex].ToString().Replace(
"'",
"''") +
"'";
2212 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2216 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2219 lcValor =
string.Empty;
2220 lnTotalElementos = 0;
2223 #endregion ArrayStrings 2225 #region ArrayBoleanos 2226 case "system.boolean[]":
2229 lcNodo = ((
bool[])loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2230 xmlParan.WriteElementString(
"tipo_param",
"BOOLEAN:ARRAY");
2233 lnTotalElementos = ((
bool[])loPar).Length;
2235 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2238 if (((
bool[])loPar)[lnIndex]) { lcValor = lcValor +
".T."; }
2239 else { lcValor = lcValor +
".F."; }
2240 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2244 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2247 lcValor =
string.Empty;
2248 lnTotalElementos = 0;
2251 #endregion ArrayBoleanos 2253 #region ArrayDateTime 2254 case "system.datetime[]":
2257 lcNodo = ((DateTime[])loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2258 xmlParan.WriteElementString(
"tipo_param",
"DATETIME:ARRAY");
2261 lnTotalElementos = ((DateTime[])loPar).Length;
2263 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2265 lcValor = lcValor +
"{^" + ((DateTime[])loPar)[lnIndex].Year.ToString().Trim() +
"-" +
2266 ((DateTime[])loPar)[lnIndex].Month.ToString().Trim() +
"-" +
2267 ((DateTime[])loPar)[lnIndex].Day.ToString().Trim() +
"}";
2268 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2272 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2275 lcValor =
string.Empty;
2276 lnTotalElementos = 0;
2279 #endregion ArrayDateTime 2281 #region ArrayDecimal 2282 case "system.decimal[]":
2285 xmlParan.WriteElementString(
"tipo_param",
"DECIMAL:ARRAY");
2288 lnTotalElementos = ((decimal[])loPar).Length;
2290 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2292 lcValor = lcValor + ((decimal[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2293 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2297 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2300 lcValor =
string.Empty;
2301 lnTotalElementos = 0;
2304 #endregion ArrayDecimal 2306 #region ArrayDeDouble 2307 case "system.double[]":
2310 lcNodo = ((
double[])loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2311 xmlParan.WriteElementString(
"tipo_param", lcNodo +
":ARRAY");
2313 lnTotalElementos = ((
double[])loPar).Length;
2316 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2318 lcValor = lcValor + ((
double[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2319 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2323 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2326 lcValor =
string.Empty;
2327 lcNodo =
string.Empty;
2328 lnTotalElementos = 0;
2331 #endregion ArrayDeDouble 2333 #region ArrayDeInt32 2334 case "system.int32[]":
2337 xmlParan.WriteElementString(
"tipo_param",
"INT32:ARRAY");
2340 lnTotalElementos = ((Int32[])loPar).Length;
2342 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2344 lcValor = lcValor + ((Int32[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2345 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2349 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2352 lcValor =
string.Empty;
2353 lnTotalElementos = 0;
2356 #endregion ArrayDeInt32 2358 #region ArrayDeInt16 2359 case "system.int16[]":
2362 xmlParan.WriteElementString(
"tipo_param",
"INT16:ARRAY");
2365 lnTotalElementos = ((Int16[])loPar).Length;
2367 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2369 lcValor = lcValor + ((Int16[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2370 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2374 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2377 lcValor =
string.Empty;
2378 lnTotalElementos = 0;
2381 #endregion ArrayDeInt16 2383 #region ArrayDeInt64 2384 case "system.int64[]":
2387 xmlParan.WriteElementString(
"tipo_param",
"INT32:ARRAY");
2390 lnTotalElementos = ((Int64[])loPar).Length;
2392 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2394 lcValor = lcValor + ((Int64[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2395 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2399 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2402 lcValor =
string.Empty;
2403 lnTotalElementos = 0;
2406 #endregion ArrayDeInt64 2408 #region ArrayDeUInt16 2409 case "system.uint16[]":
2412 xmlParan.WriteElementString(
"tipo_param",
"UINT16:ARRAY");
2415 lnTotalElementos = ((UInt16[])loPar).Length;
2417 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2419 lcValor = lcValor + ((UInt16[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2420 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2424 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2427 lcValor =
string.Empty;
2428 lnTotalElementos = 0;
2431 #endregion ArrayDeUInt16 2433 #region ArrayDeUInt32 2434 case "system.uint32[]":
2437 xmlParan.WriteElementString(
"tipo_param",
"UINT32:ARRAY");
2440 lnTotalElementos = ((UInt32[])loPar).Length;
2442 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2444 lcValor = lcValor + ((UInt32[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2445 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2449 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2452 lcValor =
string.Empty;
2453 lnTotalElementos = 0;
2456 #endregion ArrayDeUInt32 2458 #region ArrayDeUInt64 2459 case "system.uint64[]":
2462 xmlParan.WriteElementString(
"tipo_param",
"UINT64:ARRAY");
2465 lnTotalElementos = ((UInt64[])loPar).Length;
2467 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2469 lcValor = lcValor + ((UInt64[])loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2470 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2474 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2477 lcValor =
string.Empty;
2478 lnTotalElementos = 0;
2481 #endregion ArrayDeUInt64 2485 #region Listas (List<T>) 2487 #region ListaDeStrings 2488 case "system.collections.generic.list`1[system.string]":
2491 xmlParan.WriteElementString(
"tipo_param",
"STRING:ARRAY");
2494 lnTotalElementos = ((List<string>)loPar).Count;
2496 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2498 lcValor = lcValor +
"'" + ((List<string>)loPar)[lnIndex].ToString().Replace(
"'",
"''") +
"'";
2499 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2503 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2506 lcValor =
string.Empty;
2507 lnTotalElementos = 0;
2510 #endregion ListaDeStrings 2512 #region ListaDeBoleanos 2513 case "system.collections.generic.list`1[system.boolean]":
2516 lcNodo = ((List<bool>)loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2517 xmlParan.WriteElementString(
"tipo_param",
"BOOLEAN:ARRAY");
2520 lnTotalElementos = ((List<bool>)loPar).Count;
2522 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2525 if (((List<bool>)loPar)[lnIndex]) { lcValor = lcValor +
".T."; }
2526 else { lcValor = lcValor +
".F."; }
2527 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2531 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2534 lcValor =
string.Empty;
2535 lnTotalElementos = 0;
2538 #endregion ListaDeBoleanos 2540 #region ListaDeDateTime 2541 case "system.collections.generic.list`1[system.datetime]":
2544 lcNodo = ((List<DateTime>)loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2545 xmlParan.WriteElementString(
"tipo_param",
"DATETIME:ARRAY");
2548 lnTotalElementos = ((List<DateTime>)loPar).Count;
2550 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2552 lcValor = lcValor +
"{^" + ((List<DateTime>)loPar)[lnIndex].Year.ToString().Trim() +
"-" +
2553 ((List<DateTime>)loPar)[lnIndex].Month.ToString().Trim() +
"-" +
2554 ((List<DateTime>)loPar)[lnIndex].Day.ToString().Trim() +
"}";
2555 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2559 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2562 lcValor =
string.Empty;
2563 lnTotalElementos = 0;
2566 #endregion ListaDeDateTime 2568 #region ListaDeDecimal 2569 case "system.collections.generic.list`1[system.decimal]":
2572 xmlParan.WriteElementString(
"tipo_param",
"DECIMAL:ARRAY");
2575 lnTotalElementos = ((List<decimal>)loPar).Count;
2577 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2579 lcValor = lcValor + ((List<decimal>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2580 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2584 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2587 lcValor =
string.Empty;
2588 lnTotalElementos = 0;
2591 #endregion ListaDeDecimal 2593 #region ListaDeDouble 2594 case "system.collections.generic.list`1[system.double]":
2597 lcNodo = ((List<double>)loPar)[0].GetType().ToString().Trim().ToUpper().Substring(7);
2598 xmlParan.WriteElementString(
"tipo_param", lcNodo +
":ARRAY");
2600 lnTotalElementos = ((List<double>)loPar).Count;
2603 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2605 lcValor = lcValor + ((List<double>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2606 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2610 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2613 lcValor =
string.Empty;
2614 lcNodo =
string.Empty;
2615 lnTotalElementos = 0;
2618 #endregion ListaDeDouble 2620 #region ListaDeInt16 2621 case "system.collections.generic.list`1[system.int16]":
2624 xmlParan.WriteElementString(
"tipo_param",
"INT16:ARRAY");
2627 lnTotalElementos = ((List<Int16>)loPar).Count;
2629 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2631 lcValor = lcValor + ((List<Int16>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2632 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2636 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2639 lcValor =
string.Empty;
2640 lnTotalElementos = 0;
2643 #endregion ListaDeInt16 2645 #region ListaDeInt32 2646 case "system.collections.generic.list`1[system.int32]":
2649 xmlParan.WriteElementString(
"tipo_param",
"INT32:ARRAY");
2652 lnTotalElementos = ((List<Int32>)loPar).Count;
2654 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2656 lcValor = lcValor + ((List<Int32>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2657 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2661 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2664 lcValor =
string.Empty;
2665 lnTotalElementos = 0;
2668 #endregion ListaDeInt32 2670 #region ListaDeInt64 2671 case "system.collections.generic.list`1[system.int64]":
2674 xmlParan.WriteElementString(
"tipo_param",
"INT64:ARRAY");
2677 lnTotalElementos = ((List<Int64>)loPar).Count;
2679 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2681 lcValor = lcValor + ((List<Int64>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2682 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2686 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2689 lcValor =
string.Empty;
2690 lnTotalElementos = 0;
2693 #endregion ListaDeInt64 2695 #region ListaDeUInt16 2696 case "system.collections.generic.list`1[system.uint16]":
2699 xmlParan.WriteElementString(
"tipo_param",
"UINT16:ARRAY");
2702 lnTotalElementos = ((List<UInt16>)loPar).Count;
2704 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2706 lcValor = lcValor + ((List<UInt16>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2707 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2711 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2714 lcValor =
string.Empty;
2715 lnTotalElementos = 0;
2718 #endregion ListaDeUInt16 2720 #region ListaDeUInt32 2721 case "system.collections.generic.list`1[system.uint32]":
2724 xmlParan.WriteElementString(
"tipo_param",
"UINT32:ARRAY");
2727 lnTotalElementos = ((List<UInt32>)loPar).Count;
2729 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2731 lcValor = lcValor + ((List<UInt32>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2732 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2736 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2739 lcValor =
string.Empty;
2740 lnTotalElementos = 0;
2743 #endregion ListaDeUInt32 2745 #region ListaDeUInt64 2746 case "system.collections.generic.list`1[system.uint64]":
2749 xmlParan.WriteElementString(
"tipo_param",
"UINT64:ARRAY");
2752 lnTotalElementos = ((List<UInt64>)loPar).Count;
2754 for (
int lnIndex = 0; lnIndex < lnTotalElementos; lnIndex++)
2756 lcValor = lcValor + ((List<UInt64>)loPar)[lnIndex].ToString().Replace(
",",
".").Trim();
2757 if (lnIndex != lnTotalElementos - 1) lcValor = lcValor + NETVFP.SEPARADOR;
2761 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2764 lcValor =
string.Empty;
2765 lnTotalElementos = 0;
2768 #endregion ListaDeUInt64 2770 #endregion Listas (List<T>) 2772 #region Listas Ordenadas (SortedList<TKey,TValue>) 2774 #region SortedList<int,string> 2775 case "system.collections.generic.sortedlist`2[system.int32,system.string]":
2778 xmlParan.WriteElementString(
"tipo_param",
"STRING:ARRAY");
2781 lnTotalElementos = ((SortedList<int, string>)loPar).Count;
2784 foreach (
string lcValorCampo
in ((SortedList<int, string>)loPar).Values)
2787 lcValor = lcValor +
"'" + lcValorCampo.ToString().Replace(
"'",
"''") +
"'";
2788 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2792 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2795 lcValor =
string.Empty;
2796 lnTotalElementos = 0;
2797 lnElementoActual = 0;
2800 #endregion SortedList<int,string> 2802 #region SortedList<int,decimal> 2803 case "system.collections.generic.sortedlist`2[system.int32,system.decimal]":
2806 xmlParan.WriteElementString(
"tipo_param",
"DECIMAL:ARRAY");
2809 lnTotalElementos = ((SortedList<int, decimal>)loPar).Count;
2811 foreach (decimal lcValorCampo
in ((SortedList<int, decimal>)loPar).Values)
2814 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
2815 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2819 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2822 lcValor =
string.Empty;
2823 lnTotalElementos = 0;
2824 lnElementoActual = 0;
2827 #endregion SortedList<int,decimal> 2829 #region SortedList<int,bool> 2830 case "system.collections.generic.sortedlist`2[system.int32,system.boolean]":
2833 xmlParan.WriteElementString(
"tipo_param",
"BOOLEAN:ARRAY");
2836 lnTotalElementos = ((SortedList<int, bool>)loPar).Count;
2838 foreach (
bool lcValorCampo
in ((SortedList<int, bool>)loPar).Values)
2841 if (lcValorCampo) { lcValor = lcValor +
".T."; }
2842 else { lcValor = lcValor +
".F."; }
2843 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2847 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2850 lcValor =
string.Empty;
2851 lnTotalElementos = 0;
2852 lnElementoActual = 0;
2855 #endregion SortedList<int,bool> 2857 #region SortedList<int,DateTime> 2858 case "system.collections.generic.sortedlist`2[system.int32,system.datetime]":
2861 xmlParan.WriteElementString(
"tipo_param",
"DATETIME:ARRAY");
2864 lnTotalElementos = ((SortedList<int, DateTime>)loPar).Count;
2866 foreach (DateTime lcValorCampo
in ((SortedList<int, DateTime>)loPar).Values)
2869 lcValor = lcValor +
"{^" + lcValorCampo.Year.ToString().Trim() +
"-" +
2870 lcValorCampo.Month.ToString().Trim() +
"-" +
2871 lcValorCampo.Day.ToString().Trim() +
"}";
2872 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2876 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2879 lcValor =
string.Empty;
2880 lnTotalElementos = 0;
2881 lnElementoActual = 0;
2884 #endregion SortedList<int,DateTime> 2886 #region SortedList<int,double> 2887 case "system.collections.generic.sortedlist`2[system.int32,system.double]":
2890 xmlParan.WriteElementString(
"tipo_param",
"DOUBLE:ARRAY");
2892 lnTotalElementos = ((SortedList<int, double>)loPar).Count;
2894 foreach (
double lcValorCampo
in ((SortedList<int, double>)loPar).Values)
2897 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
2898 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2902 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2905 lcValor =
string.Empty;
2906 lnTotalElementos = 0;
2907 lnElementoActual = 0;
2910 #endregion SortedList<int,double> 2912 #region SortedList<int,Int16> 2913 case "system.collections.generic.sortedlist`2[system.int32,system.int16]":
2916 xmlParan.WriteElementString(
"tipo_param",
"INT16:ARRAY");
2919 lnTotalElementos = ((SortedList<int, Int16>)loPar).Count;
2921 foreach (Int16 lcValorCampo
in ((SortedList<int, Int16>)loPar).Values)
2924 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
2925 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2929 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2932 lcValor =
string.Empty;
2933 lnTotalElementos = 0;
2934 lnElementoActual = 0;
2937 #endregion SortedList<int,Int16> 2939 #region SortedList<int,Int32> 2940 case "system.collections.generic.sortedlist`2[system.int32,system.int32]":
2943 xmlParan.WriteElementString(
"tipo_param",
"INT32:ARRAY");
2946 lnTotalElementos = ((SortedList<int, Int32>)loPar).Count;
2948 foreach (Int32 lcValorCampo
in ((SortedList<int, Int32>)loPar).Values)
2951 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
2952 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2956 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2959 lcValor =
string.Empty;
2960 lnTotalElementos = 0;
2961 lnElementoActual = 0;
2964 #endregion SortedList<int,Int32> 2966 #region SortedList<int,Int64> 2967 case "system.collections.generic.sortedlist`2[system.int32,system.int64]":
2970 xmlParan.WriteElementString(
"tipo_param",
"INT64:ARRAY");
2973 lnTotalElementos = ((SortedList<int, Int64>)loPar).Count;
2975 foreach (Int64 lcValorCampo
in ((SortedList<int, Int64>)loPar).Values)
2978 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
2979 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
2983 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
2986 lcValor =
string.Empty;
2987 lnTotalElementos = 0;
2988 lnElementoActual = 0;
2991 #endregion SortedList<int,Int64> 2993 #region SortedList<int,UInt16> 2994 case "system.collections.generic.sortedlist`2[system.int32,system.uint16]":
2997 xmlParan.WriteElementString(
"tipo_param",
"UINT16:ARRAY");
3000 lnTotalElementos = ((SortedList<int, UInt16>)loPar).Count;
3002 foreach (UInt16 lcValorCampo
in ((SortedList<int, UInt16>)loPar).Values)
3005 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
3006 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
3010 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
3013 lcValor =
string.Empty;
3014 lnTotalElementos = 0;
3015 lnElementoActual = 0;
3018 #endregion SortedList<int,UInt16> 3020 #region SortedList<int,UInt32> 3021 case "system.collections.generic.sortedlist`2[system.int32,system.uint32]":
3024 xmlParan.WriteElementString(
"tipo_param",
"UINT32:ARRAY");
3027 lnTotalElementos = ((SortedList<int, UInt32>)loPar).Count;
3029 foreach (UInt32 lcValorCampo
in ((SortedList<int, UInt32>)loPar).Values)
3032 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
3033 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
3037 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
3040 lcValor =
string.Empty;
3041 lnTotalElementos = 0;
3042 lnElementoActual = 0;
3045 #endregion SortedList<int,UInt32> 3047 #region SortedList<int,UInt64> 3048 case "system.collections.generic.sortedlist`2[system.int32,system.uint64]":
3051 xmlParan.WriteElementString(
"tipo_param",
"UINT64:ARRAY");
3054 lnTotalElementos = ((SortedList<int, UInt64>)loPar).Count;
3056 foreach (UInt64 lcValorCampo
in ((SortedList<int, UInt64>)loPar).Values)
3059 lcValor = lcValor + lcValorCampo.ToString().Replace(
",",
".").Trim();
3060 if (lnElementoActual != lnTotalElementos) lcValor = lcValor + NETVFP.SEPARADOR;
3064 xmlParan.WriteElementString(
"parametros", lcValor.ToString().Trim());
3067 lcValor =
string.Empty;
3068 lnTotalElementos = 0;
3069 lnElementoActual = 0;
3072 #endregion SortedList<int,UInt64> 3074 #endregion Listas Ordenadas (SortedList<TKey,TValue>) 3079 xmlParan.WriteElementString(
"tipo_param", lcTipo.ToString().Trim().ToUpper().Substring(7));
3081 xmlParan.WriteElementString(
"parametros", _ToString(loPar));
3086 xmlParan.WriteEndElement();
3092 xmlParan.WriteEndElement();
3093 xmlParan.WriteEndDocument();
3098 return lcNombreFichero;
3106 private static void GuardarFicheroXmlRespuesta(
string tcRutaFicheroXml,
string[] tcValores)
3109 XmlDocument xmlReturn =
new XmlDocument();
3110 xmlReturn.LoadXml(
"<?xml version = \"1.0\" encoding=\"Windows-1252\" standalone=\"yes\"?><returnvalues> </returnvalues>");
3111 XmlNode loNodeA = xmlReturn.SelectSingleNode(
"returnvalues");
3114 foreach (
string lcValor
in tcValores)
3116 XmlNode loNode = xmlReturn.CreateElement(
"return");
3117 loNode.InnerText = lcValor;
3118 loNodeA.AppendChild(loNode);
3122 xmlReturn.PreserveWhitespace =
true;
3123 xmlReturn.Save(tcRutaFicheroXml);
3126 #endregion METODOS PRIVADOS Boolean _Show_Gestion_Accesos(String tcPantalla, string tcDescripcion="")
PE-86721 Este método presentará el formulario de Gestión de Accesos. PE-90297: añadimos el parámetro ...
Interficie del gestor de ficheros o365
static string GenerarChecksumOpciones(string tcOpcion, string tcSalt)
PE-102978: Generar una función hash segura a partir de una opción y un salt
static AddonsController Instance
Instancia al objeto singleton Addons
bool _Revisar_Connect_Formulario(FormBase toForm)
Método para revisar la tabla connect, actualizar los campos PROGRAMA y MODULO y realizar control de u...
static sage.ew.usuario.Usuario _This
Instancia estática del objeto usuario con los datos del usuario actual (wc_usuario) ...
Argumentos para los eventos lanzados por el addons en caso de error
bool _CargarAddOns(FunctionsDependencies loFuntionsDependencies)
Carga addons
bool _UploadFile(string tcPathOriginal, string tcPathDestination)
Sube un fichero a O365
bool _Acceso_Pantalla(string tcPantalla, _TiposAccesosPantalla tnTipoAcceso, bool tlTodosEjercicios=false, string tcEmpresa="")
Metodo que nos actualizará el acceso el titpo de acceso a una pantalla para este usuario ...
Clase Singleton para la carga de los diccionarios
PE-85105: Clase donde se implementaran aquellas funciones de encriptación y desencriptación utilizand...
override void _Load()
Load
void _CrearTareaAutomatica(string tcTaskName, string tcTaskDescription, string tcPantalla, List< bool > lstDiasSemana=null, string tcHorasMinutos="", List< string > lstParametrosExtra=null, bool tbSilentModeOnOk=false, Usuario toUsuario=null, bool tlSystemUser=true, int tnIntervalo=0)
Crea una tarea automatica DAILY con nombre tcTaskName para la ejecución de la pantalla tcPantalla PE-...
static bool CargarDiccionarios(string tcempresa, string tcCajaTpv)
A partir de un código de empresa y un código de caja nos carga las variables de empresa, mascaras, anchuras de campos standar y de TPV
Clase para uso de funciones genéricas
eTiposDocumentoImpresionMasiva
Tipos de documento para impresion masiva de desde FOX
IAddonsManager AddonsManager
Gestor de Addons
bool _OpenAndSavePath(string tcPathDestino, short tnTipo)
Abre un FolderDialog y guarda la selección del usuario en el path pasado por parémetros ...
_TiposAccesosPantalla _Acceso(string tcNombrePantalla, bool tbIgnorarHera=false)
Método que nos devolverá un entero con la siguiente información:
Dependencias con functions
void _Show_Favoritos(string tcPantalla, string tcDescripcio="")
PE-87840: método para mostrar la pantalla de favoritos
Definición de la clase Usuario