narsil/Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.cs

61 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Linq;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Repository;
using System.Collections.Generic;
using Tanshu.Accounts.Entities.Auth;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.PointOfSale
{
public partial class VoidReasonListForm : Form
{
private string[] _list;
public VoidReasonListForm(string[] list)
{
_list = list;
InitializeComponent();
}
private void VoidReasonListForm_Load(object sender, EventArgs e)
{
bsList.DataSource = _list;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
public string SelectedItem
{
get
{
if (bsList.Position >= 0)
{
var item = _list[bsList.Position];
if (item != null)
return item;
}
return null;
}
}
private void dgvVoidReasons_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
this.Close();
}
private void dgvVoidReasons_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
var data = dgvVoidReasons.Rows[e.RowIndex].DataBoundItem as string;
if (e.ColumnIndex == dgvVoidReasons.Columns["Info"].Index)
{
e.Value = data;
}
}
}
}