public override void PrepareEntityForEdition(Entity entity) { Entities.Nivel item = entity as Entities.Nivel; if (item != null && item.FromDataSource) { DataEntities.SpNivelesSel sp = new DataEntities.SpNivelesSel(); sp.ClaNivel = item.ID; DataTable dt = sp.GetDataTable(this.ConnectionString); if (dt != null && dt.Rows.Count == 1) { item.ID = Utils.GetDataRowValue(dt.Rows[0], "ClaNivel", 0); item.Nombre = Utils.GetDataRowValue(dt.Rows[0], "NomNivel", ""); } } }
public List <Entities.Nivel> Combo(int claPais) { List <Entities.Nivel> list = new List <Entities.Nivel>(); DataEntities.SpNivelesSel sp = new DataEntities.SpNivelesSel(); sp.ClaNivel = -1; DataTable dt = sp.GetDataTable(this.ConnectionString); foreach (DataRow dr in dt.Rows) { Entities.Nivel item = new Entities.Nivel(true); item.ID = Utils.GetDataRowValue(dr, "ClaNivel", 0); item.Nombre = Utils.GetDataRowValue(dr, "NomNivel", ""); this.SetWebEntityGridValues(item, dr); list.Add(item); } return(list); }