示例#1
0
 private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtItem.Text != "" && txtFabricante.Text != "" && txtCusto.Text != "" && txtIPI.Text != "" && txtICMS.Text != "")
     {
         var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este produto?", "Atenção!", Window.GetWindow(this));
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             dto.Anotacoes  = txtDescricaoDetalhada.Text.Replace("'", "''").ToUpper().TrimStart(' ');
             dto.Ncm        = txtNCM.Text;
             dto.Custo      = Convert.ToDouble(txtCusto.Text);
             dto.Icms       = Convert.ToDouble(txtICMS.Text) / 100;
             dto.Ipi        = Convert.ToDouble(txtIPI.Text) / 100;
             dto.Partnumber = txtPartnumber.Text.Replace("'", "''").ToUpper().TrimStart(' ');
             if (bll.InserirProduto(dto))
             {
                 ClearControls();
                 CustomOKMessageBox.Show("Produto cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
     }
 }