Ejemplo n.º 1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int p;

            try
            {
                p = Convert.ToInt32(eventGridView1[0, eventGridView1.CurrentRow.Index].Value.ToString());
                //p = Convert.ToInt32(eventGridView1.SelectedRows[0].ToString());
            }
            catch (Exception)
            {
                p = 0;
            }
            if (this_user.isSuperUser())
            {
                CreateEventForm ueF = new CreateEventForm(this, p, p != 0);
                ueF.Show();
            }
            else
            {
                if (p != 0)
                {
                    metroTabControl1.SelectedTab = metroTabPage2;
                    betType_GridView.DataSource  = TransactionScripts.getBetTypeByEvent(p);
                    makeBet_btn.Show();
                    BetValue_txtBox.Show();
                    betSum_lbl.Show();
                }
            }
        }
Ejemplo n.º 2
0
        private void betGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            {
                if (e.RowIndex >= 0)
                {
                    DataGridViewRow row = this.betGridView.Rows[e.RowIndex];
                    //debug_txtBox.Text = row.Cells[0].Value.ToString();
                    try
                    {
                        int p = int.Parse(row.Cells[0].Value.ToString());
                        TransactionScripts.updateBet(p,
                                                     int.Parse(row.Cells[1].Value.ToString()),
                                                     int.Parse(row.Cells[2].Value.ToString()),
                                                     float.Parse(row.Cells[3].Value.ToString()),
                                                     float.Parse(row.Cells[4].Value.ToString()),
                                                     DateTime.Parse(row.Cells[5].Value.ToString()),
                                                     bool.Parse(row.Cells[6].Value.ToString()));
                    }
                    catch (FormatException ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }

                    //Name_txt.Text = row.Cells["First Name"].Value.ToString();
                    //Surname_txt.Text = row.Cells["Last Name"].Value.ToString();
                }
            }
        }
Ejemplo n.º 3
0
        private void makeBet_btn_Click(object sender, EventArgs e)
        {
            float p;

            try
            {
                p = float.Parse(BetValue_txtBox.Text.ToString());
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Введите корректное значение ставки");
                p = 0;
            }

            if (p > 0)
            {
                Error res = TransactionScripts.makeBet(this.betType_id, this_user, p);
                if (res.error)
                {
                    MessageBox.Show(res.message);
                }
                else
                {
                    MessageBox.Show("Ставка совершена");
                }
            }
            else
            {
                MessageBox.Show("Введите корректное значение ставки");
            }
        }
Ejemplo n.º 4
0
        private void users_refresh_btn_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = TransactionScripts.getAllUsers();
            userGridView.DataSource = dt;
        }
Ejemplo n.º 5
0
        private void delete_btn_Click(object sender, EventArgs e)
        {
            int p = Convert.ToInt32(eventGridView1[0, eventGridView1.CurrentRow.Index].Value.ToString());

            TransactionScripts.deleteEvent(p);
            refresh_btn.PerformClick();
        }
Ejemplo n.º 6
0
        private void registrate_btn_Click(object sender, EventArgs e)
        {
            //label2.Text = encryption.VerifyHashedPassword(hash, password_txtBtn.Text).ToString();
            if (!string.IsNullOrWhiteSpace(email_txtBtn.Text) &&
                !string.IsNullOrWhiteSpace(fnane_txtBtn.Text) &&
                !string.IsNullOrWhiteSpace(lname_txtBtn.Text) &&
                !string.IsNullOrWhiteSpace(login_txtBox.Text) &&
                !string.IsNullOrWhiteSpace(password_txtBtn.Text))
            {
                Error res = TransactionScripts.createUser(login_txtBox.Text, fnane_txtBtn.Text, lname_txtBtn.Text,
                                                          email_txtBtn.Text, password_txtBtn.Text);
                if (!res.error)
                {
                    DialogResult result = MessageBox.Show(
                        res.message,
                        "Успешно",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information,
                        MessageBoxDefaultButton.Button1);

                    authForm.Show();
                    this.Close();
                }
                else
                {
                    DialogResult result = MessageBox.Show(
                        res.message,
                        "Не успешно",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information,
                        MessageBoxDefaultButton.Button1);
                }
            }
        }
Ejemplo n.º 7
0
 private void bet_refrash_btn_Click(object sender, EventArgs e)
 {
     if (this_user.isSuperUser())
     {
         betGridView.DataSource = TransactionScripts.getAllBets();
     }
     else
     {
         betGridView.DataSource = TransactionScripts.getBetByUID(this_user.id);
     }
 }
Ejemplo n.º 8
0
        private void refresh_btn_Click(object sender, EventArgs e)
        {
            if (this_user.isSuperUser())
            {
                createEvent_btn.Visible = true;
                delete_btn.Visible      = true;
            }

            DataTable dt = new DataTable();

            dt = TransactionScripts.getAllEvents();
            eventGridView1.DataSource = dt;
        }
Ejemplo n.º 9
0
 private void createEvent_btn_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(name_txtBox.Text) &&
         !string.IsNullOrWhiteSpace(type_txtBox.Text) &&
         !string.IsNullOrWhiteSpace(place_txtBox.Text) &&
         !string.IsNullOrWhiteSpace(date_txtBox.Text) &&
         !string.IsNullOrWhiteSpace(time_txtBox.Text))
     {
         Error res = new Error();
         if (!update)
         {
             res = TransactionScripts.createEvent(name_txtBox.Text,
                                                  type_txtBox.Text, place_txtBox.Text,
                                                  date_txtBox.Text, time_txtBox.Text);
         }
         else
         {
             res = TransactionScripts.updateEvent(event_, name_txtBox.Text,
                                                  type_txtBox.Text, place_txtBox.Text,
                                                  date_txtBox.Text, time_txtBox.Text);
         }
         if (!res.error)
         {
             mainF.update();
             this.Close();
         }
         else
         {
             DialogResult result = MessageBox.Show(
                 //res.message,
                 "Ошибка",
                 "Проверьте корректность введенных данных",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Information,
                 MessageBoxDefaultButton.Button1);
         }
     }
     else
     {
         MessageBox.Show("Заполните все поля");
     }
 }
Ejemplo n.º 10
0
        private void eventGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewRow row = this.eventGridView1.Rows[e.RowIndex];
                //debug_txtBox.Text = row.Cells[0].Value.ToString();
                try
                {
                    int p = int.Parse(row.Cells[0].Value.ToString());
                    TransactionScripts.updateEvent(p,
                                                   row.Cells[1].Value.ToString(),
                                                   row.Cells[2].Value.ToString(),
                                                   row.Cells[3].Value.ToString(),
                                                   row.Cells[4].Value.ToString());
                }
                catch (FormatException ex)
                {
                }

                //Name_txt.Text = row.Cells["First Name"].Value.ToString();
                //Surname_txt.Text = row.Cells["Last Name"].Value.ToString();
            }
        }
Ejemplo n.º 11
0
 private void enter_btn_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(login_txtBox.Text) &&
         !string.IsNullOrWhiteSpace(password_txtBox.Text))
     {
         Error res = TransactionScripts.auth(login_txtBox.Text, password_txtBox.Text);
         if (!res.error)
         {
             EventForm ef = new EventForm(new User(login_txtBox.Text), this);
             ef.Show();
             this.Hide();
         }
         else
         {
             DialogResult result = MessageBox.Show(
                 res.message,
                 "Не успешно",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error,
                 MessageBoxDefaultButton.Button1);
         }
     }
 }
Ejemplo n.º 12
0
 private void findEventById_Click(object sender, EventArgs e)
 {
     eventGridView1.DataSource = TransactionScripts.getEventById(Convert.ToInt32(eventID_txtBox.Text));
 }