public List <StudentAbilityBase> GetDefaults() { List <StudentAbilityBase> list = new List <StudentAbilityBase>(); DataTable dt = dbc.GetDataTable("SELECT * FROM A_DefaultItems"); foreach (DataRow dr in dt.Rows) { int defaultTypeId = (int)dr["DefaultType"]; StudentAbilityBase sa; switch (defaultTypeId) { case 1: sa = new PhysicalAbility(); break; case 2: sa = new CommunityOrientation(); break; case 3: sa = new CommunityInteraction(); break; default: sa = new PersonalCare(); break; } sa.StudentAbilityTypeId = (int)dr["DefaultType"]; sa.Item = dr["Item"].ToString(); sa.Selected = true; list.Add(sa); } return(list); }
public List <StudentAbilityBase> GetList(int PersonId) { List <StudentAbilityBase> list = new List <StudentAbilityBase>(); DataTable dt = dbc.GetDataTable("SELECT * FROM vw_StudentAbilities WHERE StudentId=" + PersonId); //dbc.CloseConnection(); foreach (DataRow dr in dt.Rows) { int studentAbilityTypeId = (int)dr["StudentAbilityTypeId"]; StudentAbilityBase sa; switch (studentAbilityTypeId) { case 1: sa = new PhysicalAbility(); break; case 2: sa = new CommunityOrientation(); break; default: sa = new CommunityInteraction(); break; } sa.StudentAbilityId = (int)dr["StudentAbilityId"]; sa.StudentId = (int)dr["StudentId"]; sa.Item = dr["Item"].ToString(); sa.Description = dr["Description"].ToString(); sa.Comments = dr["Comments"].ToString(); sa.StudentAbilityType = dr["StudentAbilityType"].ToString(); list.Add(sa); } return(list); }