Esempio n. 1
0
        //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;
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        /// <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);
            }
        }
Esempio n. 6
0
        /// <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);
        }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
        /// <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);
        }
Esempio n. 9
0
        /// <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);
        }
Esempio n. 10
0
        /// <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);
        }
Esempio n. 11
0
        /// <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);
        }
Esempio n. 12
0
        /// <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);
        }
Esempio n. 13
0
        /// <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);
        }
Esempio n. 14
0
        /// <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);
        }
Esempio n. 15
0
        /// <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);
        }
Esempio n. 16
0
        /// <summary>
        /// Almacena un nuevo registro en la tabla de tipos de documentos a conservar
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="tiposDocumentosConservar"></param>
        /// <returns></returns>
        public bool Almacenar(CAE cae)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //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_IndCon", cae.IndicadorConservar);

                //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 el objeto servicioGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral);
                    System.GC.Collect();
                }
            }
            return(resultado);
        }
Esempio n. 17
0
        /// <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);
        }
Esempio n. 18
0
        /// <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);
        }
Esempio n. 19
0
        /// <summary>
        ///  Ingresa un nuevo registro a la tabla @TFEIMPDGIB1.
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="idSobre"></param>
        /// <param name="nombreSobre"></param>
        /// <param name="fechaSobre"></param>
        /// <returns></returns>
        public bool Almacenar(Impuesto impuesto)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //Apuntar a la cabecera del udo
                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                //Asiganar valor a cada una de las caracteristicas del udo
                dataGeneral.SetProperty("U_TipImpDgi", impuesto.TipoImpuestoDgi);
                dataGeneral.SetProperty("U_Desc", impuesto.Descripcion);
                dataGeneral.SetProperty("U_CodImpB1", impuesto.CodigoImpuestoB1);

                //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);
        }
Esempio n. 20
0
        /// <summary>
        /// Almacenar un nuevo registro en la base datos
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="emisor"></param>
        /// <returns></returns>
        public bool Almacenar(Emisor emisor)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //Apuntar a la cabecera del UDO
                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                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.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);
        }
Esempio n. 21
0
        /// <summary>
        /// Almacena la configuracion de ejecucion para el reporte diario
        /// </summary>
        /// <param name="confRptd"></param>
        /// <returns></returns>
        private bool Almacenar(string tipoCambio)
        {
            bool salida = false;

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

                dataGeneral.SetProperty("U_TC", tipoCambio);

                //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);
        }
Esempio n. 22
0
        /// <summary>
        /// Almacenar un nuevo registro en la tabla TCONS
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="emisor"></param>
        /// <returns></returns>
        public bool Almacenar(Consecutivo consecutivo)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //Apuntar a la cabecera del UDO
                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                dataGeneral.SetProperty("U_Token", consecutivo.Token);
                dataGeneral.SetProperty("U_IdRec", consecutivo.IdReceptor);

                //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("ManteUdoConsecutivo/AlmacenarError: " + 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);
        }
Esempio n. 23
0
        /// <summary>
        /// Almacena la adenda
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="tipoObjetoAsignado"></param>
        /// <param name="objetoAsignado"></param>
        /// <param name="partesAdenda"></param>
        /// <returns></returns>
        public bool Almacenar(string formaPago)
        {
            bool salida = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //Apuntar a la cabecera del udo
                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                dataGeneral.SetProperty("U_FrmPag", formaPago);

                //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>
        /// Metodo para insertar datos en tabla TECA
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="atributos"></param>
        /// <param name="nombreUdo"></param>
        /// <returns true="Datos insertados"
        ///          false="Datos no insertados"></returns>
        private bool almacenarCorreoElectronico(Correo correo)
        {
            bool           resultado       = false;
            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                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
                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 utilizada por el objeto servicioGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral);
                    System.GC.Collect();
                }
            }
            return(resultado);
        }
Esempio n. 25
0
        /// <summary>
        /// Almacenar un nuevo registro en la tabla TFECOIDCOM
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="emisor"></param>
        /// <returns></returns>
        public bool Almacenar(string conseIdComunicacion)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                //Apuntar a la cabecera del UDO
                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                dataGeneral.SetProperty("U_ConIdCom", conseIdComunicacion);

                //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);
        }
Esempio n. 26
0
        /// <summary>
        /// Almacena un nuevo registro en la tabla de razones de referencia
        /// </summary>
        /// <param name="listaRazones"></param>
        /// <returns></returns>
        public bool Almacenar(List <RazonReferencia> listaRazones)
        {
            bool resultado = false;

            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

            try
            {
                servicioGeneral = ProcConexion.Comp.GetCompanyService().GetGeneralService("TTFERZR");
                dataGeneral     = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                foreach (RazonReferencia razon in listaRazones)
                {
                    dataGeneral.SetProperty("U_Codigo", razon.CodigoRazon);
                    dataGeneral.SetProperty("U_Razon", razon.RazonReferenciaNC);

                    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);
        }
Esempio n. 27
0
        /// <summary>
        /// Metodo para almacenar datos de la ruta de adobe por usuario
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="usuario"></param>
        /// <param name="rutaLogo"></param>
        /// <returns></returns>

        public bool AlmacenarPDf(string nombrePdf)
        {
            bool           resultado       = false;
            GeneralService servicioGeneral = null;
            GeneralData    dataGeneral     = null;

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

                dataGeneral = servicioGeneral.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);

                dataGeneral.SetProperty("U_ArcPdf", nombrePdf);
                //Agregar el nuevo registro a la base de datos
                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 utilizada por el objeto servicioGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral);
                    System.GC.Collect();
                }
            }
            return(resultado);
        }
Esempio n. 28
0
 /// <summary>
 /// Add data in database
 /// </summary>
 /// <param name="gData">Data to add</param>
 /// <returns>Return the key of the data: DocEntry or Code depends of the type of the UDO</returns>
 public GeneralDataParams Add(GeneralData gData)
 {
     return(_generalService.Add(gData));
 }
Esempio n. 29
0
 void btnCrear_Click(object sender, EventArgs e)
 {
     completo = 0;
     for (int i = 0; i < orden.Rows.Count; i++)
     {
         if (0 < Convert.ToInt32(orden.Rows[i]["quantity"]))
         {
             miss     = i;
             faltante = orden.Rows[miss]["itemcode"].ToString();
             if (MessageBox.Show("Orden incompleta falta " + faltante + " ¿Desea continuar con el registro?", "Scaneo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 orden.Rows[miss]["quantity"] = 0;
             }
         }
         completo = completo + Convert.ToInt32(orden.Rows[i]["quantity"]);
     }
     if (completo == 0)
     {
         if (tbOrdencompra.Text == orden.Rows[0]["docentry"].ToString())
         {
             DataTable      diapi  = new DataTable();
             SqlDataAdapter ordenc = new SqlDataAdapter("Select Orden from ContadorDIAPI WHERE Orden = '" + tbOrdencompra.Text + "'", cn);
             ordenc.Fill(diapi);
             if (diapi.Rows.Count == 1)
             {
                 MessageBox.Show("La orden de compra ya esta registrada", "Scaneo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 DataTable      contador = new DataTable();
                 int            conta;
                 SqlDataAdapter datos = new SqlDataAdapter("Select * from ContadorDIAPI", cn);
                 datos.Fill(contador);
                 conta = 100 + contador.Rows.Count;
                 CompanyService    companyservice = ClaseCompartida.company.GetCompanyService();
                 GeneralService    generalservice = companyservice.GetGeneralService("SCAN");
                 GeneralDataParams dataparams     = null;
                 dataparams = (GeneralDataParams)generalservice.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralDataParams);
                 //Create data for new row in main UDO
                 GeneralData           DATA     = (GeneralData)generalservice.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);
                 GeneralDataCollection children = DATA.Child("SCAN_DET");
                 // Add
                 DATA.SetProperty("Code", conta.ToString());
                 DATA.SetProperty("U_ALM", tbOrdencompra.Text);
                 DATA.SetProperty("U_Fecha", DateTime.Now);
                 for (int i = 0; i < final.Rows.Count; i++)
                 {
                     GeneralData child = children.Add();
                     child.SetProperty("U_CBB", final.Rows[i][0].ToString());
                     child.SetProperty("U_QTY", final.Rows[i][3].ToString());
                     child.SetProperty("U_ITEMCODE", final.Rows[i][1].ToString());
                 }
                 generalservice.Add(DATA);
                 sql.Contador(conta, Convert.ToInt32(tbOrdencompra.Text));
                 MessageBox.Show("Producto Registrado", "Scaneo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 dataGridView1.DataSource = null;
                 tbOrdencompra.Text       = "";
             }
         }
         else
         {
             MessageBox.Show("Los productos no pertenecen a esta orden", "Scaneo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     //Update
     //oUDO_Name.SetProperty("Code", sCode);
     //oUDO_Name.SetProperty("Name", sName);
     //oUDO_Name.SetProperty("U_Remark", sRemark);
     //oUDO_Name.SetProperty("U_ActiveYN", sActiveYN);
     //generalservice.Update(oUDO_Name);
     ////Delete
     //dataparams.SetProperty("Code", sCode);
     //generalservice.Delete(dataparams);
 }
Esempio n. 30
0
        /// <summary>
        /// Ingresa un nuevo registro a la tabla @TFECEANU y su hija
        /// @TFECEANUDET.
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="maestro"></param>
        /// <returns></returns>
        public bool AlmacenarMaestro(Anulado certRechazado)
        {
            bool resultado = false;

            GeneralService        servicioGeneral = null;
            GeneralData           dataGeneral     = null;
            GeneralData           dataDetalle     = null;
            GeneralDataCollection detalle         = null;

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

                //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_SerieCert", certRechazado.SerieCertificado);
                dataGeneral.SetProperty("U_NumDoc", certRechazado.NumeroDocumento);
                dataGeneral.SetProperty("U_Version", certRechazado.Version);
                dataGeneral.SetProperty("U_RucEmisor", certRechazado.RucEmisor);
                dataGeneral.SetProperty("U_RucRecep", certRechazado.RucReceptor);
                dataGeneral.SetProperty("U_CantComp", certRechazado.CantidadComprobantes);
                dataGeneral.SetProperty("U_FeHoFir", certRechazado.FechaHoraFirma);

                detalle = dataGeneral.Child("TFECEANUDET");

                foreach (DetAnulado razonRechazo in certRechazado.DetalleRechazo)
                {
                    dataDetalle = detalle.Add();
                    dataDetalle.SetProperty("U_TipoCFE", razonRechazo.TipoCFE);
                    dataDetalle.SetProperty("U_SerieComp", razonRechazo.SerieComprobante);
                    dataDetalle.SetProperty("U_NumComp", razonRechazo.NumeroComprobante);
                    dataDetalle.SetProperty("U_FecComp", razonRechazo.FechaComprobante);
                    dataDetalle.SetProperty("U_CodAnu", razonRechazo.CodigoAnulacion);
                    dataDetalle.SetProperty("U_GlosaDoc", razonRechazo.GlosaRechazo);
                }

                ////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 (servicioGeneral != null)
                {
                    ////Liberar memoria utlizada por el objeto servicioGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(servicioGeneral);
                    System.GC.Collect();
                }
                if (dataGeneral != null)
                {
                    ////Liberar memoria utlizada por el objeto dataGeneral
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(dataGeneral);
                    System.GC.Collect();
                }
                if (dataDetalle != null)
                {
                    ////Liberar memoria utlizada por el objeto dataDetalle
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(dataDetalle);
                    System.GC.Collect();
                }
                if (detalle != null)
                {
                    ////Liberar memoria utlizada por el objeto detalle
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(detalle);
                    System.GC.Collect();
                }
            }
            return(resultado);
        }