Exemple #1
0
        public async Task populaCampos(int FormularioId)
        {
            await PopulaQuestion();

            FormularioAcordoBll formularioAcordoBll = new FormularioAcordoBll();
            var f = await formularioAcordoBll.readAsync(FormularioId);

            if (f != null)
            {
                this.DataAcordo                = f.DataAcordo;
                this.Mes                       = f.Mes;
                this.DataUltimaAcao            = f.DataUltimaAcao;
                this.Cenario                   = f.Cenario;
                this.MotivoProcesso            = f.MotivoProcesso;
                this.Fechamento                = f.Fechamento;
                this.ValorSolicitado           = f.ValorSolicitado;
                this.ValorAlcada               = f.ValorAlcada;
                this.ValorAcordoDanosMorais    = f.ValorAcordoDanosMorais;
                this.ValorAcordoDanosMateriais = f.ValorAcordoDanosMateriais;
                this.ValorAcordoObriogacao     = f.ValorAcordoObriogacao;
                this.ContatoCom                = f.ContatoCom;
                this.Email                     = f.Email;
                this.Telefone                  = f.Telefone;
                this.Alcada                    = f.Alcada;
                this.Estado                    = f.Estado;
                this.Critico                   = f.Critico;
                this.DataNascimento            = f.DataNascimento;
            }
        }
Exemple #2
0
        public bool Salvar(int FormularioId)
        {
            try
            {
                if (FormularioId > 0)
                {
                    FormularioAcordoBll formularioAcordoBll = new FormularioAcordoBll();
                    FormularioAcordo    f;

                    f = formularioAcordoBll.read(FormularioId);
                    if (f == null)
                    {
                        f = new FormularioAcordo();
                    }

                    f.formularioId = FormularioId;
                    if (Util.ISDate(txtDtAcordo.Text))
                    {
                        f.DataAcordo = DateTime.Parse(txtDtAcordo.Text);
                    }
                    else
                    {
                        f.DataAcordo = null;
                    }
                    if (Util.ISDate(txtMesAno.Text))
                    {
                        f.Mes = DateTime.Parse(txtMesAno.Text);
                    }
                    else
                    {
                        f.Mes = null;
                    }
                    if (Util.ISDate(txtDataUltimaAcaoFA.Text))
                    {
                        f.DataUltimaAcao = DateTime.Parse(txtDataUltimaAcaoFA.Text);
                    }
                    else
                    {
                        f.DataUltimaAcao = null;
                    }

                    f.Cenario = txtCenario.Text.TrimEnd();
                    if (ddlMotivoProcesso.SelectedValue != "0")
                    {
                        f.MotivoProcesso = Convert.ToInt32(ddlMotivoProcesso.SelectedValue);
                    }
                    else
                    {
                        f.MotivoProcesso = null;
                    }
                    if (ddlFechamento.SelectedValue != "0")
                    {
                        f.Fechamento = Convert.ToInt32(ddlFechamento.SelectedValue);
                    }
                    else
                    {
                        f.Fechamento = null;
                    }

                    f.ValorSolicitado           = txtValorSolicitadoFA.Text == "" ? 0 : Convert.ToDecimal(txtValorSolicitadoFA.Text.Replace("R$ ", ""));
                    f.ValorAlcada               = txtValorAlcadaFA.Text == "" ? 0 : Convert.ToDecimal(txtValorAlcadaFA.Text.Replace("R$ ", ""));
                    f.ValorAcordoDanosMorais    = txtAcordoRealizadoMoralFA.Text == "" ? 0 : Convert.ToDecimal(txtAcordoRealizadoMoralFA.Text.Replace("R$ ", ""));
                    f.ValorAcordoDanosMateriais = txtAcordoRealizadoMaterialFA.Text == "" ? 0 : Convert.ToDecimal(txtAcordoRealizadoMaterialFA.Text.Replace("R$ ", ""));
                    f.ValorAcordoObriogacao     = txtAcordoRealizadoObricacaoFA.Text == "" ? 0 : Convert.ToDecimal(txtAcordoRealizadoObricacaoFA.Text.Replace("R$ ", ""));
                    if (ddlContatoCom.SelectedValue != "0")
                    {
                        f.ContatoCom = Convert.ToInt32(ddlContatoCom.SelectedValue);
                    }
                    else
                    {
                        f.ContatoCom = null;
                    }

                    f.Email    = txtEmailAdvogado.Text.TrimEnd();
                    f.Telefone = txtTelefoneFA.Text.Replace(")", "").Replace("(", "").Replace("-", "").Replace(" ", "").Trim();

                    if (ddlAlcada.SelectedValue != "0")
                    {
                        f.Alcada = Convert.ToInt32(ddlAlcada.SelectedValue);
                    }
                    else
                    {
                        f.Alcada = null;
                    }

                    if (ddlEstado.SelectedValue != "0")
                    {
                        f.Estado = Convert.ToInt32(ddlEstado.SelectedValue);
                    }
                    else
                    {
                        f.Estado = null;
                    }

                    if (ddlCritico.SelectedValue != "0")
                    {
                        f.Critico = Convert.ToInt32(ddlCritico.SelectedValue);
                    }
                    else
                    {
                        f.Critico = null;
                    }

                    if (Util.ISDate(txtDataNascimentoFA.Text))
                    {
                        f.DataNascimento = DateTime.Parse(txtDataNascimentoFA.Text);
                    }
                    else
                    {
                        f.DataNascimento = null;
                    }

                    formularioAcordoBll.save(f);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }