Beispiel #1
0
        private void edit()
        {
            try
            {
                STTehnicFouls data = GetSelectionData();

                DlgTechnicalFouls wnd = new DlgTechnicalFouls(connect, data);

                DialogResult result = wnd.ShowDialog();

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

                    init_list();

                    if (gpos >= 0 && dataGridViewTehFouls.Rows.Count > 0)
                    {
                        dataGridViewTehFouls.Rows[gpos].Selected             = true;
                        dataGridViewTehFouls.FirstDisplayedScrollingRowIndex = gpos;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Beispiel #2
0
        public DlgTechnicalFouls(SqlConnection cn, STTehnicFouls st)
        {
            InitializeComponent();

            connect  = cn;
            gstTF    = st;
            idseason = gstTF.idseason;

            mode = 1;

            caption = "Редактировать технический фол";
        }
Beispiel #3
0
        private void del()
        {
            try
            {
                STTehnicFouls data = GetSelectionData();

                if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    clTF.Delete(data);
                    init_list();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Beispiel #4
0
        private bool save()
        {
            bool ret = false;

            try
            {
                stC = new STTehnicFouls();

                stC = read_data();

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

            return(ret);
        }
Beispiel #5
0
        private STTehnicFouls GetSelectionData()
        {
            STTehnicFouls ret = new STTehnicFouls();

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

                    foreach (STTehnicFouls data in list)
                    {
                        if (data.id == id)
                        {
                            ret = data;
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
Beispiel #6
0
        private STTehnicFouls read_data()
        {
            STTehnicFouls ret = new STTehnicFouls();
            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 (textBoxNGame.Text.Length > 0)
                {
                    ret.idgame = int.Parse(textBoxNGame.Text.Trim());
                }
                else
                {
                    ret.idgame = 0;
                }

                if (ret.idgame > 0)
                {
                    STGame st = clGame.GetGame(idseason, ret.idgame);
                    ret.date = new DateTime(st.datetime.Value.Year, st.datetime.Value.Month, st.datetime.Value.Day,
                                            0, 0, 0, 0);
                }
                else
                {
                    ret.date = DateTime.Now;
                }

                ret.descript = textBoxDescript.Text.Trim();

                if (comboBoxReferee.Text.Length > 0)
                {
                    ret.idreferee = get_referee(comboBoxReferee.Text.Trim());
                }
                else
                {
                    ret.idreferee = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }