2025-03-27 15:05:14 +08:00

82 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace HighWay.PrintLable
{
/// <summary>
/// GoodsUpdate.xaml 的交互逻辑
/// </summary>
public partial class GoodsUpdate : Window
{
DataRow goodsRow;
public GoodsUpdate(DataRow dataRow)
{
InitializeComponent();
txtBarCode.Text = dataRow["COMMODITY_BARCODE"].ToString();
txtGoodsName.Text = dataRow["COMMODITY_NAME"].ToString();
txtGoodsUnit.Text = dataRow["COMMODITY_UNIT"].ToString();
txtGoodsRult.Text = dataRow["COMMODITY_RULE"].ToString();
txtMember.Text = dataRow["COMMODITY_MEMBERPRICE"].ToString();
txtPrice.Text = dataRow["COMMODITY_RETAILPRICE"].ToString();
goodsRow = dataRow;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Button keybtn = sender as Button;
switch (keybtn.Name)
{
case "btnClose":
//退出
this.DialogResult = false;
this.Close();
break;
case "btnEnter":
//确认修改
goodsRow["COMMODITY_BARCODE"] = txtBarCode.Text;
goodsRow["COMMODITY_NAME"] = txtGoodsName.Text;
goodsRow["COMMODITY_UNIT"] = txtGoodsUnit.Text;
goodsRow["COMMODITY_RULE"] = txtGoodsRult.Text;
goodsRow["COMMODITY_MEMBERPRICE"] = txtMember.Text;
goodsRow["COMMODITY_RETAILPRICE"] = txtPrice.Text;
this.DialogResult = true;
this.Close();
break;
}
}
private void Window_KeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Escape:
//退出
this.DialogResult = false;
this.Close();
break;
case Key.Enter:
//确认
Button_Click(btnEnter, null);
break;
}
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//点击空白退出
this.DialogResult = false;
this.Close();
}
}
}