コード例 #1
0
ファイル: Awards.cs プロジェクト: Pavlo7/NBLStats
        private void edit()
        {
            try
            {
                STAward data = GetSelectionData();

                DlgAwards wnd = new DlgAwards(connect, data);

                DialogResult result = wnd.ShowDialog();

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

                    init_data();

                    if (gpos >= 0 && dataGridViewAward.Rows.Count > 0)
                    {
                        dataGridViewAward.Rows[gpos].Selected             = true;
                        dataGridViewAward.FirstDisplayedScrollingRowIndex = gpos;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #2
0
ファイル: DlgAwards.cs プロジェクト: Pavlo7/NBLStats
        private STAward read_data()
        {
            STAward ret = new STAward();

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

                if (textBoxName.Text.Length > 0)
                {
                    ret.nameaward = textBoxName.Text.Trim();
                }
                else
                {
                    ret.nameaward = null;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
コード例 #3
0
        private void init_data()
        {
            try
            {
                dataGridViewAwardResult.Rows.Clear();

                list = clWork.GetListData(IS.idseason, currdiv.id);

                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewAwardResult.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        STAward st = clAward.GetAward(list[i].idaward);
                        dataGridViewAwardResult.Rows[i].Cells[0].Value = st.nameaward;


                        clPlayer = new CPlayer(connect, list[i].idplayer);

                        dataGridViewAwardResult.Rows[i].Cells[1].Value = string.Format("{0} {1}",
                                                                                       clPlayer.stPlayer.name, clPlayer.stPlayer.family);


                        clEP = new CEntryPlayers(connect);
                        int x = clEP.IsEntryPlayer(IS.idseason, list[i].idplayer);

                        if (x > 0)
                        {
                            clTeam = new CTeam(connect, x);
                            dataGridViewAwardResult.Rows[i].Cells[2].Value = clTeam.stTeam.name;
                        }

                        if (list[i].result != null)
                        {
                            dataGridViewAwardResult.Rows[i].Cells[3].Value =
                                string.Format("{0:f2}", list[i].result);
                        }

                        dataGridViewAwardResult.Rows[i].Cells[4].Value = list[i].idplayer;

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

                    dataGridViewAwardResult.ClearSelection();

                    dataGridViewAwardResult.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewAwardResult.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #4
0
ファイル: Awards.cs プロジェクト: Pavlo7/NBLStats
        private void del()
        {
            try
            {
                STAward data = GetSelectionData();

                if (MessageBox.Show("Вы действиетльно желаете удалить запись?", "Внимание!",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    clWork.Delete(data);
                    init_data();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #5
0
ファイル: DlgAwards.cs プロジェクト: Pavlo7/NBLStats
        private void set_data(STAward data)
        {
            try
            {
                textBoxId.Text = data.idaward.ToString();

                if (data.nameaward != null)
                {
                    textBoxName.Text = data.nameaward;
                }

                textBoxId.Focus();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #6
0
ファイル: Awards.cs プロジェクト: Pavlo7/NBLStats
        private STAward GetSelectionData()
        {
            STAward ret = new STAward();
            int     n;

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

                    ret = clWork.GetAward(n);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
コード例 #7
0
ファイル: DlgAwardsResult.cs プロジェクト: Pavlo7/NBLStats
        private STAwardsResult read_data()
        {
            STAwardsResult ret = new STAwardsResult();

            try
            {
                ret.idseason   = IS.idseason;
                ret.iddivision = iddivision;

                if (comboBoxAwards.Text.Length > 0)
                {
                    STAward st = clAward.GetAward(comboBoxAwards.Text.Trim());
                    ret.idaward = st.idaward;
                }

                if (comboBoxPlayer.Text.Length > 0)
                {
                    char[] del = { ' ', '(', ')' };

                    string s = comboBoxPlayer.Text.Trim();

                    string[] words = s.Split(del);

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

                    ret.idplayer = clPlayer.stPlayer.idplayer;
                }

                if (textBoxResult.Text.Length > 0)
                {
                    ret.result = double.Parse(textBoxResult.Text.Trim());
                }
                else
                {
                    ret.result = null;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
コード例 #8
0
ファイル: DlgAwardsResult.cs プロジェクト: Pavlo7/NBLStats
        private void set_data(STAwardsResult data)
        {
            string text = null;

            try
            {
                STAward st = clAward.GetAward(data.idaward);
                comboBoxAwards.Text = st.nameaward;

                clPlayer = new CPlayer(connect, data.idplayer);

                text = string.Format("{0} {1} ({2})", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                     clPlayer.stPlayer.personalnum);

                comboBoxPlayer.Text = text;

                if (data.result != null)
                {
                    text = string.Format("{0:f2}", data.result);
                    textBoxResult.Text = text;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #9
0
ファイル: DlgAwards.cs プロジェクト: Pavlo7/NBLStats
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                rData = read_data();

                if (mode == 1)
                {
                    if (clWork.Update(rData, (STAward)oldData))
                    {
                        DialogResult = DialogResult.OK;
                    }
                }

                if (mode == 0)
                {
                    if (clWork.Insert(rData))
                    {
                        DialogResult = DialogResult.OK;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }