コード例 #1
0
        private STGroup GetSelectionData()
        {
            STGroup ret = new STGroup();

            string text;
            int    id = 0;

            int iddiv   = 0;
            int idstage = 0;

            try
            {
                if (g_f)
                {
                    foreach (DataGridViewRow item in dataGridViewGroups.SelectedRows)
                    {
                        id = int.Parse(item.Cells[7].Value.ToString().Trim());

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

            return(ret);
        }
コード例 #2
0
        private void edit()
        {
            try
            {
                STGroup data = GetSelectionData();

                DlgGroup wnd = new DlgGroup(connect, IS, data, mode);

                DialogResult result = wnd.ShowDialog();

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

                    init_data();

                    if (gpos >= 0 && dataGridViewGroups.Rows.Count > 0)
                    {
                        dataGridViewGroups.Rows[gpos].Selected             = true;
                        dataGridViewGroups.FirstDisplayedScrollingRowIndex = gpos;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #3
0
        public DlgCompositionGroup(SqlConnection cn, STInfoSeason inf, ushort md, STGroup st)
        {
            InitializeComponent();

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

            stGroup = st;
        }
コード例 #4
0
        public DlgGroup(SqlConnection cn, STInfoSeason inf, STGroup st, ushort md)
        {
            InitializeComponent();

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

            caption = "Редактировать группу";
        }
コード例 #5
0
        private void del()
        {
            try
            {
                STGroup data = GetSelectionData();

                if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    CGroup clGroup = new CGroup(connect);
                    clGroup.Delete(data);
                    init_data();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #6
0
        private bool save()
        {
            bool ret = false;

            stC = read_data();

            if (gstGroup.idgroup > 0)
            {
                ret = clGroup.Update(stC);
            }
            else
            {
                ret = clGroup.Insert(stC);
            }

            return(ret);
        }
コード例 #7
0
        private void ToolStripMenuItemComGroup_Click(object sender, EventArgs e)
        {
            try
            {
                STGroup data = GetSelectionData();

                DlgCompositionGroup wnd = new DlgCompositionGroup(connect, IS, mode, data);

                DialogResult result = wnd.ShowDialog();

                flawour = data;

                init_data();

                if (gpos >= 0 && dataGridViewGroups.Rows.Count > 0)
                {
                    dataGridViewGroups.Rows[gpos].Selected             = true;
                    dataGridViewGroups.FirstDisplayedScrollingRowIndex = gpos;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
コード例 #8
0
        private STGroup read_data()
        {
            STGroup ret = new STGroup();

            string text = null;

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

                if (IS.cntdivision > 1)
                {
                    if (comboBoxDivision.Text.Length > 0)
                    {
                        text           = comboBoxDivision.Text.Trim();
                        clDivision     = new CDivision(connect, IS.idseason, text);
                        ret.iddivision = clDivision.stDiv.id;
                    }
                }
                else
                {
                    ret.iddivision = 0;
                }

                if (gstGroup.idgroup > 0)
                {
                    ret.idgroup = gstGroup.idgroup;
                }
                else
                {
                    ret.idgroup = clGroup.GetFreeId((int)IS.idseason);
                }

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

                if (comboBoxStage.Text.Length > 0)
                {
                    text = comboBoxStage.Text.Trim();
                    CScheme scheme = new CScheme(connect, (int)IS.idseason, ret.iddivision, text);
                    ret.idstage = scheme.stScheme.idstage;
                }
                else
                {
                    ret.idstage = 0;
                }

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

                if (textBoxCntTeamNext.Text.Length > 0)
                {
                    ret.cntteamnext = int.Parse(textBoxCntTeamNext.Text.Trim());
                }
                else
                {
                    ret.cntteamnext = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }