diff --git a/View/StuffView.xaml.cs b/View/StuffView.xaml.cs
index 9724339..e42d6d4 100644
--- a/View/StuffView.xaml.cs
+++ b/View/StuffView.xaml.cs
@@ -34,7 +34,9 @@ namespace Audit.View
{
InitializeComponent();
}
-
+ ///
+ /// 公共变量数组实体
+ ///
private Product product = new Product();//最终存入sql的实体
private Product product_temp = new Product();//取出自sql的实体缓存
@@ -65,7 +67,12 @@ namespace Audit.View
{
if (int_stuff_ProductType == 0)//判断是否为染料,非染料写空
{
- string value = stuff_Color.Background.ToString();//获取色彩框背景色
+ string colorValue = stuff_Color.Background.ToString();//获取色彩框背景色"#FFC1C2C3"
+ string StuffColor_R = string.Format("{0:X2}", colorValue.Substring(3, 2));//获取红色参数C1
+ string StuffColor_G = string.Format("{0:X2}", colorValue.Substring(5, 2));//获取绿色参数C2
+ string StuffColor_B = string.Format("{0:X2}", colorValue.Substring(7, 2));//获取蓝色参数C3
+ string StuffColor = StuffColor_B + StuffColor_G + StuffColor_R;//合并16进制rgb参数
+ int ColorCode_SQL = Convert.ToInt32(StuffColor, 16);//16进制转10进制
if (ColorCode_SQL >= 0) product.Color = ColorCode_SQL;//判断色彩数据是否有效,有效写入
}
else
@@ -79,16 +86,10 @@ namespace Audit.View
product.GRAVITY = Double.Parse(this.stuff_GRAVITY.Text);//写入原料比重
product.Concentration = Double.Parse(this.stuff_Concentration.Text);//写入原料浓度
product.ProductType = int_stuff_ProductType;//写入原料类型
- var countwd = new ProductProvider().Delete(product_temp);//删除数据库原目标信息。
+ new ProductProvider().Delete(product_temp);//删除数据库原目标信息。
var count = new ProductProvider().Insert(product);//添加数据库信息。
- if (count == 0)//判断执行是否成功
- {
- System.Windows.MessageBox.Show("ERR.C0110-1:添加失败","错误");
- }
- else
- {
- System.Windows.MessageBox.Show("添加完成");
- }
+ if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-1:添加失败","错误");//判断执行是否成功
+
}
}
@@ -144,11 +145,6 @@ namespace Audit.View
}
- ///
- ///存储色彩变量
- ///
- public static int ColorCode_SQL;
-
private void Stuff_Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
{
@@ -159,9 +155,9 @@ namespace Audit.View
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
stuff_Color.Background = new SolidColorBrush(MColor);//ARGB参数输出至stuff_Color的背景色
- string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
+ //string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
//string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB
- ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
+ //ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
}
}
}