示例#1
0
        private STVotePCA read_data()
        {
            STVotePCA ret = new STVotePCA();

            try
            {
                ret.idseason = idseason;

                ret.name  = textBoxName.Text.Trim();
                ret.ip    = textBoxIP.Text.Trim();
                ret.email = textBoxEmail.Text.Trim();


                char[]   del   = { ' ', '(', ')' };
                string   s     = comboBoxPlayer.Text.Trim();
                string[] words = s.Split(del);

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

                CPlayer clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                ret.idplayer = clPlayer.stPlayer.idplayer;

                ret.ed = new DateTime(dateTimePickerDate.Value.Year, dateTimePickerDate.Value.Month,
                                      dateTimePickerDate.Value.Day, dateTimePickerTime.Value.Hour, dateTimePickerTime.Value.Minute,
                                      0, 0);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
示例#2
0
        private void edit()
        {
            try
            {
                STVotePCA?data = GetSelectionData();

                if (data != null)
                {
                    DlgVotePCA wnd = new DlgVotePCA(connect, (STVotePCA)data);

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

                        init_data(v_param);

                        if (gpos >= 0 && dataGridViewVotePCA.Rows.Count > 0)
                        {
                            dataGridViewVotePCA.Rows[gpos].Selected             = true;
                            dataGridViewVotePCA.FirstDisplayedScrollingRowIndex = gpos;
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
示例#3
0
        public DlgVotePCA(SqlConnection cn, STVotePCA st)
        {
            InitializeComponent();

            connect = cn;
            gstDV   = st;

            idseason = gstDV.idseason;

            caption = "Редактировать голосование";

            mode = 1;
        }
示例#4
0
        private bool save()
        {
            bool ret = false;

            try
            {
                stC = new STVotePCA();

                stC = read_data();

                if (mode == 1)
                {
                    ret = clWork.Update(stC, gstDV);
                }
                else
                {
                    ret = clWork.Insert(stC);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }