Exemple #1
0
        private void btn_GivePoint_Click(object sender, EventArgs e)
        {
            Product product = new Product();

            product = DbProduct.get_product_from_id(Convert.ToInt32(lbl_id.Text));
            int score;

            if (!string.IsNullOrEmpty(lbl_id.Text))
            {
                score = Convert.ToInt32(numericUpDown_score.Value);
                score = (DbProduct.get_product_from_id(Convert.ToInt32(lbl_id.Text)).GetScore() + score) / 2;
                product.SetScore(score);

                DbProduct.UpdateProductScore(product);
            }
            else
            {
                MessageBox.Show("Score is not valid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }