Beispiel #1
0
        private void BtnCancelSel_Click(object sender, EventArgs e)
        {
            if (DgvYourMaraph.CurrentRow == null)
            {
                MessageBox.Show("Выберите марафон", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            var res = MessageBox.Show("Вы хотите отменить запись на текущий марафон?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.No)
            {
                return;
            }

            double prise = Convert.ToDouble(DgvYourMaraph.CurrentRow.Cells[4].Value);
            double chet  = Convert.ToDouble(LblSum.Text);

            DgvYourMaraph.Rows.Remove(DgvYourMaraph.CurrentRow);

            chet       += prise;
            LblSum.Text = chet.ToString();

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

            BsSorevn.EndEdit();
            this.sorevnovaniaTableAdapter.Update(this.u37_1DataSet1.Sorevnovania);

            MessageBox.Show("Запись была отменена", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #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();
        }
        /// <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();
        }
Beispiel #4
0
        /// <summary>
        /// Регистрация спортсмена.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnRegBegun_Click(object sender, EventArgs e)
        {
            if (!Password.IsPasswordCorrect(passwordTbx.Text))
            {
                MessageBox.Show("Пароль не соответсвует требованиям.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

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

            try
            {
                double z = Convert.ToDouble(summaTextBox.Text);
            }
            catch
            {
                MessageBox.Show("Не корректная сумма.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

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


            MessageBox.Show("Пользователь зарегистрирован", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Beispiel #5
0
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            string idMar = DgvAllMarap.CurrentRow.Cells[0].Value.ToString();

            BsSorevn.Filter = $"IdMaraphon = '{idMar}'";

            if (BsSorevn.Count > 0)
            {
                BsSorevn.Filter = "";
                MessageBox.Show("Вы уже записаны на данный марафон", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            BsSorevn.Filter = "";

            double prise = Convert.ToDouble(DgvAllMarap.CurrentRow.Cells[4].Value);
            double chet  = Convert.ToDouble(LblSum.Text);

            if (prise > chet)
            {
                MessageBox.Show("Не достаточно средств для записи на марафон", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            chet       -= prise;
            LblSum.Text = chet.ToString();

            BsSorevn.AddNew();

            DgvYourMaraph.CurrentRow.Cells[0].Value = idMar;

            BsSorevn.EndEdit();
            this.sorevnovaniaTableAdapter.Update(this.u37_1DataSet1.Sorevnovania);

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

            MessageBox.Show("Вы успешно записались на марафон.", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #6
0
        private void BtnBuy_Click(object sender, EventArgs e)
        {
            if (TbxCount.Text == "" || TbxCount.Text == "0")
            {
                MessageBox.Show("Укажите кол-во товара.", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string idMar = DgvAllInventar.CurrentRow.Cells[0].Value.ToString();

            double chet  = Convert.ToDouble(LblSum.Text);
            int    count = Convert.ToInt32(TbxCount.Text);
            double price = Convert.ToDouble(DgvAllInventar.CurrentRow.Cells[2].Value);

            double summ = price * count;

            if (summ > chet)
            {
                MessageBox.Show("Не достаточно средств для покупки.", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            chet       -= summ;
            LblSum.Text = chet.ToString();

            for (int i = 0; i < count; i++)
            {
                BsYourInvent.AddNew();
                DgvYourInvent.CurrentRow.Cells[0].Value = idMar;

                BsYourInvent.EndEdit();
                this.inventarBegunTableAdapter.Update(this.u37_1DataSet1.InventarBegun);
            }

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