Ejemplo 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));
            }
        }
Ejemplo n.º 2
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));
     }
 }
Ejemplo n.º 3
0
 private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtGrupo.Text != "" && txtRazao.Text != "" && txtFantasia.Text != "" && txtEndereco.Text != "" && txtCNPJ.Text != "" && txtTelefone.Text != "" && cmbUF.SelectedIndex != -1 && cmbCidade.SelectedIndex != -1)
     {
         var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este fornecedor?", "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.Estado_Id     = Convert.ToInt32(cmbUF.SelectedValue);
             dto.Cidade_Id     = Convert.ToInt32(cmbCidade.SelectedValue);
             dto.Email         = txtEmail.Text.Replace("'", "''").TrimStart(' ');
             if (bll.CadastrarFornecedor(dto))
             {
                 ClearControls();
                 CustomOKMessageBox.Show("Fornecedor cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 4
0
 private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtLogin.Text != "" && txtPassword.Password != "" && txtPasswordConfirmation.Password != "")
     {
         if (txtPassword.Password == txtPasswordConfirmation.Password)
         {
             var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este usuário?", "Atenção!", Window.GetWindow(this));
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 dto.Login    = txtLogin.Text.Replace("'", "''").ToLower();
                 dto.Password = Encrypt(txtPassword.Password.Replace("'", "''"));
                 dto.Name     = txtNome.Text.Replace("'", "''");
                 if (bll.CreateUser(dto))
                 {
                     CustomOKMessageBox.Show("Usuário cadastrado com sucesso.", "Sucesso!", Window.GetWindow(this));
                 }
                 else
                 {
                     CustomOKMessageBox.Show("Ocorreu algum erro.", "Atenção!", Window.GetWindow(this));
                 }
             }
         }
         else
         {
             CustomOKMessageBox.Show("As senhas não são iguais.", "Atenção!", Window.GetWindow(this));
         }
     }
     else
     {
         CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 5
0
        private async void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (txtRazao.Text != "" && txtNome.Text != "" && txtEmail.Text != "" && txtTelefone.Text != "" && txtCelular.Text != "" && cmbCategoria.SelectedIndex != -1)
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este contato?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    dto.Anotacoes = txtAnotacoes.Text.Replace("'", "''").ToUpper();
                    dto.Nome      = txtNome.Text.Replace("'", "''").ToUpper();
                    dto.Email     = txtEmail.Text.Replace("'", "''").ToUpper();
                    dto.Telefone  = txtTelefone.Text.Replace("'", "''").ToUpper();
                    dto.Celular   = txtCelular.Text.Replace("'", "''").ToUpper();
                    dto.Funcao_Id = cmbCategoria.SelectedValue.ToString();
                    var isSucceed = await bll.CreatePessoa(dto);

                    if (isSucceed)
                    {
                        ClearControls();
                        CustomOKMessageBox.Show("Contato cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
            }
        }
Ejemplo n.º 6
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();
                    }
                }
            }
        }
Ejemplo n.º 7
0
 private void BtnNovaVersão_Click(object sender, RoutedEventArgs e)
 {
     using (var form = new AdicionarVersaoOrcamento(dto))
     {
         form.Owner = Window.GetWindow(this);
         form.ShowDialog();
         if (form.DialogResult.HasValue && form.DialogResult.Value)
         {
             dto.Versao_Id        = form.Versao.ToString();
             dto.Versao_Descricao = form.Descricao;
             bll.AdicionarVersão(dto);
             txtVersao.Text       = form.Versao.ToString("00");
             dto.Status_Id        = 2;
             dto.Status_Descricao = "EM ANDAMENTO";
             InitializeComponents();
             CustomOKMessageBox.Show("Versão " + form.Versao.ToString("00") + " cadastrada com sucesso.", "Sucesso!", Window.GetWindow(this));
             var result = CustomOKCancelMessageBox.Show("Deseja copiar os itens de alguma versão anterior para esta versão?", "Atenção!", Window.GetWindow(this));
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 using (var cv = new CopiarVersaoOrcamento(dto))
                 {
                     cv.Owner = Window.GetWindow(this);
                     cv.ShowDialog();
                     if (cv.DialogResult.HasValue && cv.DialogResult.Value)
                     {
                         versaoOrcamentoDTO.Id = Convert.ToInt32(cv.Versao);
                         versaoOrcamentoDTO.Versao_Atividade_Id = Convert.ToInt32(cv.Versao_Atividade_Id);
                         bll.CopiarItensVersao(versaoOrcamentoDTO, dto);
                         CustomOKMessageBox.Show("Itens copiados para nova versão.", "Sucesso!", Window.GetWindow(this));
                     }
                 }
             }
         }
     }
 }
Ejemplo 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));
            }
        }
Ejemplo n.º 9
0
        private void BtnClose_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Você deseja mesmo fechar o programa?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                Application.Current.Shutdown();
            }
        }
Ejemplo n.º 10
0
        private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Você deseja mesmo aterar o BDI para '" + txtBDI.Text + "'% ?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                Update();
            }
        }
Ejemplo n.º 11
0
        private void AtualizarPrecos_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Você deseja mesmo atualiazar os preços para a versão atual?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                bll.AtualizarValores(informacoesDTO);
                Load();
                CustomOKMessageBox.Show("Preços atualizados com sucesso.", "Atualizado!", Window.GetWindow(this));
            }
        }
 public static DialogResult Show(string Text, string Caption, Window parent)
 {
     MsgBoxOKCancel = new CustomOKCancelMessageBox(parent);
     MsgBoxOKCancel.btnConfirmar.Focus();
     MsgBoxOKCancel.Height            = parent.ActualHeight;
     MsgBoxOKCancel.Width             = parent.ActualWidth;
     MsgBoxOKCancel.txtDescricao.Text = Text;
     MsgBoxOKCancel.txtTitulo.Text    = Caption;
     MsgBoxOKCancel.ShowDialog();
     MsgBoxOKCancel.Owner = parent;
     return(result);
 }
Ejemplo n.º 13
0
 private void WaitBoxLoad()
 {
     syncEvent.WaitOne();
     Dispatcher.Invoke(new Action(() =>
     {
         wb.Close();
         var result = CustomOKCancelMessageBox.Show("Itens Inseridos com sucesso.\nDeseja inserir os itens selecionados em outra atividade?", "Sucesso!", Window.GetWindow(this));
         if (result != System.Windows.Forms.DialogResult.OK)
         {
             DialogResult = true;
         }
     }));
 }
Ejemplo n.º 14
0
        private async void AtualizarPrecos_Click(object sender, RoutedEventArgs e)
        {
            var result = CustomOKCancelMessageBox.Show("Você deseja mesmo atualiazar os preços para a versão atual?", "Atenção!", Window.GetWindow(this));

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                await Task.Run(() =>
                {
                    bll.AtualizarPreco(informacoesDTO);
                });

                Load();
            }
        }
Ejemplo n.º 15
0
        private async void AdicionarEstoque_Click(object sender, RoutedEventArgs e)
        {
            int[] handles = grdItens.GetSelectedRowHandles();
            if (handles.Length > 0)
            {
                bool isLinked = true;
                foreach (var rowHandle in handles)
                {
                    var selectedItem = grdItens.GetRow(rowHandle) as EntradaNotaFiscalDTO;
                    if (selectedItem.Codigo_Getac == "")
                    {
                        isLinked = false;
                    }
                }
                if (isLinked)
                {
                    var result = CustomOKCancelMessageBox.Show("Deseja mesmo dar entrada em estoque dos produtos selecionados?", "Atenção!", Window.GetWindow(this));
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        listaEntradaEstoque = new ObservableCollection <EntradaNotaFiscalDTO>();
                        foreach (var rowHandle in handles)
                        {
                            var selectedItem = grdItens.GetRow(rowHandle) as EntradaNotaFiscalDTO;
                            listaEntradaEstoque.Add(selectedItem);
                        }
                        await Task.Run(() =>
                        {
                            bll.InserirEstoque(listaEntradaEstoque);
                        });

                        CustomOKMessageBox.Show("Itens selecionados adicionados ao estoque com sucesso!", "Sucesso!", Window.GetWindow(this));
                        if (grdItens.SelectedItems.Count != 0)
                        {
                            List <int> selectedRowHandles = new List <int>(grdItens.GetSelectedRowHandles());
                            var        descendingOrder    = selectedRowHandles.OrderByDescending(i => i);
                            grdItens.BeginDataUpdate();
                            foreach (int i in descendingOrder)
                            {
                                grdView.DeleteRow(i);
                            }
                            grdItens.EndDataUpdate();
                        }
                    }
                }
                else
                {
                    CustomOKMessageBox.Show("Há itens que não possuem link com o sistema selecionados.", "Atenção!", Window.GetWindow(this));
                }
            }
        }
Ejemplo n.º 16
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();
                    }
                }
            }
        }
        private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            decimal parse;

            if (Decimal.TryParse(txtValor.Text, out parse) && txtValor.Text != "")
            {
                var result = CustomOKCancelMessageBox.Show("Confirma o valor: " + Convert.ToDecimal(txtValor.Text).ToString("c") + " ?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    Valor        = Convert.ToDecimal(txtValor.Text).ToString().Replace(",", ".");
                    DialogResult = true;
                }
            }
        }
Ejemplo n.º 18
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));
            }
        }
Ejemplo n.º 19
0
 private void ExcluirProduto_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.DialogResult result = CustomOKCancelMessageBox.Show("Deseja mesmo remover os itens selecionados?", "Atenção!", Window.GetWindow(this));
     if (result == System.Windows.Forms.DialogResult.OK)
     {
         List <int> selectedRowHandles            = new List <int>(grdItens.GetSelectedRowHandles());
         IOrderedEnumerable <int> descendingOrder = selectedRowHandles.OrderByDescending(i => i);
         grdItens.BeginDataUpdate();
         foreach (int i in descendingOrder)
         {
             grdView.DeleteRow(i);
         }
         grdItens.EndDataUpdate();
     }
 }
Ejemplo n.º 20
0
        private void AdicionarEstoque_Click(object sender, RoutedEventArgs e)
        {
            bool iNotify = false;

            int[] handles = grdItens.GetSelectedRowHandles();
            if (handles.Length > 0)
            {
                listaInserir = new ObservableCollection <EntradaManualEstoqueDTO>();

                foreach (int rowHandle in handles)
                {
                    dto = grdItens.GetRow(rowHandle) as EntradaManualEstoqueDTO;
                    if (dto.Quantidade != 0 && dto.Custo != 0)
                    {
                        listaInserir.Add(dto);
                    }
                    else
                    {
                        iNotify = true;
                    }
                }
                if (iNotify)
                {
                    CustomOKMessageBox.Show("Existem itens que possuem a quantidade ou o preço zerado.", "Atenção!", Window.GetWindow(this));
                }
                else
                {
                    System.Windows.Forms.DialogResult result = CustomOKCancelMessageBox.Show("Deseja mesmo dar entrada nos itens selecionados?", "Atenção!", Window.GetWindow(this));
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        bll.InserirEstoque(listaInserir);
                        List <int> selectedRowHandles            = new List <int>(grdItens.GetSelectedRowHandles());
                        IOrderedEnumerable <int> descendingOrder = selectedRowHandles.OrderByDescending(i => i);
                        grdItens.BeginDataUpdate();
                        foreach (int i in descendingOrder)
                        {
                            grdView.DeleteRow(i);
                        }
                        grdItens.EndDataUpdate();
                        CustomOKMessageBox.Show("Itens adicionados com sucesso ao estoque.", "Sucesso!", Window.GetWindow(this));
                    }
                }
            }
        }
Ejemplo 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));
            }
        }
 private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtDescricao.Text != "")
     {
         var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este Grupo de Fornecedor?", "Atenção!", Window.GetWindow(this));
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             dto.Descricao = txtDescricao.Text.ToUpper().TrimStart(' ').Replace("'", "''");
             if (bll.Cadastrar(dto))
             {
                 ClearControls();
                 CustomOKCancelMessageBox.Show("Grupo de Fornecedor cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
             }
         }
     }
     else
     {
         CustomOKCancelMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
     }
 }
 private void GerarRM_Click(object sender, RoutedEventArgs e)
 {
     int[] handles = grdItens.GetSelectedRowHandles();
     if (handles.Length > 0)
     {
         var result = CustomOKCancelMessageBox.Show("Deseja mesmo gerar uma requisição de material para todos os itens selecionados?", "Atenção!", Window.GetWindow(this));
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             using (var pp = new DescricaoRM())
             {
                 pp.Owner = Window.GetWindow(this);
                 pp.ShowDialog();
                 if (pp.DialogResult.HasValue && pp.DialogResult.Value)
                 {
                     informacoesDTO.RM_Descricao = pp.Valor;
                     listaGerar = new ObservableCollection <GerarRequisicaoMaterialDTO>();
                     foreach (var rowHandle in handles)
                     {
                         var selectedItem = grdItens.GetRow(rowHandle) as GerarRequisicaoMaterialDTO;
                         listaGerar.Add(new GerarRequisicaoMaterialDTO
                         {
                             Produto_Id = selectedItem.Produto_Id,
                             Quantidade = selectedItem.Quantidade,
                             Saldo      = selectedItem.Saldo
                         });
                     }
                     var rm = bll.GerarRM(informacoesDTO, listaGerar);
                     if (rm != null && rm != "")
                     {
                         CustomOKMessageBox.Show("Requisição de Materiais Nº " + rm + " gerada com sucesso.", "Atenção!", Window.GetWindow(this));
                         Load();
                     }
                 }
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Você deve selecionar ao menos um item para gerar RM.", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 24
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));
            }
        }
Ejemplo n.º 25
0
 private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtGrupo.Text != "" && txtDescricao.Text != "" && cmbUn.SelectedIndex != -1)
     {
         var result = CustomOKCancelMessageBox.Show("Deseja mesmo cadastrar este item?", "Atenção!", Window.GetWindow(this));
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             dto.Descricao = txtDescricao.Text.Replace("'", "''").TrimStart(' ').ToUpper();
             dto.Un        = cmbUn.SelectedValue.ToString();
             dto.Mobra     = Convert.ToInt32(cbxStatus.IsChecked);
             if (bll.CadastrarItem(dto))
             {
                 ClearControls();
                 CustomOKMessageBox.Show("Fornecedor cadastrado com sucesso!", "Sucesso!", Window.GetWindow(this));
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Campos não podem estar em branco.", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 26
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));
            }
        }
Ejemplo n.º 27
0
        private void BtnAtrelarProduto_Click(object sender, RoutedEventArgs e)
        {
            var handle = grdItens.GetFocusedRow();

            dto = handle as EntradaNotaFiscalDTO;
            if (dto.Codigo_Getac != "")
            {
                var result = CustomOKCancelMessageBox.Show("Este item já está linkado. Se você deseja linkar este produto novamente, o link anterior será apagado.\nDeseja continuar?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    using (var form = new LinkarProdutoNotaFiscal(dto))
                    {
                        form.Owner = Window.GetWindow(this);
                        form.ShowDialog();
                        if (form.DialogResult.HasValue && form.DialogResult.Value)
                        {
                            grdItens.SetFocusedRowCellValue("Codigo_Getac", form.Codigo_Getac);
                            grdItens.SetFocusedRowCellValue("Descricao", form.Descricao);
                            grdItens.SetFocusedRowCellValue("Fabricante", form.Fabricante);
                        }
                    }
                }
            }
            else
            {
                using (var form = new LinkarProdutoNotaFiscal(dto))
                {
                    form.Owner = Window.GetWindow(this);
                    form.ShowDialog();
                    if (form.DialogResult.HasValue && form.DialogResult.Value)
                    {
                        grdItens.SetFocusedRowCellValue("Codigo_Getac", form.Codigo_Getac);
                        grdItens.SetFocusedRowCellValue("Descricao", form.Descricao);
                        grdItens.SetFocusedRowCellValue("Fabricante", form.Fabricante);
                    }
                }
            }
        }
Ejemplo n.º 28
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));
            }
        }
Ejemplo n.º 29
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();
            }
        }
        private void BtnAdicionar_Click(object sender, RoutedEventArgs e)
        {
            var handle = grdItens.GetFocusedRow();

            dto = handle as LinkarProdutoNotaFiscalDTO;
            dto.Codigo_Barra = Codigo_Barra;
            if (!bll.isEmpty(dto))
            {
                var resultEmpty = CustomOKCancelMessageBox.Show("Este produto já está linkado!\nDeseja mesmo alterar o link?", "Atenção!", Window.GetWindow(this));
                if (resultEmpty == System.Windows.Forms.DialogResult.OK)
                {
                    bll.UpdateCodigoBarra(dto);
                    Codigo_Getac = dto.Id.ToString();
                    Descricao    = dto.Descricao;
                    Fabricante   = dto.Fabricante;
                    DialogResult = true;
                }
            }
            else
            {
                var result = CustomOKCancelMessageBox.Show("Deseja mesmo linkar o produto da nota fiscal com este produto do sistema?", "Atenção!", Window.GetWindow(this));
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    bll.UpdateCodigoBarra(dto);
                    Codigo_Getac = dto.Id.ToString();
                    Descricao    = dto.Descricao;
                    Fabricante   = dto.Fabricante;
                    DialogResult = true;
                }
            }


            //update codigo_barras set from dto
            //passa valores para variavel publica


            /*int[] handles = grdItens.GetSelectedRowHandles();
             * if (handles.Length > 0)
             * {
             *
             * }
             *
             *
             * 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 AdicionarItemProjetoDTO;
             *        dto.Id = Convert.ToInt32(selectedItem.Id);
             *        dto.Atividade_Id = Atividade_Id;
             *        dto.Negocio_Id = Negocio_Id;
             *        dto.Anotacoes = selectedItem.Anotacoes;
             *        bll.Inserir(dto);
             *        grdItens.UnselectAll();
             *    }));
             *  }
             *  t1 = new Thread(WaitBoxLoad);
             *  t1.Start();
             * }).Start();*/
        }