Example #1
0
        public ENSociedades ObtenerUno(int id)
        {
            DbCommand oCommand = null;
            //List<ENCanales> oListaCanales = new List<ENCanales>();
            ENSociedades oENSociedades = new ENSociedades();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSociedades_Sel_uno");
                GenericDataAccess.AgregarParametro(oCommand, "@argIDSociedad", id, TipoParametro.INT, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                //while (oDataReader.Read())
                if (oDataReader.Read())
                {
                    //ENCanales oEnListaCanales = new ENCanales();

                    oENSociedades.IdSociedad  = Convert.ToInt32(oDataReader["IdSociedad"]);
                    oENSociedades.IdPersona   = Convert.ToInt32(oDataReader["IdPersona"]);
                    oENSociedades.CodigoIAFAS = oDataReader["CodigoIAFAS"].ToString();
                    oENSociedades.RazonSocial = oDataReader["RazonSocial"].ToString();
                    //oListaCanales.Add(oEnListaCanales);
                }
                //return oListaCanales;
                return(oENSociedades);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Example #2
0
        public bool Insertar(ENSociedades oENSociedad)
        {
            DbCommand oCommand = null /* TODO Change to default(_) if this is not a reference type */;

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSociedades_ins");
                GenericDataAccess.AgregarParametro(oCommand, "@IDPersona", oENSociedad.IdPersona, TipoParametro.INT, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@CodigoIAFAS", oENSociedad.CodigoIAFAS, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@ErrorCode", 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 /* TODO Change to default(_) if this is not a reference type */);
            }
        }
Example #3
0
        public List <ENSociedades> ObtenerTodos()
        {
            DbCommand           oCommand         = null;
            List <ENSociedades> oListaSociedades = new List <ENSociedades>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSociedades_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENSociedades oEnListaSociedades = new ENSociedades();
                    oEnListaSociedades.IdSociedad  = Convert.ToInt32(oDataReader["IdSociedad"]);
                    oEnListaSociedades.IdPersona   = Convert.ToInt32(oDataReader["IdPersona"]);
                    oEnListaSociedades.CodigoIAFAS = oDataReader["CodigoIAFAS"].ToString();
                    oEnListaSociedades.RazonSocial = oDataReader["RazonSocial"].ToString();
                    oListaSociedades.Add(oEnListaSociedades);
                }
                return(oListaSociedades);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Example #4
0
 public static bool Actualizar(ENSociedades oENSociedades)
 {
     return((new ADSociedades()).Actualizar(oENSociedades));
 }
Example #5
0
 public static bool Insertar(ENSociedades oENSociedades)
 {
     return((new ADSociedades()).Insertar(oENSociedades));
 }