宜昌华友成品
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.2 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DBFactory;
namespace wcfControlMonitorClient
{
/// <summary>
/// Creator:Richard.liu
/// 设备故障查询//20151120
/// </summary>
public partial class FrmDeviceErrorSolutions : Form
{
StringBuilder Commsql = new StringBuilder();
private static FrmDeviceErrorSolutions _formInstance;
public static FrmDeviceErrorSolutions FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmDeviceErrorSolutions();
}
return _formInstance;
}
set { _formInstance = value; }
}
DBOperator dbo =CStaticClass.dbo;
public FrmDeviceErrorSolutions()
{
InitializeComponent();
_formInstance = this;//20101028
Commsql.Append("SELECT F_DeviceErrorIndex as 故障代码,F_ErrorName as 故障名称,F_ErrorReasons as 故障原因,F_ErrorSolutions as 故障解决办法 FROM T_Base_Device_State ");
}
private void FrmDeviceErrorLog_FormClosing(object sender, FormClosingEventArgs e)
{
_formInstance = null;
}
private void FrmDeviceErrorSolutions_Load(object sender, EventArgs e)
{
DataView dv = dbo.ExceSQL("SELECT F_DeviceKindIndex ,F_DeviceKindName FROM T_Base_Device_Kind where F_GoodsMoveKindIndex=1").Tables[0].DefaultView;
comboBox1.ValueMember = "F_DeviceKindIndex";
comboBox1.DisplayMember = "F_DeviceKindName";
comboBox1.DataSource = dv;
}
public void button1_Click(object sender, EventArgs e)
{
try
{
int kind = -1;
int errid = -1;
if (comboBox1.SelectedValue!=null)
{
dataGridView1.DataSource = null;
int.TryParse(comboBox1.SelectedValue.ToString(), out kind);
if (int.TryParse(textBox1.Text, out errid)==true)//数字
{
string sql = string.Format("{0} where F_DeviceKindIndex={1} and F_DeviceErrorIndex={2}",Commsql.ToString(),kind,errid);
DisplayErrorSolution(sql);
}
}
}
catch (Exception ex )
{
}
}
private void button2_Click(object sender, EventArgs e)
{
int kind = -1;
if (comboBox1.SelectedValue != null)
{
int.TryParse(comboBox1.SelectedValue.ToString(), out kind);
string sql = string.Format("{0} where F_DeviceKindIndex={1} and F_DeviceErrorIndex>=30 order by F_DeviceErrorIndex", Commsql.ToString(), kind);
DisplayErrorSolution(sql);
}
}
private void DisplayErrorSolution(string sql)
{
DataView dv = dbo.ExceSQL(sql).Tables[0].DefaultView;
dataGridView1.DataSource = dv;
}
}
}