|
|
@ -52,17 +52,17 @@ namespace Audit.View |
|
|
if (this.stuff_ProductType.Text == "染料") int_stuff_ProductType = 0;//原料类型0。染料,1助剂,2粉体
|
|
|
if (this.stuff_ProductType.Text == "染料") int_stuff_ProductType = 0;//原料类型0。染料,1助剂,2粉体
|
|
|
if (this.stuff_ProductType.Text == "助剂") int_stuff_ProductType = 1; |
|
|
if (this.stuff_ProductType.Text == "助剂") int_stuff_ProductType = 1; |
|
|
if (this.stuff_ProductType.Text == "粉体助剂") int_stuff_ProductType = 2; |
|
|
if (this.stuff_ProductType.Text == "粉体助剂") int_stuff_ProductType = 2; |
|
|
if (string.IsNullOrEmpty(this.stuff_ProductCode.Text)) System.Windows.MessageBox.Show("ERR.C0101:无效的原料信息");//检查原料代码
|
|
|
if (string.IsNullOrEmpty(this.stuff_ProductCode.Text)) System.Windows.MessageBox.Show("ERR.C0101:无效的原料信息", "错误");//检查原料代码
|
|
|
else |
|
|
else |
|
|
if (string.IsNullOrEmpty(this.stuff_ProductName.Text)) System.Windows.MessageBox.Show("ERR.C0101-2:无效的原料信息,名称不可为空");//检查原料名称
|
|
|
if (string.IsNullOrEmpty(this.stuff_ProductName.Text)) System.Windows.MessageBox.Show("ERR.C0101-2:无效的原料信息", "错误");//检查原料名称
|
|
|
else |
|
|
else |
|
|
if (string.IsNullOrEmpty(this.stuff_ProductType.Text)) System.Windows.MessageBox.Show("ERR.C0101-3:无效的原料信息,类型不可为空");//检查原料类型
|
|
|
if (string.IsNullOrEmpty(this.stuff_ProductType.Text)) System.Windows.MessageBox.Show("ERR.C0101-3:无效的原料信息", "错误");//检查原料类型
|
|
|
else |
|
|
else |
|
|
if (string.IsNullOrEmpty(this.stuff_GRAVITY.Text)) System.Windows.MessageBox.Show("ERR.C0101-1:无效的原料信息,比重不可为空");//检查原料比重
|
|
|
if (string.IsNullOrEmpty(this.stuff_GRAVITY.Text)) System.Windows.MessageBox.Show("ERR.C0101-1:无效的原料信息", "错误");//检查原料比重
|
|
|
else |
|
|
else |
|
|
if (float.Parse(this.stuff_GRAVITY.Text) < 0 || float.Parse(this.stuff_GRAVITY.Text) > 5) System.Windows.MessageBox.Show("ERR.C0102-1:原料信息错误,比重错误");//检查比重输入数值
|
|
|
if (float.Parse(this.stuff_GRAVITY.Text) < 0 || float.Parse(this.stuff_GRAVITY.Text) > 5) System.Windows.MessageBox.Show("ERR.C0102-1:原料信息错误", "错误");//检查比重输入数值
|
|
|
else |
|
|
else |
|
|
if(float.Parse(this.stuff_Concentration.Text) < 0 || float.Parse(this.stuff_Concentration.Text) > 100) System.Windows.MessageBox.Show("ERR.C0102-2:原料信息错误,浓度错误");//检查浓度输入数值
|
|
|
if(float.Parse(this.stuff_Concentration.Text) < 0 || float.Parse(this.stuff_Concentration.Text) > 100) System.Windows.MessageBox.Show("ERR.C0102-2:原料信息错误", "错误");//检查浓度输入数值
|
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (int_stuff_ProductType == 0)//判断是否为染料,非染料写空
|
|
|
if (int_stuff_ProductType == 0)//判断是否为染料,非染料写空
|
|
|
@ -84,11 +84,11 @@ namespace Audit.View |
|
|
var count = new ProductProvider().Insert(product);//添加数据库信息。
|
|
|
var count = new ProductProvider().Insert(product);//添加数据库信息。
|
|
|
if (count == 0)//判断执行是否成功
|
|
|
if (count == 0)//判断执行是否成功
|
|
|
{ |
|
|
{ |
|
|
System.Windows.MessageBox.Show("ERR.C0110-1:添加失败"); |
|
|
System.Windows.MessageBox.Show("ERR.C0110-1:添加失败","错误"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
System.Windows.MessageBox.Show("添加完成"); |
|
|
System.Windows.MessageBox.Show("添加完成"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -96,14 +96,12 @@ namespace Audit.View |
|
|
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
|
|
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
|
|
{ |
|
|
{ |
|
|
product.ProductCode = this.stuff_ProductCode.Text;//原料代码
|
|
|
product.ProductCode = this.stuff_ProductCode.Text;//原料代码
|
|
|
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
|
|
|
string ShowProductName = "是否删除" + this.stuff_ProductName.Text;//获取原料名并拼接提示字符串
|
|
|
if (count == 0)//判断执行是否成功
|
|
|
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
|
|
|
|
|
|
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
|
|
|
{ |
|
|
{ |
|
|
System.Windows.MessageBox.Show("ERR.C0110-2:删除失败"); |
|
|
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
|
|
|
} |
|
|
if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("删除完成"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -148,6 +146,7 @@ namespace Audit.View |
|
|
///存储色彩变量
|
|
|
///存储色彩变量
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public static int ColorCode_SQL; |
|
|
public static int ColorCode_SQL; |
|
|
|
|
|
private List<Product> Product; |
|
|
|
|
|
|
|
|
private void Stuff_Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
|
|
|
private void Stuff_Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
|
|
|
{ |
|
|
{ |
|
|
|