private void init_combo_players(int iddivision) { CEntryPlayers clEP = new CEntryPlayers(connect); CEntryTeam clET = new CEntryTeam(connect); List <STEntryPlayers> list; List <STEntryTeam> list_team; string text = null; try { comboBoxPlayer.Items.Clear(); list_team = clET.GetTeamParticipant(idseason, iddivision); foreach (STEntryTeam it in list_team) { list = clEP.GetListEntryPlayersReal(idseason, it.idteam, DateTime.Now, null); foreach (STEntryPlayers item in list) { CPlayer clPlayer = new CPlayer(connect, item.idplayer); text = string.Format("{0} {1} ({2})", clPlayer.stPlayer.family, clPlayer.stPlayer.name, clPlayer.stPlayer.personalnum); comboBoxPlayer.Items.Add(text); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private STRankingTeam get_row(List <STRankingTeam> mix_list) { STRankingTeam ret = new STRankingTeam(); CEntryTeam clET = new CEntryTeam(connect); STEntryTeam stET; try { if (mix_list.Count == 1) { ret = mix_list[0]; } else { for (int i = IS.idseason; i > 0; i--) { foreach (STRankingTeam row in mix_list) { clET = new CEntryTeam(connect, i, row.idteam); if (clET.gstTeamPart.idteam > 0) { ret = row; return(ret); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
public EntryTeam(SqlConnection cn, STInfoSeason inf, ushort md) { InitializeComponent(); connect = cn; IS = inf; mode = md; clTeamParticipant = new CEntryTeam(connect); this.WindowState = FormWindowState.Maximized; }
private void out_team() { CEntryTeam clET; List <STEntryTeamWithName> list; try { clET = new CEntryTeam(connect); list = clET.GetTeamParticipantWithName(IS.idseason); List <STSmartBookTeam> lst_smart = new List <STSmartBookTeam>(); STSmartBookTeam item; foreach (STEntryTeamWithName row in list) { item = new STSmartBookTeam(); item.id = row.idteam; item.nameteam = row.name; if (row.idcoach1 != null) { item.idcoach1 = (int)row.idcoach1; } else { item.idcoach1 = 0; } if (row.idcoach2 != null) { item.idcoach2 = (int)row.idcoach2; } else { item.idcoach2 = 0; } if (row.idcoach3 != null) { item.idcoach3 = (int)row.idcoach3; } else { item.idcoach3 = 0; } lst_smart.Add(item); } CSmartBookTeam clSmart = new CSmartBookTeam(pathbook); clSmart.Write(lst_smart); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void create() { try { FileInfo fi1 = new FileInfo(fullpath); StreamWriter sw = fi1.CreateText(); CEntryTeam clET = new CEntryTeam(connect); CEntryPlayers clEP = new CEntryPlayers(connect); List <STEntryPlayers> list_p; CPlayer clPlayer; string text; string number; List <STEntryTeamWithName> lst = clET.GetTeamParticipantWithName(IS.idseason, "EntryTeam.IdDivision, Team.NameTeam"); foreach (STEntryTeamWithName team in lst) { sw.WriteLine("-"); sw.WriteLine(team.name.ToString().ToUpper()); list_p = clEP.GetListEntryPlayersReal(IS.idseason, team.idteam, param, null); foreach (STEntryPlayers ep in list_p) { if (ep.priority == 0) { clPlayer = new CPlayer(connect, ep.idplayer); number = "0"; if (ep.number.Length > 0 && ep.number.Length <= 2) { number = ep.number; } text = string.Format("{0} {1}", number, clPlayer.stPlayer.family); sw.WriteLine(text); } } } sw.WriteLine("-"); sw.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void FinalResult_Load(object sender, EventArgs e) { try { clDiv = new CDivision(connect); clET = new CEntryTeam(connect); clWork = new CFinalResult(connect); init_combo(); init_data(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_combo_team(int iddiv) { try { CEntryTeam clET = new CEntryTeam(connect); List <STEntryTeam> lst = clET.GetTeamParticipant(IS.idseason, iddiv); foreach (STEntryTeam item in lst) { clTeam = new CTeam(connect, item.idteam); comboBoxTeam.Items.Add(clTeam.stTeam.name); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void ReportStatsTeamAndPlayers_Load(object sender, EventArgs e) { try { clTeam = new CTeam(connect); clDiv = new CDivision(connect); clGroup = new CGroup(connect); clET = new CEntryTeam(connect); prAll = false; init_combo_division(); radioButtonUsTeam.Checked = true; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void DlgFinalResult_Load(object sender, EventArgs e) { try { clTeam = new CEntryTeam(connect); clWork = new CFinalResult(connect); if (gstFR.rang <= 0) { caption = "ќпределить место"; } else { caption = "–едактировать место"; } set_data(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private bool save() { bool ret = false; STEntryTeam stTP = new STEntryTeam(); stTP = read_data(); CEntryTeam clTPart = new CEntryTeam(connect); if (stTeamPart.idteam != 0) { ret = clTPart.Update(stTP, stTeamPart); } else { ret = clTPart.Insert(stTP); } return(ret); }
private void Start() { CEntryPlayers clEP = new CEntryPlayers(connect); List <STEntryPlayers> data_list = clEP.GetListEntryPlayers(IS.idseason, 0, "IdTeam"); RecordDisplayStats record; CEntryTeam clET; CStats clSatas = new CStats(connect); List <STStats> stats; STParamStats prst; CPlayer clPlayer; string text; try { container = new List <RecordDisplayStats>(); foreach (STEntryPlayers data in data_list) { if (data.dateout == null) { record = new RecordDisplayStats(); /* Номер и команда */ record.idplayer = data.idplayer; clPlayer = new CPlayer(connect, data.idplayer); text = string.Format("{0} {1}", clPlayer.stPlayer.family.ToUpper(), clPlayer.stPlayer.name); record.fio = text; record.idteam = data.idteam; clTeam = new CTeam(connect, data.idteam); record.nameteam = clTeam.stTeam.name; /*Дивизион */ clET = new CEntryTeam(connect, IS.idseason, data.idteam); record.iddivision = clET.gstTeamPart.iddivision; /* Гражданство */ clPlayer = new CPlayer(connect, data.idplayer); if (clPlayer.stPlayer.idcountry != null) { record.idcountry = (int)clPlayer.stPlayer.idcountry; } else { record.idcountry = 0; } /* Число сезонов */ record.cntseason = clEP.GetCntSeasonPlayer(data.idplayer); /* Возраст */ CAge age = new CAge(); if (clPlayer.stPlayer.datebirth != null) { record.age = age.GetAge((DateTime)clPlayer.stPlayer.datebirth, DateTime.Now); record.agestart = age.GetAge((DateTime)clPlayer.stPlayer.datebirth, IS.datebegin); } else { record.age = 0; record.agestart = 0; } /* Считам статистику */ prst = new STParamStats(); prst.idseason = IS.idseason; prst.idplayer = data.idplayer; stats = clSatas.GetStats(prst); if (stats.Count > 0) { foreach (STStats statplayer in stats) { record.cntgame++; record.afg += statplayer.afg; record.a3fg += statplayer.a3fg; record.aft += statplayer.aft; record.hfg += statplayer.hfg; record.h3fg += statplayer.h3fg; record.hft += statplayer.hft; record.points += statplayer.points; record.rebits += statplayer.rebits; record.rebounds += statplayer.rebounds; record.rebstg += statplayer.rebstg; record.assists += statplayer.assists; record.steals += statplayer.steals; record.blocks += statplayer.blocks; record.foulsadv += statplayer.foulsadv; record.turnass += statplayer.turnass; record.turnovers += statplayer.turnovers; record.turnteh += statplayer.turnteh; record.psfouls += statplayer.psfouls; record.ptime += statplayer.ptime; record.pm += statplayer.pm; KPI kpi = new KPI(statplayer); record.kpi += kpi.kpi; } if (record.afg > 0) { record.pc2 = (1.0 * record.hfg) / record.afg * 100; } else { record.pc2 = 0; } if (record.a3fg > 0) { record.pc3 = (1.0 * record.h3fg) / record.a3fg * 100; } else { record.pc3 = 0; } if (record.aft > 0) { record.pcft = (1.0 * record.hft) / record.aft * 100; } else { record.pcft = 0; } if (record.afg + record.a3fg > 0) { record.pcall = ((1.0 * record.hfg + record.h3fg) / (record.afg + record.a3fg)) * 100; } else { record.pcall = 0; } if (record.cntgame > 0) { record.averpoints = 1.0 * record.points / record.cntgame; record.averrebounds = 1.0 * record.rebounds / record.cntgame; record.averassists = 1.0 * record.assists / record.cntgame; record.averblocks = 1.0 * record.blocks / record.cntgame; record.aversteals = 1.0 * record.steals / record.cntgame; record.averfoulsadv = 1.0 * record.foulsadv / record.cntgame; record.averkpi = 1.0 * record.kpi / record.cntgame; record.averptime = 1.0 * record.ptime / record.cntgame; record.averturnovers = 1.0 * record.turnovers / record.cntgame; record.averafg = 1.0 * record.afg / record.cntgame; record.avera3fg = 1.0 * record.a3fg / record.cntgame; record.averaft = 1.0 * record.aft / record.cntgame; record.averhfg = 1.0 * record.hfg / record.cntgame; record.averh3fg = 1.0 * record.h3fg / record.cntgame; record.averhft = 1.0 * record.hft / record.cntgame; record.averpsfouls = 1.0 * record.psfouls / record.cntgame; if (record.averafg > 0) { record.averpc2 = (1.0 * record.averhfg) / record.averafg * 100; } else { record.averpc2 = 0; } if (record.avera3fg > 0) { record.averpc3 = (1.0 * record.averh3fg) / record.avera3fg * 100; } else { record.averpc3 = 0; } if (record.averaft > 0) { record.averpcft = (1.0 * record.averhft) / record.averaft * 100; } else { record.averpcft = 0; } if (record.averafg + record.avera3fg > 0) { record.averpcall = ((1.0 * record.averhfg + record.averh3fg) / (record.averafg + record.avera3fg)) * 100; } else { record.averpcall = 0; } } else { record.averpoints = 0; record.averrebounds = 0; record.averassists = 0; record.averblocks = 0; record.aversteals = 0; record.averfoulsadv = 0; record.averkpi = 0; record.averptime = 0; record.averturnovers = 0; record.averafg = 0; record.avera3fg = 0; record.averaft = 0; record.averhfg = 0; record.averh3fg = 0; record.averhft = 0; record.averpcall = 0; record.averpcft = 0; record.averpc3 = 0; record.averpc2 = 0; record.averpsfouls = 0; } } container.Add(record); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_combo_part() { int idteam = 0; CEntryPlayers clEP = new CEntryPlayers(connect); CEntryTeam clET; string text; try { comboBoxPart.Items.Clear(); if (comboBoxTeam.Text.Length > 0) { clTeam = new CTeam(connect, comboBoxTeam.Text.Trim()); idteam = clTeam.stTeam.id; } else { idteam = 0; } if (radioButtonPlayer.Checked == true) { List <STEntryPlayers> lst = clEP.GetListEntryPlayers(idseason, idteam, null); foreach (STEntryPlayers step in lst) { clPlayer = new CPlayer(connect, step.idplayer); text = string.Format("{0} {1} ({2})", clPlayer.stPlayer.family, clPlayer.stPlayer.name, clPlayer.stPlayer.personalnum); comboBoxPart.Items.Add(text); } } if (radioButtonCoach.Checked == true) { clET = new CEntryTeam(connect, idseason, idteam); if (clET.gstTeamPart.idcoach1 != null) { clCoach = new CCoach(connect, (int)clET.gstTeamPart.idcoach1); if (clCoach.stCoach.idcoach > 0) { text = string.Format("{0} {1} ({2})", clCoach.stCoach.family, clCoach.stCoach.name, clCoach.stCoach.personalnum); comboBoxPart.Items.Add(text); } } if (clET.gstTeamPart.idcoach2 != null) { clCoach = new CCoach(connect, (int)clET.gstTeamPart.idcoach2); if (clCoach.stCoach.idcoach > 0) { text = string.Format("{0} {1} ({2})", clCoach.stCoach.family, clCoach.stCoach.name, clCoach.stCoach.personalnum); comboBoxPart.Items.Add(text); } } if (clET.gstTeamPart.idcoach3 != null) { clCoach = new CCoach(connect, (int)clET.gstTeamPart.idcoach3); if (clCoach.stCoach.idcoach > 0) { text = string.Format("{0} {1} ({2})", clCoach.stCoach.family, clCoach.stCoach.name, clCoach.stCoach.personalnum); comboBoxPart.Items.Add(text); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void out_coach() { CCoach clCoach; List <STCoach> list; CEntryTeam clET = new CEntryTeam(connect); List <STEntryTeam> lst_et = clET.GetTeamParticipant(IS.idseason); try { clCoach = new CCoach(connect); // list = clCoach.GetList(); List <STSmartBookCoach> lst_smart = new List <STSmartBookCoach>(); STSmartBookCoach item; foreach (STEntryTeam row in lst_et) { if (row.idcoach1 != null && row.idcoach1 > 0) { item = new STSmartBookCoach(); clCoach = new CCoach(connect, (int)row.idcoach1); item.family = clCoach.stCoach.family; item.idcoach = clCoach.stCoach.idcoach; item.name = clCoach.stCoach.name; item.idteam = row.idteam; lst_smart.Add(item); } if (row.idcoach2 != null && row.idcoach2 > 0) { item = new STSmartBookCoach(); clCoach = new CCoach(connect, (int)row.idcoach2); item.family = clCoach.stCoach.family; item.idcoach = clCoach.stCoach.idcoach; item.name = clCoach.stCoach.name; item.idteam = row.idteam; lst_smart.Add(item); } if (row.idcoach3 != null && row.idcoach3 > 0) { item = new STSmartBookCoach(); clCoach = new CCoach(connect, (int)row.idcoach3); item.family = clCoach.stCoach.family; item.idcoach = clCoach.stCoach.idcoach; item.name = clCoach.stCoach.name; item.idteam = row.idteam; lst_smart.Add(item); } } CSmartBookCoach clSmart = new CSmartBookCoach(pathbook); clSmart.Write(lst_smart); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_data() { g_f = false; gpos = -1; CPlayer clPlayer; CTeam clTeam; CEntryTeam clET; string text; try { full_list = new List <STEntryPlayers>(); List <STEntryPlayers> data_list = clWork.GetListEntryPlayers(IS.idseason, param_idteam, "IdTeam,Number"); if (param_iddiv > 0) { clET = new CEntryTeam(connect); List <STEntryTeam> lstet = clET.GetTeamParticipant(IS.idseason, param_iddiv); foreach (STEntryPlayers step in data_list) { foreach (STEntryTeam stet in lstet) { if (step.idteam == stet.idteam) { full_list.Add(step); break; } } } } else { full_list = data_list; } dataGridViewEntryPlayers.Rows.Clear(); Color colortext; Color colorfont; int currteam = 0; bool fl = false; string amplua = ""; int npp = 1; if (full_list.Count > 0) { currteam = full_list[0].idteam; g_f = true; dataGridViewEntryPlayers.Rows.Add(full_list.Count); for (int i = 0; i < full_list.Count; i++) { if (currteam != full_list[i].idteam) { currteam = full_list[i].idteam; fl = !fl; npp = 1; } if (fl) { colorfont = Color.LightCyan; } else { colorfont = Color.White; } colortext = Color.Black; dataGridViewEntryPlayers.Rows[i].DefaultCellStyle.BackColor = colorfont; clET = new CEntryTeam(connect, IS.idseason, full_list[i].idteam); if (full_list[i].datein != clET.gstTeamPart.datein) { colortext = Color.Blue; } dataGridViewEntryPlayers.Rows[i].Cells[0].Value = npp.ToString(); if (full_list[i].amplua != null) { if (full_list[i].amplua == 1) { amplua = "З"; } if (full_list[i].amplua == 2) { amplua = "Ф"; } if (full_list[i].amplua == 3) { amplua = "Ц"; } } else { amplua = ""; } dataGridViewEntryPlayers.Rows[i].Cells[1].Value = amplua; clPlayer = new CPlayer(connect, full_list[i].idplayer); text = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name, clPlayer.stPlayer.payname); dataGridViewEntryPlayers.Rows[i].Cells[2].Value = text; clTeam = new CTeam(connect, full_list[i].idteam); dataGridViewEntryPlayers.Rows[i].Cells[3].Value = clTeam.stTeam.name; dataGridViewEntryPlayers.Rows[i].Cells[4].Value = full_list[i].number; if (full_list[i].growing != null) { dataGridViewEntryPlayers.Rows[i].Cells[5].Value = full_list[i].growing.ToString(); } if (full_list[i].weight != null) { dataGridViewEntryPlayers.Rows[i].Cells[6].Value = full_list[i].weight.ToString(); } dataGridViewEntryPlayers.Rows[i].Cells[7].Value = full_list[i].datein.ToShortDateString(); if (full_list[i].dateout != null) { DateTime dt = (DateTime)full_list[i].dateout; dataGridViewEntryPlayers.Rows[i].Cells[8].Value = dt.ToShortDateString(); colortext = colortext = Color.Red; } dataGridViewEntryPlayers.Rows[i].Cells[9].Value = full_list[i].idplayer.ToString(); dataGridViewEntryPlayers.Rows[i].Cells[10].Value = clPlayer.stPlayer.personalnum; dataGridViewEntryPlayers.Rows[i].Cells[11].Value = full_list[i].priority.ToString(); dataGridViewEntryPlayers.Rows[i].DefaultCellStyle.ForeColor = colortext; if (flawour.Equals(full_list[i])) { gpos = i; } npp++; } dataGridViewEntryPlayers.AllowUserToAddRows = false; } else { dataGridViewEntryPlayers.AllowUserToAddRows = false; } toolStripStatusLabel1.Text = string.Format("Количество записей: {0}", full_list.Count); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }