public void AddUpdatePurchaseInvoiceDetail(PurchaseInvoiceDetail purchaseinvoicedetail) { PurchaseInvoiceDetailData data = new PurchaseInvoiceDetailData(); try { data.AddUpdatePurchaseInvoiceDetail(purchaseinvoicedetail); // this.PurchaseOrderStatusChanged += new OrderEventsHandler(PurchaseInvoiceDetail_OrderStatusChanged); PurchaseInvoiceHeader head = new PurchaseInvoiceHeader(); PurchaseInvoiceHeaderCollection col = new PurchaseInvoiceHeaderCollection(); head = head.GetPurchaseInvoiceHeader(purchaseinvoicedetail.InvoiceID); /*this.OrderStatusChanged += new OrderEventsHandler(PurchaseInvoiceHeader_OrderStatusChanged);*/ // if (head.Status == (byte)OrderStatus.Received) // { // OnPurchaseOrderStatusChanged(purchaseinvoicedetail.ProductID, purchaseinvoicedetail.Quantity); // } UpdateInvoiceTotal(purchaseinvoicedetail.InvoiceID); } catch (Exception ex) { log.Write(ex.Message, "AddUpdatePurchaseInvoiceDetail"); throw (ex); } finally { data = null; } }
private void UpdateInvoiceTotal(int invoiceDetailID, bool flag) { PurchaseInvoiceHeader pih = new PurchaseInvoiceHeader(); PurchaseInvoiceDetail pid = new PurchaseInvoiceDetail(); PurchaseInvoiceDetailCollection pidColl = new PurchaseInvoiceDetailCollection(); try { pid = pid.GetPurchaseInvoiceDetails(invoiceDetailID); int invoiceID = pid.InvoiceID; string where = "invoiceID = " + invoiceID; string orderby = String.Empty; pidColl = pid.GetPurchaseInvoiceDetailsCollection(where, orderby); decimal total = 0.00m; foreach (PurchaseInvoiceDetail p in pidColl) { total += (decimal)(p.UnitPrice * p.Quantity); } pih = pih.GetPurchaseInvoiceHeader(invoiceID); pih.TotalDue = total; pih.UpdatePurchaseInvoiceHeader(pih); } catch (Exception ex) { log.Write(ex.Message, "UpdateInvoiceTotal"); throw (ex); } finally { pih = null; pid = null; pidColl = null; } }
public PurchaseInvoiceHeader GetPurchaseInvoiceHeader(int purchaseInvoiceHeaderID) { PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData(); PurchaseInvoiceHeader pih = new PurchaseInvoiceHeader(); try { pih = data.GetPurchaseInvoiceHeader(purchaseInvoiceHeaderID); } catch (Exception ex) { log.Write(ex.Message, "GetPurchaseInvoiceHeader"); throw (ex); } finally { data = null; } return(pih); }
public int AddPurchaseInvoiceHeader(PurchaseInvoiceHeader purchaseinvoiceheader) { PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData(); int purchaseInoviceHeaderID = 0; try { purchaseInoviceHeaderID = data.AddPurchaseInvoiceHeader(purchaseinvoiceheader); } catch (Exception ex) { log.Write(ex.Message, "AddPurchaseInvoiceHeader"); throw (ex); } finally { data = null; } return(purchaseInoviceHeaderID); }
public bool UpdatePurchaseInvoiceHeader(PurchaseInvoiceHeader purchaseinvoiceheader) { PurchaseInvoiceHeaderData data = new PurchaseInvoiceHeaderData(); bool ret = false; try { ret = data.UpdatePurchaseInvoiceHeader(purchaseinvoiceheader); } catch (Exception ex) { log.Write(ex.Message, "UpdatePurchaseInvoiceHeader"); throw (ex); } finally { data = null; } return(ret); }
public bool Contains(PurchaseInvoiceHeader purchaseInvoiceHeader) { return(this.List.Contains(purchaseInvoiceHeader)); }
public void Remove(PurchaseInvoiceHeader purchaseInvoiceHeader) { this.List.Remove(purchaseInvoiceHeader); }
public void Insert(int index, PurchaseInvoiceHeader purchaseInvoiceHeader) { this.List.Insert(index, purchaseInvoiceHeader); }
public int IndexOf(PurchaseInvoiceHeader purchaseInvoiceHeader) { return(this.List.IndexOf(purchaseInvoiceHeader)); }
public int Add(PurchaseInvoiceHeader purchaseInvoiceHeader) { return(this.List.Add(purchaseInvoiceHeader)); }