/// <summary> /// Get Computer Ip Address /// </summary> /// <returns></returns> public string GetSystemPath() { string sql = "SELECT user() as address"; string ip_address; object return_object; return_object = _dsn.ExecuteScalar(sql); if (return_object != null) { ip_address = Convert.ToString(return_object); if (String_Utilities.CountWords(ip_address, "@") != 0) { ip_address = String_Utilities.GetWord(ip_address, "@", 2); } else { ip_address = "0.0.0.0"; } } else { ip_address = "0.0.0.0"; } return(ip_address); //string ipaddress = Convert.ToString(DbService.RunScalar(sql)); //string[] p = ipaddress.Split('@'); //return p[1].ToString(); }
void TestBoundries() { int start = 0; int session = 0; DateTime start_date; DateTime end_date; DateTime current_date; DateTime from = new DateTime(1972, 1, 1); DateTime to = new DateTime(1972, 3, 1); for (start = 0; start < 7; start++) { for (current_date = from; current_date < to; current_date = current_date.AddDays(1)) { Log.log( String_Utilities.BuildSessionRangeCondition(null, current_date, 0, start, 3, out start_date, out end_date) ); Log.log(current_date.ToString("yyyyMMdd") + " is in " + start_date.ToString("yyyyMMdd") + " - " + end_date.ToString("yyyyMMdd")); } } }
public static void UpdateRanks( DateTime day_in_week, int session ) { if( input_db != null ) { long week_id = StateWriter.GetWeekID( day_in_week, session ); input_db.KindExecuteNonQuery( "replace into called_game_player_rank (card,session,bingoday,week_id,pack_set_id,game_count,total_points)" + " SELECT card,session,bingoday,"+week_id+",pack_set_id,count(*) as game_count,sum(total_points) as total_points" + " FROM called_game_player_rank2 where " //+ (true?"pack_set_id=1":"pack_set_id>0") + " card<>'000000000000000000'" //+ " and session=" + playing_session.session_number + " and " + String_Utilities.BuildSessionRangeCondition( null, day_in_week, session ) //+ " and bingoday=" + MySQLDataTable.MakeDateOnly( playing_session.bingoday ) + " group by card,pack_set_id,session,bingoday order by bingoday,session,card,pack_set_id" ); if( use_bonus_points ) { MySQLDataTable table = new MySQLDataTable( input_db, "select * from rate_rank_bonus_points" ); MySQLDataTable totals = new MySQLDataTable( input_db, "select * from called_game_player_rank where bingoday="+DsnSQLUtil.MakeDateOnly( input_db, day_in_week ) +" and session="+session+" order by total_points desc" ); if( totals != null && ( totals.Rows.Count > 0 ) ) { int place_num; foreach( DataRow row in table.Rows ) { place_num = Convert.ToInt32( row["place_in_session"] ); input_db.KindExecuteNonQuery( "replace into called_game_player_rank_bonus (card,week_id,bonus_points,bingoday,session)values(" + input_db.sql_value_quote_open + totals.Rows[place_num - 1]["card"] + input_db.sql_value_quote_close + "," + week_id + "," + row["bonus_points"].ToString() + "," + DsnSQLUtil.MakeDateOnly( input_db, day_in_week ) + "," + session + ")" ); } } } if( use_bonus_points ) { input_db.KindExecuteNonQuery( "replace into called_game_player_rank_partial (card,session,bingoday,total_points,week_id)" + "select a.card,a.session,a.bingoday,a.total_points+sum(IF(ISNULL(c.bonus_points),0,c.bonus_points)),a.week_id from called_game_player_rank as a left" + " join called_game_player_rank as b on a.card=b.card and a.week_id=b.week_id and a.total_points<b.total_points" + " left join called_game_player_rank_bonus as c on a.card=c.card " + " where b.card is null and a.week_id=" + week_id + " group by a.card,a.session,a.bingoday,a.total_points,a.week_id" ); } else { input_db.KindExecuteNonQuery( "replace into called_game_player_rank_partial (card,session,bingoday,total_points,week_id)" + "select a.card,a.session,a.bingoday,a.total_points,a.week_id from called_game_player_rank as a left" + " join called_game_player_rank as b on a.card=b.card and a.week_id=b.week_id and a.total_points<b.total_points" + " where b.card is null and a.week_id=" + week_id ); } #if asdfasdf "replace into called_game_player_rank_partial(card,session,bingoday,week_id,total_points)" + " select card,session,bingoday,week_id,max(total_points) as total_points" + " from called_game_player_rank" + " where week_id=" + week_id + " group by bingoday,session,card" ); #endif } }