Esempio n. 1
0
        private STScheme read_data()
        {
            STScheme ret = new STScheme();

            try
            {
                /* основные параметры */
                ret.idseason = (int)IS.idseason;

                ret.iddivision = idcdiv;

                if (gstScheme.idstage > 0)
                {
                    ret.idstage = gstScheme.idstage;
                }
                else
                {
                    ret.idstage = clScheme.GetFreeId((int)IS.idseason);
                }

                if (textBoxNameStage.Text.Length > 0)
                {
                    ret.namestage = textBoxNameStage.Text.Trim();
                }
                else
                {
                    ret.namestage = "";
                }

                if (comboBoxTypes.Text.Length > 0)
                {
                    ret.type = cl.GetTypeCode(comboBoxTypes.Text.Trim());
                }
                else
                {
                    ret.type = -1;
                }

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

                if (checkBoxTug.CheckState == CheckState.Checked)
                {
                    ret.iddivision = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Esempio n. 2
0
        private void del()
        {
            STScheme data = GetSelectionData();

            if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                clScheme.Delete(data);
                init_data(idCurrDiv);
            }
        }
Esempio n. 3
0
        public DlgScheme(SqlConnection cn, STInfoSeason inf, int iddiv, STScheme st, ushort md)
        {
            InitializeComponent();

            connect   = cn;
            mode      = md;
            IS        = inf;
            gstScheme = st;

            idcdiv = iddiv;

            caption = "Редактировать этап";
        }
Esempio n. 4
0
        private bool save()
        {
            bool ret = false;

            stC = read_data();

            if (gstScheme.idstage > 0)
            {
                ret = clScheme.Update(stC, gstScheme);
            }
            else
            {
                ret = clScheme.Insert(stC);
            }

            return(ret);
        }
Esempio n. 5
0
        private void add()
        {
            DlgScheme wnd = new DlgScheme(connect, IS, idCurrDiv, mode);

            DialogResult result = wnd.ShowDialog();

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

                init_data(idCurrDiv);

                if (gpos >= 0 && dataGridViewScheme.Rows.Count > 0)
                {
                    dataGridViewScheme.Rows[gpos].Selected             = true;
                    dataGridViewScheme.FirstDisplayedScrollingRowIndex = gpos;
                }
            }
        }
Esempio n. 6
0
        private STScheme GetSelectionData()
        {
            STScheme ret = new STScheme();

            int n;

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

                    CScheme sp = new CScheme(connect, (int)IS.idseason, idCurrDiv, n);

                    ret = sp.stScheme;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }