Exemplo n.º 1
0
        /// <summary>
        /// Fills Chapter object
        /// </summary>
        /// <param name="chapterObject">The object to be filled</param>
        /// <param name="reader">The reader to use to fill a single object</param>
        /// <param name="start">The ordinal position from which to start reading the reader</param>
        protected void FillObject(ChapterBase chapterObject, SqlDataReader reader, int start)
        {
            chapterObject.Id = reader.GetInt32(start + 0);
            if (!reader.IsDBNull(1))
            {
                chapterObject.ChapterNo = reader.GetString(start + 1);
            }
            if (!reader.IsDBNull(2))
            {
                chapterObject.Name = reader.GetString(start + 2);
            }
            if (!reader.IsDBNull(3))
            {
                chapterObject.Type = reader.GetString(start + 3);
            }
            if (!reader.IsDBNull(4))
            {
                chapterObject.Description = reader.GetString(start + 4);
            }
            if (!reader.IsDBNull(5))
            {
                chapterObject.PageUrl = reader.GetString(start + 5);
            }
            FillBaseObject(chapterObject, reader, (start + 6));


            chapterObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Add common parameters before calling a procedure
 /// </summary>
 /// <param name="cmd">command object, where parameters will be added</param>
 /// <param name="chapterObject"></param>
 private void AddCommonParams(SqlCommand cmd, ChapterBase chapterObject)
 {
     AddParameter(cmd, pNVarChar(ChapterBase.Property_ChapterNo, 50, chapterObject.ChapterNo));
     AddParameter(cmd, pNVarChar(ChapterBase.Property_Name, 500, chapterObject.Name));
     AddParameter(cmd, pNVarChar(ChapterBase.Property_Type, 50, chapterObject.Type));
     AddParameter(cmd, pNVarChar(ChapterBase.Property_Description, chapterObject.Description));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Updates Chapter
        /// </summary>
        /// <param name="chapterObject">Object to be updated</param>
        /// <returns>Number of rows affected</returns>
        public long Update(ChapterBase chapterObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(UPDATECHAPTER);

                AddParameter(cmd, pInt32(ChapterBase.Property_Id, chapterObject.Id));
                AddCommonParams(cmd, chapterObject);

                long result = UpdateRecord(cmd);
                if (result > 0)
                {
                    chapterObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectUpdateException(chapterObject, x);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Inserts Chapter
        /// </summary>
        /// <param name="chapterObject">Object to be inserted</param>
        /// <returns>Number of rows affected</returns>
        public long Insert(ChapterBase chapterObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(INSERTCHAPTER);

                AddParameter(cmd, pInt32Out(ChapterBase.Property_Id));
                AddCommonParams(cmd, chapterObject);

                long result = InsertRecord(cmd);
                if (result > 0)
                {
                    chapterObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                    chapterObject.Id       = (Int32)GetOutParameter(cmd, ChapterBase.Property_Id);
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectInsertException(chapterObject, x);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Fills Chapter object
 /// </summary>
 /// <param name="chapterObject">The object to be filled</param>
 /// <param name="reader">The reader to use to fill a single object</param>
 protected void FillObject(ChapterBase chapterObject, SqlDataReader reader)
 {
     FillObject(chapterObject, reader, 0);
 }
Exemplo n.º 6
0
		public void AddToListOfInfoAddOnToProcess (InformationenAddOn Entry)
			{
		    int ChapterIndex = 0;
		    bool InsertedBefore = false;
		    foreach (ChapterBase Base in UsedChapterBase)
		        {
		        if (Base.InformationenAddOnLinkedWithThisChapter.Contains(Entry))
		            {
		            InsertedBefore = true;
                    break;
		            }
                ChapterIndex++;
                }
            if (InsertedBefore)
		        return;
		    ChapterBase ChapterToProcess = new ChapterBase(ChapterIndex) { ChapterName = Entry.GetChapterText () };
			ChapterToProcess.InformationenAddOnLinkedWithThisChapter.Add(Entry);
			UsedChapterBase.Add(ChapterToProcess);
			JoinResourcesUsed();
			}