Пример #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                rData = read_data();

                if (rData.idplayer > 0 && rData.idteam > 0)
                {
                    if (mode == 1)
                    {
                        if (clWork.Update(rData, (STEntryPlayers)oldData))
                        {
                            DialogResult = DialogResult.OK;
                        }
                    }

                    if (mode == 0)
                    {
                        if (bDraft)
                        {
                            if (MessageBox.Show("Удалить игрока с драфта?", "Внимание!", MessageBoxButtons.OKCancel,
                                                MessageBoxIcon.Question) == DialogResult.OK)
                            {
                                DateTime dtout = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
                                                              DateTime.Now.Day, 0, 0, 0, 0);
                                clDraft.OutDraft(rData.idplayer, stDraft.dtin, dtout, rData.idteam);
                            }
                        }

                        if (clWork.Insert(rData))
                        {
                            DialogResult = DialogResult.OK;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Не все обязательные поля заполнены", "Внимание!", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Пример #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                rData = read_data();

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

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