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

            string nameteam;

            try
            {
                foreach (DataGridViewRow item in dataGridViewTeamPart.SelectedRows)
                {
                    nameteam = item.Cells[1].Value.ToString();

                    clTeam = new CTeam(connect, nameteam);

                    foreach (STEntryTeam s in list)
                    {
                        if (clTeam.stTeam.id == s.idteam)
                        {
                            ret = s;
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }

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

                DlgEntryTeam wnd = new DlgEntryTeam(connect, IS, st, mode);

                DialogResult result = wnd.ShowDialog();

                if (result == DialogResult.OK)
                {
                    init_data();

                    if (dataGridViewTeamPart.Rows.Count > 0)
                    {
                        int x = get_num_row(wnd.RetId());
                        dataGridViewTeamPart.Rows[x].Selected = true;

                        dataGridViewTeamPart.FirstDisplayedScrollingRowIndex = x;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
コード例 #3
0
ファイル: DlgEntryTeam.cs プロジェクト: Pavlo7/NBLStats
        /* конструктор 1 */
        public DlgEntryTeam(SqlConnection cn, STInfoSeason inf, ushort md)
        {
            InitializeComponent();

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

            stTeamPart = new STEntryTeam();

            caption = "Новая заявка";
        }
コード例 #4
0
ファイル: DlgEntryTeam.cs プロジェクト: Pavlo7/NBLStats
        /* конструктор 2 */
        public DlgEntryTeam(SqlConnection cn, STInfoSeason inf, STEntryTeam st, ushort md)
        {
            InitializeComponent();

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

            caption = "Редактирование заявки";

            comboBoxNameTeam.Enabled = false;
        }
コード例 #5
0
ファイル: DlgEntryTeam.cs プロジェクト: Pavlo7/NBLStats
        private bool save()
        {
            bool ret = false;

            STEntryTeam stTP = new STEntryTeam();

            stTP = read_data();

            CEntryTeam clTPart = new CEntryTeam(connect);

            if (stTeamPart.idteam != 0)
            {
                ret = clTPart.Update(stTP, stTeamPart);
            }
            else
            {
                ret = clTPart.Insert(stTP);
            }

            return(ret);
        }
コード例 #6
0
        private void del()
        {
            try
            {
                STEntryTeam data = GetSelectionData();

                CTeam team = new CTeam(connect, data.idteam);

                string text = string.Format("Вы действиетльно желаете удалить заявку команды {0}?",
                                            team.stTeam.name);

                if (MessageBox.Show(text, "Внимание!",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    clTeamParticipant.Delete(data);

                    init_data();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
コード例 #7
0
ファイル: DlgEntryTeam.cs プロジェクト: Pavlo7/NBLStats
        private STEntryTeam read_data()
        {
            STEntryTeam ret = new STEntryTeam();

            try
            {
                if (stTeamPart.idteam != 0 && stTeamPart.idseason != 0)
                {
                    ret.idseason = stTeamPart.idseason;
                    ret.idteam   = stTeamPart.idteam;
                }
                else
                {
                    ret.idseason = (int)IS.idseason;

                    team       = new CTeam(connect, comboBoxNameTeam.Text.Trim());
                    ret.idteam = team.stTeam.id;
                }

                div            = new CDivision(connect, (int)IS.idseason, comboBoxDivision.Text.Trim());
                ret.iddivision = div.stDiv.id;

                ret.datein = new DateTime(dateTimePickerDateIn.Value.Year, dateTimePickerDateIn.Value.Month,
                                          dateTimePickerDateIn.Value.Day, 0, 0, 0, 0);

                if (comboBoxCoach1.Text.Length > 0)
                {
                    ret.idcoach1 = get_id_coach(comboBoxCoach1.Text.Trim());
                }
                else
                {
                    ret.idcoach1 = 0;
                }

                if (comboBoxCoach2.Text.Length > 0)
                {
                    ret.idcoach2 = get_id_coach(comboBoxCoach2.Text.Trim());
                }
                else
                {
                    ret.idcoach2 = 0;
                }

                if (comboBoxCoach3.Text.Length > 0)
                {
                    ret.idcoach3 = get_id_coach(comboBoxCoach3.Text.Trim());
                }
                else
                {
                    ret.idcoach3 = 0;
                }

                if (comboBoxCaptain.Text.Length > 0)
                {
                    ret.idcaptain = get_id_player(comboBoxCaptain.Text.Trim());
                }
                else
                {
                    ret.idcaptain = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }