Ejemplo n.º 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));
     }
 }
Ejemplo n.º 2
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.º 3
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.º 4
0
 private void AlterarBDI_Click(object sender, RoutedEventArgs e)
 {
     listaAterarBDI = new ObservableCollection <MaterialDTO>();
     int[] handles = grdItens.GetSelectedRowHandles();
     if (handles.Length > 0)
     {
         foreach (var rowHandle in handles)
         {
             var selectedItem = grdItens.GetRow(rowHandle) as ListaOrcamentosDTO;
             listaAterarBDI.Add(new MaterialDTO {
                 Id = selectedItem.Id
             });
         }
         using (var form = new AlterarBDIOrcamento(listaAterarBDI))
         {
             form.Owner = Window.GetWindow(this);
             form.ShowDialog();
             if (form.DialogResult.HasValue && form.DialogResult.Value)
             {
                 Load();
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Você deve selecionar ao menos um item para alterar o BDI.", "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 void SendToDB_Click(object sender, RoutedEventArgs e)
 {
     if (bll.CadastroLote(dt))
     {
         CustomOKMessageBox.Show("Itens Cadastrados com sucesso!", "Sucesso!", Window.GetWindow(this));
     }
 }
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 void CopiarItens_Click(object sender, RoutedEventArgs e)
        {
            listaCopiar = new ObservableCollection <ListaProjetosDTO>();
            int[] handles = grdItens.GetSelectedRowHandles();

            if (handles.Length > 0)
            {
                foreach (var rowHandle in handles)
                {
                    var selectedItem = grdItens.GetRow(rowHandle) as ListaProjetosDTO;
                    listaCopiar.Add(new ListaProjetosDTO {
                        Produto_Id = selectedItem.Produto_Id
                    });
                }
                using (var form = new CopiarItensProjeto(listaCopiar, informacoesDTO))
                {
                    form.Owner = Window.GetWindow(this);
                    form.ShowDialog();
                    if (form.DialogResult.Value && form.DialogResult.HasValue)
                    {
                        Load();
                    }
                }
            }
            else
            {
                CustomOKMessageBox.Show("Você deve selecionar ao menos um item para copiar.", "Atenção!", Window.GetWindow(this));
            }
        }
Ejemplo n.º 9
0
        private async void BtnEditar_Click(object sender, RoutedEventArgs e)
        {
            Button btn   = sender as Button;
            var    index = lstClientes.Items.IndexOf(btn.DataContext);

            dto.Id            = ((ClientesDTO)lstClientes.Items[index]).Id;
            dto.Razao_Social  = ((ClientesDTO)lstClientes.Items[index]).Razao_Social;
            dto.Nome_Fantasia = ((ClientesDTO)lstClientes.Items[index]).Nome_Fantasia;
            dto.Categoria_Id  = ((ClientesDTO)lstClientes.Items[index]).Categoria_Id;
            dto.Status        = ((ClientesDTO)lstClientes.Items[index]).Status;
            using (var form = new EditarCliente(dto))
            {
                form.Owner = Window.GetWindow(this);
                form.ShowDialog();
                if (form.DialogResult.Value && form.DialogResult.HasValue)
                {
                    await Task.Run(() =>
                    {
                        listaClientes = bll.LoadClientes();
                    });

                    lstClientes.ItemsSource = listaClientes;
                    CustomOKMessageBox.Show("Cliente Atualizado com sucesso.", "Sucesso!", Window.GetWindow(this));
                }
            }
        }
Ejemplo n.º 10
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.º 11
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.º 12
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));
            }
        }
Ejemplo n.º 13
0
 private void BtnClose_Click(object sender, RoutedEventArgs e)
 {
     if (!HaveUpdate)
     {
         Application.Current.Shutdown();
     }
     else
     {
         CustomOKMessageBox.Show("Você não pode fechar o programa enquanto está fazendo update!", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 14
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));
            }
        }
Ejemplo n.º 15
0
 private void BtnConfirmar_Click(object sender, RoutedEventArgs e)
 {
     if (txtValor.Text.Length > 0)
     {
         Valor        = txtValor.Text.ToString().Replace(",", ".");
         DialogResult = true;
     }
     else
     {
         CustomOKMessageBox.Show("Descrição não pode ser nula!", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 16
0
 public static DialogResult Show(string Text, string Caption, Window parent)
 {
     MsgBoxOK = new CustomOKMessageBox(parent);
     MsgBoxOK.btnConfirmar.Focus();
     MsgBoxOK.Height            = parent.ActualHeight;
     MsgBoxOK.Width             = parent.ActualWidth;
     MsgBoxOK.txtDescricao.Text = Text;
     MsgBoxOK.txtTitulo.Text    = Caption;
     MsgBoxOK.ShowDialog();
     MsgBoxOK.Owner = parent;
     return(result);
 }
Ejemplo n.º 17
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.º 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 BtnLogin_Click(object sender, RoutedEventArgs e)
 {
     dto.Usuario = txtLogin.Text;
     dto.Senha   = Encrypt(txtPassword.Password);
     Save_Data();
     if (bll.Login(dto))
     {
         Layout mw = new Layout();
         mw.Show();
         this.Close();
     }
     else
     {
         CustomOKMessageBox.Show("Credenciais inválidas!", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 20
0
 private void BtnCadastrar_Click(object sender, RoutedEventArgs e)
 {
     if (txtDescricaoAtividade.Text.TrimStart(' ') != "")
     {
         atividadeCadastradaDTO.Atividade_id = cmbAtividade.SelectedValue.ToString();
         atividadeCadastradaDTO.Descricao    = txtDescricaoAtividade.Text.Replace("'", "''").TrimStart(' ').ToUpper();
         bll.CadastrarAtividade(dto, atividadeCadastradaDTO);
         txtDescricaoAtividade.Text = "";
         LoadAtividadesCadastradas();
         CustomOKMessageBox.Show("Atividade cadastrada com sucesso.", "Sucesso!", Window.GetWindow(this));
     }
     else
     {
         CustomOKMessageBox.Show("Descrição não pode ser nula.", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 21
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.º 22
0
 private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == System.Windows.Input.Key.Enter)
     {
         dto.Usuario = txtLogin.Text;
         dto.Senha   = Encrypt(txtPassword.Password);
         Save_Data();
         if (bll.Login(dto))
         {
             Layout mw = new Layout();
             mw.Show();
             this.Close();
         }
         else
         {
             CustomOKMessageBox.Show("Credenciais inválidas!", "Atenção!", Window.GetWindow(this));
         }
     }
 }
Ejemplo n.º 23
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 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.º 25
0
 private void InitializeComponents()
 {
     if (dto.Versao_Locked == 0)
     {
         LoadCombobox();
         LoadAtividadesCadastradas();
         grdAtividades.Visibility = Visibility.Visible;
     }
     else
     {
         if (grdAtividades.Visibility == Visibility.Visible)
         {
             grdAtividades.Visibility = Visibility.Collapsed;
         }
         CustomOKMessageBox.Show("Versão do orçamento trancada. Crie uma nova versão para adicionar atividades.", "Atenção!", Window.GetWindow(this));
     }
     if (btnEletrica.IsChecked == false)
     {
         btnEletrica.IsChecked = true;
     }
 }
Ejemplo n.º 26
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.º 27
0
 private void BtnAterarVersao_Click(object sender, RoutedEventArgs e)
 {
     if (bll.HasEnabledVersion(dto))
     {
         using (var form = new AlterarVersaoOrcamento(dto))
         {
             form.Owner = Window.GetWindow(this);
             form.ShowDialog();
             if (form.DialogResult.HasValue && form.DialogResult.Value)
             {
                 dto.Versao_Id = form.Versao;
                 bll.AlterarVersao(dto);
                 txtVersao.Text = Convert.ToInt32(dto.Versao_Id).ToString("00");
                 InitializeComponents();
             }
         }
     }
     else
     {
         CustomOKMessageBox.Show("Este orçamento só possui uma versão ou não possui versão habilitada para edição!", "Atenção!", Window.GetWindow(this));
     }
 }
Ejemplo n.º 28
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.º 29
0
        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();
                    }
                }
            }
        }
Ejemplo n.º 30
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));
            }
        }