/// <summary> /// Select values from MarcSubField by primary key(s). /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="marcSubFieldID"></param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldSelectAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int marcSubFieldID) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcSubFieldSelectAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("MarcSubFieldID", SqlDbType.Int, null, false, marcSubFieldID))) { using (CustomSqlHelper <MarcSubField> helper = new CustomSqlHelper <MarcSubField>()) { CustomGenericList <MarcSubField> list = helper.ExecuteReader(command); if (list.Count > 0) { MarcSubField o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Manage MarcSubField object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type CustomDataAccessStatus<MarcSubField>.</returns> public CustomDataAccessStatus <MarcSubField> MarcSubFieldManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, MarcSubField value) { return(MarcSubFieldManageAuto(sqlConnection, sqlTransaction, "BHL", value)); }
/// <summary> /// Update values in MarcSubField. Returns an object of type MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, MarcSubField value) { return(MarcSubFieldUpdateAuto(sqlConnection, sqlTransaction, "BHL", value)); }
/// <summary> /// Update values in MarcSubField. Returns an object of type MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="marcSubFieldID"></param> /// <param name="marcDataFieldID"></param> /// <param name="code"></param> /// <param name="value"></param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, int marcSubFieldID, int marcDataFieldID, string code, string value) { SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection); SqlTransaction transaction = sqlTransaction; using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcSubFieldUpdateAuto", connection, transaction, CustomSqlHelper.CreateInputParameter("MarcSubFieldID", SqlDbType.Int, null, false, marcSubFieldID), CustomSqlHelper.CreateInputParameter("MarcDataFieldID", SqlDbType.Int, null, false, marcDataFieldID), CustomSqlHelper.CreateInputParameter("Code", SqlDbType.NChar, 1, false, code), CustomSqlHelper.CreateInputParameter("Value", SqlDbType.NVarChar, 200, false, value), CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false))) { using (CustomSqlHelper <MarcSubField> helper = new CustomSqlHelper <MarcSubField>()) { CustomGenericList <MarcSubField> list = helper.ExecuteReader(command); if (list.Count > 0) { MarcSubField o = list[0]; list = null; return(o); } else { return(null); } } } }
/// <summary> /// Insert values into MarcSubField. Returns an object of type MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldInsertAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, MarcSubField value) { return(MarcSubFieldInsertAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcDataFieldID, value.Code, value.Value)); }
/// <summary> /// Manage MarcSubField object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type CustomDataAccessStatus<MarcSubField>.</returns> public CustomDataAccessStatus <MarcSubField> MarcSubFieldManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, MarcSubField value) { if (value.IsNew && !value.IsDeleted) { MarcSubField returnValue = MarcSubFieldInsertAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcDataFieldID, value.Code, value.Value); return(new CustomDataAccessStatus <MarcSubField>( CustomDataAccessContext.Insert, true, returnValue)); } else if (!value.IsNew && value.IsDeleted) { if (MarcSubFieldDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcSubFieldID)) { return(new CustomDataAccessStatus <MarcSubField>( CustomDataAccessContext.Delete, true, value)); } else { return(new CustomDataAccessStatus <MarcSubField>( CustomDataAccessContext.Delete, false, value)); } } else if (value.IsDirty && !value.IsDeleted) { MarcSubField returnValue = MarcSubFieldUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcSubFieldID, value.MarcDataFieldID, value.Code, value.Value); return(new CustomDataAccessStatus <MarcSubField>( CustomDataAccessContext.Update, true, returnValue)); } else { return(new CustomDataAccessStatus <MarcSubField>( CustomDataAccessContext.NA, false, value)); } }
/// <summary> /// Update values in MarcSubField. Returns an object of type MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, MarcSubField value) { return MarcSubFieldUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcSubFieldID, value.MarcDataFieldID, value.Code, value.Value); }
/// <summary> /// Update values in MarcSubField. Returns an object of type MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type MarcSubField.</returns> public MarcSubField MarcSubFieldUpdateAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, MarcSubField value) { return MarcSubFieldUpdateAuto(sqlConnection, sqlTransaction, "BHL", value ); }
/// <summary> /// Manage MarcSubField object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="connectionKeyName">Connection key name located in config file.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type CustomDataAccessStatus<MarcSubField>.</returns> public CustomDataAccessStatus<MarcSubField> MarcSubFieldManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, string connectionKeyName, MarcSubField value) { if (value.IsNew && !value.IsDeleted) { MarcSubField returnValue = MarcSubFieldInsertAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcDataFieldID, value.Code, value.Value); return new CustomDataAccessStatus<MarcSubField>( CustomDataAccessContext.Insert, true, returnValue); } else if (!value.IsNew && value.IsDeleted) { if (MarcSubFieldDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcSubFieldID)) { return new CustomDataAccessStatus<MarcSubField>( CustomDataAccessContext.Delete, true, value); } else { return new CustomDataAccessStatus<MarcSubField>( CustomDataAccessContext.Delete, false, value); } } else if (value.IsDirty && !value.IsDeleted) { MarcSubField returnValue = MarcSubFieldUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName, value.MarcSubFieldID, value.MarcDataFieldID, value.Code, value.Value); return new CustomDataAccessStatus<MarcSubField>( CustomDataAccessContext.Update, true, returnValue); } else { return new CustomDataAccessStatus<MarcSubField>( CustomDataAccessContext.NA, false, value); } }
/// <summary> /// Manage MarcSubField object. /// If the object is of type CustomObjectBase, /// then either insert values into, delete values from, or update values in MarcSubField. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <param name="value">Object of type MarcSubField.</param> /// <returns>Object of type CustomDataAccessStatus<MarcSubField>.</returns> public CustomDataAccessStatus<MarcSubField> MarcSubFieldManageAuto( SqlConnection sqlConnection, SqlTransaction sqlTransaction, MarcSubField value) { return MarcSubFieldManageAuto( sqlConnection, sqlTransaction, "BHL", value ); }