Exemple #1
0
        private void AddProduct_Click(object sender, EventArgs e)
        {
            string  nume           = ProductNameTextBox.Text;
            decimal pret           = Decimal.Parse(pretTExtBox.Text);
            int     stocProduse    = int.Parse(stoc.Text);
            string  caracteristici = textBox1.Text;
            int     optiune        = checkedListBox1.SelectedIndex + 1;
            int     optiune1       = checkedListBox2.SelectedIndex + 1;

            byte[] imagine = imageToByteArray(pictureBox1.Image);


            Vanzatori vanzator   = VanzatorController.GetSellerById(getUserID_Vanzatordb());
            int       vanzatorId = Convert.ToInt32(vanzator.VanzatorId);


            try
            {
                AddProductController.AddProduct(nume, pret, stocProduse, caracteristici, imagine, optiune, optiune1, vanzatorId);
                deleteLabels();
            }
            catch
            {
                MessageBox.Show("A aparut o eroareeeeee", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public AddProductWindow(RichTextBox outputTextField, object main)
 {
     InitializeComponent();
     AddController         = new AddProductController(outputTextField, main as IMainWindowController);
     AddController.product = ProductName;
     AddController.price   = Price;
 }
        /// <summary>
        /// The method that collected all the steps to add an item to the warehouse.
        /// </summary>
        /// <param name="addProduct"></param>
        #region Adding product
        static void AddingProcuct(AddProductController addProduct)
        {
            // Adding product
            while (true)
            {
                StartMenu();

                addProduct.YesNo(ref yesNo);

                addProduct.ValueYesNo(ref yesNo);

                if (yesNo == "n")
                {
                    break;
                }

                addProduct.EnterNumberAddMenu(ref idProduct);

                addProduct.SwitchNumberAddMenu(ref idProduct, ref countItemsOfWarehouse, ref yesNo);
            }
        }