Пример #1
0
        private void del()
        {
            STDiscvalification data = GetSelectionData();

            if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                clDv.Delete(data);
                init_list();
            }
        }
Пример #2
0
        public DlgDiscvalification(SqlConnection cn, STDiscvalification st)
        {
            InitializeComponent();

            connect = cn;

            gstDV    = st;
            idseason = gstDV.idseason;

            caption = "Редактировать дисквалификацию";

            mode = 1;
        }
Пример #3
0
        private STDiscvalification GetSelectionData()
        {
            STDiscvalification ret = new STDiscvalification();

            foreach (DataGridViewRow item in dataGridViewDV.SelectedRows)
            {
                int id = int.Parse(item.Cells[0].Value.ToString().Trim());

                foreach (STDiscvalification data in list)
                {
                    if (data.id == id)
                    {
                        ret = data;
                    }
                }
            }

            return(ret);
        }
Пример #4
0
        private void add()
        {
            DlgDiscvalification wnd = new DlgDiscvalification(connect, IS.idseason);

            DialogResult result = wnd.ShowDialog();

            if (result == DialogResult.OK)
            {
                flawour = wnd.GetFl();

                init_list();

                if (gpos >= 0 && dataGridViewDV.Rows.Count > 0)
                {
                    dataGridViewDV.Rows[gpos].Selected             = true;
                    dataGridViewDV.FirstDisplayedScrollingRowIndex = gpos;
                }
            }
        }
Пример #5
0
        private bool save()
        {
            bool ret = false;

            try
            {
                stC = new STDiscvalification();

                stC = read_data();

                if (mode == 1)
                {
                    ret = clDV.Update(stC, gstDV);
                }
                else
                {
                    ret = clDV.Insert(stC);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
Пример #6
0
        private STDiscvalification read_data()
        {
            STDiscvalification ret = new STDiscvalification();
            string             text;

            try
            {
                ret.idseason = idseason;

                if (textBoxId.Text.Length > 0)
                {
                    ret.id = int.Parse(textBoxId.Text.Trim());
                }
                else
                {
                    ret.id = 0;
                }

                if (radioButtonPlayer.Checked == true)
                {
                    ret.typepart = 0;

                    char[]   del   = { ' ', '(', ')' };
                    string   s     = comboBoxPart.Text.Trim();
                    string[] words = s.Split(del);

                    clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());

                    ret.idpart = clPlayer.stPlayer.idplayer;
                }
                if (radioButtonCoach.Checked == true)
                {
                    ret.typepart = 1;

                    char[]   del   = { ' ', '(', ')' };
                    string   s     = comboBoxPart.Text.Trim();
                    string[] words = s.Split(del);

                    clCoach = new CCoach(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());

                    ret.idpart = clCoach.stCoach.idcoach;
                }

                if (comboBoxTeam.Text.Length > 0)
                {
                    clTeam     = new CTeam(connect, comboBoxTeam.Text.Trim());
                    ret.idteam = clTeam.stTeam.id;
                }

                if (textBoxCntGame.Text.Length > 0)
                {
                    ret.cntgame = int.Parse(textBoxCntGame.Text.Trim());
                }
                else
                {
                    ret.cntgame = 0;
                }

                ret.datebegin = new DateTime(dateTimePickerDateBegin.Value.Year, dateTimePickerDateBegin.Value.Month,
                                             dateTimePickerDateBegin.Value.Day, 0, 0, 0, 0);

                ret.dateend = new DateTime(dateTimePickerDateEnd.Value.Year, dateTimePickerDateEnd.Value.Month,
                                           dateTimePickerDateEnd.Value.Day, 0, 0, 0, 0);

                ret.descript = textBoxDescript.Text.Trim();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }