private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                product = new PRODUCT();

                if (idSupply != -1)
                {
                    product.title     = tbName.Text;
                    product.category  = tbCategory.Text;
                    product.size      = Convert.ToInt32(tbSize.Text);
                    product.color     = tbColor.Text;
                    product.photo     = ImgConverter.ImageToString(pictureBoxPhoto.Image);
                    product.price     = Convert.ToInt32(tbPrice.Text);
                    product.count     = Convert.ToInt32(tbCount.Text);
                    product.id_supply = idSupply;
                }

                productsControlS.Add(product);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            try
            {
                product.title    = tbName.Text;
                product.category = tbCategory.Text;
                product.size     = Convert.ToInt32(tbSize.Text);
                product.color    = tbColor.Text;
                product.photo    = ImgConverter.ImageToString(pictureBoxPhoto.Image);
                product.price    = Convert.ToInt32(tbPrice.Text);
                product.count    = Convert.ToInt32(tbCount.Text);

                productsControlS.Update(product);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }