90 lines
3.0 KiB
C#
90 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using GZTW.AyaNova.BLL;
|
|
|
|
|
|
namespace AyaNovaOL
|
|
{
|
|
public partial class SelectAyaNovaContacts : Form
|
|
{
|
|
private RootObjectTypes mObjectType;
|
|
private VendorTypes mVendorType;
|
|
public SelectAyaNovaContacts(RootObjectTypes oType, VendorTypes vType)
|
|
{
|
|
mObjectType = oType;
|
|
mVendorType = vType;
|
|
InitializeComponent();
|
|
}
|
|
|
|
public List<Guid> SelectedIDList;
|
|
private void SelectAyaNovaContacts_Load(object sender, EventArgs e)
|
|
{
|
|
SelectedIDList=new List<Guid>();
|
|
switch (mObjectType)
|
|
{
|
|
case RootObjectTypes.Client:
|
|
{
|
|
ClientPickList cpl = ClientPickList.GetList(true);
|
|
foreach (ClientPickList.ClientPickListInfo i in cpl)
|
|
{
|
|
grid.Rows.Add(false, i.Name, i.ID.ToString());
|
|
}
|
|
|
|
}
|
|
break;
|
|
case RootObjectTypes.HeadOffice:
|
|
{
|
|
GenericNVList l = GenericNVList.GetList("HEADOFFICE", "ID", "NAME", true, false, true);
|
|
foreach (System.Collections.DictionaryEntry d in l.BindableList)
|
|
grid.Rows.Add(false,d.Value.ToString(), new Guid(d.Key.ToString()));
|
|
}
|
|
break;
|
|
case RootObjectTypes.Vendor:
|
|
{
|
|
VendorPickList cpl = VendorPickList.GetList(mVendorType);
|
|
foreach (VendorPickList.VendorPickListInfo i in cpl)
|
|
{
|
|
grid.Rows.Add(false, i.VendorType.ToString() + " - " + i.Name, i.ID.ToString());
|
|
}
|
|
}
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
//gather up list of id's
|
|
foreach (DataGridViewRow r in grid.Rows)
|
|
{
|
|
if ((bool)r.Cells["Select"].Value == true)
|
|
SelectedIDList.Add(new Guid(r.Cells["ID"].Value.ToString()));
|
|
}
|
|
//and exit
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
|
|
private void ckAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
bool bSelected=ckAll.Checked;
|
|
foreach (DataGridViewRow r in grid.Rows)
|
|
{
|
|
r.Cells["Select"].Value = bSelected;
|
|
}
|
|
}
|
|
}
|
|
}
|