public override void Refresh() { if (this._atParameterSet == null) { this.AddNew(); this.action = "insert"; } else { if (this.action == "view") { this._atParameterSet = this._atParameterManager.Get(this._atParameterSet.AtParameterSetId); } } this.spinKuaiJiNianDu.EditValue = this._atParameterSet.AtCurrentlyYear.HasValue ? this._atParameterSet.AtCurrentlyYear.Value : DateTime.Now.Year; this.DateEditAtBeginDate.EditValue = this._atParameterSet.AtBeginDate; this.DateEditAtEndDate.EditValue = this._atParameterSet.AtEndDate; this.nccACMoneySubject.EditValue = this._atParameterSet.ACMoneySubject; this.nccAtOldSunYiSubject.EditValue = this._atParameterSet.AtOldSunYiSubject; this.nccAtSunYiSubject.EditValue = this._atParameterSet.AtSunYiSubject; this.chkIsThisYear.Checked = this._atParameterSet.IsThisYear.HasValue ? this._atParameterSet.IsThisYear.Value : false; base.Refresh(); }
protected override void MovePrev() { Model.AtParameterSet atPara = this._atParameterManager.GetPrev(this._atParameterSet); if (atPara == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._atParameterSet = this._atParameterManager.Get(atPara.AtParameterSetId); }
public void Update(Model.AtParameterSet atParameterSet) { Validate(atParameterSet); if (atParameterSet != null) { if (atParameterSet.IsThisYear.Value) { this.UpdateIsThisYear(atParameterSet.AtParameterSetId); } atParameterSet.UpdateTime = DateTime.Now; accessor.Update(atParameterSet); } }
protected override void Delete() { if (this._atParameterSet == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this._atParameterManager.Delete(this._atParameterSet.AtParameterSetId); this._atParameterSet = this._atParameterManager.GetNext(this._atParameterSet); if (this._atParameterSet == null) { this._atParameterSet = this._atParameterManager.GetLast(); } }
private void TiGuiExists(Model.AtParameterSet model) { if (this.ExistsPrimary(model.AtParameterSetId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); string sequencekey = string.Format(invoiceKind); SequenceManager.Increment(sequencekey_y); SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); SequenceManager.Increment(sequencekey); model.AtParameterSetId = this.GetId(model.InsertTime.Value); TiGuiExists(model); } }
private void Validate(Model.AtParameterSet atParameterSet) { if (string.IsNullOrEmpty(atParameterSet.AtParameterSetId)) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtParameterSetId); } if (string.IsNullOrEmpty(atParameterSet.ACMoneySubjectId)) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_ACMoneySubjectId); } if (!atParameterSet.AtBeginDate.HasValue) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtBeginDate); } if (!atParameterSet.AtCurrentlyYear.HasValue) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtCurrentlyYear); } if (!atParameterSet.AtEndDate.HasValue) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtEndDate); } if (string.IsNullOrEmpty(atParameterSet.AtOldSunYiSubjectId)) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtOldSunYiSubjectId); } if (string.IsNullOrEmpty(atParameterSet.AtSunYiSubjectId)) { throw new Helper.RequireValueException(Model.AtParameterSet.PRO_AtSunYiSubjectId); } IList <Model.AtParameterSet> atplist = this.Select(); foreach (Model.AtParameterSet d in atplist) { if (atParameterSet.AtCurrentlyYear.Value == d.AtCurrentlyYear.Value && atParameterSet.AtParameterSetId != d.AtParameterSetId) { throw new Helper.InvalidValueException(Model.AtParameterSet.PRO_AtCurrentlyYear + "_Exists"); } } }
public void Insert(Model.AtParameterSet atParameterSet) { Validate(atParameterSet); try { BL.V.BeginTransaction(); atParameterSet.InsertTime = DateTime.Now; atParameterSet.UpdateTime = DateTime.Now; TiGuiExists(atParameterSet); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, atParameterSet.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, atParameterSet.InsertTime.Value.Year, atParameterSet.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, atParameterSet.InsertTime.Value.ToString("yyyy-MM-dd")); string sequencekey = string.Format(invoiceKind); SequenceManager.Increment(sequencekey_y); SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); SequenceManager.Increment(sequencekey); if (atParameterSet.IsThisYear.Value) { this.UpdateIsThisYear(atParameterSet.AtParameterSetId); } accessor.Insert(atParameterSet); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public void Insert(Model.AtParameterSet e) { this.Insert <Model.AtParameterSet>(e); }
public Model.AtParameterSet GetNext(Model.AtParameterSet e) { return(accessor.GetNext(e)); }
public Model.AtParameterSet GetPrev(Model.AtParameterSet e) { return(accessor.GetPrev(e)); }
public bool HasRowsAfter(Model.AtParameterSet e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.AtParameterSet e) { return(accessor.HasRowsBefore(e)); }
protected override void MoveLast() { this._atParameterSet = this._atParameterManager.Get(this._atParameterManager.GetLast() == null ? "" : this._atParameterManager.GetLast().AtParameterSetId); }
public void Update(Model.AtParameterSet e) { this.Update <Model.AtParameterSet>(e); }
public bool HasRowsBefore(Model.AtParameterSet e) { return(sqlmapper.QueryForObject <bool>("AtParameterSet.has_rows_before", e)); }
protected override void AddNew() { this._atParameterSet = new Book.Model.AtParameterSet(); this._atParameterSet.AtParameterSetId = this._atParameterManager.GetId(); }
public Model.AtParameterSet GetPrev(Model.AtParameterSet e) { return(sqlmapper.QueryForObject <Model.AtParameterSet>("AtParameterSet.get_prev", e)); }
public Model.AtParameterSet GetNext(Model.AtParameterSet e) { return(sqlmapper.QueryForObject <Model.AtParameterSet>("AtParameterSet.get_next", e)); }
public bool HasRowsAfter(Model.AtParameterSet e) { return(sqlmapper.QueryForObject <bool>("AtParameterSet.has_rows_after", e)); }