Exemplo n.º 1
0
        public bool Insertar(ENSCTRCorredor oENSCTRCorredor)
        {
            DbCommand oCommand = null;

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTRCorredor_ins");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCorredor", oENSCTRCorredor.CodigoCorredor, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argDescripcionCorredor", oENSCTRCorredor.DescripcionCorredor, TipoParametro.STR, Direccion.INPUT);

                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Excepciones.ManejoExcepciones(ex);
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Exemplo n.º 2
0
        public ENSCTRCorredor ObtenerUno(string CodigoCorredor)
        {
            DbCommand      oCommand        = null;
            ENSCTRCorredor oENSCTRCorredor = new ENSCTRCorredor();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTRCorredor_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCorredor", oENSCTRCorredor.CodigoCorredor, TipoParametro.STR, Direccion.INPUT);

                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                if (oDataReader.Read())
                {
                    oENSCTRCorredor.CodigoCorredor      = oDataReader["CodigoCorredor"].ToString();
                    oENSCTRCorredor.DescripcionCorredor = oDataReader["DescripcionCorredor"].ToString();
                }
                return(oENSCTRCorredor);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Exemplo n.º 3
0
        public List <ENSCTRCorredor> ObtenerTodos()
        {
            DbCommand             oCommand           = null;
            List <ENSCTRCorredor> oListaSCTRCorredor = new List <ENSCTRCorredor>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTRCorredor_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENSCTRCorredor oEnListaSCTRCorredor = new ENSCTRCorredor();
                    oEnListaSCTRCorredor.CodigoCorredor      = oDataReader["CodigoCorredor"].ToString();
                    oEnListaSCTRCorredor.DescripcionCorredor = oDataReader["DescripcionCorredor"].ToString();

                    oListaSCTRCorredor.Add(oEnListaSCTRCorredor);
                }
                return(oListaSCTRCorredor);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Exemplo n.º 4
0
 public static bool Actualizar(ENSCTRCorredor oENSCTRCorredor)
 {
     return((new ADSCTRCorredor()).Actualizar(oENSCTRCorredor));
 }
Exemplo n.º 5
0
 public static bool Insertar(ENSCTRCorredor oENSCTRCorredor)
 {
     return((new ADSCTRCorredor()).Insertar(oENSCTRCorredor));
 }