示例#1
0
        private void init_list_admin()
        {
            List <int> arr = new List <int>();
            STGameDays data;

            try
            {
                checkedListBoxAdmin.Items.Clear();

                if (mode == 1)
                {
                    data = (STGameDays)oldData;
                    arr  = clWork.GetArrayData(data.adminline);
                }

                List <STParticipant> list = clPart.GetList(7);

                for (int i = 0; i < list.Count; i++)
                {
                    checkedListBoxAdmin.Items.Add(string.Format("{0} {1}", list[i].family, list[i].name));

                    if (mode == 1)
                    {
                        foreach (int j in arr)
                        {
                            if (list[i].idpart == j)
                            {
                                checkedListBoxAdmin.SetItemChecked(i, true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
示例#2
0
        private void init_data()
        {
            string     text;
            List <int> arr;
            bool       fl;

            bool fll;
            int  curmonth = 0;

            Color colorfont;

            try
            {
                dataGridViewGameDays.Rows.Clear();

                list = clWork.GetData(IS.idseason);

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

                    curmonth = list[0].date.Month;
                    fll      = false;

                    for (int i = 0; i < list.Count; i++)
                    {
                        if (curmonth != list[i].date.Month)
                        {
                            curmonth = list[i].date.Month;
                            fll      = !fll;
                        }

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

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

                        dataGridViewGameDays.Rows[i].Cells[0].Value = list[i].nday;
                        dataGridViewGameDays.Rows[i].Cells[1].Value = list[i].date.ToLongDateString();

                        if (list[i].idplace > 0)
                        {
                            clPlace = new CPlace(connect, list[i].idplace);
                            dataGridViewGameDays.Rows[i].Cells[2].Value = clPlace.stPlace.name;
                        }
                        else
                        {
                            dataGridViewGameDays.Rows[i].Cells[2].Value = "";
                        }

                        dataGridViewGameDays.Rows[i].Cells[3].Value = list[i].cntgames;

                        if (list[i].adminline != null)
                        {
                            arr = clWork.GetArrayData(list[i].adminline);

                            if (arr.Count > 0)
                            {
                                text = null;
                                fl   = false;

                                foreach (int n in arr)
                                {
                                    clPart = new CParticipant(connect, n);

                                    if (fl == false)
                                    {
                                        text = string.Format("{0} {1}", clPart.stPart.family,
                                                             clPart.stPart.name);
                                        fl = true;
                                    }
                                    else
                                    {
                                        text += ", " + string.Format("{0} {1}", clPart.stPart.family,
                                                                     clPart.stPart.name);
                                    }
                                }

                                dataGridViewGameDays.Rows[i].Cells[4].Value = text;
                            }
                        }

                        if (list[i].washerline != null)
                        {
                            arr = clWork.GetArrayData(list[i].washerline);

                            if (arr.Count > 0)
                            {
                                text = null;
                                fl   = false;

                                foreach (int n in arr)
                                {
                                    clPart = new CParticipant(connect, n);

                                    if (fl == false)
                                    {
                                        text = string.Format("{0} {1}", clPart.stPart.family,
                                                             clPart.stPart.name);
                                        fl = true;
                                    }
                                    else
                                    {
                                        text += ", " + string.Format("{0} {1}", clPart.stPart.family,
                                                                     clPart.stPart.name);
                                    }
                                }

                                dataGridViewGameDays.Rows[i].Cells[5].Value = text;
                            }
                        }

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

                    dataGridViewGameDays.AllowUserToAddRows = false;

                    if (gpos <= 0)
                    {
                        dataGridViewGameDays.FirstDisplayedScrollingRowIndex = list.Count - 1;
                    }
                }
                else
                {
                    dataGridViewGameDays.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }