73 lines
1.9 KiB
C#
73 lines
1.9 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 InvoicingTool
|
|
{
|
|
public partial class InputCount : Form
|
|
{
|
|
decimal _Count = 0, _Unit = 2;
|
|
public decimal Count
|
|
{
|
|
get { return _Count; }
|
|
set { _Count = value; }
|
|
}
|
|
|
|
public decimal Unit
|
|
{
|
|
get { return _Unit; }
|
|
set { _Unit = value; }
|
|
}
|
|
public InputCount()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public InputCount(DataRow Row)
|
|
{
|
|
InitializeComponent();
|
|
cobUnit.Items.Add("箱");
|
|
cobUnit.Items.Add(Row["commodity_unit"].ToString());
|
|
cobUnit.Text = "箱";
|
|
txtCount.Focus();
|
|
txtCount.SelectAll();
|
|
}
|
|
private void InputCount_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
}
|
|
|
|
private void txtCount_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
btnEnter_Click(null, null);
|
|
}
|
|
}
|
|
|
|
private void btnEnter_Click(object sender, EventArgs e)
|
|
{
|
|
if (txtCount.Text.ToString().Trim() != "")
|
|
{
|
|
try
|
|
{
|
|
_Count = decimal.Parse(txtCount.Text.ToString().Trim());
|
|
_Unit = cobUnit.Text == "箱" ? 2 : 1;
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
catch
|
|
{
|
|
MessageBox.Show("请输入正确的采购数量!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtCount.Focus();
|
|
txtCount.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|