public IList <Book.Model.InvoiceJCDetail> Select(Book.Model.InvoiceHR invoice) { Hashtable table = new Hashtable(); table.Add("invoiceid", invoice.InvoiceId); table.Add("companyid", invoice.CustomerId); return(sqlmapper.QueryForList <Model.InvoiceJCDetail>("InvoiceJCDetail.select_by_companyid_update", table)); }
private void _Insert(Book.Model.InvoiceHR invoice) { //往来单位 if (invoice.Customer != null) { invoice.CustomerId = invoice.Customer.CustomerId; } //经手人 if (invoice.Employee0 != null) { invoice.Employee0Id = invoice.Employee0.EmployeeId; } //录单人 if (invoice.Employee1 != null) { invoice.Employee1Id = invoice.Employee1.EmployeeId; } if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal) { //过账人 if (invoice.Employee2 != null) { invoice.Employee2Id = invoice.Employee2.EmployeeId; } //过账时间 invoice.InvoiceGZTime = DateTime.Now; } //插入表单 accessor.Insert(invoice); //插入明细 foreach (Model.InvoiceHRDetail detail in invoice.Details) { Model.InvoiceJCDetail odetail = invoiceJCDetailAccessor.Get(detail.InvoiceJCDetailId); if (detail.InvoiceHRDetailQuantity > 0) { if (detail.InvoiceHRDetailQuantity <= odetail.InvoiceWeiHuaiRuQuantity) { detail.InvoiceId = invoice.InvoiceId; invoiceHRDetailAccessor.Insert(detail); Model.Product p = detail.Product; p.StocksQuantity += detail.InvoiceHRDetailQuantity; productAccessor.Update(detail.Product); stockAccessor.IncrementJR(new DepotPositionManager().Get(detail.DepotPositionId), p, detail.InvoiceHRDetailQuantity.Value); if (odetail != null) { odetail.InvoiceYiHuaiRuQuantity += detail.InvoiceHRDetailQuantity; odetail.InvoiceWeiHuaiRuQuantity -= detail.InvoiceHRDetailQuantity; invoiceJCDetailAccessor.Update(odetail); } } else { throw new Helper.InvalidValueException("HaiRuTaiDuo"); } } } }
public void Delete(Book.Model.InvoiceHR invoice) { sqlmapper.Delete("InvoiceHRDetail.delete_by_invoiceid", invoice.InvoiceId); }
public IList <Book.Model.InvoiceHRDetail> Select(Book.Model.InvoiceHR invoice) { return(sqlmapper.QueryForList <Model.InvoiceHRDetail>("InvoiceHRDetail.select_by_invoiceid", invoice.InvoiceId)); }