using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Tanshu.Accounts.Entities; using Tanshu.Accounts.Repository; namespace Tanshu.Accounts.PointOfSale { public partial class TaxListForm : Form { private IList _list; public TaxListForm() { InitializeComponent(); } private void btnAdd_Click(object sender, EventArgs e) { using (var frm = new TaxEditForm()) frm.ShowDialog(); _list = TaxBI.List(); bsList.DataSource = _list; } private void TaxListForm_Load(object sender, EventArgs e) { _list = TaxBI.List(); bsList.DataSource = _list; } private void btnEdit_Click(object sender, EventArgs e) { var id = ((Tax)bsList.Current).TaxID; using (var frm = new TaxEditForm(id)) frm.ShowDialog(); _list = TaxBI.List(); bsList.DataSource = _list; } private void btnExit_Click(object sender, EventArgs e) { this.Close(); } private void dgvTaxes_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { var data = dgvTaxes.Rows[e.RowIndex].DataBoundItem as Tax; if (data == null) return; if (e.ColumnIndex != 1) return; var rate = (decimal)e.Value; e.Value = string.Format("{0:P}", rate); } } }