private void RecordInvoiceTransaction(List <int> transactions, enums.invoiceStat invoiceStat) { using (var ctx = new AccContexts()) using (var ts = new TransactionScope()) { //create invoice Action var invAction = new AccountingLib.Models.invoiceAction() { invoiceID = this.invoiceID, invoiceStatID = (int)invoiceStat }; ctx.invoiceAction.AddObject(invAction); ctx.SaveChanges(); //create invoice Transactions and invoice action Transactions foreach (var item in transactions) { var invActionTrans = new AccountingLib.Models.invoiceActionTransaction() { invoiceActionID = invAction.ID, transactionID = item }; ctx.invoiceActionTransaction.AddObject(invActionTrans); ctx.SaveChanges(); } ts.Complete(); } }
/// <summary> /// Create a new invoiceActionTransaction object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static invoiceActionTransaction CreateinvoiceActionTransaction(global::System.Int32 id) { invoiceActionTransaction invoiceActionTransaction = new invoiceActionTransaction(); invoiceActionTransaction.ID = id; return invoiceActionTransaction; }
private void RecordInvoiceTransaction(List<int> transactions, enums.invoiceStat invoiceStat) { using (var ctx = new AccContexts()) using (var ts = new TransactionScope()) { //create invoice Action var invAction = new AccountingLib.Models.invoiceAction() { invoiceID = this.invoiceID, invoiceStatID = (int)invoiceStat }; ctx.invoiceAction.AddObject(invAction); ctx.SaveChanges(); //create invoice Transactions and invoice action Transactions foreach (var item in transactions) { var invActionTrans = new AccountingLib.Models.invoiceActionTransaction() { invoiceActionID = invAction.ID, transactionID = item }; ctx.invoiceActionTransaction.AddObject(invActionTrans); ctx.SaveChanges(); } ts.Complete(); } }
/// <summary> /// Deprecated Method for adding a new object to the invoiceActionTransaction EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToinvoiceActionTransaction(invoiceActionTransaction invoiceActionTransaction) { base.AddObject("invoiceActionTransaction", invoiceActionTransaction); }