public void Delete(Model.PCEarProtectCheck PCEarProtectCheck) { if (PCEarProtectCheck != null) { this.Delete(PCEarProtectCheck.PCEarProtectCheckId); } }
protected override void MoveLast() { if (LastFlag == 1) { LastFlag = 0; return; } this._earProtectCheck = this._earProtectCheckManager.mGetLast(this.IsReport); }
protected override void MoveNext() { Model.PCEarProtectCheck model = this._earProtectCheckManager.mGetNext(this._earProtectCheck); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._earProtectCheck = model; }
/// <summary> /// 查询该单据及其详细 /// </summary> /// <param name="pCClarityCheck"></param> /// <returns></returns> public Book.Model.PCEarProtectCheck Get(Book.Model.PCEarProtectCheck PCEarProtectCheck) { Model.PCEarProtectCheck model = this.Get(PCEarProtectCheck.PCEarProtectCheckId); if (model != null) { model.Details = new BL.PCEarProtectCheckDetailManager().SelectByPCEarProtectCheckId(PCEarProtectCheck.PCEarProtectCheckId); } return(model); }
public EditForm(Model.PCEarProtectCheck PCEarProtectCheck, string action) : this() { this._earProtectCheck = PCEarProtectCheck; this.action = action; if (this.action == "view") { LastFlag = 1; } }
public override void Refresh() { if (this._earProtectCheck == null) { this.AddNew(); this.action = "insert"; } else { if (this.action == "view") { this._earProtectCheck = this._earProtectCheckManager.Get(this._earProtectCheck); } } //初始化控件 this.txt_PCEarProtectCheckId.Text = this._earProtectCheck.PCEarProtectCheckId; this.txtPronoteHeaderId.Text = this._earProtectCheck.PronoteHeaderId; this.txtInvoiceCusXOId.Text = this._earProtectCheck.InvoiceCusXOId; this.ceInvoiceXOCount.EditValue = this._earProtectCheck.InvoiceXOQuantity.HasValue ? this._earProtectCheck.InvoiceXOQuantity.Value : 0; this.calcPCCheckCount.EditValue = this._earProtectCheck.CheckCount.HasValue ? this._earProtectCheck.CheckCount.Value : 0; this.Date_PCEarProtectCheck.EditValue = this._earProtectCheck.CheckDate; this.BEProduct.EditValue = this._earProtectCheck.Product; this.nccEmployeeCheck.EditValue = this._earProtectCheck.Employee; this.txtCheckedStadard.Text = this._earProtectCheck.CheckStadard; this.newChooseContorlAuditEmp.EditValue = this._earProtectCheck.AuditEmp; this.txt_AuditState.EditValue = this.GetAuditName(this._earProtectCheck.AuditState); this.lookUpEditUnit.EditValue = this._earProtectCheck.ProductUnitId; this.richTextBoxNote.Rtf = this._earProtectCheck.Note; this.bindingSourceDetail.DataSource = this._earProtectCheck.Details; base.Refresh(); switch (this.action) { case "insert": this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.gridView1.OptionsBehavior.Editable = false; break; } this.ceInvoiceXOCount.Enabled = false; this.txt_PCEarProtectCheckId.Properties.ReadOnly = true; }
protected override void AddNew() { this._earProtectCheck = new Book.Model.PCEarProtectCheck(); this._earProtectCheck.PCEarProtectCheckId = this._earProtectCheckManager.GetId(); this._earProtectCheckManager.TiGuiExists(this._earProtectCheck); this._earProtectCheck.CheckDate = DateTime.Now.Date; this._earProtectCheck.CheckCount = 1; //检测数量默认为1 //this._ansipcic.Employee = BL.V.ActiveOperator.Employee; //this._ansipcic.EmployeeId = BL.V.ActiveOperator.EmployeeId; //初始化添加一条详细 this._earProtectCheck.Details = new List <Model.PCEarProtectCheckDetail>(); //this.AddDataRows(); }
public EditForm(Model.PCEarProtectCheck PCEarProtectCheck) : this() { if (PCEarProtectCheck == null) { throw new ArithmeticException("invoiceid"); } this._earProtectCheck = PCEarProtectCheck; this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
private void Validate(Model.PCEarProtectCheck PCEarProtectCheck) { if (PCEarProtectCheck.CheckDate == null) { throw new Helper.RequireValueException(Model.PCClarityCheck.PRO_CheckDate); } if (PCEarProtectCheck.ProductId == null) { throw new Helper.RequireValueException(Model.PCEarProtectCheck.PRO_ProductId); } if (PCEarProtectCheck.EmployeeId == null) { throw new Helper.RequireValueException(Model.PCEarProtectCheck.PRO_EmployeeId); } }
//搜索 private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm form = new ListForm(); if (form.ShowDialog(this) == DialogResult.OK) { Model.PCEarProtectCheck currentModel = form.SelectItem as Model.PCEarProtectCheck; if (currentModel != null) { this._earProtectCheck = currentModel; this._earProtectCheck = this._earProtectCheckManager.Get(this._earProtectCheck); this.Refresh(); } } form.Dispose(); GC.Collect(); }
protected override void Delete() { if (this._earProtectCheck == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this._earProtectCheckManager.Delete(this._earProtectCheck.PCEarProtectCheckId); this._earProtectCheck = this._earProtectCheckManager.GetNext(this._earProtectCheck); if (this._earProtectCheck == null) { this._earProtectCheck = this._earProtectCheckManager.GetLast(); } }
public void TiGuiExists(Model.PCEarProtectCheck model) { if (this.ExistsPrimary(model.PCEarProtectCheckId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, DateTime.Now.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, DateTime.Now.Year, DateTime.Now.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, DateTime.Now.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.PCEarProtectCheckId = this.GetId(DateTime.Now); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
/// <summary> /// Insert a PCEarProtectCheck. /// </summary> public void Insert(Model.PCEarProtectCheck pCEarProtectCheck) { // // todo:add other logic here // Validate(pCEarProtectCheck); try { BL.V.BeginTransaction(); pCEarProtectCheck.InsertTime = DateTime.Now; pCEarProtectCheck.UpdateTime = DateTime.Now; TiGuiExists(pCEarProtectCheck); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCEarProtectCheck.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCEarProtectCheck.InsertTime.Value.Year, pCEarProtectCheck.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCEarProtectCheck.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); accessor.Insert(pCEarProtectCheck); foreach (var item in pCEarProtectCheck.Details) { Detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
/// <summary> /// Update a PCEarProtectCheck. /// </summary> public void Update(Model.PCEarProtectCheck pCEarProtectCheck) { // // todo: add other logic here. // Validate(pCEarProtectCheck); try { BL.V.BeginTransaction(); pCEarProtectCheck.UpdateTime = DateTime.Now; accessor.Update(pCEarProtectCheck); Detailaccessor.DeleteByPCEarProtectCheckId(pCEarProtectCheck.PCEarProtectCheckId); foreach (var item in pCEarProtectCheck.Details) { Detailaccessor.Insert(item); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public bool mHasRowsAfter(Model.PCEarProtectCheck e) { return(accessor.mHasRowsAfter(e)); }
public void Insert(Model.PCEarProtectCheck e) { this.Insert <Model.PCEarProtectCheck>(e); }
public void Update(Model.PCEarProtectCheck e) { this.Update <Model.PCEarProtectCheck>(e); }
public bool mHasRowsBefore(Model.PCEarProtectCheck e) { return(sqlmapper.QueryForObject <bool>("PCEarProtectCheck.mhas_rows_before", e)); }
public bool mHasRowsAfter(Model.PCEarProtectCheck e) { return(sqlmapper.QueryForObject <bool>("PCEarProtectCheck.mhas_rows_after", e)); }
protected override void MoveFirst() { this._earProtectCheck = this._earProtectCheckManager.mGetFirst(this.IsReport); }
public Model.PCEarProtectCheck mGetNext(Model.PCEarProtectCheck e) { return(sqlmapper.QueryForObject <Model.PCEarProtectCheck>("PCEarProtectCheck.mget_next", e)); }
public Model.PCEarProtectCheck mGetPrev(Model.PCEarProtectCheck e) { return(sqlmapper.QueryForObject <Model.PCEarProtectCheck>("PCEarProtectCheck.mget_prev", e)); }
public Model.PCEarProtectCheck GetNext(Model.PCEarProtectCheck e) { return(accessor.GetNext(e)); }
public bool mHasRowsBefore(Model.PCEarProtectCheck e) { return(accessor.mHasRowsBefore(e)); }
public Model.PCEarProtectCheck mGetPrev(Model.PCEarProtectCheck e) { return(accessor.mGetPrev(e)); }
public RO(Model.PCEarProtectCheck PCEarProtectCheck) { InitializeComponent(); if (PCEarProtectCheck == null) { return; } //foreach (var detail in PCClarityCheck.Details) //{ // foreach (var item in detail.GetType().GetProperties()) // { // if (item.Name.Contains("ClarityL") || item.Name.Contains("ClarityR") || item.Name.Contains("NoteIsPass")) // { // switch (item.GetValue(detail, null).ToString()) // { // case "0": // item.SetValue(detail, "√", null); // break; // case "1": // item.SetValue(detail, "X", null); // break; // case "2": // item.SetValue(detail, "△", null); // break; // } // } // } //} this.DataSource = PCEarProtectCheck.Details.OrderBy(d => d.CheckDate).ToList(); this.lblCompanyName.Text = BL.Settings.CompanyChineseName; this.lblDataName.Text = "耳护制程坠落测试报告"; //this.lblPriteDate.Text += DateTime.Now.ToString("yyyy-MM-dd"); this.lblPCClarityCheckID.Text = PCEarProtectCheck.PCEarProtectCheckId; this.lblCheckDate.Text = PCEarProtectCheck.CheckDate.HasValue ? PCEarProtectCheck.CheckDate.Value.ToShortDateString() : ""; this.lblInvoiceCusXOId.Text = PCEarProtectCheck.InvoiceCusXOId; this.lblPronoteHeaderId.Text = PCEarProtectCheck.PronoteHeaderId; this.lblCheckStandard.Text = PCEarProtectCheck.CheckStadard; this.lblProduct.Text = PCEarProtectCheck.Product == null ? "" : PCEarProtectCheck.Product.ToString(); this.lblEmployee.Text = PCEarProtectCheck.Employee == null ? "" : PCEarProtectCheck.Employee.ToString(); this.lblPCCheckCount.Text = PCEarProtectCheck.CheckCount.HasValue ? (PCEarProtectCheck.CheckCount.ToString() + (PCEarProtectCheck.ProductUnit == null ? "" : PCEarProtectCheck.ProductUnit.ToString()) + "/每天") : ""; this.lblInvoiceXOQuantity.Text = PCEarProtectCheck.InvoiceXOQuantity.HasValue ? PCEarProtectCheck.InvoiceXOQuantity.ToString() : ""; //this.lblUnit.Text = PCEarProtectCheck.ProductUnit == null ? null : PCEarProtectCheck.ProductUnit.ToString(); this.lblAuditEmp.Text = PCEarProtectCheck.AuditEmp == null ? null : PCEarProtectCheck.AuditEmp.ToString(); this.RTNote.Rtf = PCEarProtectCheck.Note; //this.lbl_CustomerProductName.Text = PCEarProtectCheck.Product == null ? "" : PCEarProtectCheck.Product.CustomerProductName; if (PCEarProtectCheck.Product != null) { if (string.IsNullOrEmpty(PCEarProtectCheck.Product.CustomerProductName)) { this.lbl_CustomerProductName.Text = CommonHelp.GetCustomerProductNameByPronoteHeaderId(PCEarProtectCheck.PronoteHeaderId, PCEarProtectCheck.ProductId); } else { this.lbl_CustomerProductName.Text = PCEarProtectCheck.Product.CustomerProductName; } } this.TCDate.DataBindings.Add("Text", this.DataSource, Model.PCEarProtectCheckDetail.PRO_CheckDate, "{0:yyyy-MM-dd}"); //this.TCProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); this.TCFitted.DataBindings.Add("Text", this.DataSource, Model.PCEarProtectCheckDetail.PRO_Fitted); this.TCIsBreak.DataBindings.Add("Text", this.DataSource, Model.PCEarProtectCheckDetail.PRO_IsBreak); this.TCIsDrop.DataBindings.Add("Text", this.DataSource, Model.PCEarProtectCheckDetail.PRO_IsDrop); this.TCEmployee.DataBindings.Add("Text", this.DataSource, "Employee." + Model.Employee.PROPERTY_EMPLOYEENAME); this.TCNoteIsPass.DataBindings.Add("Text", this.DataSource, Model.PCClarityCheckDetail.PRO_NoteIsPass); //this.TCBusinessHours.DataBindings.Add("Text",this.DataSource,"BusinessHours."+Model.BusinessHours.PROPERTY_BUSINESSHOURSNAME); }