Exemplo n.º 1
0
        /// <summary>
        /// update InvoiceDetail ( asume that same number of item
        /// avialable after updating InvoiceDetail )
        /// </summary>
        /// <param name="invoiceDetail"></param>
        internal void UpdateInvoiceDetail(InvoiceDetail invoiceDetail, IStcokUpdate _IStcokUpdate)
        {
            // change the stock before update because these current object
            // invoice item affected to stock
            _IStcokUpdate.UpdateStock(SouceDocType.INVREMOVE, this.ProductId, this.Quantity);

            this.ProductId    = invoiceDetail.ProductId;
            this.UnitOfMesure = invoiceDetail.UnitOfMesure;
            this.Quantity     = invoiceDetail.Quantity;
            this.UnitPrice    = invoiceDetail.UnitPrice;

            //chages made to after update
            _IStcokUpdate.UpdateStock(SouceDocType.INVOICE, this.ProductId, this.Quantity);
        }
Exemplo n.º 2
0
 /// <summary>
 /// update  invoiceHeder and then  delegate to  invoiceDetails and
 /// update stock in invoiceDetails
 /// </summary>
 /// <param name="invoiceheader"></param>
 public void UpdateInvoiceHeader(InvoiceHeader invoiceheader, IStcokUpdate _IStcokUpdate)
 {
     // update invoiceHeder information
     this.CustomerId  = invoiceheader.CustomerId;
     this.InvoiceDate = invoiceheader.InvoiceDate;
     //then move to invoiceDetails
     using (var currentInvoiceDetails = InvoiceDetials.GetEnumerator())
         using (var invoiceDetails = invoiceheader.InvoiceDetials.GetEnumerator())
         {
             // making sure that number of object in both invoiceDetails is same
             while (currentInvoiceDetails.MoveNext() && invoiceDetails.MoveNext())
             {
                 // call UpdateInvoiceDetail of invoiceDetails
                 currentInvoiceDetails.Current.
                 UpdateInvoiceDetail(invoiceDetails.Current, _IStcokUpdate);
             }
         }
     Console.WriteLine("\nInovice {0} is updated\n", invoiceheader.InvoiceNumber);
 }
Exemplo n.º 3
0
 /// <summary>
 /// constructor which tack IList<InvoiceHeder>
 /// </summary>
 /// <param name="invoiceHader"></param>
 public InvoiceService(IStcokUpdate StcokUpdate)
 {
     this._invoiceHader = new List <InvoiceHeader>();
     this._IStkUpdate   = StcokUpdate;
 }