Exemplo n.º 1
0
        public static async Task <SalesEstado> VerificarPrecioArticulo(TS_BEPromotionInput input)
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    VerificarPrecioArticuloCompleted(cliente.VERIFICAR_PROMOCION(input));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 2
0
        public static async Task <LoadEstado> ListaProductoPrecio(string glosa)
        {
            LoadEstado Respuesta = LoadEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _ListarArticuloPreciosCompleted(cliente.ListarArticuloPrecios(glosa));
                    Respuesta = LoadEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = LoadEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 3
0
        public static async Task <SalesEstado> _ObtenerArticulosPrefijos(string prefijo)
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _ObtenerArticulosPrefijosCompleted(cliente.OBTENER_ARTICULOS_POR_PREFIJO(prefijo));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 4
0
        public static async Task <SalesEstado> GrabarTransaccionPrefijo(TS_BEClienteInput Cliente, List <TS_BEArticulo> Articulos, TS_BETipoTarjetaRegistro Tipo)
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    GrabarTransaccionPrefijoCompleted(cliente.REGISTRAR_AFILIACION(cCliente: Cliente, Articulos: Articulos.ToArray(), Tipo: Tipo));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 5
0
        public static TS_BECabeceraOutPut SynchronizedGetOPTransaction(string cara, String cdcliente, bool automatic)
        {
            TS_BEOpTransInput Input = new TS_BEOpTransInput()
            {
                cara        = cara,
                Serie       = TSLoginApp.Serie,
                cdcliente   = cdcliente,
                tipocliente = "",
                automatic   = automatic
            };

            TS_SISalesClient client = null;

            try
            {
                client = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));

                return(client.ObtenerOpTransaccion(Input));
            }
            catch (Exception exception)
            {
                if (client != null)
                {
                    if (client.State == CommunicationState.Opened)
                    {
                        client.Close();
                    }
                }

                return(new TS_BECabeceraOutPut()
                {
                    Mensaje = exception.Message, Ok = false
                });
            }
        }
Exemplo n.º 6
0
        public static TS_BEMensaje SynchronizedSetSale(TerminalSIGES.Models.Lado Cara, TS_BEArticulo Transaccion)
        {
            TS_BELoadInput     cLoadingInput  = TSSalesInput.LoadInput();
            TS_BEClienteInput  cClienteInput  = TSSalesInput.InputClienteAutomaticMethod(Cara);
            TS_BECabeceraInput cCabeceraInput = TSSalesInput.InputCabeceraAutomaticMethod(Cara);

            TS_BEDetalleInput[]   cDetalleInput  = TSSalesInput.InputDetalleAutomaticMethod(Transaccion).ToArray();
            List <TS_BEPagoInput> vPagos         = TSSalesInput.InputPagosAutomaticMethod(Cara, Transaccion);
            TS_BEGrabarConfig     vConfiguracion = new TS_BEGrabarConfig()
            {
                IsNotPrint = Cara.IsImprimir
            };

            if (vPagos == null)
            {
                return(new TS_BEMensaje()
                {
                    mensaje = "EL MONTO TOTAL NO COINCIDE CON LOS PAGOS DE LA VENTA", Ok = false
                });
            }

            TS_BEPagoInput[] cPagoInput = vPagos.ToArray();

            TSSalesInput.InputMoneyAutomaticMethod(Cara, cCabeceraInput, cDetalleInput, cPagoInput);
            TS_SISalesClient client = null;

            try
            {
                client = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                TS_BERetornoTransaccion respuesta = client.GrabarTransaccion(cDetalleInput, cCabeceraInput, cPagoInput, cClienteInput, cLoadingInput, vConfiguracion);
                if (respuesta.Ok)
                {
                    return(new TS_BEMensaje()
                    {
                        mensaje = respuesta.Codigo, Ok = true
                    });
                }
                else
                {
                    return(new TS_BEMensaje()
                    {
                        mensaje = respuesta.Mensaje, Ok = false
                    });
                }
            }
            catch (Exception e)
            {
                if (client != null)
                {
                    if (client.State == CommunicationState.Opened)
                    {
                        client.Close();
                    }
                }
                return(new TS_BEMensaje()
                {
                    mensaje = e.Message, Ok = false
                });
            }
        }
Exemplo n.º 7
0
        public static async Task <SalesEstado> ObtenerCaras()
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _OBTENER_CARASCompleted(cliente.OBTENER_CARAS(TSLoginApp.Serie));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 8
0
        public static async Task <SalesEstado> _EliminarLado(string lado)
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _ELIMINAR_LADOCompleted(cliente.ELIMINAR_LADO(lado));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 9
0
        public static async Task <SalesEstado> ObtenerCorrelativo()
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    TS_BECorrelativoInput input = new TS_BECorrelativoInput()
                    {
                        seriehd = TSLoginApp.Serie
                    };
                    _ObtenerCorrelativoCompleted(cliente.ObtenerCorrelativo(input));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 10
0
        public static async Task <SalesEstado> ObtenerListaArticulos()
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    ObtenerListaArticulosCompleted(cliente.ObtenerListaArticulos(cdgrupo02: "00020"));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 11
0
        public static async Task <CustomerEstado> LoadClientByName(string rscliente)
        {
            CustomerEstado Respuesta = CustomerEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _ListarClientesByNameCompleted(cliente.ListarClientesByName((rscliente ?? "")));
                    Respuesta = CustomerEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = CustomerEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 12
0
        public static async Task <CustomerEstado> ObtenerClienteByCodigo()
        {
            CustomerEstado Respuesta = CustomerEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    TS_BEClienteSearch input = new TS_BEClienteSearch()
                    {
                        Codigo = CdCliente
                    };

                    _ObternerClienteByCodigoCompleted(cliente.ObternerClienteByCodigo(input));
                    Respuesta = CustomerEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = CustomerEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 13
0
        public static async Task <SalesEstado> GrabarVenta(bool ConIgv, bool IsCanje, bool IsNoImprimir)
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    TSCustomerApp.IsCanje = IsCanje;
                    cliente        = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    cDetalleInput  = new TS_BEDetalleInput[] { };
                    cCabeceraInput = new TS_BECabeceraInput();
                    cClienteInput  = new TS_BEClienteInput();
                    cCabeceraInput = TSSalesInput.InputcCabecera();
                    cClienteInput  = TSSalesInput.InputcCliente();
                    cDetalleInput  = TSSalesInput.Inputcdetalle(cCabeceraInput).ToArray();
                    cLoadingInput  = new TS_BELoadInput();
                    cLoadingInput  = TSSalesInput.LoadInput();
                    vConfiguracion = new TS_BEGrabarConfig()
                    {
                        IsNotPrint = IsNoImprimir
                    };

                    if (ConIgv)
                    {
                        TSSalesInput.RecalcularIGV(cDetalleInput);
                    }

                    _GrabarTransaccionCompleted(cliente.GrabarTransaccion(cDetalleInput, cCabeceraInput, cPagoInput, cClienteInput, cLoadingInput, vConfiguracion));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 14
0
        public static async Task <SalesEstado> ProcesarEliminarDocumento()
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;

            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    TS_BEDAnulaInput input = new TS_BEDAnulaInput()
                    {
                        cdtipodoc        = TipoDocumento,
                        cdusuario        = TSLoginApp.UserName,
                        fact_electronica = FactElectronica,
                        nrodocumento     = NroDocumento,
                        nropos           = NroPos,
                        nroseriemaq      = NroSerieMaq
                    };
                    _ANULAR_DOCUMENTOCompleted(cliente.ANULAR_DOCUMENTO(input));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 15
0
        public static async Task <SalesEstado> ObtenerOpTransaccion()
        {
            SalesEstado Respuesta = SalesEstado.ErrorSistema;
            await Task.Run(() => {
                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    TS_BEOpTransInput input = new TS_BEOpTransInput()
                    {
                        cara        = Cara,
                        Serie       = TSLoginApp.Serie,
                        cdcliente   = TSCustomerApp.TipoComprobante.Nombre.Equals(TSSalesInput.NotaDeDespacho().Nombre) ? TSCustomerApp.ClientOuput.nroTarjeta : TSCustomerApp.ClientOuput.cdcliente,
                        tipocliente = "",
                        automatic   = false
                    };

                    _ObtenerOpTransaccionCompleted(cliente.ObtenerOpTransaccion(input));
                    Respuesta = SalesEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = SalesEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }
Exemplo n.º 16
0
        public static async Task <LoadEstado> Loading(string cdempresa, string cdnivel, string cdusuario)
        {
            LoadEstado Respuesta = LoadEstado.ErrorSistema;
            await Task.Run(() => {
                TS_BELoadInput input = new TS_BELoadInput()
                {
                    Serie     = TSLoginApp.Serie,
                    cdempresa = cdempresa,
                    cdnivel   = cdnivel,
                    cdusuario = cdusuario
                };

                TS_SISalesClient cliente = null;
                try
                {
                    cliente = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales));
                    _LoadingCompleted(cliente.Loading(input));
                    Respuesta = LoadEstado.EsperandoRespuesta;
                }
                catch
                {
                    Respuesta = LoadEstado.ErrorSistema;
                }
                finally
                {
                    if (cliente != null)
                    {
                        if (cliente.State == CommunicationState.Opened)
                        {
                            cliente.Close();
                        }
                    }
                }
            });

            return(Respuesta);
        }