Example #1
0
 private static void AddParameters(InvoiceItem invoiceItem, SqlCommand comm)
 {
     comm.Parameters.AddWithValue("ClientSessionID", invoiceItem.ClientSessionID);
     comm.Parameters.AddWithValue("InvoiceID", invoiceItem.InvoiceID);
 }
Example #2
0
 public static InvoiceItem ReadInvoiceItem(SqlDataReader reader)
 {
     InvoiceItem invoiceItem = new InvoiceItem();
     invoiceItem.clientSession = ClientSession.ReadClientSession(reader);
     invoiceItem.invoice = Invoice.ReadInvoice(reader);
     return invoiceItem;
 }
Example #3
0
        public static int RemoveInvoiceItem(InvoiceItem oldInvoiceItem)
        {
            int rowsAffected = 0;

            // Setup Connection
            using (DatabaseConnection db = new DatabaseConnection("dbo.RemoveInvoiceItem"))
            {
                // Set Parameters
                AddOldParameters(oldInvoiceItem, db.comm);

                // Open Connection
                db.conn.Open();

                // Execute Command and Read Response
                rowsAffected = db.comm.ExecuteNonQuery();
            }

            return rowsAffected;
        }
Example #4
0
        public static int AddInvoiceItem(InvoiceItem invoiceItem)
        {
            int invoiceItemID = -1;

            // Setup Connection
            using (DatabaseConnection db = new DatabaseConnection("dbo.AddInvoiceItem"))
            {
                // Set Parameters
                AddParameters(invoiceItem, db.comm);

                // Open Connection
                db.conn.Open();

                // Execute Command and Read Response
                invoiceItemID = Convert.ToInt32(db.comm.ExecuteScalar());
            }

            return invoiceItemID;
        }