Esempio n. 1
0
        private void edit()
        {
            try
            {
                STAwardsResult data = GetSelectionData();

                DlgAwardsResult wnd = new DlgAwardsResult(connect, IS, currdiv.id, data);

                DialogResult result = wnd.ShowDialog();

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

                    init_data();

                    if (gpos >= 0 && dataGridViewAwardResult.Rows.Count > 0)
                    {
                        dataGridViewAwardResult.Rows[gpos].Selected             = true;
                        dataGridViewAwardResult.FirstDisplayedScrollingRowIndex = gpos;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Esempio n. 2
0
        private void del()
        {
            try
            {
                STAwardsResult 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); }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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); }
        }
Esempio n. 5
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                rData = read_data();

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

                if (mode == 0)
                {
                    if (clWork.Insert(rData))
                    {
                        DialogResult = DialogResult.OK;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Esempio n. 6
0
        private STAwardsResult GetSelectionData()
        {
            STAwardsResult ret = new STAwardsResult();

            STAward st;
            int     idaward;
            int     idplayer;

            try
            {
                foreach (DataGridViewRow item in dataGridViewAwardResult.SelectedRows)
                {
                    st = clAward.GetAward(item.Cells[0].Value.ToString());

                    idaward  = st.idaward;
                    idplayer = int.Parse(item.Cells[4].Value.ToString());

                    ret = clWork.GetData(IS.idseason, currdiv.id, idaward, idplayer);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }