protected VLLibraryQuestionCategory ExecuteAndGetLibraryQuestionCategory(DbCommand cmd)
        {
            VLLibraryQuestionCategory _retObject = null;

            try
            {
                cmd.Connection.Open();
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows == false)
                    {
                        return(null);
                    }
                    reader.Read();

                    _retObject = new VLLibraryQuestionCategory(reader);
                }
            }
            finally
            {
                cmd.Connection.Close();
            }

            return(_retObject);
        }
        protected Collection <VLLibraryQuestionCategory> ExecuteAndGetLibraryQuestionCategories(DbCommand cmd)
        {
            var collection = new Collection <VLLibraryQuestionCategory>();

            try
            {
                cmd.Connection.Open();
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var _object = new VLLibraryQuestionCategory(reader);
                        collection.Add(_object);
                    }
                }
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(collection);
        }
        internal override VLLibraryQuestionCategory UpdateLibraryQuestionCategoryImpl(Int32 accessToken, VLLibraryQuestionCategory category, DateTime currentTimeUtc)
        {
            try
            {
                DbCommand command = CreateCommand("valis_libraryquestioncategories_Update");
                AddParameter(command, "@accessToken", accessToken, DbType.Int32);
                AddParameter(command, "@categoryId", category.CategoryId, DbType.Int16);
                AddParameter(command, "@attributeFlags", category.AttributeFlags, DbType.Int32);
                AddParameter(command, "@lastUpdateDT", category.LastUpdateDT, DbType.DateTime);
                AddParameter(command, "@currentTimeUtc", currentTimeUtc, DbType.DateTime);
                AddParameter(command, "@textsLanguage", category.TextsLanguage, DbType.Int16);
                AddParameter(command, "@name", category.Name, DbType.String);

                return(ExecuteAndGetLibraryQuestionCategory(command));
            }
            catch (SqlException ex)
            {
                if (ex.Class == 14 && ex.State == 10)
                {
                    throw new VLInvalidAccessTokenException(SR.GetString(SR.Invalid_accessToken_while_calling_LibrariesDao, "UpdateLibraryQuestionCategoryImpl"), ex);
                }
                else
                {
                    throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryQuestionCategoryImpl"), ex);
                }
            }
            catch (Exception ex)
            {
                throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryQuestionCategoryImpll"), ex);
            }
        }
 internal abstract VLLibraryQuestionCategory CreateLibraryQuestionCategoryImpl(Int32 accessToken, VLLibraryQuestionCategory category, DateTime currentTimeUtc, short textsLanguage);
 internal abstract VLLibraryQuestionCategory UpdateLibraryQuestionCategoryImpl(Int32 accessToken, VLLibraryQuestionCategory category, DateTime currentTimeUtc);
        /// <summary>
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="obj"></param>
        /// <param name="textsLanguage"></param>
        /// <returns></returns>
        public VLLibraryQuestionCategory CreateLibraryQuestionCategory(Int32 accessToken, VLLibraryQuestionCategory obj, short textsLanguage = 0)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            try
            {
                return(CreateLibraryQuestionCategoryImpl(accessToken, obj, Utility.UtcNow(), textsLanguage));
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public VLLibraryQuestionCategory UpdateLibraryQuestionCategory(Int32 accessToken, VLLibraryQuestionCategory obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            try
            {
                return(UpdateLibraryQuestionCategoryImpl(accessToken, obj, Utility.UtcNow()));
            }
            catch
            {
                throw;
            }
        }