public ActionResult loadCompania() { try { bool reslAccion = false; Compania cnCompania = new Compania(); List <DtoCompania> ltCompania = new List <DtoCompania>(); DtoCompania dtoCompania = new DtoCompania(); dtoCompania.IdCompania = 0; dtoCompania.NombreCompania = "Seleccionar..."; ltCompania = cnCompania.cargarCompanias(); if (ltCompania.Count > 0) { ltCompania.Insert(0, dtoCompania); reslAccion = true; } return(Json(new { actionResponse = reslAccion, data = ltCompania, mensaje = "", typeAcc = 2 })); } catch (Exception ex) { return(Json(new { actionResponse = false, data = "", mensaje = ex.Message, typeAcc = 2 })); } }
public List <DtoCompania> rwCompania(IDataReader reader) { List <DtoCompania> ltCompania = new List <DtoCompania>(); while (reader.Read()) { DtoCompania objCompania = new DtoCompania(); if (reader.GetInt32(0) != 0) { objCompania.IdCompania = reader.GetInt32(0); } if (reader.GetString(1) != "") { objCompania.NombreCompania = reader.GetString(1); } objCompania.Estado = reader.GetBoolean(2); ltCompania.Add(objCompania); } return(ltCompania); }