Esempio n. 1
0
        /// <summary>
        /// Deletes a row in the database table of the current UDO.
        /// </summary>
        /// <param name="paramName">Name of the key of the UDO: "DocEntry" or "Code"</param>
        /// <param name="paramValue">Value of the key of the UDO</param>
        public void Delete(string paramName, object paramValue)
        {
            var generalParams = GetDataInterface <GeneralDataParams>(GeneralServiceDataInterfaces.gsGeneralDataParams);

            generalParams.SetProperty(paramName, paramValue);
            _generalService.Delete(generalParams);
        }
Esempio n. 2
0
        /// <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();
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        /// <summary>
        /// Elimina un rango determinado
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="numeroRango"></param>
        /// <returns></returns>
        private bool Eliminar(string[] listaDocEntry)
        {
            bool resultado = false;

            GeneralService    servicioGeneral = null;
            GeneralDataParams parametros      = null;

            try
            {
                //Obtener servicio general de la compañia
                servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFECERT");

                //Obtener lista de parametros
                parametros = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams);

                foreach (string docEntry in listaDocEntry)
                {
                    //Establecer parametros
                    parametros.SetProperty("DocEntry", docEntry);
                    //Eliminar el rango
                    servicioGeneral.Delete(parametros);
                }
                resultado = true;
            }
            catch (Exception)
            {
            }
            finally
            {
                if (parametros != null)
                {
                    //Liberar memoria utlizada por 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);
        }
Esempio n. 6
0
        /// <summary>
        /// Elimina los sobres enviados a DGI
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        public bool Eliminar(ControlSobres control)
        {
            bool resultado = false;

            GeneralService    servicioGeneral = 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);

                //Agregar el nuevo registro a la base de datos mediante el servicio general
                servicioGeneral.Delete(parametros);

                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 (servicioGeneral != null)
                {
                    //Liberar memoria utlizada por el objeto servicioGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral);
                    System.GC.Collect();
                }
            }
            return(resultado);
        }
Esempio n. 7
0
        //Exclusão em tabela customizada por objeto, passar nome da tabela e parâmetros(Nome do campo e valor)
        protected bool Excluir(string nomeObjeto, KeyValuePair <string, string> parametro)
        {
            bool retorno = false;

            try
            {
                oCompService    = oCompany.GetCompanyService();
                oGeneralService = oCompService.GetGeneralService(nomeObjeto);
                oGeneralParams  = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));

                if (parametro.Key != null && parametro.Value != null)
                {
                    oGeneralParams.SetProperty(parametro.Key, parametro.Value);
                    oGeneralService.Delete(oGeneralParams);
                    retorno = true;
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(retorno);
        }