Пример #1
0
        private void btn_product_Update_Click(object sender, EventArgs e)
        {
            try
            {
                Product product = new Product();
                product.SetId(Convert.ToInt32(dataGridView_productsOfSeller.CurrentRow.Cells["ProductId"].Value));
                product.SetName(txtb_product_name.Text);
                product.SetPrice(Convert.ToInt32(txtb_product_price.Text));
                product.SetType(cmbbox_product_type.Text);
                product.SetDescription(richTxtb_description.Text);
                product.SetImage(pictureBox_product.ImageLocation);

                DialogResult dialog = MessageBox.Show("Update changed fields.", "Okey", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialog == DialogResult.Yes)
                {
                    DbProduct.UpdateSelectedProduct(product);
                }
                fill_dataGridView_by_productsOfSeller();
                fill_product_detail();
            }
            catch (Exception)// bir şekilde boş dgv ye tıklarsa sorun çıkarmasın
            {
            }
        }