Esempio n. 1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            TechnologicalCard techCard = new TechnologicalCard();

            techCard.Title = textBox1.Text;
            techCard.Date  = dateTimePicker1.Value.Date;
            List <ProductTechCard> productTechCardList = new List <ProductTechCard>();
            ObjectComboBox         objPr1  = (ObjectComboBox)comboBoxProductsImport.SelectedItem;
            ProductTechCard        product = new ProductTechCard();

            product.ProductId = objPr1.Id;
            int amount = 0;

            Int32.TryParse(textBoxAmountImport.Text, out amount);
            product.Amount = amount;
            product.Type   = 1;
            productTechCardList.Add(product);

            product           = new ProductTechCard();
            objPr1            = (ObjectComboBox)comboBoxProductsExport.SelectedItem;
            product.ProductId = objPr1.Id;
            amount            = 0;
            Int32.TryParse(textBoxAmountExport.Text, out amount);
            product.Amount = amount;
            product.Type   = 2;
            productTechCardList.Add(product);
            techCard.ProductTechCards = productTechCardList;

            if (Id == -1)
            {
                query.queryAddTechCard(techCard);
            }
            else
            {
                techCard.Id = Id;
                query.queryUpdateTechCard(techCard);
            }
            instance.refreshGrid();
            this.Dispose();
        }