// conn.Close();
// }
// catch (MySqlException exp)
// {
// conn.Close();
// }
//}
public static void getReportOfPlayerByParams(string team, string indicator, string position, GridView report, string season)
{
string database = "powerplay";
string password_db = "admin";
string user_db = "root";
string server_db = "localhost";
connectionString = ("server=" + server_db + "; user id=" + user_db + "; password=" + password_db + "; database=" + database + "");
MySqlConnection conn = null;
try
{
//ОБЪЯВЛЕНИЕ
string table_players_stats = season+"_playersstats";
conn = new MySqlConnection(connectionString);
conn.Open();
string sql;
int pos=0;
MySqlDataAdapter da = null;
DataTable dt = new DataTable();
string search = "";
string team_filter="";
int player_id;
//ВЫБИРАЕМ ID КОМАНДЫ
if (team != null && team != "")
{
team_filter = " AND teams.name = '"+team+"' ";
}
else
{
team_filter = "";
}
if (position.Contains("LW") || position.Contains("RW") || position.Contains("C") || position.Contains("DD") || position.Contains("OD"))
{
search += " WHERE ";
for (int i = 0; i < position.Split(',').Length; i++)
{
if (i == 0)
search += "players.position = '" + position.Split(',')[i] + "' ";
else search += " OR players.position = '" + position.Split(',')[i] + "' ";
}
}
else search = "";
/*НАХОДИМ ИГРОКА, ЛИДЕРА ВНУТРИ КОМАНДЫ*/
sql = "select " + table_players_stats + ".player,players.name,teams.abb,sum(" + table_players_stats + ".gp) as GP,sum(" + table_players_stats + ".g) as G,sum(" + table_players_stats + ".a) as A,sum(" + table_players_stats + ".p) as P,sum(" + table_players_stats + ".pl_mn) as PL_MN,sum(" + table_players_stats + ".pim) as PIM,ROUND(sum(" + table_players_stats + ".pim)/sum(" + table_players_stats + ".gp),2) as PIM_G,sum(" + table_players_stats + ".g_fs) as GFS,sum(" + table_players_stats + ".g_pp) as GPP,sum(" + table_players_stats + ".g_sh) as GSH,sum(" + table_players_stats + ".g_ot) as GOT,sum(" + table_players_stats + ".g_w) as GW,sum(" + table_players_stats + ".so) as SO,sum(" + table_players_stats + ".g_so) as GSO,ROUND(sum(" + table_players_stats + ".g_so)/sum(" + table_players_stats + ".so)*100,2) as SOR,sum(" + table_players_stats + ".g_wso) as GWSO,sum(" + table_players_stats + ".sh) as SH,ROUND(sum(" + table_players_stats + ".fo_w)/sum(" + table_players_stats + ".fo)*100,2) as FO_per,ROUND(sum(" + table_players_stats + ".toi)/sum(" + table_players_stats + ".gp),2) as TOI,ROUND(sum(" + table_players_stats + ".sft)/sum(" + table_players_stats + ".gp),2) as SFT from " + table_players_stats + " inner join players on players.id = " + table_players_stats + ".player inner join teams on teams.id = " + table_players_stats + ".team " + team_filter + " " + search + " group by " + table_players_stats + ".player order by " + indicator + " DESC;";
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.