protected void grdDebitoContaRetorno_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) == 0) { Label lstCriticas = (Label)e.Row.FindControl("lstCriticas"); AAT_TBL_RET_DEB_CONTA retDebConta = (AAT_TBL_RET_DEB_CONTA)e.Row.DataItem; string strCrit = ""; foreach (AAT_TBL_RET_DEB_CONTA_CRITICAS crit in retDebConta.AAT_TBL_RET_DEB_CONTA_CRITICAS) { strCrit += String.Format("<li>{0} - {1}</li>", crit.COD_CRITICA, crit.DCR_CRITICA); } lstCriticas.Text = String.Format("<ul style='margin: 0px;'>{0}</ul>", strCrit); Label lblCritica = (Label)e.Row.FindControl("lblCritica"); retDebConta = (AAT_TBL_RET_DEB_CONTA)e.Row.DataItem; strCrit = ""; AAT_TBL_RET_DEB_CONTA_CRITICAS crit2 = retDebConta.AAT_TBL_RET_DEB_CONTA_CRITICAS.FirstOrDefault(); if (crit2 != null) { strCrit += String.Format("{0} - {1}", crit2.COD_CRITICA, crit2.DCR_CRITICA); lblCritica.Text = strCrit; } } } }
public Resultado DePara(DataTable dt, String NomeArquivo) { Resultado res = new Resultado(); List <AAT_TBL_RET_DEB_CONTA> lsDebConta = new List <AAT_TBL_RET_DEB_CONTA>(); int line_count = 1; base.DeleteData(NomeArquivo); foreach (DataRow row in dt.Rows) { String _data = row["DATA"].ToString(); AAT_TBL_RET_DEB_CONTA newRetDebConta = new AAT_TBL_RET_DEB_CONTA(); newRetDebConta.DCR_NOM_ARQ = NomeArquivo; newRetDebConta.ID_TP_REGISTRO = _data.Substring(0, 1); newRetDebConta.COD_EMPRESA = _data.Substring(79, 3); newRetDebConta.NUM_REGISTRO = _data.Substring(82, 9); newRetDebConta.NUM_REPRESENTANTE = _data.Substring(91, 8); newRetDebConta.ID_DEB_BANC = _data.Substring(1, 25); newRetDebConta.NUM_NOSSO_NUMERO = _data.Substring(69, 10); newRetDebConta.DTA_VENCIMENTO = _data.Substring(44, 8); newRetDebConta.VLR_DEBITO = _data.Substring(52, 15); newRetDebConta.AGENC_DEB_CONTA = _data.Substring(26, 4); newRetDebConta.ID_CLIENTE_BANCO = _data.Substring(30, 14); switch (newRetDebConta.ID_TP_REGISTRO) { case "A": newRetDebConta.DTA_VENCIMENTO = _data.Substring(65, 8); break; case "F": newRetDebConta.COD_MOTIVO_RET = _data.Substring(67, 2); break; } //newRetDebConta.COD_MOTIVO_RET=(newRetDebConta.ID_TP_REGISTRO=="F") ? _data.Substring(67, 2) : null; newRetDebConta.COD_MOVIMENTO = _data.Substring(149, 1); newRetDebConta.AAT_TBL_RET_DEB_CONTA_MOTIVO = GetMotivo(newRetDebConta.COD_MOTIVO_RET); newRetDebConta.NUM_SEQ_LINHA = line_count; line_count++; lsDebConta.Add(newRetDebConta); } Criticar(lsDebConta); if (lsDebConta.Count > 0) { base.Persistir(lsDebConta); res.Sucesso(lsDebConta.Count + " registro(s) importado(s) com sucesso."); } else { res.Erro("Nenhum registro localizado."); } return(res); }