protected override void AddNew() { this.invoicehc = new Model.InvoiceHC(); this.invoicehc.InvoiceDate = DateTime.Now; this.invoicehc.Details = new List <Model.InvoiceHCDetail>(); this.invoicehc.Jrdetails = new List <Model.InvoiceJRDetail>(); this.invoicehc.InvoiceId = this.invoiceManager.GetNewId(); }
public ViewForm(string invoiceId) : this() { this.invoice = this.invoiceHCManager.Get(invoiceId); if (invoice == null) { throw new ArithmeticException("invoiceid"); } }
public ViewForm(Model.InvoiceHC initInvoiceHC) : this() { if (initInvoiceHC == null) { throw new ArithmeticException("initInvoiceHC"); } this.invoice = initInvoiceHC; }
protected override Form GetViewForm() { Model.InvoiceHC invoice = this.SelectedItem as Model.InvoiceHC; if (invoice != null) { return(new ViewForm(invoice.InvoiceId)); } return(null); }
public EditForm(Model.InvoiceHC invoice) : this() { if (invoicehc == null) { throw new ArithmeticException("invoiceid"); } this.invoicehc = invoice; this.action = "update"; }
protected override void MovePrev() { Model.InvoiceHC invoice = this.invoiceManager.GetPrev(this.invoicehc); if (invoice == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.invoicehc = this.invoiceManager.Get(invoice.InvoiceId); }
public EditForm(string invoiceId) : this() { this.invoicehc = this.invoiceManager.Get(invoiceId); if (invoicehc == null) { throw new ArithmeticException("invoiceid"); } this.action = "update"; }
protected override void TurnNull() { if (this.invoicehc == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this.invoiceManager.TurnNull(this.invoicehc.InvoiceId); this.invoicehc = this.invoiceManager.GetNext(this.invoicehc); if (this.invoicehc == null) { this.invoicehc = this.invoiceManager.GetLast(); } }
public override void Refresh() { if (this.invoicehc == null) { this.invoicehc = new Book.Model.InvoiceHC(); this.action = "insert"; } else { if (this.action != "insert") { this.invoicehc = this.invoiceManager.Get(this.invoicehc.InvoiceId); if (this.invoicehc == null) { this.invoicehc = new Book.Model.InvoiceHC(); } } } this.textEditInvoiceId.EditValue = this.invoicehc.InvoiceId; this.dateEditInvoiceDate.DateTime = this.invoicehc.InvoiceDate.Value; this.textEditNote.EditValue = this.invoicehc.InvoiceNote; this.lookUpEditDepot.EditValue = this.invoicehc.DepotId; if (this.invoicehc.DepotId != null) { this.bindingSourceDepotPosition.DataSource = this.depotPositionManager.Select(depotManager.Get(this.invoicehc.DepotId)); } //if (this.invoice.Customer != null) //{ // this.lookUpEdit1.EditValue = this.invoice.Customer.CustomerId; //} textEditjrinvoiceid.Text = this.invoicehc.JrInvoiceId; //this.buttonEditCompany.EditValue = this.invoice.Customer; this.buttonEditEmployee.EditValue = this.invoicehc.Employee0; this.EmpAudit.EditValue = this.Invoice.AuditEmp; this.textEditAuditState.Text = this.Invoice.AuditStateName; switch (this.action) { case "insert": case "update": this.bindingSource1.DataSource = this.invoicehc.Details; this.barBtnChooseJR.Enabled = true; break; case "view": this.bindingSource1.DataSource = this.invoiceManager.Get(this.invoicehc.InvoiceId).Details; this.barBtnChooseJR.Enabled = false; break; default: break; } base.Refresh(); this.buttonEditEmployee.Enabled = false; this.lookUpEditDepot.Properties.ReadOnly = true; this.newChooseContorlSupper.Enabled = false; this.textEditjrinvoiceid.Properties.ReadOnly = true; }
public Model.InvoiceHC GetPrev(Model.InvoiceHC e) { return(sqlmapper.QueryForObject <Model.InvoiceHC>("InvoiceHC.get_prev", e)); }
protected override void MoveLast() { this.invoicehc = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId); }
public Model.InvoiceHC GetPrev(Model.InvoiceHC e) { return(accessor.GetPrev(e)); }
public void Update(Model.InvoiceHC e) { this.Update <Model.InvoiceHC>(e); }
private void _TurnNull(Model.InvoiceHC invoice) { invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Null; _Update(invoice); }
public bool HasRowsAfter(Model.InvoiceHC e) { return(sqlmapper.QueryForObject <bool>("InvoiceHC.has_rows_after", e)); }
public Model.InvoiceHC Get(string invoiceId) { Model.InvoiceHC invoice = accessor.Get(invoiceId); invoice.Details = invoiceHCDetailAccessor.Select(invoice); return(invoice); }
private void _Update(Model.InvoiceHC invoice) { invoice.UpdateTime = DateTime.Now;; //invoice.CustomerId = invoice.Customer.CustomerId; if (invoice.Employee0 != null) { invoice.Employee0Id = invoice.Employee0.EmployeeId; } Model.InvoiceHC invoiceOriginal = this.Get(invoice.InvoiceId); Helper.InvoiceStatus invoiceStatus = (Helper.InvoiceStatus)invoice.InvoiceStatus.Value; switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus) { case Helper.InvoiceStatus.Draft: switch (invoiceStatus) { case Helper.InvoiceStatus.Draft: break; case Helper.InvoiceStatus.Normal: accessor.Delete(invoiceOriginal.InvoiceId); invoice.InsertTime = invoiceOriginal.InsertTime; invoice.UpdateTime = DateTime.Now; _Insert(invoice); break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } break; case Helper.InvoiceStatus.Normal: switch (invoiceStatus) { case Helper.InvoiceStatus.Normal: invoiceOriginal.InvoiceStatus = (int)Helper.InvoiceStatus.Null; _TurnNull(invoiceOriginal); accessor.Delete(invoiceOriginal.InvoiceId); invoice.InsertTime = invoiceOriginal.InsertTime; invoice.UpdateTime = DateTime.Now; _Insert(invoice); break; case Helper.InvoiceStatus.Null: foreach (Model.InvoiceHCDetail detail in invoice.Details) { if (detail.InvoiceHCDetailQuantity > 0) { Model.InvoiceJRDetail temp = invoiceJRDetailAccessor.Get(detail.InvoiceJRDetailId); if (temp != null) { temp.InvoiceWeiHuaiChuQuantity += detail.InvoiceHCDetailQuantity; temp.InvoiceYiHuaiChuQuantity -= detail.InvoiceHCDetailQuantity; invoiceJRDetailAccessor.Update(temp); } Model.Product p = detail.Product; //byte[] pic = new byte[] { }; //if (p.ProductImage == null) // p.ProductImage = pic; //if (p.ProductImage1 == null) // p.ProductImage1 = pic; //if (p.ProductImage2 == null) // p.ProductImage2 = pic; //if (p.ProductImage3 == null) // p.ProductImage3 = pic; productAccessor.Update(p); stockAccessor.DecrementJC(new BL.DepotPositionManager().Get(detail.DepotPositionId), p, detail.InvoiceHCDetailQuantity.Value); } } break; } break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } }
public IList <Model.InvoiceJRDetail> Select(Model.InvoiceHC invoice) { return(accessor.Select(invoice)); }
public bool HasRowsBefore(Model.InvoiceHC e) { return(accessor.HasRowsBefore(e)); }
public bool HasRowsBefore(Model.InvoiceHC e) { return(sqlmapper.QueryForObject <bool>("InvoiceHC.has_rows_before", e)); }
public bool HasRowsAfter(Model.InvoiceHC e) { return(accessor.HasRowsAfter(e)); }
public Model.InvoiceHC GetNext(Model.InvoiceHC e) { return(sqlmapper.QueryForObject <Model.InvoiceHC>("InvoiceHC.get_next", e)); }
public Model.InvoiceHC GetNext(Model.InvoiceHC e) { return(accessor.GetNext(e)); }
public void Insert(Model.InvoiceHC e) { this.Insert <Model.InvoiceHC>(e); }