Пример #1
0
        public Invoice issueInvoice(int receiverEntityID, int currencyID, Dictionary<deliverable, decimal> servicesAmt)
        {
            var invoiceData=new invoice{};
            var inv = new Invoice();
            inv.New(invoiceData);

            foreach (var item in servicesAmt)
                inv.addInvoiceOrderDetail((item.Key as deliverable));

            inv.finalizeInvoice();

            return inv;
        }
Пример #2
0
        public void New(invoice inv)
        {
            INV = inv;

            using (var ctx = new accountingEntities())
            using (var ts = new TransactionScope())
            {
                //Entity
                var e = new entity{entityTypeID = (int)projectEnums.entityType.invoice};
                ctx.entities.AddObject(e);

                //New Invoice
                var newInvoice = new invoice()
                {
                    currencyID = inv.currencyID,
                    ID=e.ID
                };

                //sys Action
                var sysaction = new sysAction{sysActionTypeID=(int)projectEnums.sysAction.invoice};
                ctx.sysActions.AddObject(sysaction);

                //sys Action Invoice
                var sysActionInvoice = new invoiceAction
                {
                    ID = sysaction.ID,
                    invoiceStatusID= (int)projectEnums.invoiceStatus.Generated,
                    name="Invoice Generated at "+DateTime.Now.ToLongTimeString()
                };
                ctx.invoiceActions.AddObject(sysActionInvoice);

                ctx.SaveChanges();
                ts.Complete();
            }
        }
 /// <summary>
 /// Create a new invoice object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static invoice Createinvoice(global::System.Int32 id)
 {
     invoice invoice = new invoice();
     invoice.ID = id;
     return invoice;
 }
Пример #4
0
 public void Load(int invoiceID)
 {
     using (var ctx = new accountingEntities())
     {
         INV = ctx.invoices.Where(x => x.ID.Equals(invoiceID)).FirstOrDefault();
         if (INV == null)
             throw new Exception("Invoice does not exists");
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the invoices EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToinvoices(invoice invoice)
 {
     base.AddObject("invoices", invoice);
 }