public ReviewList GetAll() { try { _list.Clear(); Database db = new Database("Books"); db.Command.CommandType = System.Data.CommandType.StoredProcedure; db.Command.CommandText = "tblReviewGETALL"; DataTable dt = db.ExecuteQuery(); //dgvStudent.DataSource = dt; foreach (DataRow dr in dt.Rows) { Review s = new Review(); s.Initialize(dr); s.InitializeBusinessData(dr); s.IsDirty = false; s.IsNew = false; s.evtIsSavable += new IsSavableHandler(s_evtIsSavable); _list.Add(s); } } catch (Exception ex) { throw; } return(this); }
public ReviewList GetByUserID(Guid UserID) { Database db = new Database("Books"); try { db.Command.Parameters.Clear(); db.Command.CommandType = CommandType.StoredProcedure; db.Command.CommandText = "tblReviewGETBYUSERID"; db.Command.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = UserID; DataTable dt = db.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { Review s = new Review(); s.Initialize(dr); s.InitializeBusinessData(dr); s.IsDirty = false; s.IsNew = false; s.evtIsSavable += new IsSavableHandler(s_evtIsSavable); _list.Add(s); } } catch (Exception ex) { throw; } return(this); }
public ReviewList GetAll() { try { _list.Clear(); Database db = new Database("Books"); db.Command.CommandType = System.Data.CommandType.StoredProcedure; db.Command.CommandText = "tblReviewGETALL"; DataTable dt = db.ExecuteQuery(); //dgvStudent.DataSource = dt; foreach (DataRow dr in dt.Rows) { Review s = new Review(); s.Initialize(dr); s.InitializeBusinessData(dr); s.IsDirty = false; s.IsNew = false; s.evtIsSavable += new IsSavableHandler(s_evtIsSavable); _list.Add(s); } } catch(Exception ex) { throw; } return this; }
public ReviewList GetByBookID(Guid BookID) { Database db = new Database("Books"); try { db.Command.Parameters.Clear(); db.Command.CommandType = CommandType.StoredProcedure; db.Command.CommandText = "tblReviewGETBYBOOKID"; db.Command.Parameters.Add("@BookID", SqlDbType.UniqueIdentifier).Value = BookID; DataTable dt = db.ExecuteQuery(); foreach (DataRow dr in dt.Rows) { Review s = new Review(); s.Initialize(dr); s.InitializeBusinessData(dr); s.IsDirty = false; s.IsNew = false; s.evtIsSavable += new IsSavableHandler(s_evtIsSavable); _list.Add(s); } } catch (Exception ex) { throw; } return this; }