コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
        }