Esempio n. 1
0
        public static void SaveTipoDestino(ref TipoDestinoDTO TipoDestino)
        {
            SqlCommand command;

            if (TipoDestino.IsNew)
            {
                command = GetDbSprocCommand("usp_TipoDestino_Insert");
                command.Parameters.Add(CreateOutputParameter("@IDTipoDestino", SqlDbType.Int));
            }
            else
            {
                command = GetDbSprocCommand("usp_TipoDestino_Update");
                command.Parameters.Add(CreateParameter("@IDTipoAlojamiento", TipoDestino.idTipoDestinoDTO));
            }


            command.Parameters.Add(CreateParameter("@Descripcion", TipoDestino.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 (TipoDestino.IsNew)
            {
                TipoDestino.idTipoDestinoDTO = (int)command.Parameters["@IDTipoDestino"].Value;
            }
        }
Esempio n. 2
0
        internal override DTOBase PopulateDTO(SqlDataReader reader)
        {
            TipoDestinoDTO TipoDestino = new TipoDestinoDTO();

            if (!reader.IsDBNull(Ord_idTipoDestino))
            {
                TipoDestino.idTipoDestinoDTO = reader.GetInt32(Ord_idTipoDestino);
            }
            // IdCliente
            if (!reader.IsDBNull(Ord_descripcionDTO))
            {
                TipoDestino.descripcionDTO = reader.GetString(Ord_descripcionDTO);
            }
            return(TipoDestino);
        }