Пример #1
0
        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); }
        }
Пример #2
0
        private void init_data()
        {
            try
            {
                dataGridViewAwardResult.Rows.Clear();

                list = clWork.GetListData(IS.idseason, currdiv.id);

                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewAwardResult.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        STAward st = clAward.GetAward(list[i].idaward);
                        dataGridViewAwardResult.Rows[i].Cells[0].Value = st.nameaward;


                        clPlayer = new CPlayer(connect, list[i].idplayer);

                        dataGridViewAwardResult.Rows[i].Cells[1].Value = string.Format("{0} {1}",
                                                                                       clPlayer.stPlayer.name, clPlayer.stPlayer.family);


                        clEP = new CEntryPlayers(connect);
                        int x = clEP.IsEntryPlayer(IS.idseason, list[i].idplayer);

                        if (x > 0)
                        {
                            clTeam = new CTeam(connect, x);
                            dataGridViewAwardResult.Rows[i].Cells[2].Value = clTeam.stTeam.name;
                        }

                        if (list[i].result != null)
                        {
                            dataGridViewAwardResult.Rows[i].Cells[3].Value =
                                string.Format("{0:f2}", list[i].result);
                        }

                        dataGridViewAwardResult.Rows[i].Cells[4].Value = list[i].idplayer;

                        if (flawour.Equals(list[i]))
                        {
                            gpos = i;
                        }
                    }

                    dataGridViewAwardResult.ClearSelection();

                    dataGridViewAwardResult.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewAwardResult.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #3
0
        private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxName.Text.Length > 0)
                {
                    char[] del = { ' ', '(', ')' };

                    string s = comboBoxName.Text.Trim();

                    string[] words = s.Split(del);

                    clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                    CEntryPlayers cl = new CEntryPlayers(connect);

                    int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer);


                    if (idt != 0)
                    {
                        CTeam tm = new CTeam(connect, idt);
                        labelIsDemind.ForeColor = Color.Red;
                        labelIsDemind.Text      = string.Format("{0}", tm.stTeam.name);
                    }
                    else
                    {
                        labelIsDemind.ForeColor = Color.DarkGreen;
                        labelIsDemind.Text      = "свободен";
                    }


                    string str1 = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                                clPlayer.stPlayer.payname);

                    labelFIO.Text = str1;

                    CAge age = new CAge();

                    if (clPlayer.stPlayer.datebirth != null)
                    {
                        DateTime dte = (DateTime)clPlayer.stPlayer.datebirth;
                        string   sm  = age.GetFullAge(dte, datein);

                        string str2 = string.Format("{0}, {1}", dte.ToLongDateString(), sm);

                        labelDate.Text = str2;
                    }

                    CCountry clCountry = new CCountry(connect);

                    string str3 = string.Format("{0}, {1}", clPlayer.stPlayer.personalnum,
                                                clCountry.stCountry.shortname);

                    labelPersNum.Text = str3;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }
Пример #4
0
        /* вставка данных */
        private void set_data()
        {
            CCoach  clCoach;
            CPlayer clPlayer;
            string  text;

            try
            {
                team = new CTeam(connect, stTeamPart.idteam);
                comboBoxNameTeam.Text = team.stTeam.name;

                CCity city = new CCity(connect, team.stTeam.idcity);
                labelDisl.Text = string.Format("{0}, {1}", city.stFullCity.name, city.stFullCity.nameregion);

                dateTimePickerDateIn.Value = stTeamPart.datein;

                div = new CDivision(connect, (int)IS.idseason, stTeamPart.iddivision);
                comboBoxDivision.Text = div.stDiv.name;

                clTeamComposition = new CEntryPlayers(connect);
                team_composition  = clTeamComposition.GetListEntryPlayers(IS.idseason, stTeamPart.idteam, "Number");

                init_data(team_composition);
                init_combo_captain();

                if (stTeamPart.idcoach1 != null)
                {
                    clCoach             = new CCoach(connect, (int)stTeamPart.idcoach1);
                    text                = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);
                    comboBoxCoach1.Text = text;
                }

                if (stTeamPart.idcoach2 != null)
                {
                    clCoach             = new CCoach(connect, (int)stTeamPart.idcoach2);
                    text                = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);
                    comboBoxCoach2.Text = text;
                }

                if (stTeamPart.idcoach3 != null)
                {
                    clCoach             = new CCoach(connect, (int)stTeamPart.idcoach3);
                    text                = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);
                    comboBoxCoach3.Text = text;
                }

                if (stTeamPart.idcaptain != null)
                {
                    clPlayer = new CPlayer(connect, (int)stTeamPart.idcaptain);
                    string num = get_num_captain((int)stTeamPart.idcaptain);
                    text = string.Format("#{0} {1} {2}", num, clPlayer.stPlayer.family, clPlayer.stPlayer.name);
                    comboBoxCaptain.Text = text;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #5
0
        private void DlgEntryId_Load(object sender, EventArgs e)
        {
            try
            {
                clEP           = new CEntryPlayers(connect);
                labelText.Text = string.Format("Кто играл под номером {0}?", number);

                init_combo();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #6
0
        private void init_data_in()
        {
            CPlayer       clP  = new CPlayer(connect);
            CEntryPlayers clEP = new CEntryPlayers(connect);
            CInfoSeason   clIS;
            CTeam         clTeam;

            try
            {
                dataGridViewIn.Rows.Clear();

                List <STEntryPlayers> list = clEP.GetListEntryPlayer(gstPlayer.idplayer);

                if (list.Count > 0)
                {
                    dataGridViewIn.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        dataGridViewIn.Rows[i].Cells[0].Value = list[i].idseason;

                        clIS = new CInfoSeason(connect, list[i].idseason);
                        STInfoSeason st = (STInfoSeason)clIS.s_IS;
                        dataGridViewIn.Rows[i].Cells[1].Value = st.nameseason;

                        clTeam = new CTeam(connect, list[i].idteam);
                        dataGridViewIn.Rows[i].Cells[2].Value = clTeam.stTeam.name;

                        int cnt = clP.GetCntGames(list[i].idseason, list[i].idteam, gstPlayer.idplayer);
                        dataGridViewIn.Rows[i].Cells[3].Value = cnt.ToString();


                        dataGridViewIn.Rows[i].Cells[4].Value = list[i].datein.ToLongDateString();

                        if (list[i].dateout != null)
                        {
                            DateTime dt = (DateTime)list[i].dateout;
                            dataGridViewIn.Rows[i].Cells[5].Value = dt.ToLongDateString();
                        }
                    }

                    dataGridViewIn.ClearSelection();


                    dataGridViewIn.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewIn.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #7
0
        private void DlgTeamsPlayer_Load(object sender, EventArgs e)
        {
            string text = null;

            try
            {
                clWork = new CEntryPlayers(connect);
                clTeam = new CTeam(connect);

                init_combo_players();
                init_combo_team();

                if (oldData != null)
                {
                    mode = 1;
                }
                else
                {
                    mode = 0;
                }

                if (mode == 0)
                {
                    text = "Добавить заявку игрока";

                    dateTimePickerDate.Value = IS.datebegin;

                    DateTime dttt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, 0);

                    dateTimePickerTimeIn.Value = dttt;

                    if (recomendedteam != null)
                    {
                        clTeam            = new CTeam(connect, recomendedteam);
                        comboBoxTeam.Text = clTeam.stTeam.name;
                    }

                    checkBoxOut.CheckState        = CheckState.Unchecked;
                    dateTimePickerDateOut.Enabled = false;
                    dateTimePickerTimeOut.Enabled = false;
                }
                if (mode == 1)
                {
                    text = "Редактировать заявку игрока";
                    set_data((STEntryPlayers)oldData);
                }

                view_param.idseason = null;

                this.Text = text;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #8
0
        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); }
        }
Пример #9
0
        /* запуск формы */
        private void DlgTeamParticipant_Load(object sender, EventArgs e)
        {
            try
            {
                this.Text = caption;

                init_combo_team();
                init_combo_coach();
                init_combo_division();

                clTeamComposition = new CEntryPlayers(connect);

                if (stTeamPart.idteam != 0)
                {
                    set_data();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Пример #10
0
        private void EntryPlayer_Load(object sender, EventArgs e)
        {
            try
            {
                clWork = new CEntryPlayers(connect);

                this.WindowState = FormWindowState.Maximized;

                recom        = 0;
                param_iddiv  = 0;
                param_idteam = 0;

                init_combo_div();

                radioButtonAll.Checked   = true;
                comboBoxDivision.Enabled = false;
                comboBoxTeam.Enabled     = false;

                init_data();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #11
0
        private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxName.Text.Length > 0)
                {
                    char[] del = { ' ', '(', ')' };

                    string s = comboBoxName.Text.Trim();

                    string[] words = s.Split(del);

                    clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                    CEntryPlayers cl = new CEntryPlayers(connect);

                    int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer);


                    if (idt != 0)
                    {
                        CTeam tm = new CTeam(connect, idt);
                        labelIsDemind.ForeColor = Color.Red;
                        labelIsDemind.Text      = string.Format("{0}", tm.stTeam.name);
                    }
                    else
                    {
                        labelIsDemind.ForeColor = Color.DarkGreen;
                        labelIsDemind.Text      = "свободен";
                    }


                    string str1 = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                                clPlayer.stPlayer.payname);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #12
0
        private void out_player()
        {
            CEntryPlayers         clEP;
            List <STEntryPlayers> list;

            CPlayer clPlayer;

            try
            {
                clEP = new CEntryPlayers(connect);
                list = clEP.GetListEntryPlayers(IS.idseason, 0, "IdTeam,Number");

                List <STSmartBookPlayer> lst_smart = new List <STSmartBookPlayer>();
                STSmartBookPlayer        item;

                foreach (STEntryPlayers row in list)
                {
                    if (row.dateout == null)
                    {
                        item     = new STSmartBookPlayer();
                        clPlayer = new CPlayer(connect, row.idplayer);

                        item.family   = clPlayer.stPlayer.family;
                        item.idplayer = row.idplayer;
                        item.idteam   = row.idteam;
                        item.name     = clPlayer.stPlayer.name;
                        item.number   = int.Parse(row.number);

                        lst_smart.Add(item);
                    }
                }

                CSmartBookPlayer clSmart = new CSmartBookPlayer(pathbook);
                clSmart.Write(lst_smart);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #13
0
        private void comboBoxPlayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                char[] del = { ' ', '(', ')' };

                string s = comboBoxPlayer.Text.Trim();

                string[] words = s.Split(del);

                clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                CEntryPlayers cl = new CEntryPlayers(connect);

                int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer);


                if (idt != 0)
                {
                    CTeam tm = new CTeam(connect, idt);
                    textBoxTeam.Text = tm.stTeam.name;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #14
0
        private void insert_report(List <STGame> lst_game, StreamWriter sw, string name)
        {
            CStats         clSatas = new CStats(connect);
            List <STStats> stats;
            STParamStats   prst;

            List <STStats> data = new List <STStats>();

            try
            {
                if (lst_game.Count > 0)
                {
                    sw.WriteLine(name);
                    sw.WriteLine("---------------------------");

                    sw.WriteLine("<p>&nbsp;</p>");

                    lst_center   = new List <STDataSymbol5>();
                    lst_defender = new List <STDataSymbol5>();
                    lst_forward  = new List <STDataSymbol5>();

                    data = new List <STStats>();

                    // вытягиваем стаистику
                    foreach (STGame game in lst_game)
                    {
                        int     r = 0;
                        STStats newst;

                        prst          = new STParamStats();
                        prst.idseason = game.idseason;
                        prst.idgame   = game.idgame;
                        prst.idteam   = game.idteam1;
                        stats         = clSatas.GetStats(prst);

                        if (game.apoints >= 0 && game.bpoints >= 0)
                        {
                            r = (int)game.apoints - (int)game.bpoints;
                        }


                        foreach (STStats st in stats)
                        {
                            newst    = st;
                            newst.pm = r;
                            data.Add(newst);
                        }

                        prst          = new STParamStats();
                        prst.idseason = game.idseason;
                        prst.idgame   = game.idgame;
                        prst.idteam   = game.idteam2;
                        stats         = clSatas.GetStats(prst);

                        if (game.apoints >= 0 && game.bpoints >= 0)
                        {
                            r = (int)game.bpoints - (int)game.apoints;
                        }

                        foreach (STStats st in stats)
                        {
                            newst    = st;
                            newst.pm = r;
                            data.Add(newst);
                        }
                    }

                    // сортируем по id
                    ListCompareStatsByID clCompareStats = new ListCompareStatsByID();
                    data.Sort(clCompareStats);

                    // расчитываем
                    int           currid  = 0;
                    int           curteam = 0;
                    int           cnt     = 1;
                    STDataSymbol5 item;

                    CEntryPlayers  clEP = new CEntryPlayers(connect);
                    STEntryPlayers stEP;

                    CTeam   clTeam   = new CTeam(connect);
                    CPlayer clPlayer = new CPlayer(connect);

                    int point = 0;
                    int reb   = 0;
                    int ass   = 0;
                    int stl   = 0;
                    int blk   = 0;
                    int res   = 0;

                    double kf = 0;

                    bool first = true;

                    for (int i = 0; i < data.Count; i++)
                    {
                        if (first)
                        {
                            currid  = data[0].idplayer;
                            curteam = data[0].idteam;

                            point = data[0].points;
                            reb   = data[0].rebounds;
                            ass   = data[0].assists;
                            stl   = data[0].steals;
                            blk   = data[0].blocks;
                            res   = data[0].pm;

                            cnt = 1;

                            first = false;
                        }
                        else
                        {
                            if (currid == data[i].idplayer)
                            {
                                cnt++;
                                ass   += data[i].assists;
                                blk   += data[i].blocks;
                                point += data[i].points;
                                reb   += data[i].rebounds;
                                stl   += data[i].steals;
                                res   += data[i].pm;
                            }
                            else
                            {
                                //
                                item     = new STDataSymbol5();
                                clTeam   = new CTeam(connect, curteam);
                                clPlayer = new CPlayer(connect, currid);
                                stEP     = clEP.GetEntryPlayerLast(data[i].idseason, currid);

                                item.team = clTeam.stTeam.name;
                                item.name = clPlayer.stPlayer.family + " " + clPlayer.stPlayer.name;

                                item.points   = (1.0 * point) / cnt;
                                item.assists  = (1.0 * ass) / cnt;
                                item.block    = (1.0 * blk) / cnt;
                                item.rebounds = (1.0 * reb) / cnt;
                                item.steals   = (1.0 * stl) / cnt;
                                item.res      = res;


                                if (item.res > 30)
                                {
                                    kf = 1.1;
                                }
                                if (item.res > 20 && item.res <= 30)
                                {
                                    kf = 1.2;
                                }
                                if (item.res > 10 && item.res <= 20)
                                {
                                    kf = 1.25;
                                }
                                if (item.res > 5 && item.res <= 10)
                                {
                                    kf = 1.3;
                                }
                                if (item.res > 0 && item.res <= 5)
                                {
                                    kf = 1.35;
                                }
                                if (item.res > -5 && item.res <= 0)
                                {
                                    kf = 0.95;
                                }
                                if (item.res > -10 && item.res <= -5)
                                {
                                    kf = 0.9;
                                }
                                if (item.res > -20 && item.res <= -10)
                                {
                                    kf = 0.85;
                                }
                                if (item.res > -30 && item.res <= -20)
                                {
                                    kf = 0.8;
                                }
                                if (item.res <= -30)
                                {
                                    kf = 0.7;
                                }

                                if (stEP.amplua != null)
                                {
                                    if (stEP.amplua == 1)
                                    {
                                        item.amplua = "защитник";

                                        item.ball = ((item.points * 1.5) + (item.assists * 2.5) + item.rebounds +
                                                     (item.steals * 2) + item.block) * kf;

                                        lst_defender.Add(item);
                                    }
                                    if (stEP.amplua == 2)
                                    {
                                        item.amplua = "форвард";


                                        item.ball = ((item.points * 2.5) + (item.assists * 1.5) + item.rebounds +
                                                     item.steals + item.block) * kf;

                                        lst_forward.Add(item);
                                    }
                                    if (stEP.amplua == 3)
                                    {
                                        item.amplua = "центровой";


                                        item.ball = ((item.points + item.assists + (item.rebounds * 2.5) +
                                                      item.steals + (item.block * 2))) * kf;

                                        lst_center.Add(item);
                                    }
                                }

                                currid  = data[i].idplayer;
                                curteam = data[i].idteam;

                                point = data[i].points;
                                reb   = data[i].rebounds;
                                ass   = data[i].assists;
                                stl   = data[i].steals;
                                blk   = data[i].blocks;
                                res   = data[i].pm;

                                cnt = 1;
                            }
                        }
                    }

                    item     = new STDataSymbol5();
                    clTeam   = new CTeam(connect, curteam);
                    clPlayer = new CPlayer(connect, currid);
                    stEP     = clEP.GetEntryPlayerLast(IS.idseason, currid);

                    item.team = clTeam.stTeam.name;
                    item.name = clPlayer.stPlayer.family + " " + clPlayer.stPlayer.name;

                    item.points   = (1.0 * point) / cnt;
                    item.assists  = (1.0 * ass) / cnt;
                    item.block    = (1.0 * blk) / cnt;
                    item.rebounds = (1.0 * reb) / cnt;
                    item.steals   = (1.0 * stl) / cnt;
                    item.res      = res;

                    if (item.res > 30)
                    {
                        kf = 1.1;
                    }
                    if (item.res > 20 && item.res <= 30)
                    {
                        kf = 1.2;
                    }
                    if (item.res > 10 && item.res <= 20)
                    {
                        kf = 1.25;
                    }
                    if (item.res > 5 && item.res <= 10)
                    {
                        kf = 1.3;
                    }
                    if (item.res > 0 && item.res <= 5)
                    {
                        kf = 1.35;
                    }
                    if (item.res > -5 && item.res <= 0)
                    {
                        kf = 0.95;
                    }
                    if (item.res > -10 && item.res <= -5)
                    {
                        kf = 0.9;
                    }
                    if (item.res > -20 && item.res <= -10)
                    {
                        kf = 0.85;
                    }
                    if (item.res > -30 && item.res <= -20)
                    {
                        kf = 0.8;
                    }
                    if (item.res <= -30)
                    {
                        kf = 0.7;
                    }


                    if (stEP.amplua != null)
                    {
                        if (stEP.amplua == 1)
                        {
                            item.amplua = "защитник";

                            item.ball = ((item.points * 1.5) + (item.assists * 2.5) + item.rebounds +
                                         (item.steals * 2) + item.block) * kf;

                            lst_defender.Add(item);
                        }
                        if (stEP.amplua == 2)
                        {
                            item.amplua = "форвард";


                            item.ball = ((item.points * 2.5) + (item.assists * 1.5) + item.rebounds +
                                         item.steals + item.block) * kf;

                            lst_forward.Add(item);
                        }
                        if (stEP.amplua == 3)
                        {
                            item.amplua = "центровой";


                            item.ball = ((item.points + item.assists + (item.rebounds * 2.5) +
                                          item.steals + (item.block * 2))) * kf;

                            lst_center.Add(item);
                        }
                    }


                    // сортируем по баллам
                    ListCompareByBall clComparyBall = new ListCompareByBall();
                    lst_center.Sort(clComparyBall);
                    lst_defender.Sort(clComparyBall);
                    lst_forward.Sort(clComparyBall);

                    // выводим в файл
                    int x = 1;

                    foreach (STDataSymbol5 set in lst_defender)
                    {
                        //     if (x == 5) break;
                        sw.WriteLine(string.Format
                                         ("<p>{0,2}.{1,-20} ({2}) {3} , баллы:{4}, о:{5}, пб:{6}, пр:{7}, пх:{8}, б:{9}</p>",
                                         x, set.name, set.team, set.amplua, set.ball, set.points, set.rebounds,
                                         set.assists, set.steals, set.block));
                        x++;
                    }
                    foreach (STDataSymbol5 set in lst_forward)
                    {
                        //     if (x == 9) break;
                        sw.WriteLine(string.Format
                                         ("<p>{0,2}.{1,-20} ({2}) {3} , баллы:{4}, о:{5}, пб:{6}, пр:{7}, пх:{8}, б:{9}</p>",
                                         x, set.name, set.team, set.amplua, set.ball, set.points, set.rebounds,
                                         set.assists, set.steals, set.block));
                        x++;
                    }
                    foreach (STDataSymbol5 set in lst_center)
                    {
                        //   if (x == 11) break;
                        sw.WriteLine(string.Format
                                         ("<p>{0,2}.{1,-20} ({2}) {3} , баллы:{4}, о:{5}, пб:{6}, пр:{7}, пх:{8}, б:{9}</p>",
                                         x, set.name, set.team, set.amplua, set.ball, set.points, set.rebounds,
                                         set.assists, set.steals, set.block));
                        x++;
                    }

                    sw.WriteLine("<p>&nbsp;</p>");
                    sw.WriteLine("<p><img src=\"\" alt=\"\" /></p>");
                    sw.WriteLine("<p>&nbsp;</p>");
                    sw.WriteLine("<p>&nbsp;</p>");

                    sw.WriteLine("------------");
                    sw.WriteLine("");
                    sw.WriteLine("");
                    sw.WriteLine("");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #15
0
        private void Stats_Load(object sender, EventArgs e)
        {
            string text;
            CTeam  cl;
            CCity  clc;

            int idcity1 = 0, idcity2 = 0;

            try
            {
                cl        = new CTeam(connect, (int)gSTGame.idteam1);
                nameteam1 = cl.stTeam.name;
                idcity1   = cl.stTeam.idcity;
                cl        = new CTeam(connect, (int)gSTGame.idteam2);
                nameteam2 = cl.stTeam.name;
                idcity2   = cl.stTeam.idcity;

                text = string.Format("Статистика игры: {0} - {1} {2}:{3}", nameteam1, nameteam2,
                                     gSTGame.apoints, gSTGame.bpoints);
                this.Text = text;


                clc = new CCity(connect, idcity1);
                if (clc.stFullCity.name != null)
                {
                    radioButtonTeam1.Text = string.Format("{0} ({1},{2})", nameteam1, clc.stFullCity.name,
                                                          clc.stFullCity.namecountry);
                }
                else
                {
                    radioButtonTeam1.Text = nameteam1;
                }

                clc = new CCity(connect, idcity2);
                if (clc.stFullCity.name != null)
                {
                    radioButtonTeam2.Text = string.Format("{0} ({1},{2})", nameteam2, clc.stFullCity.name,
                                                          clc.stFullCity.namecountry);
                }
                else
                {
                    radioButtonTeam2.Text = nameteam2;
                }

                curridteam    = (int)gSTGame.idteam1;
                currnameteam  = nameteam1;
                currentpoints = (int)gSTGame.apoints;

                clTC = new CEntryPlayers(connect);
                List <STEntryPlayers> lst = clTC.GetListEntryPlayersReal(IS.idseason, (int)gSTGame.idteam1,
                                                                         (DateTime)gSTGame.datetime, null);
                team1 = lst;
                team1.Sort(clep);
                lst = clTC.GetListEntryPlayersReal(IS.idseason, (int)gSTGame.idteam2,
                                                   (DateTime)gSTGame.datetime, null);
                team2 = lst;
                team2.Sort(clep);

                currteam = team1;

                init_data();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #16
0
        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); }
        }
Пример #17
0
        private List <STDataRating> calculate()
        {
            List <STDataRating> ret = new List <STDataRating>();
            STDataRating        item;

            CPlayer         clPlayer;
            List <STPlayer> lst_player;
            STPlayerParam   paramPlayer = new STPlayerParam();

            paramPlayer.idseason = null;

            CStats         clStats;
            List <STStats> stStats;
            STParamStats   paramStats;

            CEntryPlayers  clEP;
            STEntryPlayers stEP;

            int idteam = 0;

            CTeam clTeam;

            try
            {
                clPlayer = new CPlayer(connect);
                clStats  = new CStats(connect);
                clEP     = new CEntryPlayers(connect);

                lst_player = clPlayer.GetList(paramPlayer);

                foreach (STPlayer st in lst_player)
                {
                    item = new STDataRating();

                    clPlayer  = new CPlayer(connect, st.idplayer);
                    item.name = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                              clPlayer.stPlayer.payname);
                    idteam = clEP.IsEntryPlayer(IS.idseason, st.idplayer);
                    if (idteam > 0)
                    {
                        clTeam        = new CTeam(connect, idteam);
                        item.nameteam = clTeam.stTeam.name;
                    }
                    else
                    {
                        item.nameteam = "не заявлен в текущем сезоне";
                    }

                    paramStats          = new STParamStats();
                    paramStats.idplayer = st.idplayer;

                    stStats = clStats.GetStats(paramStats);

                    foreach (STStats stst in stStats)
                    {
                        item.cntgame++;

                        item.points   += stst.points;
                        item.rebounds += stst.rebounds;
                        item.steals   += stst.steals;
                        item.fouls    += stst.psfouls;
                        item.blocks   += stst.blocks;
                        item.assists  += stst.assists;
                    }

                    ret.Add(item);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
Пример #18
0
        private void init_data_leader_team()
        {
            try
            {
                CEntryPlayers         clEP       = new CEntryPlayers(connect);
                List <STEntryPlayers> data_list1 = clEP.GetListEntryPlayersReal(IS.idseason, team1.id,
                                                                                DateTime.Now, null);
                List <STEntryPlayers> data_list2 = clEP.GetListEntryPlayersReal(IS.idseason, team2.id,
                                                                                DateTime.Now, null);


                List <RecordPlayerPreView> stTeam1 = CalculateStats(data_list1);
                List <RecordPlayerPreView> stTeam2 = CalculateStats(data_list2);

                dataGridViewLeader.Rows.Clear();

                dataGridViewLeader.Rows.Add(9);

                /* Очки */
                dataGridViewLeader.Rows[0].Cells[0].Value = GetStringData(stTeam1, 1);
                dataGridViewLeader.Rows[0].Cells[1].Value = "Очки";
                dataGridViewLeader.Rows[0].Cells[2].Value = GetStringData(stTeam2, 1);

                /* Подборы */
                dataGridViewLeader.Rows[1].Cells[0].Value = GetStringData(stTeam1, 2);
                dataGridViewLeader.Rows[1].Cells[1].Value = "Подборы";
                dataGridViewLeader.Rows[1].Cells[2].Value = GetStringData(stTeam2, 2);

                /* Передачи */
                dataGridViewLeader.Rows[2].Cells[0].Value = GetStringData(stTeam1, 3);
                dataGridViewLeader.Rows[2].Cells[1].Value = "Передачи";
                dataGridViewLeader.Rows[2].Cells[2].Value = GetStringData(stTeam2, 3);

                /* Перехваты */
                dataGridViewLeader.Rows[3].Cells[0].Value = GetStringData(stTeam1, 4);
                dataGridViewLeader.Rows[3].Cells[1].Value = "Перехваты";
                dataGridViewLeader.Rows[3].Cells[2].Value = GetStringData(stTeam2, 4);

                /* Блок-шоты */
                dataGridViewLeader.Rows[4].Cells[0].Value = GetStringData(stTeam1, 5);
                dataGridViewLeader.Rows[4].Cells[1].Value = "Блок-шоты";
                dataGridViewLeader.Rows[4].Cells[2].Value = GetStringData(stTeam2, 5);

                /* Процент 2 очк. */
                dataGridViewLeader.Rows[5].Cells[0].Value = GetStringData(stTeam1, 6);
                dataGridViewLeader.Rows[5].Cells[1].Value = "Процент 2 очк.";
                dataGridViewLeader.Rows[5].Cells[2].Value = GetStringData(stTeam2, 6);

                /* Процент 3 очк. */
                dataGridViewLeader.Rows[6].Cells[0].Value = GetStringData(stTeam1, 7);
                dataGridViewLeader.Rows[6].Cells[1].Value = "Процент 3 очк.";
                dataGridViewLeader.Rows[6].Cells[2].Value = GetStringData(stTeam2, 7);

                /* Процент штраф. */
                dataGridViewLeader.Rows[7].Cells[0].Value = GetStringData(stTeam1, 8);
                dataGridViewLeader.Rows[7].Cells[1].Value = "Процент штраф.";
                dataGridViewLeader.Rows[7].Cells[2].Value = GetStringData(stTeam2, 8);

                /* Процент с игры */
                dataGridViewLeader.Rows[8].Cells[0].Value = GetStringData(stTeam1, 9);
                dataGridViewLeader.Rows[8].Cells[1].Value = "Процент с игры";
                dataGridViewLeader.Rows[8].Cells[2].Value = GetStringData(stTeam2, 9);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #19
0
        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); }
        }
Пример #20
0
        private void init_data()
        {
            CTeam     clTeam;
            CDivision clDivision;
            CPlayer   clPlayer;
            CCoach    clCoach;

            CEntryPlayers clEP = new CEntryPlayers(connect);


            string text;

            try
            {
                g_f = false;

                dataGridViewTeamPart.Rows.Clear();

                list = new List <STEntryTeam>();

                if (iddiv == 0)
                {
                    list = clTeamParticipant.GetTeamParticipant((int)IS.idseason);
                }
                else
                {
                    list = clTeamParticipant.GetTeamParticipant((int)IS.idseason, iddiv);
                }

                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewTeamPart.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        /* № п\п */
                        dataGridViewTeamPart.Rows[i].Cells[0].Value = (i + 1).ToString();

                        /* Команда */
                        clTeam = new CTeam(connect, list[i].idteam);
                        dataGridViewTeamPart.Rows[i].Cells[1].Value = clTeam.stTeam.name;

                        /* Главный тренер */
                        if (list[i].idcoach1 != null)
                        {
                            clCoach = new CCoach(connect, (int)list[i].idcoach1);
                            text    = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);
                            dataGridViewTeamPart.Rows[i].Cells[2].Value = text;
                        }

                        /* Помощник тренера */
                        if (list[i].idcoach2 != null && list[i].idcoach2 != 0)
                        {
                            clCoach = new CCoach(connect, (int)list[i].idcoach2);
                            text    = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);

                            if (list[i].idcoach3 != null && list[i].idcoach3 != 0)
                            {
                                clCoach = new CCoach(connect, (int)list[i].idcoach3);
                                string text1 =
                                    string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name);
                                text = text + ", " + text1;
                            }

                            dataGridViewTeamPart.Rows[i].Cells[3].Value = text;
                        }

                        /* Капитан */
                        if (list[i].idcaptain != null)
                        {
                            clPlayer = new CPlayer(connect, (int)list[i].idcaptain);
                            text     = string.Format("{0} {1}", clPlayer.stPlayer.family, clPlayer.stPlayer.name);
                            dataGridViewTeamPart.Rows[i].Cells[4].Value = text;
                        }

                        /* Число игроков в команде */
                        dataGridViewTeamPart.Rows[i].Cells[5].Value =
                            clEP.GetCntPlayers(list[i].idseason, list[i].idteam, null);

                        /* Дата заявки */
                        dataGridViewTeamPart.Rows[i].Cells[6].Value = list[i].datein.ToShortDateString();

                        /* Дивизион */
                        clDivision = new CDivision(connect, list[i].idseason, list[i].iddivision);
                        dataGridViewTeamPart.Rows[i].Cells[7].Value = clDivision.stDiv.name;

                        double power = get_power(list[i].idteam);
                        dataGridViewTeamPart.Rows[i].Cells[8].Value = power.ToString();
                    }

                    dataGridViewTeamPart.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }