private void _Insert(Model.InvoiceQO invoice) { _ValidateForInsert(invoice); invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.AccountId = invoice.Account.AccountId; 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); foreach (Model.InvoiceQODetail detail in invoice.Details) { detail.InvoiceId = invoice.InvoiceId; invoiceQODetailAccessor.Insert(detail); } if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal) { Model.Account account = invoice.Account; account.AccountBalance1 -= invoice.InvoiceTotal; accountAccessor.Update(account); } }
public ViewForm(string invoiceid) : this() { this.invoice = invoiceQOManager.Get(invoiceid); if (invoice == null) { throw new ArithmeticException("invoiceid"); } }
protected override void AddNew() { this.invoice = new Model.InvoiceQO(); this.invoice.InvoiceId = this.invoiceManager.GetNewId(); this.invoice.InvoiceDate = DateTime.Now; this.invoice.Details = new List <Model.InvoiceQODetail>(); }
public ViewForm(Model.InvoiceQO invoiceQO) : this() { if (invoiceQO == null) { throw new ArithmeticException("invoiceQO"); } this.invoice = invoiceQO; }
public EditForm(string invoiceid) : this() { this.invoice = invoiceManager.Get(invoiceid); if (invoice == null) { throw new ArithmeticException("invoiceid"); } this.action = "update"; }
public EditForm(Model.InvoiceQO invoiceQO) : this() { if (invoiceQO == null) { throw new ArithmeticException("invoiceid"); } this.invoice = invoiceQO; this.action = "update"; }
protected override void MovePrev() { Model.InvoiceQO invoice = this.invoiceManager.GetPrev(this.invoice); if (invoice == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.invoice = this.invoiceManager.Get(invoice.InvoiceId); }
protected override Form GetViewForm() { Model.InvoiceQO invoice = this.SelectedItem as Model.InvoiceQO; if (invoice != null) { return(new ViewForm(invoice.InvoiceId)); } return(null); }
private void Validate(Model.InvoiceQO invoice) { if (invoice.Account == null) { throw new Helper.RequireValueException("Account"); } if (invoice.Details.Count == 0) { throw new Helper.RequireValueException("Details"); } }
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(); } }
public R01(string invoiceId) { InitializeComponent(); this.invoice = this.invoiceManager.Get(invoiceId); if (this.invoice == null) { return; } this.invoice.Details = this.invoiceDetailManager.Select(this.invoice); this.DataSource = this.invoice.Details; //CompanyInfo this.xrLabelCompanyInfoAddress.Text = BL.Settings.CompanyAddress1; this.xrLabelCompanyInfoFAX.Text = BL.Settings.CompanyFax; this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName + Properties.Resources.InvoiceQO; this.xrLabelCompanyInfoTelphone.Text = BL.Settings.CompanyPhone; //每页合计统计 this.xrLabelPateTotal.Summary.Running = SummaryRunning.Page; this.xrLabelPateTotal.Summary.Func = SummaryFunc.Sum; this.xrLabelPateTotal.Summary.FormatString = "{0:0}"; this.xrLabelPateTotal.Summary.IgnoreNullValues = true; this.xrLabelPateTotal.DataBindings.Add("Text", this.DataSource, Model.InvoiceQODetail.PROPERTY_INVOICEQODETAILMONEY, "{0:0}"); this.xrLabelAccount.Text = this.invoice.Account.AccountName; this.xrLabelInvoiceDate.Text = this.invoice.InvoiceDate.Value.ToString("yyyy-MM-dd"); this.xrLabelInvoiceId.Text = this.invoice.InvoiceId; this.xrLabelNote.Text = this.invoice.InvoiceNote; this.xrLabelTotal.Summary.Running = SummaryRunning.Report; this.xrLabelTotal.Summary.Func = SummaryFunc.Sum; this.xrLabelTotal.Summary.FormatString = "{0:0}"; this.xrLabelTotal.Summary.IgnoreNullValues = true; this.xrLabelTotal.DataBindings.Add("Text", this.DataSource, Model.InvoiceQODetail.PROPERTY_INVOICEQODETAILMONEY, "{0:0}"); this.xrTableCellKind.DataBindings.Add("Text", this.DataSource, "OutgoingKind." + Model.OutgoingKind.PROPERTY_OUTGOINGKINDNAME); this.xrTableCellMoney.DataBindings.Add("Text", this.DataSource, Model.InvoiceQODetail.PROPERTY_INVOICEQODETAILMONEY, "{0:0}"); this.xrTableCellNote.DataBindings.Add("Text", this.DataSource, Model.InvoiceQODetail.PROPERTY_INVOICEQODETAILNOTE); }
public Model.InvoiceQO Get(string invoiceId) { Model.InvoiceQO invoice = accessor.Get(invoiceId); invoice.Details = invoiceQODetailAccessor.Select(invoice); return(invoice); }
public bool HasRowsBefore(Model.InvoiceQO e) { return(sqlmapper.QueryForObject <bool>("InvoiceQO.has_rows_before", e)); }
public bool HasRowsBefore(Model.InvoiceQO e) { return(accessor.HasRowsBefore(e)); }
private void _TurnNormal(Model.InvoiceQO invoice) { invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal; _Update(invoice); }
public override void Refresh() { if (this.invoice == null) { this.invoice = new Book.Model.InvoiceQO(); this.action = "insert"; } this.textEditInvoiceId.EditValue = this.invoice.InvoiceId; this.dateEditInvoiceDate.DateTime = this.invoice.InvoiceDate.Value; //this.textEditAbstract.EditValue = this.invoice.InvoiceAbstract; this.textEditNote.EditValue = this.invoice.InvoiceNote; this.buttonEditEmployee.EditValue = this.invoice.Employee0; this.buttonEditAccount.EditValue = this.invoice.Account; this.EmpAudit.EditValue = this.invoice.AuditEmp; this.textEditAuditState.Text = this.invoice.AuditStateName; this.bindingSource1.DataSource = this.invoice.Details; switch (this.action) { case "insert": this.textEditInvoiceId.Properties.ReadOnly = false; this.dateEditInvoiceDate.Properties.ReadOnly = false; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = true; //this.textEditAbstract.Properties.ReadOnly = false; this.textEditNote.Properties.ReadOnly = false; this.buttonEditEmployee.ShowButton = true; this.buttonEditAccount.ShowButton = true; this.buttonEditEmployee.ButtonReadOnly = false; this.buttonEditAccount.ButtonReadOnly = false; this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.textEditInvoiceId.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false; this.textEditNote.Properties.ReadOnly = false; this.buttonEditEmployee.ShowButton = true; this.buttonEditAccount.ShowButton = true; this.buttonEditEmployee.ButtonReadOnly = false; this.buttonEditAccount.ButtonReadOnly = false; this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.textEditInvoiceId.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.ReadOnly = true; this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false; this.textEditNote.Properties.ReadOnly = true; this.buttonEditEmployee.ShowButton = true; this.buttonEditAccount.ShowButton = true; this.buttonEditEmployee.ButtonReadOnly = false; this.buttonEditAccount.ButtonReadOnly = false; this.gridView1.OptionsBehavior.Editable = false; break; default: break; } base.Refresh(); }
public bool HasRowsAfter(Model.InvoiceQO e) { return(accessor.HasRowsAfter(e)); }
public Model.InvoiceQO GetPrev(Model.InvoiceQO e) { return(accessor.GetPrev(e)); }
protected override void MoveLast() { this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId); }
public Model.InvoiceQO GetPrev(Model.InvoiceQO e) { return(sqlmapper.QueryForObject <Model.InvoiceQO>("InvoiceQO.get_prev", e)); }
public Model.InvoiceQO GetNext(Model.InvoiceQO e) { return(accessor.GetNext(e)); }
public Model.InvoiceQO GetNext(Model.InvoiceQO e) { return(sqlmapper.QueryForObject <Model.InvoiceQO>("InvoiceQO.get_next", e)); }
public bool HasRowsAfter(Model.InvoiceQO e) { return(sqlmapper.QueryForObject <bool>("InvoiceQO.has_rows_after", e)); }
private void _Update(Model.InvoiceQO invoice) { _ValidateForUpdate(invoice); invoice.UpdateTime = DateTime.Now; invoice.Employee0Id = invoice.Employee0.EmployeeId; invoice.AccountId = invoice.Account.AccountId; Model.InvoiceQO 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: accessor.Update(invoice); invoiceQODetailAccessor.Delete(invoice); foreach (Model.InvoiceQODetail detail in invoice.Details) { detail.InvoiceId = invoice.InvoiceId; detail.InvoiceQODetailId = Guid.NewGuid().ToString(); invoiceQODetailAccessor.Insert(detail); } break; case Helper.InvoiceStatus.Normal: accessor.Delete(invoiceOriginal.InvoiceId); invoice.InsertTime = invoiceOriginal.InsertTime; invoice.UpdateTime = DateTime.Now; _Insert(invoice); //accessor.Update(invoice); //invoiceQODetailAccessor.Delete(invoice); //foreach (Model.InvoiceQODetail detail in invoice.Details) //{ // detail.InvoiceId = invoice.InvoiceId; // detail.InvoiceQODetailId = Guid.NewGuid().ToString(); // invoiceQODetailAccessor.Insert(detail); //} //Model.Account account = invoice.Account; //account.AccountBalance1 -= invoice.InvoiceTotal; //accountAccessor.Update(account); //invoice.Employee2Id = invoice.Employee2.EmployeeId; //invoice.InvoiceGZTime = DateTime.Now; break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } break; case Helper.InvoiceStatus.Normal: switch (invoiceStatus) { case Helper.InvoiceStatus.Draft: throw new InvalidOperationException(); 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); //Model.Account accountOriginal = invoiceOriginal.Account; //accountOriginal.AccountBalance1 += invoiceOriginal.InvoiceTotal; //accountAccessor.Update(accountOriginal); //accessor.Delete(invoiceOriginal.InvoiceId); //invoice.InsertTime = invoiceOriginal.InsertTime; //invoice.UpdateTime = DateTime.Now; //invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal; //_Insert(invoice); break; case Helper.InvoiceStatus.Null: //invoice.Employee3Id = V.ActiveEmployee.EmployeeId; //invoice.InvoiceZFTime = DateTime.Now; //invoice.InvoiceZFCause = ""; //accessor.Update(invoice); Model.Account account = invoice.Account; account.AccountBalance1 += invoice.InvoiceTotal; accountAccessor.Update(account); break; } break; case Helper.InvoiceStatus.Null: throw new InvalidOperationException(); } }
public void Update(Model.InvoiceQO e) { this.Update <Model.InvoiceQO>(e); }
public void Insert(Model.InvoiceQO e) { this.Insert <Model.InvoiceQO>(e); }