|
|
@ -59,20 +59,28 @@ namespace Audit.View |
|
|
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 (int.Parse(this.stuff_GRAVITY.Text) < 0 || int.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(int.Parse(this.stuff_Concentration.Text) < 0 || int.Parse(this.stuff_Concentration.Text) > 10) 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 |
|
|
{ |
|
|
{ |
|
|
product.ProductCode = this.stuff_ProductCode.Text; |
|
|
if (ColorCode_SQL > 0) product.Color = ColorCode_SQL;//判断色彩数据是否有效,有效写入
|
|
|
product.ProductName = this.stuff_ProductName.Text; |
|
|
if (string.IsNullOrEmpty(this.stuff_Price.Text) == false) product.Price = Double.Parse(this.stuff_Price.Text);//判断价格数据是否有效,有效写入
|
|
|
product.Price = int.Parse(this.stuff_Price.Text); |
|
|
if (string.IsNullOrEmpty(this.stuff_ProductUnit.Text) == false) product.ProductUnit = int.Parse(this.stuff_ProductUnit.Text);//判断供应商数据是否有效,有效写入
|
|
|
product.GRAVITY = int.Parse(this.stuff_GRAVITY.Text); |
|
|
product.ProductCode = this.stuff_ProductCode.Text;//写入原料代码
|
|
|
product.ProductUnit = int.Parse(this.stuff_ProductUnit.Text); |
|
|
product.ProductName = this.stuff_ProductName.Text;//写入原料名称
|
|
|
product.Concentration = int.Parse(this.stuff_Concentration.Text); |
|
|
product.GRAVITY = Double.Parse(this.stuff_GRAVITY.Text);//写入原料比重
|
|
|
product.ProductType = int_stuff_ProductType; |
|
|
product.Concentration = Double.Parse(this.stuff_Concentration.Text);//写入原料浓度
|
|
|
product.Color = ColorCode_SQL; |
|
|
product.ProductType = int_stuff_ProductType;//写入原料类型
|
|
|
//var count = Product().Insert(product);
|
|
|
var count = new ProductProvider().Insert(product);//实例化并添加数据库信息。
|
|
|
|
|
|
if (count == 0)//判断执行是否成功
|
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("ERR.C0110-1:添加失败"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
System.Windows.MessageBox.Show("添加完成"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|