protected VLLibraryOption ExecuteAndGetLibraryOption(DbCommand cmd) { VLLibraryOption _retObject = null; try { cmd.Connection.Open(); using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows == false) { return(null); } reader.Read(); _retObject = new VLLibraryOption(reader); } } finally { cmd.Connection.Close(); } return(_retObject); }
internal override VLLibraryOption UpdateLibraryOptionImpl(Int32 accessToken, VLLibraryOption option, DateTime currentTimeUtc) { try { DbCommand command = CreateCommand("valis_libraryoptions_Update"); AddParameter(command, "@accessToken", accessToken, DbType.Int32); AddParameter(command, "@question", option.Question, DbType.Int32); AddParameter(command, "@optionId", option.OptionId, DbType.Byte); AddParameter(command, "@optionType", option.OptionType, DbType.Byte); AddParameter(command, "@displayOrder", option.DisplayOrder, DbType.Int16); AddParameter(command, "@optionValue", option.OptionValue, DbType.Int16); AddParameter(command, "@attributeFlags", option.AttributeFlags, DbType.Int32); AddParameter(command, "@currentTimeUtc", currentTimeUtc, DbType.DateTime); AddParameter(command, "@textsLanguage", option.TextsLanguage, DbType.Int16); AddParameter(command, "@optionText", option.OptionText, DbType.String); return(ExecuteAndGetLibraryOption(command)); } catch (SqlException ex) { if (ex.Class == 14 && ex.State == 10) { throw new VLInvalidAccessTokenException(SR.GetString(SR.Invalid_accessToken_while_calling_LibrariesDao, "UpdateLibraryOptionImpl"), ex); } else { throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryOptionImpl"), ex); } } catch (Exception ex) { throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryOptionImpll"), ex); } }
/// <summary> /// /// </summary> /// <param name="accessToken"></param> /// <param name="obj"></param> /// <param name="textsLanguage"></param> /// <returns></returns> public VLLibraryOption CreateLibraryOption(Int32 accessToken, VLLibraryOption option, short textsLanguage) { if (option == null) { throw new ArgumentNullException("option"); } try { return(CreateLibraryOptionImpl(accessToken, option, Utility.UtcNow(), textsLanguage)); } catch { throw; } }
/// <summary> /// /// </summary> /// <param name="accessToken"></param> /// <param name="option"></param> /// <returns></returns> public VLLibraryOption UpdateLibraryOption(Int32 accessToken, VLLibraryOption option) { if (option == null) { throw new ArgumentNullException("option"); } try { return(UpdateLibraryOptionImpl(accessToken, option, Utility.UtcNow())); } catch { throw; } }
protected Collection <VLLibraryOption> ExecuteAndGetLibraryOptions(DbCommand cmd) { var collection = new Collection <VLLibraryOption>(); try { cmd.Connection.Open(); using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var _object = new VLLibraryOption(reader); collection.Add(_object); } } } finally { cmd.Connection.Close(); } return(collection); }
internal abstract VLLibraryOption CreateLibraryOptionImpl(Int32 accessToken, VLLibraryOption option, DateTime currentTimeUtc, short textsLanguage);
internal abstract VLLibraryOption UpdateLibraryOptionImpl(Int32 accessToken, VLLibraryOption option, DateTime currentTimeUtc);