/// <summary> /// Adds the album's details to the database /// </summary> /// <param name="customerAlbum">CustomerAlbum object being added to the database</param> /// <returns>New unique identifier for the CustomerAlbum, generated by the database</returns> public static Int16 AddCustomerAlbum(Business.CustomerAlbum customerAlbum) { try { return((Int16)Control.ExecuteScalar("AddCustomerAlbum", customerAlbum.GetParametersForStoredProcedure(false))); } catch (System.Exception e) { throw new Exception.AddDbObjectException("Could not add customer album", e); } }
/// <summary> /// Updates the album's details in the database /// </summary> /// <param name="customerAlbum">CustomerAlbum object being updated in the database</param> public static void UpdateCustomerAlbum(Business.CustomerAlbum customerAlbum) { try { Control.ExecuteNonQuery("UpdateCustomerAlbum", customerAlbum.GetParametersForStoredProcedure(true)); } catch (System.Exception e) { throw new Exception.UpdateDbObjectException("Could not update customer album", e); } }
/// <summary> /// Creates a new Business.CustomerAlbum object from the data in the DataTableReader /// </summary> /// <param name="dtr">DataTableReader containing the CustomerAlbum's data</param> /// <returns>Business.CustomerAlbum object</returns> private static Business.CustomerAlbum GetCustomerAlbumFromDataTableReader(DataTableReader dtr) { Business.CustomerAlbum customerAlbum = new Business.CustomerAlbum(); customerAlbum.Id = (Int16)dtr["Id"]; customerAlbum.customerId = (Guid)dtr["CustomerId"]; customerAlbum.Name = (String)dtr["Name"]; customerAlbum.Description = (String)dtr["Description"]; customerAlbum.Images = GetCustomerImagesByCustomerAlbumId(customerAlbum.Id, customerAlbum.customerId); customerAlbum.DateCreated = (DateTime)dtr["DateCreated"]; customerAlbum.IsInDatabase = true; return(customerAlbum); }