示例#1
0
        private void codeTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string       productCode  = codeTextBox.Text;
                    ProductModel productModel = ProductManagement.SelectProductByCode(productCode);

                    if (!SearchDuplicates(productCode))
                    {
                        SubCategoryModel subCategoryModel = SubCategoryManagement.SelectSubCategoryById(productModel.IdSubCategory.ToString());
                        string           tax   = "0,13";
                        decimal          taxes = (productModel.NormalPrice * decimal.Parse(tax));
                        dgvAparts.Rows.Add(productModel.IdProduct.ToString(), productModel.Code, productModel.Description, subCategoryModel.Name, 1, productModel.NormalPrice, productModel.NormalPrice, 0, taxes.ToString("##,##0.00"));
                    }
                    codeTextBox.Focus();
                    codeTextBox.Text = string.Empty;
                    setInformation();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void codeTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string       productCode  = codeTextBox.Text;
                ProductModel productModel = ProductManagement.SelectProductByCode(productCode);

                if (!SearchDuplicates(productCode))
                {
                    SubCategoryModel subCategoryModel = SubCategoryManagement.SelectSubCategoryById(productModel.IdSubCategory.ToString());
                    dgvInputExitProduct.Rows.Add(productModel.IdProduct.ToString(), productModel.Code, productModel.Description, subCategoryModel.Name, 1, productModel.NormalPrice);
                }
                codeTextBox.Focus();
                codeTextBox.Text = string.Empty;
            }
        }