忱 沈 4 years ago
parent
commit
9b7de37cc8
  1. 4
      View/QueryView.xaml.cs
  2. 27
      View/StuffView.xaml.cs
  3. 6
      Windows/LogWindow.xaml.cs

4
View/QueryView.xaml.cs

@ -39,14 +39,14 @@ namespace Audit.View
{
if (string.IsNullOrWhiteSpace(query_start) || string.IsNullOrWhiteSpace(query_end))//判断查询时间是否存在
{
MessageBox.Show("SC:无效查询信息");//返回无效信息弹窗
MessageBox.Show("SC:无效查询信息", "错误");//返回无效信息弹窗
}
else
{
int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1
if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效
{
MessageBox.Show("SC:无效查询时间");//返回无效时间弹窗
MessageBox.Show("SC:无效查询时间", "错误");//返回无效时间弹窗
}
else
{

27
View/StuffView.xaml.cs

@ -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 = 1;
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
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
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
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
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
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
{
if (int_stuff_ProductType == 0)//判断是否为染料,非染料写空
@ -84,7 +84,7 @@ namespace Audit.View
var count = new ProductProvider().Insert(product);//添加数据库信息。
if (count == 0)//判断执行是否成功
{
System.Windows.MessageBox.Show("ERR.C0110-1:添加失败");
System.Windows.MessageBox.Show("ERR.C0110-1:添加失败","错误");
}
else
{
@ -96,14 +96,12 @@ namespace Audit.View
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
product.ProductCode = this.stuff_ProductCode.Text;//原料代码
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
if (count == 0)//判断执行是否成功
string ShowProductName = "是否删除" + this.stuff_ProductName.Text;//获取原料名并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
{
System.Windows.MessageBox.Show("ERR.C0110-2:删除失败");
}
else
{
System.Windows.MessageBox.Show("删除完成");
var count = new ProductProvider().Delete(product);//删除数据库目标信息。
if (count == 0) System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
}
}
@ -148,6 +146,7 @@ namespace Audit.View
///存储色彩变量
/// </summary>
public static int ColorCode_SQL;
private List<Product> Product;
private void Stuff_Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
{

6
Windows/LogWindow.xaml.cs

@ -59,7 +59,7 @@ namespace Audit.Windows
{
if ((Passwds == "sql") || (Passwds == "SQL"))//数据库设置页面判断
{
MessageBox.Show("警告:进入数据库设置请您明确操作目的及可能需承担的后果");
MessageBox.Show("进入数据库设置请您明确操作目的及可能需承担的后果", "警告");
Windows.Set_up_Sql setup = new Windows.Set_up_Sql();
setup.Show();//实例化并打开设置窗口
this.Close();//关闭当前窗口
@ -75,7 +75,7 @@ namespace Audit.Windows
}
else
{
MessageBox.Show("ERR.C0001:拒绝登录");//设置密码错误
MessageBox.Show("ERR.C0001:拒绝登录", "错误");//设置密码错误
}
}
@ -86,7 +86,7 @@ namespace Audit.Windows
var usersql = UserAccountProvide.Select().FirstOrDefault(item => item.UserCode == users && item.PassWord == Passwds);//查询比较用户信息
if (usersql == null)//判断查询结果
{
MessageBox.Show("ERR.C0000:用户名或密码错误");
MessageBox.Show("ERR.C0000:用户名或密码错误", "错误");
}
else
{

Loading…
Cancel
Save