public void Delete(string id) { #region 编号递减 Model.InvoiceCG model = this.Get(id); string invoiceKind = "CG".ToLower(); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); Model.Sequence sequence = new SequenceAccessor().Get(sequencekey_d); if (sequence != null) { sequence.Val--; new SequenceAccessor().Update(sequence); } #endregion this.Delete <Model.InvoiceCG>(id); }
public void Delete(string id) { #region 编号递减 Model.InvoiceLH model = this.Get(id); string invoiceKind = "LH".ToLower(); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InvoiceDate.Value.Year, model.InvoiceDate.Value.Month); Model.Sequence sequence = new SequenceAccessor().Get(sequencekey_m); if (sequence != null) { if (Convert.ToInt32(id.Substring(4)) >= sequence.Val) { sequence.Val--; sequence.Val = sequence.Val < 0 ? 0 : sequence.Val; new SequenceAccessor().Update(sequence); } } #endregion this.Delete <Model.InvoiceLH>(id); }