Example #1
0
        public static void SaveTipoAlojamiento(ref TipoAlojamientoDTO TipoAlojamiento)
        {
            SqlCommand command;

            if (TipoAlojamiento.IsNew)
            {
                command = GetDbSprocCommand("usp_TipoAlojamiento_Insert");
                command.Parameters.Add(CreateOutputParameter("@IDTipoAlojamiento", SqlDbType.Int));
            }
            else
            {
                command = GetDbSprocCommand("usp_TipoAlojamiento_Update");
                command.Parameters.Add(CreateParameter("@IDTipoAlojamiento", TipoAlojamiento.idTipoAlojamientoDTO));
            }


            command.Parameters.Add(CreateParameter("@Descripcion", TipoAlojamiento.descripcionDTO, 50));

            // Run the command.
            command.Connection.Open();
            command.ExecuteNonQuery();
            command.Connection.Close();

            // If this is a new record, let's set the ID so the object
            // will have it.
            if (TipoAlojamiento.IsNew)
            {
                TipoAlojamiento.idTipoAlojamientoDTO = (int)command.Parameters["@IDTipoAlojamiento"].Value;
            }
        }
Example #2
0
        internal override DTOBase PopulateDTO(SqlDataReader reader)
        {
            TipoAlojamientoDTO TipoAlojamiento = new TipoAlojamientoDTO();

            if (!reader.IsDBNull(Ord_idTipoAlojamiento))
            {
                TipoAlojamiento.idTipoAlojamientoDTO = reader.GetInt32(Ord_idTipoAlojamiento);
            }
            // IdCliente
            if (!reader.IsDBNull(Ord_descripcionDTO))
            {
                TipoAlojamiento.descripcionDTO = reader.GetString(Ord_descripcionDTO);
            }


            return(TipoAlojamiento);
        }