示例#1
0
        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            if (!string.IsNullOrEmpty(txtCodigo.Text))
            {
                if (dbOrcamento.ExcluirProdutoPorIdOrcamento(Convert.ToInt32(txtCodigo.Text), ref erro))
                {
                    if (dbOrcamento.ExcluirOrcamento(Convert.ToInt32(txtCodigo.Text), ref erro))
                    {
                        Session.Add("success", "Orçamento Excluído com Sucesso! ");
                        limpa();
                    }
                    else
                    {
                        Session.Add("danger", "Não foi possível excluído o Orçamento " + erro);
                    }
                }
                else
                {
                    Session.Add("danger", "Não foi possível excluído o Orçamento " + erro);
                }
            }
        }
示例#2
0
        protected void gvProdutos_SelectedIndexChanged(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            Produto    objProduto = new Produto();
            ProdutoDAL dbProduto  = new ProdutoDAL();

            Pessoa    objPessoa = new Pessoa();
            PessoaDAL dbPessia  = new PessoaDAL();

            objOrcamento = dbOrcamento.ObertProdutoPorID(Convert.ToInt32(gvProdutos.SelectedDataKey.Value), ref erro);

            objPessoa = dbPessia.ObterPessoaID(objOrcamento.IdPessoa, ref erro);

            objProduto = dbProduto.ObterProdutoPorID(objOrcamento.IdProduto, ref erro);

            if (objOrcamento != null && objProduto != null && objPessoa != null)
            {
                bindProduto(objOrcamento, objProduto, objPessoa);
            }
            else
            {
                Session.Add("danger", "Erro " + erro);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            string comunicado = string.Empty;

            int qtdeOrcamento = dbOrcamento.ObertOrcamentosPendentes(ref erro);

            if (qtdeOrcamento > 0)
            {
                comunicado = ", temos " + qtdeOrcamento + " Orçamento(s) pendente(s)";
            }

            NotaFiscal    objNotaFiscal = new NotaFiscal();
            NotaFiscalDAL dbNotaFiscal  = new NotaFiscalDAL();

            int qtdeNotasFiscais = dbNotaFiscal.ObterNotasFiscaisPendentes(ref erro);

            if (qtdeNotasFiscais > 0)
            {
                comunicado += " temos " + qtdeNotasFiscais + " NF Vencida(s)";
            }

            HttpCookie cookie = Request.Cookies["login"];

            lblboasVindas.Text = "Bem vindo " + cookie.Value + comunicado;
        }
示例#4
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            if (!string.IsNullOrEmpty(txtCodigo.Text))
            {
                objOrcamento.IdOrcamento = Convert.ToInt32(txtCodigo.Text);
                objOrcamento.Descricao   = txtDescricao.Text;
                objOrcamento.Data        = Convert.ToDateTime(DateTime.Now);
                objOrcamento.Status      = Convert.ToInt32(cbAprovado.Checked);
                objOrcamento.Valor       = Convert.ToDouble(lblTotal.Text);
                objOrcamento.IdPessoa    = Convert.ToInt32(txtCodCliente.Text);
                objOrcamento.Vencimento  = Convert.ToDateTime(txtVencimento.Text);

                if (!dbOrcamento.AtualizarOrcamento(objOrcamento, ref erro))
                {
                    Session.Add("danger", "Não foi possível atualizar o Orçamento " + erro);
                }
                else
                {
                    Session.Add("success", "Orçamento atualizado com Sucesso! ");
                    limpa();
                }
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            DataTable dtOrcamento = dbOrcamento.ObterListaOrcamentoPendentes(ref erro);

            if (dtOrcamento == null && erro != "")
            {
                Session.Add("danger", "Não foi possível Carregar a lista de Orçamentos " + erro);
            }
            else
            {
                gvOrcamentos.DataSource = dtOrcamento;
                gvOrcamentos.DataBind();
            }

            NotaFiscal    objNF = new NotaFiscal();
            NotaFiscalDAL dbNF  = new NotaFiscalDAL();

            DataTable dtNF = dbNF.ObterListaDeNotaFiscaisAVencidas(ref erro);

            if (dtNF == null && erro != "")
            {
                Session.Add("danger", "Não foi possível Carregar a lista de Notas Fiscais! " + erro);
            }
            else
            {
                gvNotas.DataSource = dtNF;
                gvNotas.DataBind();
            }
        }
        protected void btnImprimir_Click(object sender, EventArgs e)
        {
            if (!validacoes())
            {
                Session.Add("danger", "Selecione um Orçamento ");
            }
            else
            {
                OrcamentoDAL dbPedidoCompra = new OrcamentoDAL();

                _crystalReport = new LSN022_IMPRIMIRORCAMENTO_();
                _dsPedido      = dbPedidoCompra.GetData(Convert.ToInt32(txtCodigo.Text), ref erro);
                if (_dsPedido != null)
                {
                    _crystalReport.SetDataSource(_dsPedido);
                    CrystalReportViewer1.ReportSource = _crystalReport;
                    _crystalReport.PrintToPrinter(1, false, 0, 0);
                }

                if (erro != "")
                {
                    Session.Add("danger", "Não foi possível imprimir " + erro);
                }
            }
        }
示例#7
0
        public void carregaGvOrcamento()
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();
            DataTable    dtOrcamento  = dbOrcamento.ObterListaOrcamento(ref erro);

            gvOrcamento.DataSource = dtOrcamento;
            gvOrcamento.AutoGenerateSelectButton = true;
            gvOrcamento.DataBind();
        }
示例#8
0
        protected void txtBusca_TextChanged(object sender, EventArgs e)
        {
            OrcamentoDAL dbOrcamento = new OrcamentoDAL();
            DataTable    lstProduto  = dbOrcamento.PesquisaListaOrcamentoPendente(txtBusca.Text, ref erro);

            gvNF.DataSource = lstProduto;
            gvNF.AutoGenerateSelectButton = true;
            gvNF.DataBind();
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "openModal();", true);
        }
示例#9
0
        public void carregaGvOrcamento()
        {
            btnCancelar_Click(this, null);
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();
            DataTable    dtOrcamento  = dbOrcamento.ObterListaOrcamentoPorStatus(ref erro);

            gvOrcamento.DataSource = dtOrcamento;
            gvOrcamento.AutoGenerateSelectButton = true;
            gvOrcamento.DataBind();
        }
示例#10
0
        protected void gvOrcamento_SelectedIndexChanged(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            objOrcamento = dbOrcamento.ObterOrcamentoPorId(Convert.ToInt32(gvOrcamento.SelectedDataKey.Value), ref erro);

            if (objOrcamento != null)
            {
                bindOrcamento(objOrcamento);
            }
        }
示例#11
0
        public void carregaGvProduto()
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();
            DataTable    dtOrcamento  = dbOrcamento.ObterListaProdutoOrcamentoPorID(Convert.ToInt32(txtCodigo.Text), ref erro);

            gvProdutos.DataSource = dtOrcamento;
            gvProdutos.AutoGenerateSelectButton = true;
            gvProdutos.DataBind();
            if (dtOrcamento != null && dtOrcamento.Rows.Count > 0)
            {
                lblTotal.Text = dtOrcamento.Rows[0].ItemArray[6].ToString();
            }
        }
示例#12
0
 public IList <OrcamentoPedidoVendaCabDTO> selectOrcamentoPedidoVendaCabPagina(int primeiroResultado, int quantidadeResultados, OrcamentoPedidoVendaCabDTO orcamentoPedidoVendaCab)
 {
     try
     {
         IList <OrcamentoPedidoVendaCabDTO> resultado = null;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             OrcamentoDAL DAL = new OrcamentoDAL(session);
             resultado = DAL.selectPagina(primeiroResultado, quantidadeResultados, orcamentoPedidoVendaCab);
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
示例#13
0
 public OrcamentoPedidoVendaCabDTO salvarAtualizarOrcamentoPedidoVendaCab(OrcamentoPedidoVendaCabDTO orcamentoPedidoVendaCab)
 {
     try
     {
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             OrcamentoDAL DAL = new OrcamentoDAL(session);
             DAL.saveOrUpdate(orcamentoPedidoVendaCab);
             session.Flush();
         }
         return(orcamentoPedidoVendaCab);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
示例#14
0
        protected void btnRemover_Click(object sender, EventArgs e)
        {
            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            if (!string.IsNullOrEmpty(hfCodigoProdutoOrcamento.Value))
            {
                if (dbOrcamento.ExcluirProdutoPorIdOrcamento(Convert.ToInt32(hfCodigoProdutoOrcamento.Value), ref erro))
                {
                    Session.Add("success", "Produto Excluído com Sucesso! ");
                    carregaGvProduto();
                }
                else
                {
                    Session.Add("danger", "Não foi possível excluído o Produto " + erro);
                }
            }
        }
示例#15
0
 public int deleteOrcamentoPedidoVendaCab(OrcamentoPedidoVendaCabDTO orcamentoPedidoVendaCab)
 {
     try
     {
         int resultado = -1;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             OrcamentoDAL DAL = new OrcamentoDAL(session);
             DAL.delete(orcamentoPedidoVendaCab);
             session.Flush();
             resultado = 0;
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
示例#16
0
        protected void btnAdicionar_Click(object sender, EventArgs e)
        {
            if (!validacoes())
            {
                Session.Add("danger", "Preencha os campos corretamente!");
                return;
            }

            Orcamento    objOrcamento = new Orcamento();
            OrcamentoDAL dbOrcamento  = new OrcamentoDAL();

            objOrcamento.IdOrcamento = (string.IsNullOrEmpty(txtCodigo.Text)) ? 0 : Convert.ToInt32(txtCodigo.Text);

            objOrcamento.Descricao           = txtDescricao.Text;
            objOrcamento.Vencimento          = Convert.ToDateTime(txtVencimento.Text);
            objOrcamento.IdPessoa            = Convert.ToInt32(txtCodCliente.Text);
            objOrcamento.IdProduto           = (string.IsNullOrEmpty(ddlProduto.SelectedValue)) ? 0 : Convert.ToInt32(ddlProduto.SelectedValue);
            objOrcamento.Quantidade          = (string.IsNullOrEmpty(txtQuantidade.Text)) ? 0 : Convert.ToDecimal(txtQuantidade.Text);
            objOrcamento.Qdte_metro_quadrado = (string.IsNullOrEmpty(txtQtdeMetroQuadrado.Text)) ? 0 : Convert.ToDecimal(txtQtdeMetroQuadrado.Text);
            objOrcamento.Status = Convert.ToInt32(cbAprovado.Checked);

            if (cbValorUnitario.Checked)
            {
                objOrcamento.Valor = Convert.ToDouble(txtValorPrevisto.Text) * Convert.ToDouble(txtQuantidade.Text);
            }
            else
            {
                objOrcamento.Valor = (Convert.ToDouble(txtValorPorMetro.Text) * (Convert.ToDouble(txtQtdeMetroQuadrado.Text))) * Convert.ToDouble(txtQuantidade.Text);
            }

            int idOrcamento = 0;

            if (string.IsNullOrEmpty(txtCodigo.Text))
            {
                idOrcamento = dbOrcamento.InserirOrcamento(objOrcamento, ref erro);
                if (erro != "")
                {
                    Session.Add("danger", "Não foi possível criar o Orçamento " + erro);
                    return;
                }

                txtCodigo.Text            = idOrcamento.ToString();
                txtQtdeMetroQuadrado.Text = string.Empty;
                txtQuantidade.Text        = string.Empty;
            }

            //objOrcamento.ValorUnitario =  (cbValorUnitario.Checked) ? 1 : 0 ;
            objOrcamento.ValorUnitario = Convert.ToInt16(cbValorUnitario.Checked);

            if (string.IsNullOrEmpty(hfCodigoProdutoOrcamento.Value))
            {
                if (!dbOrcamento.AdicionarProduto(objOrcamento, ref erro, Convert.ToInt32(txtCodigo.Text)))
                {
                    Session.Add("danger", "Não foi possível Adicionar o produto ao Orcamento numero " + idOrcamento + "! " + erro);
                    return;
                }
            }
            else
            {
                objOrcamento.IdProdutoOrcamento = Convert.ToInt32(hfCodigoProdutoOrcamento.Value);
                if (!dbOrcamento.AtualizarProduto(objOrcamento, ref erro, Convert.ToInt32(txtCodigo.Text)))
                {
                    Session.Add("danger", "Não foi possível atualizar o produto! " + erro);
                    return;
                }
            }
            carregaGvProduto();
            carregaGvOrcamento();
        }