Exemple #1
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()); }
        }
Exemple #2
0
        private void set_data()
        {
            DateTime dt;
            CAge     age = new CAge();
            int      ag;

            try
            {
                textBoxFIO.Text = gstPlayer.family + " " + gstPlayer.name + " " + gstPlayer.payname;
                if (gstPlayer.datebirth != null)
                {
                    dt = (DateTime)gstPlayer.datebirth;
                    textBoxDateBirth.Text = dt.ToLongDateString();

                    ag = age.GetAge((DateTime)gstPlayer.datebirth, DateTime.Now);
                    textBoxAge.Text = ag.ToString();
                }

                if (gstPlayer.namefoto != null && gstPlayer.namefoto.Length > 0)
                {
                    string pathfoto = string.Format("{0}\\{1}", clParam.s_Path.pathfoto, gstPlayer.namefoto);

                    FileInfo fi = new FileInfo(pathfoto);
                    if (fi.Exists)
                    {
                        Bitmap bt = new Bitmap(pathfoto);
                        pictureBoxFoto.Image = bt;;
                    }
                    else
                    {
                        MessageBox.Show(string.Format("‘айл {0} не найден", pathfoto),
                                        "¬нимание!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Exemple #3
0
        /* инициализация списка состава команды */
        private void init_data(List <STEntryPlayers> tm_c)
        {
            CPlayer clPlayer;
            CAge    age = new CAge();
            CStatus status;

            string amplua = "";

            try
            {
                g_f = false;

                dataGridViewCompositionTeam.Rows.Clear();

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

                    dataGridViewCompositionTeam.Rows.Add(tm_c.Count);

                    for (int i = 0; i < tm_c.Count; i++)
                    {
                        if (tm_c[i].dateout == null)
                        {
                            if (tm_c[i].datein == stTeamPart.datein)
                            {
                                dataGridViewCompositionTeam.Rows[i].DefaultCellStyle.BackColor = Color.White;
                            }
                            else
                            {
                                dataGridViewCompositionTeam.Rows[i].DefaultCellStyle.BackColor = Color.Aquamarine;
                            }
                        }
                        else
                        {
                            dataGridViewCompositionTeam.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                        }

                        /* № п\п */
                        dataGridViewCompositionTeam.Rows[i].Cells[0].Value = (i + 1).ToString();
                        /* Амплуа */
                        if (tm_c[i].amplua != null)
                        {
                            if (tm_c[i].amplua == 1)
                            {
                                amplua = "З";
                            }
                            if (tm_c[i].amplua == 2)
                            {
                                amplua = "Ф";
                            }
                            if (tm_c[i].amplua == 3)
                            {
                                amplua = "Ц";
                            }
                        }
                        else
                        {
                            amplua = "";
                        }
                        dataGridViewCompositionTeam.Rows[i].Cells[1].Value = amplua;
                        /* ФИО */
                        clPlayer = new CPlayer(connect, tm_c[i].idplayer);
                        dataGridViewCompositionTeam.Rows[i].Cells[2].Value = clPlayer.stPlayer.family +
                                                                             " " + clPlayer.stPlayer.name + " " + clPlayer.stPlayer.payname;
                        /* Номер */
                        dataGridViewCompositionTeam.Rows[i].Cells[3].Value = tm_c[i].number.ToString();
                        /* Рост */
                        if (tm_c[i].growing != null)
                        {
                            dataGridViewCompositionTeam.Rows[i].Cells[4].Value = tm_c[i].growing.ToString();
                        }
                        /* Вес */
                        if (tm_c[i].weight != null)
                        {
                            dataGridViewCompositionTeam.Rows[i].Cells[5].Value = tm_c[i].weight.ToString();
                        }
                        /* Возраст */
                        if (clPlayer.stPlayer.datebirth != null)
                        {
                            dataGridViewCompositionTeam.Rows[i].Cells[6].Value =
                                age.GetAge((DateTime)clPlayer.stPlayer.datebirth, DateTime.Now).ToString();
                        }

                        /* Дата заявки */
                        dataGridViewCompositionTeam.Rows[i].Cells[7].Value = tm_c[i].datein.ToShortDateString();
                        /* Дата отзаявки*/
                        if (tm_c[i].dateout != null)
                        {
                            DateTime dt = (DateTime)tm_c[i].dateout;
                            dataGridViewCompositionTeam.Rows[i].Cells[8].Value = dt.ToShortDateString();
                        }

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

                    dataGridViewCompositionTeam.ClearSelection();
                    dataGridViewCompositionTeam.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewCompositionTeam.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }
Exemple #4
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); }
        }