示例#1
0
 /// <summary>
 /// Retrieves Get Total Rows of Chapter
 /// </summary>
 /// <returns>Int32 type object</returns>
 public Int32 GetRowCount()
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         return(data.GetRowCount());
     }
 }
示例#2
0
 /// <summary>
 /// Retrieve list of Chapter  by query String.
 /// <param name="query"></param>
 /// </summary>
 /// <returns>List of Chapter</returns>
 public ChapterList GetByQuery(String query)
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         return(data.GetByQuery(query));
     }
 }
示例#3
0
 /// <summary>
 /// Retrieve list of Chapter  by PageRequest.
 /// <param name="request"></param>
 /// </summary>
 /// <returns>List of Chapter</returns>
 public ChapterList GetPaged(PagedRequest request)
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         return(data.GetPaged(request));
     }
 }
示例#4
0
 /// <summary>
 /// Retrieve list of Chapter.
 /// no parameters required to be passed in.
 /// </summary>
 /// <returns>List of Chapter</returns>
 public ChapterList GetAll()
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         return(data.GetAll());
     }
 }
示例#5
0
 /// <summary>
 /// Retrieve Chapter data using unique ID
 /// </summary>
 /// <param name="_Id"></param>
 /// <returns>Chapter Object</returns>
 public Chapter Get(Int32 _Id)
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         return(data.Get(_Id));
     }
 }
示例#6
0
 /// <summary>
 /// Delete operation for Chapter
 /// <param name="_Id"></param>
 /// <returns></returns>
 private bool Delete(Int32 _Id)
 {
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         // return if code > 0
         return(data.Delete(_Id) > 0);
     }
 }
示例#7
0
        public ChapterEntity ChapterEntityConversion()
        {
            IChapterDataAccess chapterDataAccess = new ChapterDataAccess();

            return(new ChapterEntity
            {
                Id = this.Id,
                Name = this.Name,
                CourseId = this.CourseId
            });
        }
示例#8
0
        /// <summary>
        /// Retrieve list of Chapter.
        /// </summary>
        /// <param name="fillChild"></param>
        /// <returns>List of Chapter</returns>
        public ChapterList GetAll(bool fillChild)
        {
            ChapterList chapterList = new ChapterList();

            using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
            {
                chapterList = data.GetAll();
            }
            if (fillChild)
            {
                foreach (Chapter chapterObject in chapterList)
                {
                    FillChapterWithChilds(chapterObject, fillChild);
                }
            }
            return(chapterList);
        }
示例#9
0
        /// <summary>
        /// Update base of Chapter Object.
        /// Data manipulation processing for: new, deleted, updated Chapter
        /// </summary>
        /// <param name="chapterObject"></param>
        /// <returns></returns>
        public bool UpdateBase(Chapter chapterObject)
        {
            // use of switch for different types of DML
            switch (chapterObject.RowState)
            {
            // insert new rows
            case BaseBusinessEntity.RowStateEnum.NewRow:
                return(Insert(chapterObject));

            // delete rows
            case BaseBusinessEntity.RowStateEnum.DeletedRow:
                return(Delete(chapterObject.Id));
            }
            // update rows
            using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
            {
                return(data.Update(chapterObject) > 0);
            }
        }
示例#10
0
 /// <summary>
 /// Insert new chapter.
 /// data manipulation for insertion of Chapter
 /// </summary>
 /// <param name="chapterObject"></param>
 /// <returns></returns>
 private bool Insert(Chapter chapterObject)
 {
     // new chapter
     using (ChapterDataAccess data = new ChapterDataAccess(ClientContext))
     {
         // insert to chapterObject
         Int32 _Id = data.Insert(chapterObject);
         // if successful, process
         if (_Id > 0)
         {
             chapterObject.Id = _Id;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
        public Course CourseConversion()
        {
            IChapterDataAccess   chapterDataAccess = new ChapterDataAccess();
            List <Chapter>       chapters          = new List <Chapter>();
            List <ChapterEntity> chapterEntities   = new List <ChapterEntity>();

            chapterEntities = chapterDataAccess.FindAllChapterByCourse(this.Id);

            foreach (var chapterEntity in chapterEntities)
            {
                chapters.Add(chapterEntity.ChapterConversion());
            }
            return(new Course
            {
                Id = this.Id,
                Name = this.Name,
                ChapterList = chapters,
                UserId = this.UserId
            });
        }