protected override void AddNew() { this.invoice = new Model.InvoiceQK(); this.invoice.InvoiceId = this.invoiceManager.GetNewId(); this.invoice.InvoiceDate = DateTime.Now; }
private void _Update(Model.InvoiceQK invoice) { _ValidateForUpdate(invoice); Model.InvoiceQK invoiceOriginal = this.Get(invoice.InvoiceId); switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus) { case Helper.InvoiceStatus.Draft: switch ((Helper.InvoiceStatus)invoice.InvoiceStatus) { case Helper.InvoiceStatus.Draft: invoice.UpdateTime = DateTime.Now; invoice.CustomerId = invoice.Customer.CustomerId; invoice.Employee0Id = invoice.Employee0.EmployeeId; accessor.Update(invoice); break; case Helper.InvoiceStatus.Normal: invoice.UpdateTime = DateTime.Now; invoice.CustomerId = invoice.Customer.CustomerId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1.EmployeeId; invoice.Employee2Id = invoice.Employee2.EmployeeId; invoice.InvoiceGZTime = DateTime.Now; accessor.Update(invoice); break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } break; case Helper.InvoiceStatus.Normal: switch ((Helper.InvoiceStatus)invoice.InvoiceStatus) { case Helper.InvoiceStatus.Draft: throw new InvalidOperationException(); case Helper.InvoiceStatus.Normal: invoice.UpdateTime = DateTime.Now; accessor.Update(invoice); break; case Helper.InvoiceStatus.Null: invoice.UpdateTime = DateTime.Now; invoice.Employee3Id = invoice.Employee3.EmployeeId; invoice.InvoiceZFTime = DateTime.Now; invoice.InvoiceZFCause = ""; accessor.Update(invoice); break; } break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } }
protected override Form GetViewForm() { Model.InvoiceQK invoice = this.SelectedItem as Model.InvoiceQK; if (invoice != null) { return(new ViewForm(invoice.InvoiceId)); } return(null); }
protected override void MovePrev() { Model.InvoiceQK invoice = this.invoiceManager.GetPrev(this.invoice); if (invoice == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.invoice = this.invoiceManager.Get(invoice.InvoiceId); }
public EditForm(Model.InvoiceQK invoice) : this() { if (invoice == null) { throw new ArithmeticException("invoiceid"); } this.invoice = this.invoiceManager.Get(invoice.InvoiceId); this.action = "update"; }
public EditForm(string invoiceId) : this() { this.invoice = this.invoiceManager.Get(invoiceId); if (this.invoice == null) { throw new ArithmeticException("invoiceid"); } this.action = "update"; }
private void Validate(Model.InvoiceQK invoice) { if (string.IsNullOrEmpty(invoice.InvoiceId)) { throw new Helper.RequireValueException("Id"); } if (invoice.Employee0 == null) { throw new Helper.RequireValueException("Employee0"); } }
public R01(string invoiceId) { InitializeComponent(); this.invoice = this.invoiceManager.Get(invoiceId); if (this.invoice == null) { throw new ArgumentException(); } this.xrTableCellCompany.Text = this.invoice.Customer.ToString(); this.xrTableCellTotal0.Text = this.invoice.InvoiceTotal0.ToString(); this.xrTableCellTotal1.Text = this.invoice.InvoiceTotal1.ToString(); this.xrLabelInvoiceId.Text = this.invoice.InvoiceId; this.xrLabelInvoiceDate.Text = this.invoice.InvoiceDate.Value.ToShortDateString(); }
//public EditForm(Model.Company company) // : this() //{ // if (company == null) // throw new ArgumentNullException("company"); // this.invoice = new Book.Model.InvoiceQK(); // ////this.invoice.InvoiceId = this.invoiceManager.GetNewId(); // this.invoice.InvoiceDate = DateTime.Today; // this.invoice.Company = company; // this.invoice.InvoiceTotal0 = company.CompanyR1; // this.invoice.InvoiceTotal1 = company.CompanyR1; //} #endregion #region FormLoad private void EditForm_Load(object sender, EventArgs e) { if (this.invoice == null) { this.invoice = new Book.Model.InvoiceQK(); ////this.invoice.InvoiceId = this.invoiceManager.GetNewId(); this.invoice.InvoiceDate = DateTime.Today; } this.textEditInvoiceId.Text = this.invoice.InvoiceId; this.dateEditInvoiceDate.EditValue = this.invoice.InvoiceDate; this.buttonEditEmployee.EditValue = this.invoice.Employee0; //this.textEditAbstract.Text = this.invoice.InvoiceAbstract; this.textEditNote.Text = this.invoice.InvoiceNote; this.buttonEditCompany.EditValue = this.invoice.Customer; this.calcEditMoney0.EditValue = this.invoice.InvoiceTotal0; this.calcEditMoney1.EditValue = this.invoice.InvoiceTotal1; }
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.invoiceManager.TurnNull(this.invoice.InvoiceId); this.invoice = this.invoiceManager.GetNext(this.invoice); if (this.invoice == null) { this.invoice = this.invoiceManager.GetLast(); } }
private void _Insert(Model.InvoiceQK invoice) { _ValidateForInsert(invoice); invoice.InsertTime = DateTime.Now; invoice.UpdateTime = DateTime.Now; invoice.CustomerId = invoice.Customer.CustomerId; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.Employee1Id = invoice.Employee1.EmployeeId; if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal) { //过账人 invoice.Employee2Id = invoice.Employee2.EmployeeId; //过账时间 invoice.InvoiceGZTime = DateTime.Now; } accessor.Insert(invoice); }
public bool HasRowsAfter(Model.InvoiceQK e) { return(accessor.HasRowsAfter(e)); }
public override void Refresh() { if (this.invoice == null) { this.invoice = new Book.Model.InvoiceQK(); this.action = "insert"; } this.textEditInvoiceId.Text = this.invoice.InvoiceId; this.dateEditInvoiceDate.EditValue = this.invoice.InvoiceDate; //this.textEditAbstract.Text = this.invoice.InvoiceAbstract; this.textEditNote.Text = this.invoice.InvoiceNote; this.buttonEditEmployee.EditValue = this.invoice.Employee0; this.buttonEditCompany.EditValue = this.invoice.Customer; this.calcEditMoney0.EditValue = this.invoice.InvoiceTotal0; this.calcEditMoney1.EditValue = this.invoice.InvoiceTotal1; switch (this.action) { case "insert": this.textEditInvoiceId.Properties.ReadOnly = false; this.dateEditInvoiceDate.Properties.ReadOnly = false; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = true; this.calcEditMoney1.Properties.ReadOnly = false; this.textEditNote.Properties.ReadOnly = false; this.buttonEditCompany.ShowButton = true; this.buttonEditEmployee.ShowButton = true; this.buttonEditCompany.ButtonReadOnly = false; this.buttonEditEmployee.ButtonReadOnly = false; break; case "update": this.textEditInvoiceId.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false; this.calcEditMoney1.Properties.ReadOnly = false; this.textEditNote.Properties.ReadOnly = false; this.buttonEditCompany.ShowButton = true; this.buttonEditEmployee.ShowButton = true; this.buttonEditCompany.ButtonReadOnly = false; this.buttonEditEmployee.ButtonReadOnly = false; break; case "view": this.textEditInvoiceId.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false; this.calcEditMoney1.Properties.ReadOnly = true; this.textEditNote.Properties.ReadOnly = true; this.buttonEditCompany.ShowButton = false; this.buttonEditEmployee.ShowButton = false; this.buttonEditCompany.ButtonReadOnly = true; this.buttonEditEmployee.ButtonReadOnly = true; break; default: break; } base.Refresh(); }
protected override void MoveLast() { this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId); }
public Model.InvoiceQK GetPrev(Model.InvoiceQK e) { return(accessor.GetPrev(e)); }
public Model.InvoiceQK GetNext(Model.InvoiceQK e) { return(accessor.GetNext(e)); }
public bool HasRowsAfter(Model.InvoiceQK e) { return(sqlmapper.QueryForObject <bool>("InvoiceQK.has_rows_after", e)); }
private void _TurnNormal(Model.InvoiceQK invoice) { invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal; _Update(invoice); }
public void Update(Model.InvoiceQK e) { this.Update <Model.InvoiceQK>(e); }
public ViewForm(string invoiceid) : this() { this.invoice = this.invoiceManager.Get(invoiceid); }
public Model.InvoiceQK GetPrev(Model.InvoiceQK e) { return(sqlmapper.QueryForObject <Model.InvoiceQK>("InvoiceQK.get_prev", e)); }
public Model.InvoiceQK GetNext(Model.InvoiceQK e) { return(sqlmapper.QueryForObject <Model.InvoiceQK>("InvoiceQK.get_next", e)); }
public bool HasRowsBefore(Model.InvoiceQK e) { return(accessor.HasRowsBefore(e)); }
public void Insert(Model.InvoiceQK e) { this.Insert <Model.InvoiceQK>(e); }
public ViewForm(Model.InvoiceQK invoice) : this() { this.invoice = invoice; }
public bool HasRowsBefore(Model.InvoiceQK e) { return(sqlmapper.QueryForObject <bool>("InvoiceQK.has_rows_before", e)); }