Files
ayanova7/source/Plugins/AyaNova.Plugin.QBOI/SetAYImportPartVendor.cs
2018-06-29 19:47:36 +00:00

83 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AyaNova.PlugIn.QBOI
{
public partial class SetAYImportPartVendor : Form
{
public SetAYImportPartVendor()
{
InitializeComponent();
}
private void SetAYImportPartVendor_Load(object sender, EventArgs e)
{
this.btnCancel.Image = Util.AyaImage("Cancel24");
this.btnOK.Image = Util.AyaImage("OK24");
this.Icon = Util.AyaIcon("Part16icon");
//Fill combo's and select defaults
DataTable dt = new DataTable("VENDORS");
//setup the columns
dt.Columns.Add("ID", typeof(string));
dt.Columns.Add("FullName", typeof(string));
dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
dt.DefaultView.Sort = "FullName asc";
cbVendor.BindingContext = new BindingContext();
cbVendor.DisplayMember = "FullName";
cbVendor.ValueMember = "ID";
dt.Rows.Add(
new object[] {
Guid.Empty.ToString(),
"< DO NOT SET VENDOR >"
});
foreach (GZTW.AyaNova.BLL.VendorPickList.VendorPickListInfo i in Util.AyaVendorList)
{
if (i.VendorType == GZTW.AyaNova.BLL.VendorTypes.Wholesaler)
{
dt.Rows.Add(
new object[] {
i.ID.ToString(),
i.Name
});
}
}
cbVendor.DataSource = dt;
cbVendor.SelectedValue = Util._ImportPartToAyaNovaDefaultVendorId.ToString();
}
private void btnOK_Click(object sender, EventArgs e)
{
object o = cbVendor.SelectedValue;
if (o == null)
{
Util._ImportPartToAyaNovaDefaultVendorId = Guid.Empty;
}
else
{
Util._ImportPartToAyaNovaDefaultVendorId = new Guid(o.ToString());
}
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}