Ejemplo n.º 1
0
        private void ImportStats_Load(object sender, EventArgs e)
        {
            try
            {
                clParam = new CParamApp();

                clFileInfo = new CFileInfo(connect);
                clRecords  = new CRecordsPerson(connect);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Ejemplo n.º 2
0
        public Stats(SqlConnection cn, STInfoSeason inf, ushort md, STGame gm)
        {
            InitializeComponent();

            connect = cn;
            IS      = inf;
            mode    = md;
            gSTGame = gm;

            clStats = new CStats(connect);
            clfs    = new ListCompareByNumberFormStats();
            clep    = new ListCompareByNumberFromEntryPlayers();

            lst_records = new List <STRecordsPerson>();

            clRecords = new CRecordsPerson(connect);
        }
Ejemplo n.º 3
0
        private void verify_records(STStats stats)
        {
            CRecordsPerson clRec = new CRecordsPerson(connect);

            string text;

            STRecordsPerson newrecord;

            try
            {
                foreach (STRecordsPerson st in lst_records)
                {
                    if (st.coderecord == 1)
                    {
                        if (stats.points > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 1;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.points;

                            text = string.Format("Новый рекорд по очкам. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 2)
                    {
                        if (stats.rebounds > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 2;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.rebounds;

                            text = string.Format("Новый рекорд по подборам. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 3)
                    {
                        if (stats.assists > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 3;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.assists;

                            text = string.Format("Новый рекорд по результативным передачам. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 4)
                    {
                        if (stats.steals > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 4;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.steals;

                            text = string.Format("Новый рекорд по перехватам. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 5)
                    {
                        if (stats.blocks > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 5;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.blocks;

                            text = string.Format("Новый рекорд по блок-шотам. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 6)
                    {
                        if (stats.hfg > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 6;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.hfg;

                            text = string.Format("Новый рекорд по количеству забитых средних бросков. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 7)
                    {
                        if (stats.h3fg > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 7;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.h3fg;

                            text = string.Format("Новый рекорд по количеству забитых дальних бросков. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                    if (st.coderecord == 8)
                    {
                        if (stats.hft > st.result)
                        {
                            newrecord            = new STRecordsPerson();
                            newrecord.coderecord = 8;
                            newrecord.iddivision = st.iddivision;
                            newrecord.idgame     = stats.idgame;
                            newrecord.idplayer   = stats.idplayer;
                            newrecord.idseason   = stats.idseason;
                            newrecord.idteam     = stats.idteam;
                            newrecord.result     = stats.hft;

                            text = string.Format("Новый рекорд по количеству забитых штрафных бросков. Сохранить?");

                            if (MessageBox.Show(text, "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                clRec.Update(newrecord, st);
                                brec = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Ejemplo n.º 4
0
        private void set_data(int iddiv)
        {
            CPlayer clPlayer;
            CTeam   clTeam;
            CGame   clGame;

            STRecordsPerson data;
            STRecordsPerson?reads;
            string          text;

            STGame   game;
            string   team1, team2;
            DateTime dt;

            CRecordsPerson clRec = new CRecordsPerson(connect);

            try
            {
                /* Очки*/
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 1);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult1.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer1.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam1.Text = clTeam.stTeam.name;

                    labelSeason1.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame1.Text = text;
                }
                else
                {
                    labelResult1.Text = null;
                    labelTeam1.Text   = null;
                    labelPlayer1.Text = null;
                    labelSeason1.Text = null;
                    labelGame1.Text   = null;
                }
                /*__________________________________________________*/

                /* Подборы*/
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 2);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult2.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer2.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam2.Text = clTeam.stTeam.name;

                    labelSeason2.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame2.Text = text;
                }
                else
                {
                    labelResult2.Text = null;
                    labelTeam2.Text   = null;
                    labelPlayer2.Text = null;
                    labelSeason2.Text = null;
                    labelGame2.Text   = null;
                }
                /*__________________________________________________*/

                /* Передачи*/
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 3);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult3.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer3.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam3.Text = clTeam.stTeam.name;

                    labelSeason3.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame3.Text = text;
                }
                else
                {
                    labelResult3.Text = null;
                    labelTeam3.Text   = null;
                    labelPlayer3.Text = null;
                    labelSeason3.Text = null;
                    labelGame3.Text   = null;
                }
                /*__________________________________________________*/

                /* Перехваты */
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 4);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult4.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer4.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam4.Text = clTeam.stTeam.name;

                    labelSeason4.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame4.Text = text;
                }
                else
                {
                    labelResult4.Text = null;
                    labelTeam4.Text   = null;
                    labelPlayer4.Text = null;
                    labelSeason4.Text = null;
                    labelGame4.Text   = null;
                }
                /*__________________________________________________*/

                /* Блок - шоты*/
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 5);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult5.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer5.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam5.Text = clTeam.stTeam.name;

                    labelSeason5.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame5.Text = text;
                }
                else
                {
                    labelResult5.Text = null;
                    labelTeam5.Text   = null;
                    labelPlayer5.Text = null;
                    labelSeason5.Text = null;
                    labelGame5.Text   = null;
                }
                /*__________________________________________________*/

                /* 2-х */
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 6);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult6.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer6.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam6.Text = clTeam.stTeam.name;

                    labelSeason6.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame6.Text = text;
                }
                else
                {
                    labelResult6.Text = null;
                    labelTeam6.Text   = null;
                    labelPlayer6.Text = null;
                    labelSeason6.Text = null;
                    labelGame6.Text   = null;
                }
                /*__________________________________________________*/

                /* 3-х */
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 7);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult7.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer7.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam7.Text = clTeam.stTeam.name;

                    labelSeason7.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame7.Text = text;
                }
                else
                {
                    labelResult7.Text = null;
                    labelTeam7.Text   = null;
                    labelPlayer7.Text = null;
                    labelSeason7.Text = null;
                    labelGame7.Text   = null;
                }
                /*__________________________________________________*/

                /* штраф */
                /*__________________________________________________*/
                reads = clRec.GetRecord(iddiv, 8);

                if (reads != null)
                {
                    data = (STRecordsPerson)reads;

                    labelResult8.Text = data.result.ToString();

                    clPlayer = new CPlayer(connect, data.idplayer);
                    text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                             clPlayer.stPlayer.payname);
                    labelPlayer8.Text = text;

                    clTeam          = new CTeam(connect, data.idteam);
                    labelTeam8.Text = clTeam.stTeam.name;

                    labelSeason8.Text = data.idseason.ToString();

                    clGame = new CGame(connect);
                    game   = clGame.GetGame(data.idseason, data.idgame);

                    team1 = null;
                    team2 = null;
                    dt    = new DateTime();

                    if (game.idteam1 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam1);
                        team1  = clTeam.stTeam.name;
                    }

                    if (game.idteam2 != null)
                    {
                        clTeam = new CTeam(connect, (int)game.idteam2);
                        team2  = clTeam.stTeam.name;
                    }

                    if (game.datetime != null)
                    {
                        dt = (DateTime)game.datetime;
                    }
                    text = string.Format("{0} - {1} ({2})", team1, team2, dt.ToShortDateString());

                    labelGame8.Text = text;
                }
                else
                {
                    labelResult8.Text = null;
                    labelTeam8.Text   = null;
                    labelPlayer8.Text = null;
                    labelSeason8.Text = null;
                    labelGame8.Text   = null;
                }
                /*__________________________________________________*/
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }