public void InsertUpdate(Model.Invoice invoice) { DA.IInvoiceAccessor accessor = this.GetAccessor(); if (accessor != null) { MethodInfo methodInfo = accessor.GetType().GetMethod("HasRows", new Type[] { typeof(string) }); bool hasRows = (bool)methodInfo.Invoke(accessor, new object[] { invoice.InvoiceId }); if (hasRows && invoice.InsertTime != null) { this.Update(invoice); } else { this.Insert(invoice); } } }
public virtual void Delete(string invoiceId) { try { DA.IInvoiceAccessor accessor = this.GetAccessor(); MethodInfo methodInfo = accessor.GetType().GetMethod("Delete", new Type[] { typeof(string) }); if (methodInfo != null) { //if (accessor == Book.DA.IInvoiceZSAccessor) //{ //invoiceZSDetailAccessor.Delete(invoice); //} methodInfo.Invoke(accessor, new object[] { invoiceId }); } } catch { V.RollbackTransaction(); throw new Helper.InvalidValueException("DeleteError"); } }