..
This commit is contained in:
@@ -40,6 +40,35 @@ namespace FCM0000
|
||||
|
||||
private void itemsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var drv = bs.Current as DataRowView;
|
||||
if (drv == null)
|
||||
{
|
||||
itemName = string.Empty;
|
||||
item = -1;
|
||||
itemmodel = string.Empty;
|
||||
itemprice = 0;
|
||||
itemSupply = string.Empty;
|
||||
itemSupplyidx = -1;
|
||||
SID = string.Empty;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var dr = drv.Row as dsMSSQL.ItemsRow;
|
||||
item = dr.idx;
|
||||
if (dr.IsnameNull()) itemName = string.Empty;
|
||||
else itemName = dr.name;
|
||||
if (dr.IsmodelNull()) itemmodel = string.Empty;
|
||||
else itemmodel = dr.model;
|
||||
if (dr.IspriceNull()) itemprice = 0;
|
||||
else itemprice = dr.price;
|
||||
if (dr.IssupplyNull()) itemSupply = string.Empty;
|
||||
else itemSupply = dr.supply;
|
||||
if (dr.IssupplyidxNull()) itemSupplyidx = -1;
|
||||
else itemSupplyidx = dr.supplyidx;
|
||||
SID = dr.sid;
|
||||
}
|
||||
|
||||
if (itemName.isEmpty() || item == -1) DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
else DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
@@ -54,37 +83,15 @@ namespace FCM0000
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
var drv = bs.Current as DataRowView;
|
||||
if (drv == null)
|
||||
{
|
||||
itemName = string.Empty;
|
||||
item = -1;
|
||||
itemmodel = string.Empty;
|
||||
itemprice = 0;
|
||||
itemSupply = string.Empty;
|
||||
itemSupplyidx = -1;
|
||||
SID = string.Empty;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var dr = drv.Row as dsMSSQL.ItemsRow;
|
||||
item = dr.idx;
|
||||
if (dr.IsnameNull()) itemName = string.Empty;
|
||||
else itemName = dr.name;
|
||||
if (dr.IsmodelNull()) itemmodel = string.Empty;
|
||||
else itemmodel = dr.model;
|
||||
if (dr.IspriceNull()) itemprice = 0;
|
||||
else itemprice = dr.price;
|
||||
if (dr.IssupplyNull()) itemSupply = string.Empty;
|
||||
else itemSupply = dr.supply;
|
||||
if (dr.IssupplyidxNull()) itemSupplyidx = -1;
|
||||
else itemSupplyidx = dr.supplyidx;
|
||||
SID = dr.sid;
|
||||
}
|
||||
|
||||
btOK.PerformClick();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void dv_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
btOK.PerformClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user