Beispiel #1
0
        /// <summary>
        /// Inserta nuevo cajero automatico
        /// </summary>
        /// <param name="cajerAutomatico">entidad cajero automatico</param>
        /// <returns>devuelve un booleano true o false</returns>
        public Boolean InsertCajeroAutomatico(CajerAutomatico cajerAutomatico)
        {
            Boolean resultado;

            try
            {
                var spInsertCajero = new StoreProcedure("[dbo].[SP_CAJERO_AUTOMATICO_INSERT]");
                spInsertCajero.AddParameter("@NOMBRE_NV", cajerAutomatico.Nombre, DirectionValues.Input);
                spInsertCajero.AddParameter("@TIPO_PUNTO_ID_IN", cajerAutomatico.TipoPuntoId, DirectionValues.Input);
                spInsertCajero.AddParameter("@DEPARTAMENTO_ID_IN", cajerAutomatico.DepartamentoId, DirectionValues.Input);
                spInsertCajero.AddParameter("@LATITUD_DC", cajerAutomatico.Latitud, DirectionValues.Input);
                spInsertCajero.AddParameter("@LONGITUD_DC", cajerAutomatico.Longitud, DirectionValues.Input);
                spInsertCajero.AddParameter("@DIRECCION_NV", cajerAutomatico.Direccion, DirectionValues.Input);
                spInsertCajero.AddParameter("@FLAG_MINUSVALIDO", cajerAutomatico.FlagMinusvalido, DirectionValues.Input);
                spInsertCajero.AddParameter("@MONEDA_ID_IN", cajerAutomatico.MonedaId, DirectionValues.Input);
                resultado = spInsertCajero.ExecuteStoredProcedure(ConexionString);
                if (spInsertCajero.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_CAJERO_AUTOMATICO_INSERT] Descripcion:" + spInsertCajero.ErrorMessage.Trim());
                }
            }
            catch (Exception ex)
            {
                TextLogger.LogError(LogManager.GetCurrentClassLogger(), ex, "Error En el metodo: InsertCajeroAutomatico");
                throw new Exception("Procedimiento Almacenado :[dbo].[SP_CAJERO_AUTOMATICO_INSERT]" + ex);
            }
            return(resultado);
        }
Beispiel #2
0
        /// <summary>
        /// Inserta nueva Agencia o Agente
        /// </summary>
        /// <param name="agenteAgencia">objeto Agencia Agente</param>
        /// <returns>True si es exitoso la incersion y false si es fallida</returns>
        public Boolean InsertAgenteAgencia(AgenteAgencia agenteAgencia)
        {
            var transaction = new Transaction();

            try
            {
                var spInsertAgenAgencia = new StoreProcedure("[dbo].[SP_AGEN_AGENCIA_INSERT]");
                spInsertAgenAgencia.AddParameter("@NOMBRE_NV", agenteAgencia.Nombre, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@TIPO_PUNTO_ID_IN", agenteAgencia.TipoPuntoId, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@DEPARTAMENTO_ID_IN", agenteAgencia.DepartamentoId, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@LATITUD_DC", agenteAgencia.Latitud, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@LONGITUD_DC", agenteAgencia.Longitud, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@DIRECCION_NV", agenteAgencia.Direccion, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@NOMBRE_SERVIDOR", agenteAgencia.NombreServidor, DirectionValues.Input);
                spInsertAgenAgencia.AddParameter("@AGEN_AGENCIA_ID_IN", agenteAgencia.AgenteAgenciaId, DirectionValues.Ouput);
                spInsertAgenAgencia.ExecuteStoredProcedure(ConexionString);
                if (spInsertAgenAgencia.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_AGEN_AGENCIA_INSERT] Descripcion:" + spInsertAgenAgencia.ErrorMessage.Trim());
                }
                agenteAgencia.AgenteAgenciaId = Convert.ToInt32(spInsertAgenAgencia.GetItem("@AGEN_AGENCIA_ID_IN").Value);
                foreach (Horario item in agenteAgencia.ListHorarios)
                {
                    var spHorario = new StoreProcedure("[dbo].[SP_HORARIO_INSERT]");
                    spHorario.AddParameter("@AGEN_AGENCIA_ID_IN", agenteAgencia.AgenteAgenciaId, DirectionValues.Input);
                    spHorario.AddParameter("@DIA_ID_IN", item.diaId, DirectionValues.Input);
                    spHorario.AddParameter("@HORARIO_DESC", item.HorarioDescripcion, DirectionValues.Input);
                    transaction.Batch.Add(spHorario);
                }
                transaction.EjecutarTransaccion(ConexionString);
                if (transaction.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_HORARIO_INSERT] Descripcion:" + transaction.ErrorMessage.Trim());
                }
            }
            catch (Exception ex)
            {
                TextLogger.LogError(LogManager.GetCurrentClassLogger(), ex, "Error En el metodo: InsertAgenteAgencia");
                throw new Exception("Procedimiento Almacenado :[dbo].[SP_AGEN_AGENCIA_INSERT]" + ex);
            }
            return(true);
        }
Beispiel #3
0
        public Boolean InsertPunto(Punto punto)
        {
            Boolean resultado;

            try
            {
                string conexionString = Conexion.ConexionGmaps();
                var    storeProcedure = new StoreProcedure("[dbo].[SP_PUNTO_INSERT]");
                storeProcedure.AddParameter("@NOMBRE_NV", punto.Nombre, DirectionValues.Input);
                storeProcedure.AddParameter("@TIPO_PUNTO_ID_IN", punto.TipoPuntoId, DirectionValues.Input);
                storeProcedure.AddParameter("@DEPARTAMENTO_ID_IN", punto.DepartamentoId, DirectionValues.Input);
                storeProcedure.AddParameter("@LATITUD_DC", punto.Latitud, DirectionValues.Input);
                storeProcedure.AddParameter("@LONGITUD_DC", punto.Longitud, DirectionValues.Input);
                storeProcedure.AddParameter("@DIRECCION_NV", punto.Direccion, DirectionValues.Input);
                resultado = storeProcedure.ExecuteStoredProcedure(conexionString);
                if (storeProcedure.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_PUNTO_INSERT] Descripcion:" + storeProcedure.ErrorMessage.Trim());
                }
            }
            catch (Exception ex)
            {
                TextLogger.LogError(LogManager.GetCurrentClassLogger(), ex, "Error En el metodo: InsertDireccionCliente");
                throw new Exception("Procedimiento Almacenado :[dbo].[SP_PUNTO_INSERT]" + ex);
            }
            return(resultado);
        }
Beispiel #4
0
        /// <summary>
        /// Trae los puntos por medio de un criterio
        /// </summary>
        /// <returns>un data table de clientes</returns>
        public DataTable GetManyPuntoByTipoId(int tipoPuntoId, int departamentoId)
        {
            DataTable dtPuntos;

            try
            {
                string conexionString = Conexion.ConexionGmaps();
                var    storeProcedure = new StoreProcedure("[dbo].[SP_PUNTO_GET_MANY_BY_TIPO]");
                storeProcedure.AddParameter("@TIPO_PUNTO_ID_IN", tipoPuntoId, DirectionValues.Input);
                storeProcedure.AddParameter("@DEPARTAMENTO_ID_IN", departamentoId, DirectionValues.Input);
                dtPuntos = storeProcedure.MakeQuery(conexionString);
                if (storeProcedure.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_PUNTO_GET_MANY_BY_TIPO] Descripcion:" + storeProcedure.ErrorMessage.Trim());
                }
            }
            catch (Exception ex)
            {
                TextLogger.LogError(LogManager.GetCurrentClassLogger(), ex, "Error En el metodo: getManyPuntoByTipoId");
                throw new Exception("Procedimiento Almacenado :[dbo].[SP_PUNTO_GET_MANY_BY_TIPO]" + ex);
            }
            return(dtPuntos);
        }
        /// <summary>
        /// Trae los parametros por medio de un criterio
        /// </summary>
        /// <returns>un data table de clientes</returns>
        public DataTable GetManyParametro(String tipoParametro)
        {
            DataTable dtParametro;

            try
            {
                string conexionString = Conexion.ConexionGmaps();
                var    storeProcedure = new StoreProcedure("[dbo].[SP_PARAMETRO_GET_MANY_BY_TIPO]");
                storeProcedure.AddParameter("@TIPO_PARAMETRO_NV", tipoParametro, DirectionValues.Input);
                dtParametro = storeProcedure.MakeQuery(conexionString);
                if (storeProcedure.ErrorMessage != String.Empty)
                {
                    throw new Exception("Procedimiento Almacenado :[dbo].[SP_PARAMETRO_GET_ALL] Descripcion:" + storeProcedure.ErrorMessage.Trim());
                }
            }
            catch (Exception ex)
            {
                TextLogger.LogError(LogManager.GetCurrentClassLogger(), ex, "Error En el metodo: getManyParametro");
                throw new Exception("Procedimiento Almacenado :[dbo].[SP_PARAMETRO_GET_ALL]" + ex);
            }
            return(dtParametro);
        }