示例#1
0
        public int InsertaCarritoCambio(NuevoCambioC9 cambioC9, string idEmpleado, string idTerminal, string idTienda, string idMaquina, ref string idCarrito, ref int iDuplicado)
        {
            int result = 0;

            int            idArticulo = 0;
            int            idPedido   = 0;
            int            cabDetalle = 0;
            double         PVP        = 0;
            SqlTransaction sqlTrans;

            objCapaDatos             = new ClsCapaDatos9();
            objCapaDatos.ConexString = StrCadenaConexion;
            sqlTrans = objCapaDatos.GetTransaction();
            try
            {
                idArticulo = objCapaDatos.GetIdArticulo(cambioC9.Referencia, ref PVP, ref cabDetalle, sqlTrans);
                if (idCarrito != "")
                {
                    iDuplicado = objCapaDatos.CheckCambiosDuplicados(idArticulo, idCarrito, sqlTrans);
                }
                if (iDuplicado < 1)
                {
                    //insertar pedido
                    result = objCapaDatos.InsertarPedido(idArticulo, idTerminal, PVP, idTienda, idEmpleado, sqlTrans, ref idPedido);
                    if (result > 0)
                    {
                        if (idCarrito == "")
                        {
                            result = objCapaDatos.InsertarCarrito(idEmpleado, sqlTrans, ref idCarrito, cambioC9.TarjetaActual, cambioC9.NuevaTarjeta, cambioC9.IdCliente, idMaquina);
                        }
                        else
                        {
                            result = objCapaDatos.UpdatarCarrito(idEmpleado, sqlTrans, ref idCarrito, cambioC9.TarjetaActual, cambioC9.NuevaTarjeta, cambioC9.IdCliente, idMaquina);
                        }

                        if (result > 0)
                        {
                            result = objCapaDatos.InsertaCarritoLinea(idCarrito, idArticulo, PVP, idPedido, sqlTrans, cabDetalle);
                        }
                    }
                }

                if (result > 0)
                {
                    sqlTrans.Commit();
                }
                else
                {
                    sqlTrans.Rollback();
                    log.Error("Realizando Rollback en la creación del carrito para cambios en Cliente 9");
                }
            }
            catch (Exception ex) {
                log.Error("Exception InsertarCarritoCambio:" + ex.Message.ToString());
                sqlTrans.Rollback();
            }

            return(result);
        }
示例#2
0
        public int ActualizaDatosCliente(Models.Cliente9 client, Models.Cliente9Extent clientExtend, string IdEmpleado, string IdTienda, string IdTerminal, ref string strWS, ref string IdSocioC9, ref int error309)
        {
            int            result = 0;
            SqlTransaction sqlTrans;
            string         cadConexion = "";

            error309                 = 0;
            strWS                    = "";
            IdSocioC9                = "";
            objCapaDatos             = new ClsCapaDatos9();
            objCapaDatos.ConexString = StrCadenaConexion;
            sqlTrans                 = objCapaDatos.GetTransaction();
            cadConexion              = sqlTrans.Connection.ConnectionString;
            try
            {
                result = objCapaDatos.TryAbreConexion(ref sqlTrans);
                result = objCapaDatos.ActualizacionCliente9(client, clientExtend, IdEmpleado, sqlTrans);
                if (result > 0)
                {
                    result = ws_ActualizaSocio(client, clientExtend, IdEmpleado, IdTienda, IdTerminal, ref strWS, ref IdSocioC9, cadConexion);
                    if (result == 309)
                    {
                        error309 = 1;
                        sqlTrans.Commit();
                    }
                    if (result > 0)
                    {
                        if (error309 != 1)
                        {
                            objCapaDatos.ActualizaIdC9(IdSocioC9, client, sqlTrans);
                            sqlTrans.Commit();
                        }
                    }
                    else
                    {
                        sqlTrans.Rollback();
                    }
                }
                else
                {
                    sqlTrans.Rollback();
                }
                objCapaDatos.TryCierraConexion();
            }
            catch (Exception ex) {
                log.Error("ClsCliente9.ActualizaCliente:" + ex.Message.ToString());
                sqlTrans.Rollback();
            }

            return(result);
        }
示例#3
0
        public int  GetContadorTiendas(string strTienda, ref int NumTienda, ref int ContadorTiendas, ref bool blnAlmacen)
        {
            int result = 0;

            try {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.CuentaTiendas(strTienda, ref NumTienda, ref ContadorTiendas, ref blnAlmacen);
            }
            catch (Exception ex) {
                log.Error("Exception GetContadorTiendas." + ex.Message.ToString());
            }

            return(result);
        }
示例#4
0
        //Se utiliza para obtener los datos de busqueda de cliente en la administración de cliente nine
        public List <Cliente9> GetClienteAdm9(String Cliente, DateTime Fecha)
        {
            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;

                return(objCapaDatos.GetDatCliente(Cliente, Fecha));
            }

            catch (Exception sqlEx)
            {
                log.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, sqlEx);
                throw new Exception(sqlEx.Message, sqlEx.InnerException);
            }
        }
示例#5
0
        public int ObtieneDatosTarjeta(string IdCarrito, ref string TarjetaActual, ref string TarjetaConsolidada, ref string IdEmpleado, ref string IdCliente, ref string idTarjetaAnterior, SqlTransaction sqlTrans)
        {
            int result = 0;

            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.GetDatosTarjeta(IdCarrito, ref TarjetaActual, ref TarjetaConsolidada, ref IdEmpleado, ref IdCliente, ref idTarjetaAnterior, sqlTrans);
            }
            catch (Exception ex)
            {
                log.Error("Exception CompruebaIdOk." + ex.Message.ToString());
            }
            return(result);
        }
示例#6
0
        public int ValidaCambiosTJT(string idCarrito, string referencias, ref int NumArticulos)
        {
            int result = 0;

            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.GetItemCarrito(idCarrito, referencias, ref NumArticulos);
            }
            catch (Exception ex)
            {
                log.Error("Exception CompruebaIdOk." + ex.Message.ToString());
            }
            return(result);
        }
示例#7
0
        public List <Models.FacturacionC9> GetDatosFacturacion(string IdCliente)
        {
            List <Models.FacturacionC9> datosFac = new List <Models.FacturacionC9>();
            int result = 0;

            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.GetDatosFacturacion(IdCliente, ref datosFac);
            }
            catch (Exception ex) {
                log.Error("Exception GetDatosFacturacion:" + ex.Message.ToString());
            }
            return(datosFac);
        }
示例#8
0
        public int GuardaDatosFacturacion(Models.FacturacionC9 DatosFact, string RFCOld)
        {
            int result = 0;

            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.SetDatosFacturacion(DatosFact, RFCOld);
            }
            catch (Exception ex) {
                log.Error("Exception GuardaDatosFacturacion:" + ex.Message.ToString());
            }

            return(result);
        }
示例#9
0
        private int ObtieneRango(ref long RangoIni, ref long RangoFin, int option)
        {
            int result = 0;

            objCapaDatos             = new ClsCapaDatos9();
            objCapaDatos.ConexString = StrCadenaConexion;
            try
            {
                result = objCapaDatos.ObtieneRango(ref RangoIni, ref RangoFin, option);
            }
            catch (Exception ex)
            {
                log.Error("Exception ObtieneRango:" + ex.Message.ToString());
            }
            return(result);
        }
示例#10
0
        internal virtual void InvokeUpCliente9Ws(string idTienda, string idCliente, int opcion)
        {
            Int16    Result    = 0;
            String   DIRFTP    = String.Empty;
            String   Online    = String.Empty;
            string   accion    = "";
            DateTime fecha     = DateTime.Now;
            short    opcAccion = Convert.ToInt16(opcion);

            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;

                DataSet Ds = new DataSet();
                ServicioModdoOnline.SModdoOnlineSoapClient _wsOnline;


                objCapaDatos.GetConfOnline(idTienda, ref DIRFTP, ref Online);

                if (Online == "1")
                {
                    String Url = GetURLWsOnline("SModdoOnlineSoap");
                    accion = (opcion == 1) ? "SUBIDA" : "SUBIDA TARJETA";
                    //codigo comentado sobre comprobar una url
                    if (CheckURLWs(Url, 10000))
                    {
                        Ds        = objCapaDatos.GeDataSetUpClientes(Convert.ToInt32(idCliente), opcion);
                        _wsOnline = new ServicioModdoOnline.SModdoOnlineSoapClient();
                        Result    = _wsOnline.SetUpDownClientes(ref Ds, DIRFTP, fecha, idTienda, idCliente, Convert.ToInt16(opcion));

                        //registramos en el historico web services
                        objCapaDatos.InsertarHistoricoWs(idTienda, fecha, accion, "UP", idCliente, "", DIRFTP, Result);
                    }
                    else
                    {
                        objCapaDatos.InsertarHistoricoWs(idTienda, fecha, accion, "UP", idCliente, "", DIRFTP, 0);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                objCapaDatos.InsertarHistoricoWs(idTienda, _Fecha, "CLIENTES", "UP", idCliente, "", DIRFTP, Result);
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
示例#11
0
        public int CompruebaIdOk(long idCliTmp)
        {
            int result = 1;


            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.CompruebaIdCliente(idCliTmp);
            }
            catch (Exception ex)
            {
                log.Error("Exception CompruebaIdOk." + ex.Message.ToString());
            }
            return(result);
        }
示例#12
0
        public int CkeckCliente9BD(int IdCliente, ref int yaEsC9)
        {
            int result = 1;


            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.CheckCliente9(IdCliente, ref yaEsC9);
            }
            catch (Exception ex)
            {
                log.Error("Exception CompruebaIdOk." + ex.Message.ToString());
            }
            return(result);
        }
示例#13
0
        public int EliminaClienteNine(string IdCliente, string numTarjeta)
        {
            int result = 1;


            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.EliminaCliente9(IdCliente, numTarjeta);
            }
            catch (Exception ex)
            {
                log.Error("Exception EliminaCliente9." + ex.Message.ToString());
            }
            return(result);
        }
示例#14
0
        public int  UpdateHistoricoErr309(string strMetodoWS, string strEntrada, string Tienda)
        {
            int result = 1;


            try
            {
                objCapaDatos             = new ClsCapaDatos9();
                objCapaDatos.ConexString = StrCadenaConexion;
                result = objCapaDatos.UpdateHistoricoErr309(strMetodoWS, strEntrada, Tienda);
            }
            catch (Exception ex)
            {
                log.Error("Exception EliminaCliente9." + ex.Message.ToString());
            }
            return(result);
        }
示例#15
0
        public int CambioPlastico(DataSet ds, string strIdTicket, string IdCarrito, string Tienda, string Terminal, string NivelConsolidado, ref string msgWS)
        {
            int    result            = 0;
            string TjtActual         = "";
            string TjtConsolidada    = "";
            string IdTarjetaAnterior = "";
            bool   esCambio          = false;
            string NivelActual       = "";
            string IdEmpleado        = "";
            string cadConexion       = "";
            string IdCliente         = "";

            SqlTransaction sqlTrans;

            objCapaDatos             = new ClsCapaDatos9();
            objCapaDatos.ConexString = StrCadenaConexion;
            sqlTrans = objCapaDatos.GetTransaction();
            try
            {
                cadConexion = sqlTrans.Connection.ConnectionString;
                result      = objCapaDatos.TryAbreConexion(ref sqlTrans);

                esCambio = ValidaVentaPlastico(ds, ref NivelActual, NivelConsolidado);
                if (esCambio)
                {
                    if (ObtieneDatosTarjeta(IdCarrito, ref TjtActual, ref TjtConsolidada, ref IdEmpleado, ref IdCliente, ref IdTarjetaAnterior, sqlTrans) > 0)
                    {
                        int tipoCambio = getIdUpgrade(NivelActual.ToUpper(), NivelConsolidado.ToUpper());
                        result = CambioTjTWs(IdEmpleado, strIdTicket, IdCarrito, Terminal, Tienda, TjtActual, TjtConsolidada, tipoCambio, ref msgWS, cadConexion);
                        if (result > 0)
                        {
                            result = objCapaDatos.TryAbreConexion(ref sqlTrans);
                            result = objCapaDatos.ActualizaDatosCambioBD(IdCliente, IdEmpleado, Terminal, Tienda, TjtActual, IdTarjetaAnterior, NivelActual, sqlTrans);
                            if (result > 0)
                            {
                                sqlTrans.Commit();
                                objCapaDatos.TryCierraConexion();

                                //se sube los datos al online
                                try
                                {
                                    InvokeUpCliente9Ws(Tienda, IdCliente, 3);
                                }
                                catch (Exception ex)
                                {
                                    msgWS = "TODO OK. Pero no se pudo subir el cliente al WS ONLINE";
                                    log.Error("Error al subir el cliente al ws online." + ex.Message.ToString());
                                }
                            }
                            else
                            {
                                sqlTrans.Rollback();
                            }
                        }
                    }
                }
                objCapaDatos.TryCierraConexion();
            }
            catch (Exception ex) {
                log.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(result);
        }
示例#16
0
        public int UpdateClientetoNine(ref Cliente9 client, string IdEmpleado, string IdTienda, string IdTerminal, ref int error309, ref string msgWS)
        {
            int            result = 0;
            SqlTransaction sqlTrans;
            int            yaEsC9 = 0;

            msgWS = "";
            string IdSocioC9   = "";
            string cadConexion = "";
            double dblID       = Convert.ToDouble(DateTime.Now.ToString("yyyyMMddHHmmss"));

            objCapaDatos             = new ClsCapaDatos9();
            objCapaDatos.ConexString = StrCadenaConexion;
            sqlTrans = objCapaDatos.GetTransaction();
            try
            {
                cadConexion = sqlTrans.Connection.ConnectionString;
                result      = objCapaDatos.TryAbreConexion(ref sqlTrans);
                result      = CkeckCliente9BD(client.Id_Cliente, ref yaEsC9);

                result = objCapaDatos.UpdateClienteGeneral(client, sqlTrans);
                result = objCapaDatos.UpdateClienteTo9(client, FCaducidadAlta, IdEmpleado, dblID, sqlTrans, yaEsC9);

                if (result > 0)
                {
                    result = ws_AltaSocio(client, IdEmpleado, IdTienda, IdTerminal, ref msgWS, ref IdSocioC9, cadConexion);
                    if (result == 309)
                    {
                        error309 = 1;
                        sqlTrans.Commit();
                    }
                    if (result > 0)
                    {
                        if (error309 != 1)
                        {
                            objCapaDatos.AniadeIdC9(IdSocioC9, client.Nombre.ToString(), client.Apellidos.ToString(), dblID.ToString(), client.Id_Cliente.ToString(), sqlTrans);

                            sqlTrans.Commit();
                            objCapaDatos.TryCierraConexion();
                            try
                            {
                                InvokeUpCliente9Ws(IdTienda, client.Id_Cliente.ToString(), 3);
                            }
                            catch (Exception ex)
                            {
                                msgWS = "TODO OK. Pero no se pudo subir el cliente al WS ONLINE";
                                log.Error("Error al subir el cliente al ws online." + ex.Message.ToString());
                            }

                            result = 1;
                        }
                    }
                    else
                    {
                        sqlTrans.Rollback();
                    }
                }
                else
                {
                    sqlTrans.Rollback();
                }
                objCapaDatos.TryCierraConexion();
            }
            catch (Exception sqlEx)
            {
                log.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, sqlEx);
                sqlTrans.Rollback();
                throw new Exception(sqlEx.Message, sqlEx.InnerException);
            }
            finally {
            }
            return(result);
        }