private void BtnAdicionarMaterial_Click(object sender, RoutedEventArgs e) { if (!txtNomeMaterial.Text.Equals("") && !txtCodigoMaterial.Text.Equals("") && !txtPrecoMaterial.Text.Equals("") && !txtQuantidadeMaterial.Text.Equals("") && !txtfabricante.Text.Equals("")) { Material material = new Material { Codigo = txtCodigoMaterial.Text }; material = MaterialDao.BuscarMaterialPorCodigo(material); ItensMaterial listaMaterial = new ItensMaterial { material = material, quantidade = Convert.ToInt32(txtQuantidadeMaterial.Text), }; listaItensMateriais.Add(listaMaterial); dtaListaMateriais.ItemsSource = listaItensMateriais; dtaListaMateriais.Items.Refresh(); //Calculo Valor Total totalMaterial += material.Valor * Convert.ToInt32(txtQuantidadeMaterial.Text); txtTotalMaterial.Text = totalMaterial.ToString("C2"); //Calculo do Imposto totalImpostoMaterial += (material.Valor * Convert.ToInt32(txtQuantidadeMaterial.Text)) * 0.10; txtTotalImpostoMaterial.Text = totalImpostoMaterial.ToString("C2"); //Calculo Valor Total totalGeralMaterial = totalMaterial + totalImpostoMaterial; txtTotalGeralMaterial.Text = totalGeralMaterial.ToString("C2"); LimparFormularioMaterial(); } else { MessageBox.Show("Por Favor Preencha todos os campos!", "Cadastro de Materiais"); } }
public static void CadastrarMaterial(ItensMaterial listamaterial) { orcamento1.material.Add(listamaterial); }