private async void BtnOrcamentista_Click(object sender, RoutedEventArgs e) { BlackScreen bs = new BlackScreen(); var position = Mouse.GetPosition(this); using (var form = new ProcurarOrcamentista(position, dto)) { bs.Show(); form.ShowDialog(); if (form.DialogResult.Value && form.DialogResult.HasValue) { WaitBox wb = new WaitBox { Owner = Window.GetWindow(this) }; wb.Show(); orcamentistasDTO.Id = form.Id; orcamentistasDTO.Login = form.Login; orcamentistasDTO.Nome_Simples = form.Nome_Simples; orcamentistasDTO.Negocio_Id = dto.Id; await Task.Run(() => { bll.InserirOracamentista(orcamentistasDTO); }); orcamentistas = bll.LoadOrcamentistaCadastrado(dto); pnlOrcamentistas.ItemsSource = orcamentistas; wb.Close(); } } bs.Close(); }
private void BtnPesquisa_Click(object sender, RoutedEventArgs e) { BlackScreen bs = new BlackScreen(); var position = Mouse.GetPosition(this); using (var form = new ProcurarOrcamento(position)) { form.Owner = Window.GetWindow(this); form.ShowDialog(); if (form.DialogResult.Value && form.DialogResult.HasValue) { dto.Id = form.Negocio_Id; var loadtext = Orcamentosbll.LoadTextBoxes(dto); if (loadtext.Count > 0) { foreach (OrcamentosDTO item in loadtext) { txtNumero.Text = "P" + Convert.ToInt32(dto.Id).ToString("0000"); txtDescricao.Text = item.Descricao; txtCidade.Text = item.Cidade; txtUF.Text = item.UF; txtCliente.Text = item.Razao_Social; //txtVersao.Text = Convert.ToInt32(item.Versao_Valida).ToString("00"); cmbVersao.ItemsSource = versaoBLL.LoadVersao(dto); cmbVersao.SelectedValuePath = "Num_Versao"; cmbVersao.DisplayMemberPath = "Num_Versao"; cmbVersao.SelectedIndex = Convert.ToInt32(item.Versao_Valida) - 1; } } else { bs.Close(); CustomOKMessageBox.Show("Não há atividades cadastradas para este negócio.", "Atenção!", Window.GetWindow(this)); InitializeComponents(); } } } }