private void Delete() { Main main = new Main(); Tournaments Tournaments = new Tournaments(); string hash = main.getdata(); string t_id = Tournaments.getdata(); string id; id = lstMembers.SelectedItems[0].Text; var request = (HttpWebRequest)WebRequest.Create("http://5.180.139.59/index.php"); string postData = "token=" + hash + "&type=update&query=delete_tournament_user&id_user="******"&t_id=" + t_id; var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var mycontent = new StreamReader(response.GetResponseStream()).ReadToEnd(); LoadMembers(); // text = txtNameT.Text + " " + cbGame.GetItemText(cbGame.SelectedItem).ToString() + " " + cbMode.GetItemText(cbMode.SelectedItem).ToString() + " " + dtpT.Value.ToString(); }
private void btnTournaments_Click(object sender, EventArgs e) { Tournaments Tournamentspanel = new Tournaments(); Tournamentspanel.Show(); this.Hide(); }
private void btnBack_Click(object sender, EventArgs e) { Tournaments Tournaments = new Tournaments(); Tournaments.Show(); this.Hide(); }
private void EditTournament() { Tournaments Tournaments = new Tournaments(); Main main = new Main(); string id = Tournaments.getdata(); string hash = main.getdata(); string Date = txtDate.Text; //2019-12-05 string Time = txtData.Text; //12:00 string Game = cbGame.Text; string Name = txtNameT.Text; string Mode = cbMode.Text; string MaxPlayers = txtMaxplayers.Text; string Description = txtDescription.Text; var request = (HttpWebRequest)WebRequest.Create("http://5.180.139.59/index.php"); string postData = "type=update&query=change_tournament_data&token=" + hash + "&t_id=" + id + "&date=" + Date + "&time=" + Time + "&game_name=" + Game + "&tour_name=" + Name + "&type_t=" + Mode + "&max_players=" + MaxPlayers + "&description=" + Description; var data = Encoding.UTF8.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var mycontent = new StreamReader(response.GetResponseStream()).ReadToEnd(); }
private void btnAccept_Click(object sender, EventArgs e) { CreateTournament(); Tournaments Tournaments = new Tournaments(); Tournaments.Show(); this.Hide(); }
private void Bracket_Load(object sender, EventArgs e) { lstBracket.FullRowSelect = true; this.Icon = dsa.Properties.Resources.zsz_fcvos10_LWv_icon; this.BackgroundImage = dsa.Properties.Resources.image; Tournaments Tournaments = new Tournaments(); string id = Tournaments.getdata(); // System.Diagnostics.Process.Start("http://5.180.139.59/result.php?id="+id); LoadBracket(); chId.Width = 25; chStage.Width = 100; }
private void LoadTournaments() { Tournaments Tournaments = new Tournaments(); Main main = new Main(); string id = Tournaments.getdata(); string hash = main.getdata(); var request = (HttpWebRequest)WebRequest.Create("http://5.180.139.59/index.php"); string postData = "type=get&query=get_reg_tournament_v2&token=" + hash + "&t_id=" + id; var data = Encoding.UTF8.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var mycontent = new StreamReader(response.GetResponseStream()).ReadToEnd(); var jsonString = mycontent; if (jsonString != null) { RootObject datas = JsonConvert.DeserializeObject <RootObject>(jsonString); foreach (var Json in datas.json) { cbGame.Text = Json.GameName; txtNameT.Text = Json.TournamentName; type = Json.Type; cbMode.Text = Json.Type; txtDate.Text = Json.Date; txtData.Text = Json.Time; txtDescription.Text = Json.description; txtMaxplayers.Text = Json.max_players; lblAccepted.Text = Json.accepted + "/" + Json.max_players; } } }
private void LoadMembers() { Tournaments Tournaments = new Tournaments(); string id = Tournaments.getdata(); lstMembers.Items.Clear(); var request = (HttpWebRequest)WebRequest.Create("http://5.180.139.59/index.php"); string postData = "type=get&query=get_tournament_users&t_id=" + id; var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var mycontent = new StreamReader(response.GetResponseStream()).ReadToEnd(); var jsonString = mycontent; if (jsonString != "0") { RootObject datas = JsonConvert.DeserializeObject <RootObject>(jsonString); if (datas != null) { foreach (var Json in datas.json) { text = Json.idUser + " " + "Логин:" + " " + Json.Login + " " + "Номер телефона:" + " " + Json.NUMBER + " " + "Команда:" + " " + Json.team; ListViewItem item = new ListViewItem(Json.idUser); item.SubItems.Add(Json.Login); item.SubItems.Add(Json.NUMBER); item.SubItems.Add(Json.team); lstMembers.Items.Add(item); allItems.AddRange(lstMembers.Items.Cast <ListViewItem>()); } } } }
private void LoadBracket() { try { Tournaments Tournaments = new Tournaments(); string id = Tournaments.getdata(); lstBracket.Items.Clear(); var request = (HttpWebRequest)WebRequest.Create("http://5.180.139.59/index.php"); string postData = "type=get&query=get_tournament_results&t_id=" + id; var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var mycontent = new StreamReader(response.GetResponseStream()).ReadToEnd(); var jsonString = mycontent; if (jsonString != "0") { RootObject datas = JsonConvert.DeserializeObject <RootObject>(jsonString); if (datas != null) { foreach (var Json in datas.json) { text = Json.id_result + " " + Json.stage + " " + Json.team1_name + " " + Json.team2_name + " " + Json.play1_score + " " + Json.play2_score; ListViewItem item = new ListViewItem(Json.id_result); string stage = "0"; if (Json.stage == 0.ToString()) { stage = "Финал"; } if (Json.stage == 1.ToString()) { stage = "Полуфинал"; } if (Json.stage == 2.ToString()) { stage = "Четвертьфинал"; } if (Json.stage == 3.ToString()) { stage = "1/8"; } if (Json.stage == 4.ToString()) { stage = "1/16"; } if (Json.stage == 5.ToString()) { stage = "1/32"; } if (Json.stage == 6.ToString()) { stage = "1/64"; } item.SubItems.Add(stage); item.SubItems.Add(Json.team1_name); item.SubItems.Add(Json.team2_name); item.SubItems.Add(Json.play1_score + ":" + Json.play2_score); lstBracket.Items.Add(item); } } } else { lstBracket.Items.Add("Пусто"); } } catch { Error Error = new Error(); Error.Show(); } }