public TermClassList GetByStudentId(Guid studentId) { Database database = new Database("DB_109645_projectfinal"); DataTable dt = new DataTable(); database.Command.CommandType = System.Data.CommandType.StoredProcedure; database.Command.CommandText = "tblTermClassGetByStudentId"; database.Command.Parameters.Add("@StudentId", SqlDbType.UniqueIdentifier).Value = studentId; dt = database.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { TermClass termclass = new TermClass(); termclass.Initialize(dr); termclass.InitializeBusinessData(dr); _List.Add(termclass); } return(this); }
public TermClassList GetAll() { Database database = new Database("DB_109645_projectfinal"); database.Command.Parameters.Clear(); database.Command.CommandType = CommandType.StoredProcedure; database.Command.CommandText = "tblTermClassGetAll"; DataTable dt = database.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { TermClass termclass = new TermClass(); termclass.Initialize(dr); termclass.InitializeBusinessData(dr); termclass.IsNew = false; termclass.IsDirty = false; termclass.Savable += TermClass_Savable; _List.Add(termclass); } return(this); }