Ejemplo n.º 1
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); }
        }
Ejemplo n.º 2
0
        private void init_combo()
        {
            string text;

            try
            {
                comboBoxPlayer.Items.Clear();

                lst = clEP.GetListEntryPlayers(IS.idseason, idteam, "Number");

                //List<STEntryPlayers> lst = clEP.GetListEntryPlayersReal(IS.idseason, (int)gSTGame.idteam1,
                //     (DateTime)gSTGame.datetime, null);

                foreach (STEntryPlayers item in lst)
                {
                    clPlayer = new CPlayer(connect, item.idplayer);
                    text     = string.Format("#{0} {1} {2}", item.number, clPlayer.stPlayer.family, clPlayer.stPlayer.name);
                    comboBoxPlayer.Items.Add(text);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Ejemplo n.º 3
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); }
        }
Ejemplo n.º 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); }
        }
Ejemplo n.º 5
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); }
        }
Ejemplo n.º 6
0
        private void init_data()
        {
            g_f  = false;
            gpos = -1;

            CPlayer    clPlayer;
            CTeam      clTeam;
            CEntryTeam clET;

            string text;

            try
            {
                full_list = new List <STEntryPlayers>();

                List <STEntryPlayers> data_list =
                    clWork.GetListEntryPlayers(IS.idseason, param_idteam, "IdTeam,Number");

                if (param_iddiv > 0)
                {
                    clET = new CEntryTeam(connect);
                    List <STEntryTeam> lstet = clET.GetTeamParticipant(IS.idseason, param_iddiv);

                    foreach (STEntryPlayers step in data_list)
                    {
                        foreach (STEntryTeam stet in lstet)
                        {
                            if (step.idteam == stet.idteam)
                            {
                                full_list.Add(step);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    full_list = data_list;
                }

                dataGridViewEntryPlayers.Rows.Clear();


                Color colortext;
                Color colorfont;

                int currteam = 0;

                bool fl = false;

                string amplua = "";

                int npp = 1;

                if (full_list.Count > 0)
                {
                    currteam = full_list[0].idteam;

                    g_f = true;

                    dataGridViewEntryPlayers.Rows.Add(full_list.Count);

                    for (int i = 0; i < full_list.Count; i++)
                    {
                        if (currteam != full_list[i].idteam)
                        {
                            currteam = full_list[i].idteam;
                            fl       = !fl;

                            npp = 1;
                        }

                        if (fl)
                        {
                            colorfont = Color.LightCyan;
                        }
                        else
                        {
                            colorfont = Color.White;
                        }

                        colortext = Color.Black;

                        dataGridViewEntryPlayers.Rows[i].DefaultCellStyle.BackColor = colorfont;

                        clET = new CEntryTeam(connect, IS.idseason, full_list[i].idteam);
                        if (full_list[i].datein != clET.gstTeamPart.datein)
                        {
                            colortext = Color.Blue;
                        }

                        dataGridViewEntryPlayers.Rows[i].Cells[0].Value = npp.ToString();

                        if (full_list[i].amplua != null)
                        {
                            if (full_list[i].amplua == 1)
                            {
                                amplua = "З";
                            }
                            if (full_list[i].amplua == 2)
                            {
                                amplua = "Ф";
                            }
                            if (full_list[i].amplua == 3)
                            {
                                amplua = "Ц";
                            }
                        }
                        else
                        {
                            amplua = "";
                        }
                        dataGridViewEntryPlayers.Rows[i].Cells[1].Value = amplua;

                        clPlayer = new CPlayer(connect, full_list[i].idplayer);
                        text     = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                                 clPlayer.stPlayer.payname);
                        dataGridViewEntryPlayers.Rows[i].Cells[2].Value = text;

                        clTeam = new CTeam(connect, full_list[i].idteam);
                        dataGridViewEntryPlayers.Rows[i].Cells[3].Value = clTeam.stTeam.name;

                        dataGridViewEntryPlayers.Rows[i].Cells[4].Value = full_list[i].number;

                        if (full_list[i].growing != null)
                        {
                            dataGridViewEntryPlayers.Rows[i].Cells[5].Value = full_list[i].growing.ToString();
                        }

                        if (full_list[i].weight != null)
                        {
                            dataGridViewEntryPlayers.Rows[i].Cells[6].Value = full_list[i].weight.ToString();
                        }

                        dataGridViewEntryPlayers.Rows[i].Cells[7].Value = full_list[i].datein.ToShortDateString();

                        if (full_list[i].dateout != null)
                        {
                            DateTime dt = (DateTime)full_list[i].dateout;
                            dataGridViewEntryPlayers.Rows[i].Cells[8].Value = dt.ToShortDateString();
                            colortext = colortext = Color.Red;
                        }

                        dataGridViewEntryPlayers.Rows[i].Cells[9].Value = full_list[i].idplayer.ToString();

                        dataGridViewEntryPlayers.Rows[i].Cells[10].Value = clPlayer.stPlayer.personalnum;

                        dataGridViewEntryPlayers.Rows[i].Cells[11].Value = full_list[i].priority.ToString();

                        dataGridViewEntryPlayers.Rows[i].DefaultCellStyle.ForeColor = colortext;

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

                        npp++;
                    }

                    dataGridViewEntryPlayers.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewEntryPlayers.AllowUserToAddRows = false;
                }

                toolStripStatusLabel1.Text = string.Format("Количество записей: {0}", full_list.Count);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }