Beispiel #1
0
 /// <summary>
 /// The Add method is used to insert the received object into the corresponding database table. It uses the
 /// AddParameters method to covert the object attributes into a dictionary, which is then passed
 /// into the DataSQL helper method along with the insert sql statement.
 /// </summary>
 /// <param name="customer">The customer object.</param>
 /// <returns>The inserted record's primary key.</returns>
 public static int Add(Customer customer)
 {
     // Converts the instance data to a dictionary, and passes both the sql statement & the dictionary
     // as arguments to the generic ScalarQuery helper method. It will return a int being the newly inserted
     // primary key.
     return(DataSQL <Customer> .ScalarQuery(SQL_INSERT, AddParameters(customer)));
 }
Beispiel #2
0
        /// <summary>
        /// The Count method is used to count the amount of transaction items that have been
        /// added to a specific transaction based on the transaction type (either being rental or sale).
        /// </summary>
        /// <param name="transactionID">The transaction's primary key.</param>
        /// <param name="TransactionType">The transaction type.</param>
        /// <returns>The count of items relating to a transaction & type.</returns>
        public static int Count(int transactionID, TransactionItem.TransactionType type)
        {
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@TransactionID", transactionID);
            parameters.Add("@Type", (int)type);
            return(DataSQL <Transaction> .ScalarQuery(SQL_COUNT, parameters));
        }
Beispiel #3
0
 /// <summary>
 /// The Add method is used to insert the received object into the corresponding database table. It uses the
 /// AddParameters method to covert the object attributes into a dictionary, which is then passed
 /// into the DataSQL helper method along with the insert sql statement.
 /// </summary>
 /// <param name="dvd">The dvd object.</param>
 /// <returns>The inserted record's primary key.</returns>
 public static int Add(DVD dvd)
 {
     return(DataSQL <DVD> .ScalarQuery(SQL_INSERT, AddParameters(dvd)));
 }
Beispiel #4
0
 /// <summary>
 /// The Add method is used to insert the received object into the corresponding database table. It uses the
 /// AddParameters method to covert the object attributes into a dictionary, which is then passed
 /// into the DataSQL helper method along with the insert sql statement.
 /// </summary>
 /// <param name="transaction">The transaction object.</param>
 /// <returns>The inserted record's primary key.</returns>
 public static int Add(Transaction transaction)
 {
     return(DataSQL <Transaction> .ScalarQuery(SQL_INSERT, AddParameters(transaction)));
 }