public async Task populaCampos(int FormularioId, string status) { disabilitaCamposReabertura(status); await carregaAreaCausadora(); await carregaCentroCusto(); await carregaAno(); await carregaPercursoCobranca(); await carregaCanal(); Questao6Bll questao6Bll = new Questao6Bll(); var q = await questao6Bll.readAsync(FormularioId); if (q != null) { ViewState["idQuestao"] = q.id; this.AreaCausadora = q.areaCausadoraId; this.CentroCusto = q.centroCustoId; if (q.areaCausadoraId == null) { q.areaCausadoraId = 0; await carregaMotivo((int)q.areaCausadoraId); } else { await carregaMotivo((int)q.areaCausadoraId); } if (q.motivoId == null) { q.motivoId = 0; await carregaSubMotivo((int)q.motivoId); } else { await carregaSubMotivo((int)q.motivoId); } this.Motivo = q.motivoId; this.SubMotivo = q.subMotivoId; this.Mes = q.mes; this.Ano = q.anoId; this.PercursoCobranca = q.percursoCobrancaId; this.CanalCritico = q.CanalCritico; if (CanalCritico == true) { CanalManifestoID.Style.Add("display", "block"); } else { rfCanal.Enabled = false; rfProtocoloManifesto.Enabled = false; } this.Memorando = q.MemorandoAtendimento; this.Conta = q.NumeroConta; this.ProtocoloManifesto = q.ProtocoloManifesto; this.Canal = q.qualCanalID; } }
public void Salvar(int FormularioId) { try { if (FormularioId > 0) { Questao6Bll questao6Bll = new Questao6Bll(); Questao6 q = new Questao6(); q.id = Convert.ToInt32(ViewState["idQuestao"]); q.formularioId = FormularioId; if (ddlAreaCausadora.SelectedValue != "0") { q.areaCausadoraId = Convert.ToInt32(ddlAreaCausadora.SelectedValue); } else { q.areaCausadoraId = null; } q.motivoId = null; q.subMotivoId = null; if (ddlCentroCusto.SelectedValue != "0") { q.centroCustoId = Convert.ToInt32(ddlCentroCusto.SelectedValue); } else { q.centroCustoId = null; } if (ddlMotivo.SelectedValue != "0" && ddlMotivo.SelectedValue != "") { q.motivoId = Convert.ToInt32(ddlMotivo.SelectedValue); } else { q.motivoId = null; } if (ddlSubMotivo.SelectedValue != "0" && ddlSubMotivo.SelectedValue != "") { q.subMotivoId = Convert.ToInt32(ddlSubMotivo.SelectedValue); } else { q.subMotivoId = null; } if (ddlMes.SelectedValue != "0") { q.mes = Convert.ToInt32(ddlMes.SelectedValue); } else { q.mes = null; } if (ddlAno.SelectedValue != "0") { q.anoId = Convert.ToInt32(ddlAno.SelectedValue); } else { q.anoId = null; } if (ddlPercursoCobranca.SelectedValue != "0") { q.percursoCobrancaId = Convert.ToInt32(ddlPercursoCobranca.SelectedValue); } else { q.percursoCobrancaId = null; } q.CanalCritico = rbCanaisCriticos.SelectedValue == "1" ? true : false; if (q.CanalCritico == true) { if (ddlCanal.SelectedValue != "0") { q.qualCanalID = Convert.ToInt32(ddlCanal.SelectedValue); } else { q.qualCanalID = null; } q.ProtocoloManifesto = txtProtocoloManifesto.Text.TrimEnd(); } else { q.qualCanalID = null; q.ProtocoloManifesto = null; } q.MemorandoAtendimento = txtMemorandoAtendimento.Text.TrimEnd(); q.NumeroConta = txtNumeroConta.Text.TrimEnd(); questao6Bll.save(q); ViewState["idQuestao"] = q.id; } } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }