Exemplo n.º 1
0
        public void gvProposta_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                proposta_tb obj = ((proposta_tb)e.Row.DataItem);

                ((HyperLink)e.Row.FindControl("lnkEditar")).NavigateUrl = string.Concat("PropostaDetalhe?id=", obj.proposta_id);
                ((HyperLink)e.Row.FindControl("lnkEditar")).Text        = obj.proposta_id.ToString();
            }
        }
Exemplo n.º 2
0
        private void CarregarTela()
        {
            if (!string.IsNullOrEmpty(Request["cotacao_id"]))
            {
                cotacao_id = Convert.ToInt16(Request["cotacao_id"]);
            }

            ViewState["vsCotacaoID"] = cotacao_id;


            if (!string.IsNullOrEmpty(Request["id"]))
            {
                proposta = new PropostaRepositorio().RecuperarPelaChave(Convert.ToInt32(Request["id"]));
                chkAgenciamento.Checked = Convert.ToBoolean(proposta.agenciamento);
                txtCodigo.Text          = proposta.codigo.ToString();
                txtDataEmissao.Text     = proposta.data_emissao.ToString();
                txtDataProposta.Text    = proposta.data_proposta.ToString();
                txtParcelamento.Text    = proposta.parcelamento.ToString();
                txtPremio.Text          = proposta.premio_liquido.ToString();

                ViewState["vsPropostaID"] = proposta.proposta_id;

                if (!string.IsNullOrEmpty(proposta.cotacao_id.ToString()))
                {
                    cotacao_id = proposta.cotacao_id;
                }

                txtDataEmissao.Text  = System.DateTime.Now.ToString();
                txtDataProposta.Text = System.DateTime.Now.ToString();

                if (!string.IsNullOrEmpty(Request["premio"]))
                {
                    txtPremio.Text = Request["premio"].ToString();
                }

                txtPremio.Enabled = false;

                estado = EntityState.Modified;
            }
            else
            {
                estado = EntityState.Added;
            }

            ViewState["vsEstado"] = estado;
        }
Exemplo n.º 3
0
        private void alterar()
        {
            using (var ctx = new CTX_GERCOM())
            {
                proposta = new PropostaRepositorio().RecuperarPelaChave(ctx, Convert.ToInt32(Request["id"]));

                carregarEntidade();

                try
                {
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Exemplo n.º 4
0
        private void inserir()
        {
            proposta = new proposta_tb();

            carregarEntidade();

            using (var ctx = new CTX_GERCOM())
            {
                try
                {
                    ctx.proposta_tb.Add(proposta);
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }