public RO(Model.InvoiceLH invoice) { InitializeComponent(); this.DataSource = invoice.Detail; lbl_CompanyName.Text = BL.Settings.CompanyChineseName; lbl_InvoiceId.Text = invoice.InvoiceId; lbl_Customer.Text = invoice.Customer == null ? "" : invoice.Customer.CustomerShortName; lbl_ReportDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); lbl_ConveyanceMethod.Text = invoice.ConveyanceMethod == null ? "" : invoice.ConveyanceMethod.ConveyanceMethodName; lbl_InvoiceDate.Text = invoice.InvoiceDate.Value.ToString("yyyy-MM-dd"); TC_No.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_Number); TCProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id); TCKehuPinhao.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName); TC_InvoiceXOCusId.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_InvoiceXOCusId); TCCustomerProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); TC_EstimateQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_EstimateQty); TCProductUnit.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_ProductUnit); TC_BoxCapacityQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxCapacityQty); TCBoxNumber.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxNumber); TCBoxQty.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_BoxQty); TCNote.DataBindings.Add("Text", this.DataSource, Model.InvoiceLHDetail.PRO_Note); lbl_EmpCreater.Text = invoice.EmpCreater == null ? "" : invoice.EmpCreater.EmployeeName; //lbl_EmpShengguan.Text = invoice.EmpShengguan == null ? "" : invoice.EmpShengguan.EmployeeName; //lbl_EmpShechu.Text = invoice.EmpShechu == null ? "" : invoice.EmpShechu.EmployeeName; //lbl_EmpPinjian.Text=invoice.EmpPinjian==null?"":invoice.EmpPinjian.EmployeeName; //lbl_EmpDepot.Text = invoice.EmpDepot == null ? "" : invoice.EmpDepot.EmployeeName; }
protected override void MoveLast() { if (LastFlag == 1) { LastFlag = 0; return; } this.invoice = this.invoiceLHManager.Get(this.invoiceLHManager.GetLast() == null ? "" : this.invoiceLHManager.GetLast().InvoiceId); }
protected override void AddNew() { this.invoice = new Model.InvoiceLH(); this.invoice.InvoiceId = this.invoiceLHManager.GetIdByMonth(DateTime.Now); this.invoice.InvoiceDate = DateTime.Now; this.invoice.EmpCreater = BL.V.ActiveOperator.Employee; }
protected override void MovePrev() { Model.InvoiceLH invoice = this.invoiceLHManager.GetPrev(this.invoice); if (invoice == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.invoice = this.invoiceLHManager.Get(invoice.InvoiceId); }
public override void Refresh() { if (this.invoice == null) { this.invoice = new Book.Model.InvoiceLH(); this.action = "insert"; } else { if (this.action == "view") { this.invoice = this.invoiceLHManager.GetDetail(invoice.InvoiceId); } } this.txt_InvoiceId.EditValue = this.invoice.InvoiceId; this.date_InvoiceDate.EditValue = this.invoice.InvoiceDate; this.ncc_Customer.EditValue = this.invoice.Customer; this.lue_ConveyanceMethod.EditValue = this.invoice.ConveyanceMethodId; this.ncc_EmpCreater.EditValue = this.invoice.EmpCreater; //this.ncc_EmpShengguan.EditValue = this.invoice.EmpShengguan; //this.ncc_EmpShechu.EditValue = this.invoice.EmpShechu; //this.ncc_EmpPinjian.EditValue = this.invoice.EmpPinjian; //this.ncc_EmpDepot.EditValue = this.invoice.EmpDepot; this.EmpAudit.EditValue = this.invoice.AuditEmp; this.textEditAuditState.Text = this.invoice.AuditStateName; this.bindingSourceDetail.DataSource = this.invoice.Detail; 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; default: break; } base.Refresh(); this.txt_InvoiceId.Properties.ReadOnly = true; this.ncc_EmpCreater.Enabled = false; }
public EditForm(Model.InvoiceLH invoiceLH) : this() { if (invoiceLH == null) { throw new ArithmeticException("invoiceid"); } this.invoice = invoiceLH; this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
public EditForm(string invoiceId) : this() { this.invoice = this.invoiceLHManager.Get(invoiceId); if (this.invoice == null) { throw new ArithmeticException("invoiceid"); } this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
protected override void TiGuiExists(Book.Model.Invoice model) { Model.InvoiceLH lh = this.Get(model.InvoiceId); if (lh != null) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); //string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); //SequenceManager.Increment(sequencekey_d); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InvoiceDate.Value.Year, model.InvoiceDate.Value.Month); SequenceManager.Increment(sequencekey_m); model.InvoiceId = this.GetIdByMonth(model.InsertTime.Value); TiGuiExists(model); } }
public Model.InvoiceLH GetDetail(string invoiceId) { Model.InvoiceLH invoice = this.Get(invoiceId); if (invoice != null) { invoice.Detail = accessorDetail.SelectByHeaderId(invoiceId); if (invoice.Detail == null) { invoice.Detail = new List <Model.InvoiceLHDetail>(); } } return(invoice); }
private void Validate(Model.InvoiceLH invoice) { if (string.IsNullOrEmpty(invoice.InvoiceId)) { throw new Helper.RequireValueException(Model.InvoiceLH.PRO_InvoiceId); } if (invoice.InvoiceDate == null) { throw new Helper.RequireValueException(Model.InvoiceLH.PRO_InvoiceDate); } if (string.IsNullOrEmpty(invoice.CustomerId)) { throw new Helper.RequireValueException(Model.InvoiceLH.PRO_CustomerId); } }
protected override void TurnNull() { if (this.invoice == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } this.invoiceLHManager.Delete(this.invoice.InvoiceId); this.invoice = this.invoiceLHManager.GetNext(this.invoice); if (this.invoice == null) { this.invoice = this.invoiceLHManager.GetLast(); } }
/// <summary> /// Insert a InvoiceLH. /// </summary> public void _Insert(Model.InvoiceLH invoiceLH) { // // todo:add other logic here // //Validate(invoiceLH); invoiceLH.InsertTime = DateTime.Now; invoiceLH.UpdateTime = DateTime.Now; accessor.Insert(invoiceLH); foreach (var item in invoiceLH.Detail) { item.InvoiceLHId = invoiceLH.InvoiceId; accessorDetail.Insert(item); } }
/// <summary> /// Update a InvoiceLH. /// </summary> public void Update(Model.InvoiceLH invoiceLH) { // // todo: add other logic here. // Validate(invoiceLH); invoiceLH.UpdateTime = DateTime.Now; accessor.Update(invoiceLH); accessorDetail.DeleteByHeaderId(invoiceLH.InvoiceId); foreach (var item in invoiceLH.Detail) { item.InvoiceLHId = invoiceLH.InvoiceId; accessorDetail.Insert(item); } }
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); }
public Model.InvoiceLH GetPrev(Model.InvoiceLH e) { return(sqlmapper.QueryForObject <Model.InvoiceLH>("InvoiceLH.get_prev", e)); }
public void Update(Model.InvoiceLH e) { this.Update <Model.InvoiceLH>(e); }
public bool HasRowsAfter(Model.InvoiceLH e) { return(accessor.HasRowsAfter(e)); }
public Model.InvoiceLH GetPrev(Model.InvoiceLH e) { return(accessor.GetPrev(e)); }
protected override void MoveFirst() { this.invoice = this.invoiceLHManager.Get(this.invoiceLHManager.GetFirst() == null ? "" : this.invoiceLHManager.GetFirst().InvoiceId); }
public Model.InvoiceLH GetNext(Model.InvoiceLH e) { return(accessor.GetNext(e)); }
public Model.InvoiceLH GetNext(Model.InvoiceLH e) { return(sqlmapper.QueryForObject <Model.InvoiceLH>("InvoiceLH.get_next", e)); }
public void Insert(Model.InvoiceLH e) { this.Insert <Model.InvoiceLH>(e); }
public bool HasRowsBefore(Model.InvoiceLH e) { return(sqlmapper.QueryForObject <bool>("InvoiceLH.has_rows_before", e)); }
public bool HasRowsAfter(Model.InvoiceLH e) { return(sqlmapper.QueryForObject <bool>("InvoiceLH.has_rows_after", e)); }
public bool HasRowsBefore(Model.InvoiceLH e) { return(accessor.HasRowsBefore(e)); }