예제 #1
0
        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();
                }
        }
예제 #2
0
        public void New(int issuerEntityID, int receiverEntityID, int currencyID)
        {
            using (var ctx = new AccContexts())
                using (var ts = new TransactionScope())
                {
                    var newInvoice = new AccountingLib.Models.invoice()
                    {
                        issuerEntityID   = issuerEntityID,
                        receiverEntityID = receiverEntityID,
                        currencyID       = currencyID
                    };
                    ctx.invoice.AddObject(newInvoice);
                    ctx.SaveChanges();

                    //create invoice Action
                    var invAction = new AccountingLib.Models.invoiceAction()
                    {
                        invoiceID     = newInvoice.ID,
                        invoiceStatID = (int)enums.invoiceStat.Generated
                    };
                    ctx.invoiceAction.AddObject(invAction);
                    ctx.SaveChanges();

                    this.loadInvoiceByInvoiceID(newInvoice.ID);

                    ts.Complete();
                }
        }
예제 #3
0
        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();

            }
        }
예제 #4
0
        public void New(int issuerEntityID,int receiverEntityID, int currencyID)
        {
            using (var ctx = new AccContexts())
            using (var ts = new TransactionScope())
            {
                var newInvoice = new AccountingLib.Models.invoice()
                {
                    issuerEntityID = issuerEntityID,
                    receiverEntityID = receiverEntityID,
                    currencyID=currencyID
                };
                ctx.invoice.AddObject(newInvoice);
                ctx.SaveChanges();

                //create invoice Action
                var invAction = new AccountingLib.Models.invoiceAction()
                {
                    invoiceID = newInvoice.ID,
                    invoiceStatID = (int)enums.invoiceStat.Generated
                };
                ctx.invoiceAction.AddObject(invAction);
                ctx.SaveChanges();

                this.loadInvoiceByInvoiceID(newInvoice.ID);

                ts.Complete();
            }
        }
 /// <summary>
 /// Create a new invoiceAction object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static invoiceAction CreateinvoiceAction(global::System.Int32 id)
 {
     invoiceAction invoiceAction = new invoiceAction();
     invoiceAction.ID = id;
     return invoiceAction;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the invoiceAction EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToinvoiceAction(invoiceAction invoiceAction)
 {
     base.AddObject("invoiceAction", invoiceAction);
 }