public void Validate(Model.PCEarplugsStayWireCheck model) { if (model.PCEarplugsStayWireCheckDate == null) { throw new Helper.InvalidValueException(Model.PCEarplugsStayWireCheck.PRO_PCEarplugsStayWireCheckDate); } }
/// <summary> /// Update a PCEarplugsStayWireCheck. /// </summary> public void Update(Model.PCEarplugsStayWireCheck pCEarplugsStayWireCheck) { // // todo: add other logic here. // try { BL.V.BeginTransaction(); Validate(pCEarplugsStayWireCheck); pCEarplugsStayWireCheck.UpdateTime = DateTime.Now; accessor.Update(pCEarplugsStayWireCheck); accessorDetail.DeleteByHeaderId(pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId); foreach (var item in pCEarplugsStayWireCheck.Details) { item.PCEarplugsStayWireCheckId = pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId; accessorDetail.Insert(item); } BL.V.CommitTransaction(); } catch (Exception ex) { BL.V.RollbackTransaction(); throw ex; } }
public ROStayWire(Model.PCEarplugsStayWireCheck pCEarplugsStayWireCheck) { InitializeComponent(); this.DataSource = pCEarplugsStayWireCheck.Details; this.TCParameter.Text = pCEarplugsStayWireCheck.TestCondition; this.lbl_CompanyName.Text = BL.Settings.CompanyChineseName; this.lbl_ReportDate.Text += DateTime.Now.ToString("yyyy-MM-dd"); this.lbl_Note.Text = pCEarplugsStayWireCheck.Note; this.lbl_Employee.Text = pCEarplugsStayWireCheck.Employee == null ? "" : pCEarplugsStayWireCheck.Employee.ToString(); this.TCDate.DataBindings.Add("Text", this.DataSource, "pCEarplugsStayWireCheck." + Model.PCEarplugsStayWireCheck.PRO_PCEarplugsStayWireCheckDate, "{0:yyyy-MM-dd}"); this.TCFromId.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_FromId); this.TCCusXOId.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerInvoiceXOId); this.TCInvoiceQuantity.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_InvoiceXOQuantity); this.TCProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); this.TCProductUnit.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_ProductUnit); this.TCCheckedStandard.DataBindings.Add("Text", this.DataSource, "InvoiceXO.xocustomer." + Model.Customer.PRO_CheckedStandard); this.TCTestQuantity.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_TestQuantity); this.TCWaiguan.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_Waiguan); this.TCDuise.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_Duise); this.TCFama.DataBindings.Add("Text", this.DataSource, Model.PCEarplugsStayWireCheckDetail.PRO_Fama); }
protected override void MoveLast() { if (this.LastFlag == 1) { this.LastFlag = 0; return; } this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetLast(); }
public Model.PCEarplugsStayWireCheck GetDetail(string pCEarplugsStayWireCheckId) { Model.PCEarplugsStayWireCheck model = this.Get(pCEarplugsStayWireCheckId); if (model != null) { model.Details = accessorDetail.SelectByHeaderId(pCEarplugsStayWireCheckId); } return(model); }
protected override void MovePrev() { Model.PCEarplugsStayWireCheck PCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetPrev(this._pCEarplugsStayWireCheck); if (PCEarplugsStayWireCheck == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._pCEarplugsStayWireCheck = PCEarplugsStayWireCheck; }
int LastFlag = 0; //页面载 入时是否执行 last方法 public EditFormStayWire(string pCEarplugsStayWireCheckId) : this() { this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.Get(pCEarplugsStayWireCheckId); if (this._pCEarplugsStayWireCheck == null) { throw new ArithmeticException("PCEarplugsStayWireCheckId"); } this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
public EditFormStayWire(Model.PCEarplugsStayWireCheck pCEarplugsStayWireCheck) : this() { if (pCEarplugsStayWireCheck == null) { throw new ArithmeticException("PCEarplugsStayWireCheckId"); } this._pCEarplugsStayWireCheck = pCEarplugsStayWireCheck; this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
protected override void AddNew() { this._pCEarplugsStayWireCheck = new Book.Model.PCEarplugsStayWireCheck(); this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId = this._pCEarplugsStayWireCheckManager.GetId(); this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckDate = DateTime.Now; this._pCEarplugsStayWireCheck.Employee = BL.V.ActiveOperator.Employee; this._pCEarplugsStayWireCheck.EmployeeId = BL.V.ActiveOperator.EmployeeId; if (this.cob_TestCondition.Properties.Items.Count > 0) { this._pCEarplugsStayWireCheck.TestCondition = this.cob_TestCondition.Properties.Items[0].ToString(); } this.action = "insert"; }
protected override void Delete() { if (this._pCEarplugsStayWireCheck == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this._pCEarplugsStayWireCheckManager.Delete(this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId); this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetNext(this._pCEarplugsStayWireCheck); if (this._pCEarplugsStayWireCheck == null) { this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetLast(); } }
private void TiGuiExists(Model.PCEarplugsStayWireCheck model) { if (this.ExistsPrimary(model.PCEarplugsStayWireCheckId)) { //设置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.PCEarplugsStayWireCheckId = this.GetId(model.InsertTime.Value); TiGuiExists(model); } }
/// <summary> /// Insert a PCEarplugsStayWireCheck. /// </summary> public void Insert(Model.PCEarplugsStayWireCheck pCEarplugsStayWireCheck) { // // todo:add other logic here // try { BL.V.BeginTransaction(); pCEarplugsStayWireCheck.InsertTime = DateTime.Now; pCEarplugsStayWireCheck.UpdateTime = DateTime.Now; Validate(pCEarplugsStayWireCheck); this.TiGuiExists(pCEarplugsStayWireCheck); accessor.Insert(pCEarplugsStayWireCheck); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCEarplugsStayWireCheck.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCEarplugsStayWireCheck.InsertTime.Value.Year, pCEarplugsStayWireCheck.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCEarplugsStayWireCheck.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); foreach (var item in pCEarplugsStayWireCheck.Details) { item.PCEarplugsStayWireCheckId = pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId; accessorDetail.Insert(item); } BL.V.CommitTransaction(); } catch (Exception ex) { BL.V.RollbackTransaction(); throw ex; } }
public override void Refresh() { if (this._pCEarplugsStayWireCheck == null) { this.AddNew(); } else { if (this.action == "view") { this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetDetail(this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId); } } this.txt_Id.EditValue = this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckId; this.date_Check.EditValue = this._pCEarplugsStayWireCheck.PCEarplugsStayWireCheckDate; this.ncc_Employee.EditValue = this._pCEarplugsStayWireCheck.Employee; this.cob_TestCondition.Text = this._pCEarplugsStayWireCheck.TestCondition; this.txt_Note.EditValue = this._pCEarplugsStayWireCheck.Note; this.bindingSourceDetail.DataSource = this._pCEarplugsStayWireCheck.Details; base.Refresh(); switch (this.action) { case "view": this.gridView1.OptionsBehavior.Editable = false; break; default: this.gridView1.OptionsBehavior.Editable = true; break; } this.txt_Id.Properties.ReadOnly = true; this.colParameter.Caption = this._pCEarplugsStayWireCheck.TestCondition; }
public bool HasRowsBefore(Model.PCEarplugsStayWireCheck e) { return(sqlmapper.QueryForObject <bool>("PCEarplugsStayWireCheck.has_rows_before", e)); }
protected override void MoveFirst() { this._pCEarplugsStayWireCheck = this._pCEarplugsStayWireCheckManager.GetFirst(); }
public Model.PCEarplugsStayWireCheck GetPrev(Model.PCEarplugsStayWireCheck e) { return(sqlmapper.QueryForObject <Model.PCEarplugsStayWireCheck>("PCEarplugsStayWireCheck.get_prev", e)); }
public Model.PCEarplugsStayWireCheck GetNext(Model.PCEarplugsStayWireCheck e) { return(accessor.GetNext(e)); }
public void Update(Model.PCEarplugsStayWireCheck e) { this.Update <Model.PCEarplugsStayWireCheck>(e); }
public void Insert(Model.PCEarplugsStayWireCheck e) { this.Insert <Model.PCEarplugsStayWireCheck>(e); }
public bool HasRowsAfter(Model.PCEarplugsStayWireCheck e) { return(sqlmapper.QueryForObject <bool>("PCEarplugsStayWireCheck.has_rows_after", e)); }
public bool HasRowsAfter(Model.PCEarplugsStayWireCheck e) { return(accessor.HasRowsAfter(e)); }