public ProductDetail(int product_id) { InitializeComponent(); product = DbProduct.get_product_from_id(product_id); fill_product_details(); if (Seller.activeSeller != 0) //satıcı hesabi ise satın al butonlarını göremesini engelliyoruz { btn_buy.Enabled = false; btn_GivePoint.Enabled = false; } fill_comments(); }
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); } }