This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Filter = React.createClass({ | |
propTypes: { // 1) assign expected parameter type | |
onFilterPokemonAtkChange: React.PropTypes.func, | |
onFilterPokemonTypeChange: React.PropTypes.func, | |
}, | |
render: function() { | |
return (<div id="filterBar"> | |
<label>Select Pokemon Type: </label> | |
<select name="type" id="pokemonTypeFilter" onChange={this.props.onFilterPokemonTypeChange}> {/* 2) assign event listener function for pokemon filter */} | |
<option value="">- ALL -</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Pokedex = React.createClass({ | |
getInitialState: function() { // 1) Setup initial state | |
return { | |
filterPokemonType: null, | |
filterPokemonAtk: null, | |
}; | |
}, | |
filterPokemonByTypeAndMinAtk: function (allPokemons, filterPokemonType, filterPokemonAtk) { | |
// ... Filter function just like in jQuery | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Result = React.createClass({ | |
render: function() { | |
return (<div> | |
<div>--- Total Filter Pokemon: {this.props.filterPokemon.length} ---</div> | |
<ul> | |
<li></li> {/* how each pokemon display */} | |
</ul> | |
</div>); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return <PokemonInfo pokemonDetail={item} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3. set render function | |
var render = function() { | |
var filterPokemonType = store.getState().pokemonType; | |
var filterPokemonAtk = store.getState().pokemonAtk; | |
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk); | |
ReactDOM.render( | |
<div> | |
<div>--- Total Filter Pokemon: {filterPokemon.length} ---</div> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. set Reducer function to accept store.dispatch() | |
var reducer = function (state, action) { | |
var newState = state; | |
if (typeof state === 'undefined') { | |
return { | |
pokemonType: null, | |
pokemonAtk: null | |
}; | |
} | |
switch (action.type) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2. set render function | |
var renderPokemonList = function(filterPokemon) { | |
$("#filterPokemonCount").html(filterPokemon.length); | |
var liStrings = filterPokemon.map(function (item) { | |
return "<li>" + item.name + " (Atk: " + item.attack + ", Def: " + item.defense + ")</li>"; | |
}); | |
$("#pokemonListUl").html(liStrings); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. set Listener for each filter | |
$("#pokemonTypeFilter").on('change', function(){ | |
var filterPokemonType = this.value; | |
var filterPokemonAtk = $("#pokemonAtkFilter").val(); | |
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk); | |
renderPokemonList(filterPokemon); | |
}); | |
$("#pokemonAtkFilter").on('keyup', function(){ | |
var filterPokemonAtk = this.value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Request> | |
<Source> | |
<RequestorID Client="15858" EMailAddress="XML@HOTELQUICKLY.COM" Password="2KS0JPZT5O"/> | |
<RequestorPreferences Currency="USD" Country="TW"> | |
<RequestMode>SYNCHRONOUS</RequestMode> | |
</RequestorPreferences> | |
</Source> | |
<RequestDetails> | |
<SearchHotelPriceRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public UserUnique CreateUserUniqueIfNotExisted(CustomerInsight_DBEntities refDb, Dictionary<int, UserUnique> existedUserUnique) | |
{ | |
UserUnique tmpUu; | |
if (!existedUserUnique.TryGetValue(this.user_unique_id, out tmpUu)) | |
{ | |
tmpUu = UserUnique.CreateUserUniqueFromUui(this.user_unique_id, refDb); | |
existedUserUnique.Add(tmpUu.user_unique_id, tmpUu); | |
} | |
return tmpUu; | |
} |