91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
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;
|
|
|
|
namespace FCM0000
|
|
{
|
|
public partial class fLovItem : Form
|
|
{
|
|
public string itemName = string.Empty;
|
|
public int item = -1;
|
|
public string itemmodel = string.Empty;
|
|
public decimal itemprice = 0;
|
|
public string SID = string.Empty;
|
|
|
|
public string itemSupply = string.Empty;
|
|
public int itemSupplyidx = -1;
|
|
|
|
string keyword = string.Empty;
|
|
public fLovItem(string search_)
|
|
{
|
|
InitializeComponent();
|
|
this.keyword = search_;
|
|
this.KeyPreview = true;
|
|
this.KeyDown += (s1, e1) => {
|
|
if (e1.KeyCode == Keys.Escape) this.Close();
|
|
};
|
|
|
|
}
|
|
|
|
private void fLovItem_Load(object sender, EventArgs e)
|
|
{
|
|
//search data
|
|
this.ta.FillSearch(this.dsMSSQL.Items,this.keyword);
|
|
}
|
|
|
|
private void itemsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
|
{
|
|
if (itemName.isEmpty() || item == -1) DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
else DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
}
|
|
|
|
|
|
private void bs_CurrentChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dv_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
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();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|