|
|
|
@ -33,12 +33,23 @@ namespace Audit.View |
|
|
|
public StuffView() |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
this.DataGridStuff.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 生成序列号的方法
|
|
|
|
/// </summary>
|
|
|
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) |
|
|
|
{ |
|
|
|
e.Row.Header = e.Row.GetIndex() + 1; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 公共变量数组实体
|
|
|
|
/// </summary>
|
|
|
|
private Product product = new Product();//最终存入sql的实体
|
|
|
|
private Product product_temp = new Product();//取出自sql的实体缓存
|
|
|
|
public static Boolean Button_sql = false; |
|
|
|
|
|
|
|
private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
|
|
|
{ |
|
|
|
@ -89,7 +100,7 @@ namespace Audit.View |
|
|
|
new ProductProvider().Delete(product_temp);//删除数据库原目标信息。
|
|
|
|
var count = new ProductProvider().Insert(product);//添加数据库信息。
|
|
|
|
if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-1:添加失败", "错误");//判断执行是否成功
|
|
|
|
|
|
|
|
else Button_sql = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -102,6 +113,7 @@ namespace Audit.View |
|
|
|
{ |
|
|
|
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
|
|
|
|
if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
|
|
|
|
else Button_sql = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|