public RelationXOForm(string invoiceXOCusId) : this() { this._relationXO = this.manager.SelectByInvoiceXOCusId(invoiceXOCusId); //if (this._relationXO != null) //如果为Null,则提示 this.LastFlag = 1; }
/// <summary> /// Insert a RelationXO. /// </summary> public void Insert(Model.RelationXO relationXO) { // // todo:add other logic here // try { BL.V.BeginTransaction(); relationXO.InsertTime = DateTime.Now; relationXO.UpdateTime = DateTime.Now; accessor.Insert(relationXO); foreach (var item in relationXO.Detail) { detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public void Validate(Model.RelationXO model) { if (model.InvoiceXOId == null) { throw new Helper.InvalidValueException(Model.RelationXO.PRO_RelationXOId); } }
protected override void AddNew() { this._relationXO = new Book.Model.RelationXO(); this._relationXO.RelationXOId = Guid.NewGuid().ToString(); this._relationXO.Employee = BL.V.ActiveOperator.Employee; this.action = "insert"; }
protected override void MoveLast() { if (LastFlag == 1) { LastFlag = 0; return; } this._relationXO = this.manager.GetLast(); }
protected override void MoveNext() { Model.RelationXO p = this.manager.GetNext(this._relationXO); if (p == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._relationXO = p; }
public Model.RelationXO GetDetail(string id) { Model.RelationXO model = this.Get(id); if (model != null) { model.Detail = detailaccessor.SelectByHeaderId(id); } return(model); }
private void btn_Search_Click(object sender, EventArgs e) { SearchForm f = new SearchForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.RelationXO model = this.manager.SelectByInvoiceXOCusId(f.InvoiceCusId); if (model != null) { this._relationXO = model; this.Refresh(); } else { MessageBox.Show("沒有符合條件的項!", this.Text, MessageBoxButtons.OK); } } }
public override void Refresh() { if (this._relationXO == null) { this.AddNew(); } else { if (this.action == "view") { this._relationXO = this.manager.GetDetail(this._relationXO.RelationXOId); } } this.txt_InvoiceXOId.EditValue = this._relationXO.InvoiceXOId; //this.txt_InvoiceCusId.EditValue = this._relationXO.InvoiceCusId; Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(this._relationXO.InvoiceXOId); if (xo != null) { this.txt_InvoiceCusId.EditValue = xo.CustomerInvoiceXOId; } else { this.txt_InvoiceCusId.EditValue = null; } this.nccEmp.EditValue = this._relationXO.Employee; this.bindingSourceDetail.DataSource = this._relationXO.Detail; base.Refresh(); this.txt_InvoiceCusId.Properties.ReadOnly = true; this.txt_InvoiceXOId.Properties.ReadOnly = true; switch (this.action) { case "view": this.gridView1.OptionsBehavior.Editable = false; break; default: this.gridView1.OptionsBehavior.Editable = true; break; } this.btn_Search.Enabled = true; }
protected override void Delete() { if (this._relationXO == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Model.RelationXO model = this.manager.GetNext(this._relationXO); this.manager.Delete(this._relationXO.RelationXOId); if (model == null) { this._relationXO = this.manager.GetLast(); } else { this._relationXO = model; } } }
/// <summary> /// Update a RelationXO. /// </summary> public void Update(Model.RelationXO relationXO) { // // todo: add other logic here. // try { BL.V.BeginTransaction(); relationXO.UpdateTime = DateTime.Now; accessor.Update(relationXO); //刪除詳細 detailaccessor.DeleteByHeaderId(relationXO.RelationXOId); foreach (var item in relationXO.Detail) { detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public bool HasRowsBefore(Model.RelationXO e) { return(accessor.HasRowsBefore(e)); }
public Model.RelationXO GetPrev(Model.RelationXO e) { return(accessor.GetPrev(e)); }
public void Insert(Model.RelationXO e) { this.Insert <Model.RelationXO>(e); }
public Model.RelationXO GetNext(Model.RelationXO e) { return(accessor.GetNext(e)); }
protected override void MoveFirst() { this._relationXO = this.manager.GetFirst(); }
public void Update(Model.RelationXO e) { this.Update <Model.RelationXO>(e); }
public bool HasRowsBefore(Model.RelationXO e) { return(sqlmapper.QueryForObject <bool>("RelationXO.has_rows_before", e)); }
public bool HasRowsAfter(Model.RelationXO e) { return(sqlmapper.QueryForObject <bool>("RelationXO.has_rows_after", e)); }
public Model.RelationXO GetNext(Model.RelationXO e) { return(sqlmapper.QueryForObject <Model.RelationXO>("RelationXO.get_next", e)); }
public bool HasRowsAfter(Model.RelationXO e) { return(accessor.HasRowsAfter(e)); }
public Model.RelationXO GetPrev(Model.RelationXO e) { return(sqlmapper.QueryForObject <Model.RelationXO>("RelationXO.get_prev", e)); }