コード例 #1
0
        private void BtnSetSum_Click(object sender, EventArgs e)
        {
            if (TbxSumPopoln.Text == "")
            {
                return;
            }

            double summ    = double.Parse(LblSumm.Text);
            double summAdd = double.Parse(TbxSumPopoln.Text);

            if (!IsDataKart(MtbSrok.Text))
            {
                MessageBox.Show("Пополнение счета не возможно, срок годности карты истек", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            summ        += summAdd;
            LblSumm.Text = summ.ToString();

            BsSponsor.EndEdit();

            this.sponsorTableAdapter.Update(this.u37_1DataSet1.Sponsor);

            TbxSumPopoln.Clear();
        }
コード例 #2
0
        private void FormRegestry_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'u37_1DataSet1.Begun' table. You can move, or remove it, as needed.
            this.begunTableAdapter.Fill(this.u37_1DataSet1.Begun);
            // TODO: This line of code loads data into the 'u37_1DataSet1.Sponsor' table. You can move, or remove it, as needed.
            this.sponsorTableAdapter.Fill(this.u37_1DataSet1.Sponsor);
            // TODO: This line of code loads data into the 'u37_1DataSet1.Zritels' table. You can move, or remove it, as needed.
            this.zritelsTableAdapter.Fill(this.u37_1DataSet1.Zritels);

            BsZritel.AddNew();
            BsBegun.AddNew();
            BsSponsor.AddNew();
        }
コード例 #3
0
        /// <summary>
        /// Регистрация спонсора.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnRegSpon_Click(object sender, EventArgs e)
        {
            if (kartaNumTextBox.Text.Length != 16 && kartaNumTextBox.Text.Length != 20)
            {
                MessageBox.Show("Длина номера карты должна быть 16 цифр, либо 20 цифр.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (kartaCVVTextBox.Text.Length != 3)
            {
                MessageBox.Show("Длина СVV карты должен состоять из 3 цифр.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!Password.IsPasswordCorrect(passwordSpons.Text))
            {
                MessageBox.Show("Пароль не соответсвует требованиям.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (passwordSpons.Text != TbxRepPassSpon.Text)
            {
                MessageBox.Show("Пароли не совпадают", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (DataKorrect(TbxSrok.Text))
            {
                MessageBox.Show("Не корректная дата", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                BsSponsor.EndEdit();
                this.sponsorTableAdapter.Update(this.u37_1DataSet1.Sponsor);
            }
            catch
            {
                MessageBox.Show("Пользователь с таким логином уже существует", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MessageBox.Show("Пользователь зарегистрирован", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
コード例 #4
0
        /// <summary>
        /// Обработчик взноса спортсмену.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnTake_Click(object sender, EventArgs e)
        {
            if (TbxTakeSum.Text == "")
            {
                return;
            }

            double summ         = Convert.ToDouble(DgvBegun.CurrentRow.Cells[1].Value);
            double summAdd      = Convert.ToDouble(TbxTakeSum.Text);
            double summSponsora = Convert.ToDouble(LblSumm.Text);

            if (summSponsora < summAdd)
            {
                MessageBox.Show("Не достаточно средств", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TbxTakeSum.Clear();
                return;
            }

            if (!IsDataKart(MtbSrok.Text))
            {
                MessageBox.Show("Пополнение счета не возможно, срок годности карты истек");
                return;
            }

            summ         += summAdd;
            summSponsora -= summAdd;
            LblSumm.Text  = summSponsora.ToString();
            DgvBegun.CurrentRow.Cells[1].Value = summ;

            AddBegunSponsor(summAdd);

            BsBegun.EndEdit();
            this.begunTableAdapter.Update(this.u37_1DataSet1.Begun);

            BsSponsor.EndEdit();
            this.sponsorTableAdapter.Update(this.u37_1DataSet1.Sponsor);

            TbxTakeSum.Clear();
        }