public static Familia GetFamiliaById(int IdModulo) { FamiliaTableAdapter localAdapter = new FamiliaTableAdapter(); if (IdModulo <= 0) { return(null); } Familia theFamilia = null; try { FamiliaDS.FamiliaDataTable table = localAdapter.GetFamiliaById(IdModulo); if (table != null && table.Rows.Count > 0) { FamiliaDS.FamiliaRow row = table[0]; theFamilia = FillUserRecord(row); } } catch (Exception q) { log.Error("Un error ocurrio mientras obtenia la familia de la base de dato", q); return(null); } return(theFamilia); }
public static List <Familia> GetFamiliaListForSearch(string whereSql) { if (string.IsNullOrEmpty(whereSql)) { whereSql = "1 = 1"; } List <Familia> theList = new List <Familia>(); Familia theUser = null; FamiliaTableAdapter theAdapter = new FamiliaTableAdapter(); try { FamiliaDS.FamiliaDataTable table = theAdapter.GetFamiliaForSearch(whereSql); if (table != null && table.Rows.Count > 0) { foreach (FamiliaDS.FamiliaRow row in table.Rows) { theUser = FillUserRecord(row); theList.Add(theUser); } } } catch (Exception q) { log.Error("el error ocurrio mientras obtenia la lista de la familia de la base de datos", q); return(null); } return(theList); }