/// <summary>
 /// Update values in MarcImportBatch. Returns an object of type MarcImportBatch.
 /// </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 MarcImportBatch.</param>
 /// <returns>Object of type MarcImportBatch.</returns>
 public MarcImportBatch MarcImportBatchUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     string connectionKeyName,
     MarcImportBatch value)
 {
     return MarcImportBatchUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName,
         value.MarcImportBatchID,
         value.FileName,
         value.InstitutionCode);
 }
        /// <summary>
        /// Manage MarcImportBatch object.
        /// If the object is of type CustomObjectBase, 
        /// then either insert values into, delete values from, or update values in MarcImportBatch.
        /// </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 MarcImportBatch.</param>
        /// <returns>Object of type CustomDataAccessStatus<MarcImportBatch>.</returns>
        public CustomDataAccessStatus<MarcImportBatch> MarcImportBatchManageAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            MarcImportBatch value)
        {
            if (value.IsNew && !value.IsDeleted)
            {

                MarcImportBatch returnValue = MarcImportBatchInsertAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.FileName,
                        value.InstitutionCode);

                return new CustomDataAccessStatus<MarcImportBatch>(
                    CustomDataAccessContext.Insert,
                    true, returnValue);
            }
            else if (!value.IsNew && value.IsDeleted)
            {
                if (MarcImportBatchDeleteAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.MarcImportBatchID))
                {
                return new CustomDataAccessStatus<MarcImportBatch>(
                    CustomDataAccessContext.Delete,
                    true, value);
                }
                else
                {
                return new CustomDataAccessStatus<MarcImportBatch>(
                    CustomDataAccessContext.Delete,
                    false, value);
                }
            }
            else if (value.IsDirty && !value.IsDeleted)
            {

                MarcImportBatch returnValue = MarcImportBatchUpdateAuto(sqlConnection, sqlTransaction, connectionKeyName,
                    value.MarcImportBatchID,
                        value.FileName,
                        value.InstitutionCode);

                return new CustomDataAccessStatus<MarcImportBatch>(
                    CustomDataAccessContext.Update,
                    true, returnValue);
            }
            else
            {
                return new CustomDataAccessStatus<MarcImportBatch>(
                    CustomDataAccessContext.NA,
                    false, value);
            }
        }
 /// <summary>
 /// Update values in MarcImportBatch. Returns an object of type MarcImportBatch.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type MarcImportBatch.</param>
 /// <returns>Object of type MarcImportBatch.</returns>
 public MarcImportBatch MarcImportBatchUpdateAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     MarcImportBatch value)
 {
     return MarcImportBatchUpdateAuto(sqlConnection, sqlTransaction, "BHL", value );
 }
 /// <summary>
 /// Manage MarcImportBatch object.
 /// If the object is of type CustomObjectBase, 
 /// then either insert values into, delete values from, or update values in MarcImportBatch.
 /// </summary>
 /// <param name="sqlConnection">Sql connection or null.</param>
 /// <param name="sqlTransaction">Sql transaction or null.</param>
 /// <param name="value">Object of type MarcImportBatch.</param>
 /// <returns>Object of type CustomDataAccessStatus<MarcImportBatch>.</returns>
 public CustomDataAccessStatus<MarcImportBatch> MarcImportBatchManageAuto(
     SqlConnection sqlConnection,
     SqlTransaction sqlTransaction,
     MarcImportBatch value)
 {
     return MarcImportBatchManageAuto( sqlConnection, sqlTransaction, "BHL", value  );
 }