Beispiel #1
0
        public void ConversaoValorPacote()
        {
            PacotesCT  pacoteCT   = new PacotesCT();
            PacotesDTO pacotesDTO = new PacotesDTO();

            pacotesDTO.ValorPacote = Convert.ToDecimal("teste valor");
        }
Beispiel #2
0
        public void FillClientes()
        {
            pacoteCT = new PacotesCT();
            DataTable dtPacote = pacoteCT.SelecionarPorFiltro(new PacotesDTO());

            grvPacote.DataSource = dtPacote;
            grvPacote.DataBind();
        }
Beispiel #3
0
        public void FillPacotes()
        {
            PacotesCT pacotesCT = new PacotesCT();
            DataTable dtPacotes = pacotesCT.SelecionarPorFiltro(new PacotesDTO());

            ddlPacote.DataSource     = dtPacotes;
            ddlPacote.DataValueField = "IDPACOTES";
            ddlPacote.DataTextField  = "NOMEPACOTE";
            ddlPacote.DataBind();
        }
Beispiel #4
0
        public void TesteQuantidadeDeCaracteres()
        {
            PacotesCT  pacoteCT   = new PacotesCT();
            PacotesDTO pacotesDTO = new PacotesDTO();

            pacotesDTO.DescPacote  = "Descrição do Pacote de Teste";
            pacotesDTO.NomePacote  = "Nome do Pacote de Teste Nome do Pacote de Teste Nome do Pacote de Teste Nome do Pacote de Teste";
            pacotesDTO.ValorPacote = Convert.ToDecimal("20");
            bool resultado = pacoteCT.Insere(pacotesDTO);
        }
Beispiel #5
0
        public void InsercaoDePacoteValido()
        {
            PacotesCT  pacoteCT   = new PacotesCT();
            PacotesDTO pacotesDTO = new PacotesDTO();

            pacotesDTO.DescPacote  = "Descrição do Pacote de Teste";
            pacotesDTO.NomePacote  = "Nome do Pacote de Teste";
            pacotesDTO.ValorPacote = 20;
            bool resultado = pacoteCT.Insere(pacotesDTO);

            Assert.AreEqual(true, resultado);
        }
Beispiel #6
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            VendaDTO vendaDTO = new VendaDTO();

            vendaDTO.IdCliente            = Convert.ToInt32(ddlCliente.SelectedValue);
            vendaDTO.IdPacote             = Convert.ToInt32(ddlPacote.SelectedValue);
            vendaDTO.DataVencimentoFatura = ValidarData();
            vendaDTO.Status     = ddlStatus.SelectedValue.Substring(0, 1);
            vendaDTO.Observacao = txtObservacao.Text;
            vendaDTO.DataVenda  = DateTime.Now;

            PacotesCT  pacoteCT  = new PacotesCT();
            PacotesDTO pacoteDTO = new PacotesDTO();

            pacoteDTO.Identificador = vendaDTO.IdPacote;
            DataTable dtPacotes = pacoteCT.SelecionarPorFiltro(pacoteDTO);

            vendaDTO.ValorVenda = Convert.ToDecimal(dtPacotes.Rows[0]["VALORPACOTE"]);

            VendaCT vendaCT = new VendaCT();

            try
            {
                if (HiddenFieldCliente.Value == "")
                {
                    vendaCT.Insere(vendaDTO);
                }
                else
                {
                    vendaDTO.Identificador = Convert.ToInt32(HiddenFieldCliente.Value);
                    vendaCT.Altera(vendaDTO);
                }
                LimparCampos();
                FillPedidos();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "aviso", "alert('Salvo com sucesso.');", true);
            }
            catch (Exception erro)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "aviso", "alert('Erro: " + erro.Message + "');", true);
            }
        }
Beispiel #7
0
        protected void grvPacote_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "editar")
            {
                pacoteCT                = new PacotesCT();
                pacoteDTO               = new PacotesDTO();
                txtIdPacote.Value       = e.CommandArgument.ToString();
                pacoteDTO.Identificador = Convert.ToInt32(e.CommandArgument.ToString());
                DataTable dtPacotes = pacoteCT.SelecionarPorFiltro(pacoteDTO);

                if (dtPacotes.Rows.Count > 0)
                {
                    DataRow drCliente = dtPacotes.Rows[0];
                    pacoteDTO.Identificador = Convert.ToInt32(drCliente["IDPACOTES"].ToString());
                    txtNome.Text            = drCliente["NOMEPACOTE"].ToString();
                    txtDescricao.Text       = drCliente["DESCPACOTE"].ToString();
                    decimal valor = Convert.ToDecimal(drCliente["VALORPACOTE"].ToString());
                    txtValor.Text = valor.ToString("N2");
                }
            }
            else if (e.CommandName == "excluir")
            {
                pacoteCT  = new PacotesCT();
                pacoteDTO = new PacotesDTO();
                pacoteDTO.Identificador = Convert.ToInt32(e.CommandArgument);

                try
                {
                    if (pacoteCT.Excluir(pacoteDTO))
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Aviso", "alert('Pacote Excluido com Sucesso!!!')", true);
                        Response.Redirect("~/ManterPacotes.aspx");
                    }
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Aviso", "alert('Erro ao Excluir o Pacote:\n" + ex.Message + "')", true);
                }
            }
        }