Beispiel #1
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()); }
        }
Beispiel #2
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); }
        }