Exemplo n.º 1
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (txtRazao.Text != "" && txtFantasia.Text != "" && cmbCategoria.SelectedIndex != -1)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este cliente?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    dto.Razao_Social  = txtRazao.Text.Replace("'", "''").ToUpper();
                    dto.Nome_Fantasia = txtFantasia.Text.Replace("'", "''").ToUpper();
                    dto.Categoria_Id  = Convert.ToInt32(cmbCategoria.SelectedValue);
                    bool    isSucess = false;
                    WaitBox wb       = new WaitBox();
                    wb.Owner = Window.GetWindow(this);
                    wb.Show();
                    await Task.Run(() =>
                    {
                        isSucess = bll.CreateCliente(dto);
                    });

                    wb.Close();
                    if (isSucess)
                    {
                        ClearControls();
                        CustomOKMessageBox.Show("Cliente cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 2
0
        private async void LoadData()
        {
            wb = new WaitBox();
            wb.Show();
            wb.Owner = Window.GetWindow(this);
            wb.Show();
            await Task.Run(() =>
            {
                ChartDTO = dashboardComercialBLL.LoadCharts();
            });

            chart.Series      = ChartDTO.SeriesCollection;
            chartlabel.Labels = ChartDTO.Labels;
            txtMedia.Text     = ChartDTO.Media.ToString("N2").Replace(",", ".");
            await Task.Run(() =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    listaComercial = dashboardComercialBLL.Load();
                }));
            });

            grdComercial.DataContext = listaComercial;
            listaNegocios            = listaComercial.First().ListaNegocios;
            Formatter   = value => value.ToString("P");
            DataContext = this;
            Find        = "1";
            Commit();
            wb.Close();
        }
        private void InsertComQtde()
        {
            new Thread(() =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                }));
                syncEvent.Set();

                foreach (var atividade in listaChecked)
                {
                    dto.Atividade_Id = atividade.Id.ToString();
                    foreach (var item in listaCopiar)
                    {
                        dto.Id         = item.Id;
                        dto.Quantidade = item.Quantidade;
                        bll.InsertComQtde(dto);
                    }
                }
                t1 = new Thread(WaitBoxLoad);
                t1.Start();
            }).Start();
        }
Exemplo n.º 4
0
        private void Insert()
        {
            new Thread(() =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                }));
                syncEvent.Set();

                foreach (var atividade in listaChecked)
                {
                    atividadesProjetoDTO.Atividade_Id = atividade.Atividade_Id;
                    foreach (var item in listaCopiar)
                    {
                        dto.Produto_Id = item.Produto_Id;
                        bll.CopiarItens(dto, informacoesDTO, atividadesProjetoDTO);
                    }
                }
                t1 = new Thread(WaitBoxLoad);
                t1.Start();
            }).Start();
        }
Exemplo n.º 5
0
        private async void BtnFechar_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Este procedimento não tem volta. Após fechar o orçamento você irá criar uma Ordem de Serviço baseada no número deste orçamento.\nDeseja continuar?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                using (var form = new ValorFechadoOrcamento())
                {
                    form.Owner = Window.GetWindow(this);
                    form.ShowDialog();
                    if (form.DialogResult.Value && form.DialogResult.HasValue)
                    {
                        dto.Valor_Fechamento = form.Valor;
                        WaitBox wb = new WaitBox
                        {
                            Owner = Window.GetWindow(this)
                        };
                        wb.Show();
                        await Task.Run(() =>
                        {
                            bll.FecharNegocio(dto);
                        });

                        dto.Status_Id        = 5;
                        dto.Status_Descricao = "FECHADO";
                        txtStatus.Text       = dto.Status_Descricao;
                        wb.Close();
                        InitializeComponents();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            dto.Id            = id;
            dto.Razao_Social  = txtRazao.Text.Replace("'", "''").ToUpper();
            dto.Nome_Fantasia = txtFantasia.Text.Replace("'", "''").ToUpper();
            dto.Descricao     = txtDescricao.Text.Replace("'", "''").ToUpper();
            dto.Cnpj          = txtCNPJ.Text;
            dto.Endereco      = txtEndereco.Text.Replace("'", "''");
            dto.Ie            = txtIE.Text.Replace("'", "''");
            dto.Telefone      = txtTelefone.Text;
            dto.Status        = Convert.ToInt32(cbxStatus.IsChecked);
            dto.Cliente_Id    = cliente_Id;
            dto.UF_Id         = cmbUF.SelectedValue.ToString();
            dto.Cidade_Id     = cmbCidade.SelectedValue.ToString();
            WaitBox wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };

            wb.Show();
            await Task.Run(() =>
            {
                bll.EditarEstabelecimento(dto);
            });

            wb.Close();
            DialogResult = true;
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        private async void EstornarSaida_Click(object sender, RoutedEventArgs e)
        {
            int[] handles = grdItens.GetSelectedRowHandles();
            if (handles.Length > 0)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo excluir todos os itens selecionados?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    listaExcluir = new ObservableCollection <MovimentoSaidaDTO>();
                    foreach (var rowHandle in handles)
                    {
                        var selectedItem = grdItens.GetRow(rowHandle) as MovimentoSaidaDTO;
                        listaExcluir.Add(selectedItem);
                    }
                    wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                    await Task.Run(() =>
                    {
                        bll.Excluir(listaExcluir);
                    });

                    wb.Close();
                    grdItens.UnselectAll();
                    Load();
                }
            }
            else
            {
                CustomOKMessageBox.Show("Você deve selecionar ao menos um item para excluir.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 9
0
        private async void BtnHabilitar_Click(object sender, RoutedEventArgs e)
        {
            if (pnlOrcamentistas.Items.Count > 0)
            {
                WaitBox wb = new WaitBox
                {
                    Owner = Window.GetWindow(this)
                };
                wb.Show();
                await Task.Run(() =>
                {
                    bll.HabilitarOrcamento(dto);
                });

                dto.Status_Id        = 2;
                dto.Status_Descricao = "EM ANDAMENTO";
                txtStatus.Text       = dto.Status_Descricao;
                wb.Close();
                InitializeComponents();
            }
            else
            {
                CustomOKMessageBox.Show("Para habilitar o orçamento você deve cadastrar ao menos um orçamentista.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 10
0
        private async void LoadGrupo()
        {
            wb       = new WaitBox();
            wb.Owner = Window.GetWindow(this);
            wb.Show();
            await Task.Run(() =>
            {
                listaGrupos = bll.LoadGrupo();
            });

            lstGrupos.ItemsSource = listaGrupos;
            wb.Close();
        }
Exemplo n.º 11
0
        private async void Load()
        {
            wb       = new WaitBox();
            wb.Owner = Window.GetWindow(this);
            wb.Show();
            await Task.Run(() =>
            {
                listaSaldo = bll.Load();
            });

            grdItens.ItemsSource = listaSaldo;
            wb.Close();
        }
Exemplo n.º 12
0
        private async void LoadNegocios()
        {
            wb       = new WaitBox();
            wb.Owner = Window.GetWindow(this);
            wb.Show();
            await Task.Run(() =>
            {
                listaNegocios = bll.LoadNegocios(dto);
            });

            lstClientes.ItemsSource = listaNegocios;
            wb.Close();
        }
Exemplo n.º 13
0
        private async void BtnPesquisa_Click(object sender, RoutedEventArgs e)
        {
            var position = Mouse.GetPosition(this);

            using (var form = new ProcurarNegocio(position))
            {
                form.Owner = Window.GetWindow(this);
                form.ShowDialog();
                if (form.DialogResult.Value && form.DialogResult.HasValue)
                {
                    dto.Id = form.Negocio_Id;
                    WaitBox wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                    await Task.Run(() =>
                    {
                        dto = bll.LoadGerenciarOrcamento(dto).First();
                    });


                    txtNumero.Text       = dto.Numero.ToUpper();
                    txtCliente.Text      = dto.Razao_Social;
                    txtNumero.Text       = dto.Numero.ToUpper();
                    txtCliente.Text      = dto.Razao_Social;
                    txtCNPJ.Text         = dto.Cnpj;
                    txtStatus.Text       = dto.Status_Descricao;
                    txtVersao.Text       = Convert.ToInt32(dto.Versao_Id).ToString("00");
                    txtEndereco.Text     = dto.Endereco;
                    txtCidadeEstado.Text = dto.CidadeEstado;
                    txtDescricao.Text    = dto.Descricao;
                    txtVendedor.Text     = dto.Vendedor;

                    txtResponsavel.Text = dto.Contato_Nome;
                    if (dto.Anotacoes != "")
                    {
                        txtAnotacoes.Text = dto.Anotacoes;
                    }
                    else
                    {
                        txtAnotacoes.Text = "Não existe informações adicionais para este negócio.";
                    }
                    txtPrazo.Text = Convert.ToDateTime(dto.Prazo).ToString("dd/MM/yyyy");
                    InitializeComponents();
                    orcamentistas = bll.LoadOrcamentistaCadastrado(dto);
                    pnlOrcamentistas.ItemsSource = orcamentistas;
                    wb.Close();
                }
            }
        }
Exemplo n.º 14
0
        private void Load()
        {
            syncEvent.Set();
            var negocios = bll.LoadNegocios();

            Dispatcher.Invoke(new Action(() =>
            {
                w1 = new WaitBox();
                w1.Show();
            }));

            Thread.Sleep(500);

            foreach (FunildeVendasDTO item in negocios)
            {
                Dispatcher.Invoke(DispatcherPriority.Background,
                                  new Action(() =>
                {
                    FunilControl uc = new FunilControl(item.Id, item.Descricao, item.Prazo, item.Cidade, item.Fantasia, item.Descricao_Status, item.Status_Orcamento);

                    uc.PreviewMouseLeftButtonDown += NF_MouseDownParent;

                    switch (item.Status_Orcamento)
                    {
                    case 1:
                        pnFila.Children.Add(uc);
                        break;

                    case 2:
                        pnExecucao.Children.Add(uc);
                        break;

                    case 3:
                        pnEnviados.Children.Add(uc);
                        break;

                    case 4:
                        pnNegociacao.Children.Add(uc);
                        break;

                    case 5:
                        pnVendidos.Children.Add(uc);
                        break;

                    case 6:
                        pnCancelados.Children.Add(uc);
                        break;
                    }
                }));
            }
        }
Exemplo n.º 15
0
        private async void BtnCancelar_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Este procedimento irá cancelar o orçamento, este processo não tem volta.\nDeseja continuar?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                using (var form = new MotivoCancelamentoOrcamento())
                {
                    form.Owner = Window.GetWindow(this);
                    form.ShowDialog();
                    if (form.DialogResult.HasValue && form.DialogResult.Value)
                    {
                        var presult = CustomOKCancelMessageBox.Show("Deseja adicionar o valor da concorrência?", "Atenção!", Window.GetWindow(this));
                        if (presult == System.Windows.Forms.DialogResult.OK)
                        {
                            using (var pp = new PrecoPerdidoOrcamento())
                            {
                                pp.Owner = Window.GetWindow(this);
                                pp.ShowDialog();
                                if (pp.DialogResult.HasValue && pp.DialogResult.Value)
                                {
                                    dto.Valor_Perdido = pp.Valor;
                                }
                            }
                        }
                        else
                        {
                            dto.Valor_Perdido = "0";
                        }
                        dto.Motivo_Cancelamento    = form.Motivo_Cancelamento;
                        dto.Motivo_Cancelamento_Id = form.Motivo_Cancelamento_Id;
                        WaitBox wb = new WaitBox
                        {
                            Owner = Window.GetWindow(this)
                        };
                        wb.Show();
                        await Task.Run(() =>
                        {
                            bll.CancelarNegocio(dto);
                        });

                        dto.Status_Id        = 5;
                        dto.Status_Descricao = "CANCELADO";
                        txtStatus.Text       = dto.Status_Descricao;
                        wb.Close();
                        InitializeComponents();
                    }
                }
            }
        }
Exemplo n.º 16
0
        private async void AtenderMateriais_Click(object sender, RoutedEventArgs e)
        {
            int[] handles = grdItens.GetSelectedRowHandles();
            if (handles.Length > 0)
            {
                bool iNotify = false;
                foreach (var rowHandle in handles)
                {
                    var selectedItem = grdItens.GetRow(rowHandle) as EstornoEstoqueDTO;
                    if (selectedItem.Quantidade == 0)
                    {
                        iNotify = true;
                    }
                }
                if (iNotify)
                {
                    CustomOKMessageBox.Show("Existem materiais na sua seleção que possuem a quantidade zerada.", "Atenção!", Window.GetWindow(this));
                }
                else
                {
                    var result = CustomOKCancelMessageBox.Show("Deseja mesmo estornar os produtos selecionados?", "Atenção!", Window.GetWindow(this));
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        listaEstorno = new ObservableCollection <EstornoEstoqueDTO>();
                        foreach (var rowHandle in handles)
                        {
                            var selectedItem = grdItens.GetRow(rowHandle) as EstornoEstoqueDTO;
                            listaEstorno.Add(selectedItem);
                        }
                        WaitBox wb = new WaitBox
                        {
                            Owner = Window.GetWindow(this)
                        };
                        await Task.Run(() =>
                        {
                            bll.EstornarProdutos(listaEstorno);
                        });

                        wb.Close();
                        CustomOKMessageBox.Show("Itens estornados com sucesso!", "Sucesso!", Window.GetWindow(this));
                        Load();
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Você deve selecionar ao menos um produto para atender.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 17
0
        private async void LoadFornecedores()
        {
            wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };
            wb.Show();
            await Task.Run(() =>
            {
                listaFornecedores = bll.LoadFornecedores();
            });

            lstFornecedores.ItemsSource = listaFornecedores;
            wb.Close();
        }
Exemplo n.º 18
0
        private async void LoadItens()
        {
            wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };
            wb.Show();
            await Task.Run(() =>
            {
                listaItens = bll.LoadItens();
            });

            lstItens.ItemsSource = listaItens;
            wb.Close();
        }
Exemplo n.º 19
0
        private async void LoadEstabelecimentos()
        {
            wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };
            wb.Show();
            await Task.Run(() =>
            {
                listaEstabelecimentos = bll.LoadEstabelecimentos();
            });

            lstClientes.ItemsSource = listaEstabelecimentos;
            wb.Close();
        }
Exemplo n.º 20
0
        public async void Load()
        {
            wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };
            wb.Show();
            await Task.Run(() =>
            {
                listaOrcamentos = bll.LoadOrcamento(informacoesDTO);
            });

            grdItens.ItemsSource = listaOrcamentos;
            LoadSidePanel();
            wb.Close();
        }
Exemplo n.º 21
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (txtRazao.Text != "" && txtEstabelecimento.Text != "" && txtNome.Text != "" && dtPicker.Text != "" && cmbContato.SelectedIndex != -1 && cmbPrioridade.SelectedIndex != -1 && cmbVendedor.SelectedIndex != -1)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este negócio?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    WaitBox wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                    GetValues();
                    var isSucceed = false;
                    await Task.Run(() =>
                    {
                        isSucceed = bll.CreateNegocios(dto);
                    });

                    if (isSucceed)
                    {
                        var negocio = new NegociosDTO();
                        await Task.Run(() =>
                        {
                            negocio = bll.RetNegocioId();
                        });

                        ClearControls();
                        wb.Close();
                        CustomOKMessageBox.Show("Negocio P" + Convert.ToInt32(negocio.Id).ToString("0000") + " cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
                    }
                    else
                    {
                        wb.Close();
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 22
0
        private async void BtnPesquisa_Click(object sender, RoutedEventArgs e)
        {
            BlackScreen bs       = new BlackScreen();
            var         position = Mouse.GetPosition(this);

            using (var form = new ProcurarOrcamentoCadastrado(position))
            {
                form.Owner = Window.GetWindow(this);
                form.ShowDialog();
                if (form.DialogResult.Value && form.DialogResult.HasValue)
                {
                    informacoesDTO.Id = Convert.ToInt32(form.Negocio_Id);
                    var informacoes = new ObservableCollection <InformacoesListaOrcamentosDTO>();
                    wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                    await Task.Run(() =>
                    {
                        informacoes = informacoesBLL.LoadInformacoes(informacoesDTO);
                    });

                    wb.Close();
                    if (informacoes.Count > 0)
                    {
                        informacoesDTO                  = informacoes.First();
                        txtNumero.Text                  = "P" + Convert.ToInt32(informacoesDTO.Id).ToString("0000");
                        txtDescricao.Text               = informacoesDTO.Descricao;
                        txtCidade.Text                  = informacoesDTO.Cidade;
                        txtUF.Text                      = informacoesDTO.Uf;
                        txtCliente.Text                 = informacoesDTO.Razao_Social;
                        txtVersao.Text                  = Convert.ToInt32(informacoesDTO.Versao).ToString("00");
                        cmbDisciplina.ItemsSource       = informacoesDTO.Disciplinas;
                        cmbDisciplina.SelectedValuePath = "Id";
                        cmbDisciplina.DisplayMemberPath = "Descricao";
                        cmbDisciplina.SelectedIndex     = 0;
                    }
                }
            }
        }
Exemplo n.º 23
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (txtRazao.Text != "" && txtFantasia.Text != "" && txtEndereco.Text != "" && txtCNPJ.Text != "" && txtTelefone.Text != "" && cmbUF.SelectedIndex != -1 && cmbCidade.SelectedIndex != -1)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este estabelecimento?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    dto.Razao_Social  = txtRazao.Text.Replace("'", "''").ToUpper();
                    dto.Nome_Fantasia = txtFantasia.Text.Replace("'", "''").ToUpper();
                    dto.Endereco      = txtEndereco.Text.Replace("'", "''").ToUpper();
                    dto.Cnpj          = txtCNPJ.Text.Replace("'", "''").ToUpper();
                    dto.Ie            = txtIE.Text.Replace("'", "''").ToUpper();
                    dto.Telefone      = txtTelefone.Text.Replace("'", "''").ToUpper();
                    dto.UF_Id         = cmbUF.SelectedValue.ToString();
                    dto.Cidade_Id     = cmbCidade.SelectedValue.ToString();
                    dto.Descricao     = txtDescricao.Text.Replace("'", "''").ToUpper();
                    WaitBox wb = new WaitBox
                    {
                        Owner = Window.GetWindow(this)
                    };
                    wb.Show();
                    bool isSuccess = false;
                    await Task.Run(() =>
                    {
                        isSuccess = bll.CreateEstabelecimento(dto);
                    });

                    wb.Close();
                    if (isSuccess)
                    {
                        ClearControls();
                        CustomOKMessageBox.Show("Estabelecimento cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 24
0
        public PrecificarProdutos()
        {
            InitializeComponent();

            new Thread(() =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    wb       = new WaitBox();
                    wb.Owner = Window.GetWindow(this);
                    wb.Show();
                }));

                syncEvent.Set();
                Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
                {
                    listaProdutos = bll.LoadProdutos();
                    t1            = new Thread(WaitLoad);
                    t1.Start();
                }));
            }).Start();
        }
Exemplo n.º 25
0
        private void Excluir_Click(object sender, RoutedEventArgs e)
        {
            int[] handles = grdItens.GetSelectedRowHandles();

            if (handles.Length > 0)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo excluir todos os itens selecionados?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    new Thread(() =>
                    {
                        Dispatcher.Invoke(new Action(() =>
                        {
                            wb       = new WaitBox();
                            wb.Owner = Window.GetWindow(this);
                            wb.Show();
                        }));
                        syncEvent.Set();
                        foreach (var rowHandle in handles)
                        {
                            Dispatcher.Invoke(DispatcherPriority.Background,
                                              new Action(() =>
                            {
                                var selectedItem = grdItens.GetRow(rowHandle) as ListaProjetosDTO;
                                dto.Id           = Convert.ToInt32(selectedItem.Id);
                                bll.Excluir(dto);
                            }));
                        }
                        t1 = new Thread(WaitBoxLoad);
                        t1.Start();
                    }).Start();
                }
            }
            else
            {
                CustomOKMessageBox.Show("Você deve selecionar ao menos um item para excluir.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 26
0
        private async void BtnEnviar_Click(object sender, RoutedEventArgs e)
        {
            if (!await bll.HasPricelessItems(dto))
            {
                var result = CustomOKCancelMessageBox.Show("Enviar o orçamento para o cliente desabilitará esta versão para alteraçoes.\nDeseja mesmo fazer isso?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    using (var form = new ValorEnviadoOrcamento())
                    {
                        form.Owner = Window.GetWindow(this);
                        form.ShowDialog();
                        if (form.DialogResult.Value && form.DialogResult.HasValue)
                        {
                            dto.Valor_Enviado = form.Valor;
                            WaitBox wb = new WaitBox
                            {
                                Owner = Window.GetWindow(this)
                            };
                            wb.Show();
                            await Task.Run(() =>
                            {
                                bll.EnviarCliente(dto);
                            });

                            dto.Status_Descricao = "ENVIADO AO CLIENTE";
                            txtStatus.Text       = dto.Status_Descricao;
                            dto.Status_Id        = 3;
                            wb.Close();
                            InitializeComponents();
                        }
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Não é possivel enviar o orçamento. Existem preços zerados no mesmo, por favor revise.", "Atenção!", Window.GetWindow(this));
            }
        }
Exemplo n.º 27
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            dto.Id            = id.ToString();
            dto.Razao_Social  = txtRazao.Text.Replace("'", "''").ToUpper();
            dto.Nome_Fantasia = txtFantasia.Text.Replace("'", "''").ToUpper();
            dto.Categoria_Id  = Convert.ToInt32(cmbCategoria.SelectedValue);
            dto.Status        = Convert.ToInt32(cbxStatus.IsChecked);
            wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };
            wb.Show();
            var isSucceed = await bll.UpdateClientes(dto);

            if (isSucceed)
            {
                Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
                {
                    wb.Close();
                    DialogResult = true;
                }));
            }
        }
Exemplo n.º 28
0
        private void Update()
        {
            new Thread(() =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    dto.Bdi = Convert.ToDouble(txtBDI.Text);
                    wb      = new WaitBox();
                    wb.Show();
                }));
                syncEvent.Set();

                foreach (var item in listaAlterar)
                {
                    syncEvent.Set();
                    dto.Id = item.Id;
                    bll.AtualizarBDI(dto);
                    syncEvent.WaitOne();
                }
                t1 = new Thread(WaitBoxLoad);
                t1.Start();
            }).Start();
        }
Exemplo n.º 29
0
        private async void ButtonsDemoChip_DeleteClick(object sender, RoutedEventArgs e)
        {
            var btn   = sender as MaterialDesignThemes.Wpf.Chip;
            int index = pnlOrcamentistas.Items.IndexOf(btn.DataContext);

            orcamentistasDTO.Id           = ((OrcamentistasDTO)pnlOrcamentistas.Items[index]).Id;
            orcamentistasDTO.Negocio_Id   = dto.Id;
            orcamentistasDTO.Nome_Simples = ((OrcamentistasDTO)pnlOrcamentistas.Items[index]).Nome_Simples;
            WaitBox wb = new WaitBox
            {
                Owner = Window.GetWindow(this)
            };

            wb.Show();
            await Task.Run(() =>
            {
                bll.RemoverOrcamentista(orcamentistasDTO);
            });

            orcamentistas = bll.LoadOrcamentistaCadastrado(dto);
            pnlOrcamentistas.ItemsSource = orcamentistas;
            wb.Close();
        }
Exemplo n.º 30
0
        private async void BtnNegociacao_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Você deseja mesmo marcar este orçamento como em negociação?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                WaitBox wb = new WaitBox
                {
                    Owner = Window.GetWindow(this)
                };
                wb.Show();
                await Task.Run(() =>
                {
                    bll.EmNegociacao(dto);
                });

                dto.Status_Descricao = "EM NEGOCIAÇÃO";
                txtStatus.Text       = dto.Status_Descricao;
                dto.Status_Id        = 4;
                wb.Close();
                InitializeComponents();
            }
        }