/// <summary> /// Actualiza la configuracion de ejecucion del reporte diario /// </summary> /// <param name="confRptd"></param> /// <returns></returns> private bool Actualizar(ConfRptd confRptd, string docEntry) { bool salida = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTCRPTD"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", docEntry); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_DiaE", confRptd.DiaEjecucion); dataGeneral.SetProperty("U_Modo", confRptd.ModoEjecucion); dataGeneral.SetProperty("U_SecEnv", confRptd.SecuenciaEnvio); dataGeneral.SetProperty("U_CAE_General", confRptd.CAEGenerico); dataGeneral.SetProperty("U_AutoGenerar", confRptd.AutoGenerar); dataGeneral.SetProperty("U_HoraEjecucion", confRptd.HoraEjec); dataGeneral.SetProperty("U_DiaEFinal", confRptd.DiaFin); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Update(dataGeneral); salida = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(salida); }
/// <summary> /// Actualiza la configuracion de ejecucion del reporte diario /// </summary> /// <param name="confRptd"></param> /// <returns></returns> private bool Actualizar(string tipoCambio, string docEntry) { bool salida = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEADOBE"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", docEntry); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_TC", tipoCambio); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Update(dataGeneral); salida = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(salida); }
//Inclusão em tabela customizada por objeto, passar nome da tabela e coleção de parâmetros(Nome do campo e valor) protected void Incluir(string nomeObjeto, Dictionary <string, string> parametros) { try { oCompService = oCompany.GetCompanyService(); oCompany.StartTransaction(); oGeneralService = oCompService.GetGeneralService(nomeObjeto); oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); if (parametros != null && parametros.Count > 0) { foreach (var item in parametros) { oGeneralData.SetProperty(item.Key.ToString(), item.Value.ToString()); } oGeneralService.Add(oGeneralData); } if (oCompany.InTransaction) { oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit); } } catch (Exception e) { if (oCompany.InTransaction) { oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack); } throw e; } }
public static bool addUDOInfo(object UDOInfo, string UDOName) { bool blResult = false; CompanyService objCompanyService = null; GeneralService UDOService = null; GeneralData headerInfo = null; GeneralDataParams addResult = null; try { objCompanyService = MainObject.Instance.B1Company.GetCompanyService(); UDOService = objCompanyService.GetGeneralService(UDOName); headerInfo = UDOService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); foreach (var prop in UDOInfo.GetType().GetProperties()) { headerInfo.SetProperty(prop.Name, prop.GetValue(UDOInfo, null)); } addResult = UDOService.Add(headerInfo); } catch (Exception er) { _Logger.Error("", er); } return(blResult); }
//Alteração em tabela customizada por objeto, passar nome da tabela e coleção de parâmetros(Nome do campo e valor) protected bool Alterar(string nomeObjeto, string codigo, Dictionary <string, string> parametros) { bool retorno = false; try { oCompService = oCompany.GetCompanyService(); oGeneralService = oCompService.GetGeneralService(nomeObjeto); oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams))); //Recupera Objeto para alteração oGeneralParams.SetProperty("Code", codigo); oGeneralData = oGeneralService.GetByParams(oGeneralParams); if (parametros != null && parametros.Count > 0) { foreach (var item in parametros) { oGeneralData.SetProperty(item.Key.ToString(), item.Value.ToString()); } oGeneralService.Update(oGeneralData); } retorno = true; } catch (Exception e) { throw e; } return(retorno); }
//Consulta em tabela customizada por objeto, passar nome da tabela e coleção de parâmetros(Nome do campo e valor) protected GeneralData Consultar(string nomeObjeto, Dictionary <string, string> parametros) { oGeneralData = null; try { if (!String.IsNullOrEmpty(nomeObjeto) && parametros != null) { oCompService = oCompany.GetCompanyService(); oGeneralService = oCompService.GetGeneralService(nomeObjeto); oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams))); if (parametros != null && parametros.Count > 0) { foreach (var item in parametros) { oGeneralParams.SetProperty(item.Key.ToString(), item.Value); } oGeneralData = oGeneralService.GetByParams(oGeneralParams); } } } catch (Exception e) { throw e; } return(oGeneralData); }
/// <summary> /// Deleta registro /// </summary> /// <param name="tableName">Nome da tabela</param> /// <param name="where">Condição WHERE</param> public void DeleteModel(string tableName, string where) { Recordset rs = (Recordset)SBOApp.Company.GetBusinessObject(BoObjectTypes.BoRecordset); string sql = @"SELECT Code FROM [{0}] WHERE {1}"; sql = SBOApp.TranslateToHana(String.Format(sql, tableName, where)); rs.DoQuery(String.Format(sql, tableName, where)); if (rs.RecordCount > 0) { CompanyService sCompany = SBOApp.Company.GetCompanyService(); GeneralService oGeneralService = sCompany.GetGeneralService(tableName.Replace("@", "")); GeneralDataParams oGeneralParams = (GeneralDataParams)oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams); oGeneralParams.SetProperty("Code", rs.Fields.Item(0).Value.ToString()); oGeneralService.Delete(oGeneralParams); } //Libera o objeto rs e chama o Garbage Collector Marshal.ReleaseComObject(rs); rs = null; GC.Collect(); }
/// <summary> /// Actualiza los datos de un motivo de rechazo determinado /// </summary> /// <param name="comp"></param> /// <param name="estadoCertificadoRecibido"></param> /// <returns></returns> public bool Actualizar(EstadoCertificadoRecibido estadoCertificadoRecibido) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEESTCFER"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", estadoCertificadoRecibido.DocEntry); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_Motivo", estadoCertificadoRecibido.Motivo); dataGeneral.SetProperty("U_Glosa", estadoCertificadoRecibido.Glosa); dataGeneral.SetProperty("U_Detalle", estadoCertificadoRecibido.Detalle); dataGeneral.SetProperty("U_ConsRec", estadoCertificadoRecibido.IdConsecutivo); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Update(dataGeneral); resultado = true; } catch (Exception) { } finally { if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (parametros != null) { //Liberar memoria utlizada por objeto parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Almacena los datos de la tabla TFECERT /// </summary> /// <param name="comp"></param> /// <param name="ruta"></param> /// <param name="pass"></param> /// <param name="usuario"></param> /// <returns></returns> public bool AlmacenarTFECERT(string ruta, string pass) { bool salida = true; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; if (comprobarCertificado(ruta, pass)) { try { string[] borrar = consultaBorrar(); if (borrar != null) { Eliminar(borrar); } //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECERT"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_RutaCer", ruta); dataGeneral.SetProperty("U_ClaveCer", pass); dataGeneral.SetProperty("U_UsuarioCer", ProcConexion.Comp.UserName); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); } catch (Exception) { salida = false; } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } } else { errorCertificado = true; salida = false; } return(salida); }
/// <summary> /// Almacena un nuevo registro en la tabla de CAE's /// </summary> /// <param name="comp"></param> /// <param name="cae"></param> /// <returns></returns> public bool Almacenar(CAE cae, out string idCAE) { bool resultado = false; idCAE = ""; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECAE"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_TipoDoc", ((int)cae.TipoCFE).ToString()); dataGeneral.SetProperty("U_NombDoc", cae.NombreDocumento); dataGeneral.SetProperty("U_Sucursal", cae.Sucursal); dataGeneral.SetProperty("U_Caja", QuitarGuion(cae.Caja)); dataGeneral.SetProperty("U_Serie", cae.Serie.ToUpper()); dataGeneral.SetProperty("U_NumIni", cae.NumeroDesde.ToString()); dataGeneral.SetProperty("U_NumFin", cae.NumeroHasta.ToString()); dataGeneral.SetProperty("U_TipAut", cae.TipoAutorizacion); dataGeneral.SetProperty("U_NumAut", cae.NumeroAutorizacion); dataGeneral.SetProperty("U_ValDesde", cae.FechaEmision); dataGeneral.SetProperty("U_ValHasta", cae.FechaVencimiento); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); //Consulta el DocEntry generado para el cae recien ingresado idCAE = ConsultarNumeroRangoCreado(cae); resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Actualiza los datos de un tipo de documento a conservar determinado /// </summary> /// <param name="comp"></param> /// <param name="cae"></param> /// <param name="numeroRegistro"></param> /// <returns></returns> public bool Actualizar(CAE cae, string numeroRegistro) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFETDCON"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", numeroRegistro); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_TipoDoc", ((int)cae.TipoCFE).ToString()); dataGeneral.SetProperty("U_NombDoc", cae.NombreDocumento); dataGeneral.SetProperty("U_IndCon", cae.IndicadorConservar); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Update(dataGeneral); resultado = true; } catch (Exception) { } finally { if (parametros != null) { //Liberar memoria utlizada por el objeto parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Actualiza los datos del emisor de factura electronica en la base de datos /// </summary> /// <param name="comp"></param> /// <param name="emisor"></param> /// <returns></returns> public bool Actualizar(Emisor emisor) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEEMI"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", 1); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); dataGeneral.SetProperty("U_Ruc", emisor.Ruc.ToString()); dataGeneral.SetProperty("U_Nombre", emisor.Nombre); dataGeneral.SetProperty("U_NombreC", emisor.NombreComercial); dataGeneral.SetProperty("U_NumRes", emisor.NumeroResolucion); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Update(dataGeneral); resultado = true; } catch (Exception) { } finally { if (parametros != null) { //Liberar memoria utlizada por el objeto parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Metodo para actualizar los datos de correo electronico /// </summary> /// <param name="comp"></param> /// <returns></returns> private bool actualizarCorreoElectronico(Correo correo, string entry) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTECA"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", entry); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_Correo", correo.Cuenta); dataGeneral.SetProperty("U_Clave", correo.Clave); dataGeneral.SetProperty("U_Opcion", correo.Opcion); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Update(dataGeneral); resultado = true; } catch (Exception) { } finally { if (parametros != null) { //Liberar memoria utlizada por parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Add new bom version /// </summary> private void AddBomVer(ref Recordset oRecBomVer, ref GeneralService oGeneralService, ref bool bubbleEvent, out string versionCode) { SAPbobsCOM.GeneralData oGeneralData; SAPbobsCOM.CompanyService sCmp; SAPbobsCOM.GeneralDataCollection oSons; SAPbobsCOM.GeneralData oSon; sCmp = oSBOCompany.GetCompanyService(); oGeneralService = sCmp.GetGeneralService("BOMVER"); oGeneralData = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData); oSons = oGeneralData.Child("SOL_BOMVER_D"); versionCode = string.Empty; try { // Specify data for main UDO versionCode = GenerateBomVersion(oRecBomVer.Fields.Item("ItemCode").Value); oGeneralData.SetProperty("U_SOL_ITEMCODE", oRecBomVer.Fields.Item("ItemCode").Value); oGeneralData.SetProperty("U_SOL_ITEMNAME", oRecBomVer.Fields.Item("ItemName").Value); oGeneralData.SetProperty("U_SOL_ITMGRPCOD", oRecBomVer.Fields.Item("ItmsGrpCod").Value); oGeneralData.SetProperty("U_SOL_ITEMGROUP", oRecBomVer.Fields.Item("ItmsGrpNam").Value); oGeneralData.SetProperty("U_SOL_BOMTYPE", oRecBomVer.Fields.Item("BomType").Value); oGeneralData.SetProperty("U_SOL_VERSION", versionCode); oGeneralData.SetProperty("U_SOL_PLANQTY", oRecBomVer.Fields.Item("PlanQty").Value); oGeneralData.SetProperty("U_SOL_POSTDATE", DateTime.Now.Date); oGeneralData.SetProperty("U_SOL_STATUS", "A"); oGeneralData.SetProperty("U_SOL_WHSCODE", oRecBomVer.Fields.Item("ToWH").Value); oGeneralData.SetProperty("U_SOL_REMARK", "Created by Add-On Update Bom Version"); while (!oRecBomVer.EoF) { oSon = oSons.Add(); oSon.SetProperty("U_SOL_TYPE", oRecBomVer.Fields.Item("Type").Value); oSon.SetProperty("U_SOL_ITEMCODE", oRecBomVer.Fields.Item("ItemCodeComp").Value); oSon.SetProperty("U_SOL_ITEMNAME", GetItemName(oRecBomVer.Fields.Item("ItemCodeComp").Value)); oSon.SetProperty("U_SOL_QTY", oRecBomVer.Fields.Item("Quantity").Value); oSon.SetProperty("U_SOL_WHSCODE", oRecBomVer.Fields.Item("Warehouse").Value); oSon.SetProperty("U_SOL_UOM", oRecBomVer.Fields.Item("Uom").Value); oSon.SetProperty("U_SOL_METHOD", oRecBomVer.Fields.Item("IssueMthd").Value); oRecBomVer.MoveNext(); } oGeneralService.Add(oGeneralData); } catch (Exception ex) { bubbleEvent = false; oSBOApplication.MessageBox(ex.Message); } finally { Utils.releaseObject(oGeneralData); Utils.releaseObject(sCmp); Utils.releaseObject(oSons); } }
/// <summary> /// Actualiza el estado de los sobres /// </summary> /// <param name="control"></param> /// <returns></returns> public bool Actualizar(ControlSobres control) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECONSOB"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", control.DocEntry); //Apuntar al udo que corresponde con los parametros dataGeneral = servicioGeneral.GetByParams(parametros); dataGeneral.SetProperty("U_Estado", control.Estado); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Update(dataGeneral); resultado = true; } catch (Exception ex) { SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(ex.ToString()); } finally { if (parametros != null) { //Liberar memoria utlizada por el objeto parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Almacena la adenda /// </summary> /// <param name="comp"></param> /// <param name="tipoObjetoAsignado"></param> /// <param name="objetoAsignado"></param> /// <param name="partesAdenda"></param> /// <returns></returns> private bool Almacenar(Adenda adenda) { bool salida = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEADENDA"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); dataGeneral.SetProperty("U_TipoObjAsig", adenda.TipoObjetoAsignado.ToString()); dataGeneral.SetProperty("U_ObjAsig", adenda.ObjetoAsignado); dataGeneral.SetProperty("U_Adenda1", adenda.ArregloAdenda[0]); dataGeneral.SetProperty("U_Adenda2", adenda.ArregloAdenda[1]); dataGeneral.SetProperty("U_Adenda3", adenda.ArregloAdenda[2]); dataGeneral.SetProperty("U_Adenda4", adenda.ArregloAdenda[3]); dataGeneral.SetProperty("U_Adenda5", adenda.ArregloAdenda[4]); dataGeneral.SetProperty("U_Adenda6", adenda.ArregloAdenda[5]); dataGeneral.SetProperty("U_Adenda7", adenda.ArregloAdenda[6]); dataGeneral.SetProperty("U_Adenda8", adenda.ArregloAdenda[7]); dataGeneral.SetProperty("U_Adenda9", adenda.ArregloAdenda[8]); dataGeneral.SetProperty("U_Adenda10", adenda.ArregloAdenda[9]); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); salida = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(salida); }
/// <summary> /// Almacena un nuevo registro en la tabla de Sucursales Direccion /// </summary> /// <param name="comp"></param> /// <param name="listaSucuDire"></param> /// <returns></returns> public bool Almacenar(ArrayList listaSucuDire) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTSUCDIRE"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Recorre la lista de retencion/percepcion foreach (SucuDireccion SucDire in listaSucuDire) { if (SucDire.Codigo != "" && SucDire.Ciudad != "") { //Establecer los valores para las propiedades dataGeneral.SetProperty("U_Codigo", SucDire.Codigo); dataGeneral.SetProperty("U_Calle", SucDire.Calle); dataGeneral.SetProperty("U_Telefono", SucDire.Telefono); dataGeneral.SetProperty("U_Ciudad", SucDire.Ciudad); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); } } resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Ingresa un nuevo registro a la tabla @TFECFE. /// </summary> /// <param name="comp"></param> /// <param name="idCFE"></param> /// <param name="idSobre"></param> /// <param name="tipo"></param> /// <param name="idReceptor"></param> /// <param name="fechaCreacion"></param> /// <param name="estado"></param> /// <returns></returns> public bool Almacenar(CFE cfe, string MayorUI) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECFE"); //Apuntar a la cabecera del UDO dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Asiganar valor a cada una de la propiedades del udo dataGeneral.SetProperty("U_DocSap", cfe.DocumentoSAP); dataGeneral.SetProperty("U_TipoDoc", cfe.TipoCFEInt.ToString()); dataGeneral.SetProperty("U_NumCFE", cfe.NumeroComprobante.ToString()); dataGeneral.SetProperty("U_Serie", cfe.SerieComprobante); dataGeneral.SetProperty("U_EstadoDgi", cfe.EstadoDGI.ToString()); dataGeneral.SetProperty("U_EstadoRec", cfe.EstadoReceptor.ToString()); dataGeneral.SetProperty("U_Sucursal", cfe.CodigoCasaPrincipalEmisor.ToString()); dataGeneral.SetProperty("U_FechaFirma", cfe.FechaFirma.ToString()); dataGeneral.SetProperty("U_MayorUI", MayorUI); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception ex) { // SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("ManteUdoCFE/Error: " + ex.ToString()); } finally { if (dataGeneral != null) { //Liberar memoria utlizada por dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Ingresa un nuevo registro a la tabla @TFECFE. /// </summary> /// <param name="comp"></param> /// <param name="rango"></param> /// <returns></returns> public bool Almacenar(Rango rango) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFERANGO"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para cada una de las propiedades del udo dataGeneral.SetProperty("U_TipoDoc", ((int)rango.TipoDocumento).ToString()); dataGeneral.SetProperty("U_NumIni", rango.NumeroInicial.ToString()); dataGeneral.SetProperty("U_NumFin", rango.NumeroFinal.ToString()); dataGeneral.SetProperty("U_NumAct", rango.NumeroActual.ToString()); dataGeneral.SetProperty("U_Serie", rango.Serie); dataGeneral.SetProperty("U_ValDesde", rango.ValidoDesde); dataGeneral.SetProperty("U_ValHasta", rango.ValidoHasta); dataGeneral.SetProperty("U_IdCAE", rango.IdCAE); dataGeneral.SetProperty("U_Activo", rango.Activo); //Agregar el nuevo registro a la base de dato utilizando el servicio general de la compañia servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Ingresa un nuevo registro a la tabla @TFEST /// </summary> /// <param name="comp"></param> /// <param name="maestro"></param> /// <returns></returns> public bool Almacenar(SobreTransito sobreTransito) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEST"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para cada una de las propiedades del udo dataGeneral.SetProperty("U_NomSob", sobreTransito.NombreSobre); dataGeneral.SetProperty("U_Token", sobreTransito.Token); dataGeneral.SetProperty("U_IdRec", sobreTransito.IdReceptor); dataGeneral.SetProperty("U_TipoRec", sobreTransito.TipoReceptor.ToString()); dataGeneral.SetProperty("U_CorRec", sobreTransito.CorreoReceptor); dataGeneral.SetProperty("U_Tipo", sobreTransito.Tipo); dataGeneral.SetProperty("U_Numero", sobreTransito.Numero); dataGeneral.SetProperty("U_Serie", sobreTransito.Serie); //Agregar el nuevo registro a la base de dato utilizando el servicio general de la compañia servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception ex) { SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("Error Almacenar Sobre Transito " + ex.ToString()); } finally { if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral GC.SuppressFinalize(servicioGeneral); System.GC.Collect(); } if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral GC.SuppressFinalize(dataGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Almacena la configuracion de ejecucion para el reporte diario /// </summary> /// <param name="confRptd"></param> /// <returns></returns> private bool Almacenar(ConfRptd confRptd) { bool salida = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTCRPTD"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); dataGeneral.SetProperty("U_DiaE", confRptd.DiaEjecucion); dataGeneral.SetProperty("U_Modo", confRptd.ModoEjecucion); dataGeneral.SetProperty("U_SecEnv", confRptd.SecuenciaEnvio); dataGeneral.SetProperty("U_CAE_General", confRptd.CAEGenerico); dataGeneral.SetProperty("U_AutoGenerar", confRptd.AutoGenerar); dataGeneral.SetProperty("U_HoraEjecucion", confRptd.HoraEjec); dataGeneral.SetProperty("U_DiaEFinal", confRptd.DiaFin); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); salida = true; } catch (Exception ex) { SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(ex.ToString()); } finally { if (dataGeneral != null) { //Liberar memoria utlizada por objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(salida); }
/// <summary> /// Almacena un nuevo registro en la tabla de retencion/percepecion /// </summary> /// <param name="comp"></param> /// <param name="listaRetencionPercepcion"></param> /// <returns></returns> public bool Almacenar(ArrayList listaRetencionPercepcion) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFERP"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Recorre la lista de retencion/percepcion foreach (RetencionPercepcion retPer in listaRetencionPercepcion) { //Establecer los valores para las propiedades dataGeneral.SetProperty("U_SuPas", retPer.SujetoPasivo); dataGeneral.SetProperty("U_ConRet", retPer.ContribuyenteRetenido); dataGeneral.SetProperty("U_Agente", retPer.AgenteResponsable); dataGeneral.SetProperty("U_FormBeta", retPer.FormularioLineaBeta); dataGeneral.SetProperty("U_CodRet", retPer.CodigoRetencion); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); } resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
//Consulta o o último Id por objeto na tabela customizada protected int ConsultarUltimoId(string nomeObjeto) { int ultimo = 0; try { oCompService = oCompany.GetCompanyService(); oGeneralService = oCompService.GetGeneralService(nomeObjeto); try { oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); GeneralCollectionParams oGeneralCol = oGeneralService.GetList(); List <int> lista = new List <int>(); foreach (GeneralDataParams item in oGeneralCol) { string aux = item.GetProperty("Code").ToString(); if (aux != "*") { lista.Add(Convert.ToInt32(aux)); } } lista.Sort(); ultimo = lista.Last(); } catch (Exception e) { //Não existe registro no BD if (e.HResult == -2028) { return(ultimo); } //Registro Duplicado else if (e.HResult == -2035) { throw e; } } } catch (Exception e) { throw e; } return(ultimo); }
/// <summary> /// Almacena los sobres /// </summary> /// <param name="controlSobres"></param> /// <returns></returns> public bool Almacenar(ControlSobres controlSobres) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECONSOB"); //Apuntar a la cabecera del UDO dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Asiganar valor a cada una de la propiedades del udo dataGeneral.SetProperty("U_Tipo", controlSobres.Tipo); dataGeneral.SetProperty("U_Serie", controlSobres.Serie); dataGeneral.SetProperty("U_Numero", controlSobres.Numero); dataGeneral.SetProperty("U_Estado", controlSobres.Estado); dataGeneral.SetProperty("U_Usuario", controlSobres.UsuarioSap); dataGeneral.SetProperty("U_DocSap", controlSobres.DocumentoSap); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception ex) { SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("ERROR: Almacenar Envio DGI/ " + ex.ToString()); } finally { if (dataGeneral != null) { //Liberar memoria utlizada por dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Ingresa un nuevo registro a la tabla @TFECERCON /// </summary> /// <param name="comp"></param> /// <param name="idCFE"></param> /// <param name="idSobre"></param> /// <param name="tipo"></param> /// <param name="idReceptor"></param> /// <param name="fechaCreacion"></param> /// <param name="estado"></param> /// <returns></returns> public bool Almacenar(CFE cfe) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECERCON"); //Apuntar a la cabecera del UDO dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Asiganar valor a cada una de la propiedades del udo dataGeneral.SetProperty("U_DocSap", cfe.DocumentoSAP); dataGeneral.SetProperty("U_TipoDoc", cfe.TipoCFEInt.ToString()); dataGeneral.SetProperty("U_NumCFE", cfe.NumeroComprobante.ToString()); dataGeneral.SetProperty("U_Serie", cfe.SerieComprobante); dataGeneral.SetProperty("U_EmaRec", cfe.CorreoReceptor); //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Elimina el sobre en transito /// </summary> /// <param name="comp"></param> /// <param name="docEntry"></param> /// <returns></returns> public bool Eliminar(string docEntry) { bool resultado = false; GeneralService servicioGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = (ProcConexion.Comp.GetCompanyService()).GetGeneralService("TTFEST"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); //Establecer parametros parametros.SetProperty("DocEntry", docEntry); if (ValidarDocEntry(docEntry)) { //Agregar el nuevo registro a la base de datos mediante el servicio general servicioGeneral.Delete(parametros); } resultado = true; } catch (Exception) { //SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("Error Eliminar " + ex.ToString()); } finally { if (parametros != null) { //Liberar memoria utlizada por el objeto parametros GC.SuppressFinalize(parametros); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral GC.SuppressFinalize(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Almacena un nuevo motivo de rechazo /// </summary> /// <param name="comp"></param> /// <param name="estadoCertificadoRecibido"></param> /// <returns></returns> public bool Almacenar(EstadoCertificadoRecibido estadoCertificadoRecibido) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEESTCFER"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para cada una de las propiedades del udo dataGeneral.SetProperty("U_Motivo", estadoCertificadoRecibido.Motivo); dataGeneral.SetProperty("U_Glosa", estadoCertificadoRecibido.Glosa); dataGeneral.SetProperty("U_Detalle", estadoCertificadoRecibido.Detalle); dataGeneral.SetProperty("U_ConsRec", estadoCertificadoRecibido.IdConsecutivo); //Agregar el nuevo registro a la base de dato utilizando el servicio general de la compañia servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Ingresa un nuevo registro a la tabla @TFESOBRE. /// </summary> /// <param name="comp"></param> /// <param name="idSobre"></param> /// <param name="nombreSobre"></param> /// <param name="fechaSobre"></param> /// <returns></returns> public bool Almacenar(string idSobre, string nombreSobre, string fechaSobre) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener el servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFESOBRE"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Asiganar valor a cada una de las caracteristicas del udo dataGeneral.SetProperty("U_IDSobre", idSobre); dataGeneral.SetProperty("U_NomSobre", nombreSobre); dataGeneral.SetProperty("U_FecSobre", fechaSobre); //Agregar el nuevo registro a la base de datos mediante el servicio general de la compañia servicioGeneral.Add(dataGeneral); resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por el objeto dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utilizada por el objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Elimina todos los registros de retencion/percepcion existentes /// </summary> /// <param name="comp"></param> /// <param name="listaSucursalesDirecciones"></param> /// <returns></returns> public bool Eliminar(ArrayList listaSucursalesDirecciones) { bool resultado = false; GeneralService servicioGeneral = null; GeneralDataParams parametros = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTSUCDIRE"); //Obtener lista de parametros parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams); foreach (SucuDireccion SucDire in listaSucursalesDirecciones) { //Establecer parametros parametros.SetProperty("DocEntry", SucDire.IdidSucuDire); //Eliminar el rango servicioGeneral.Delete(parametros); } resultado = true; } catch (Exception) { } finally { if (parametros != null) { //Liberar memoria utlizada por el objeto parametros System.Runtime.InteropServices.Marshal.ReleaseComObject(parametros); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }
/// <summary> /// Almacena un nuevo registro en la tabla de estado de contingencia /// </summary> /// <param name="comp"></param> /// <param name="estado"></param> /// <returns></returns> public bool Almacenar(string estado) { bool resultado = false; GeneralService servicioGeneral = null; GeneralData dataGeneral = null; try { //Obtener servicio general de la compañia servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFEESTCON"); //Apuntar a la cabecera del udo dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); //Establecer los valores para las propiedades dataGeneral.SetProperty("U_Activo", estado); //Agregar el nuevo registro a la base de datos mediante el serivicio general servicioGeneral.Add(dataGeneral); FrmEstadoContingencia.estadoContingencia = estado; resultado = true; } catch (Exception) { } finally { if (dataGeneral != null) { //Liberar memoria utlizada por dataGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral); System.GC.Collect(); } if (servicioGeneral != null) { //Liberar memoria utlizada por objeto servicioGeneral System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral); System.GC.Collect(); } } return(resultado); }