📄 sysmain.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace netCS
{
/// <summary>
/// sysmain 的摘要说明。
/// </summary>
public class sysmain : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.ListBox listBox3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ListBox listBox4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.DataGrid dataGrid3;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.ListBox listBox5;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.ListBox listBox6;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button16;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.ListBox listBox7;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.Button button17;
private System.Windows.Forms.ComboBox comboBox3;
private System.Windows.Forms.Button button18;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.ComboBox comboBox4;
private System.Windows.Forms.Button button19;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public sysmain()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
SqlConnection cn=new SqlConnection(conn.con);
SqlCommand com=new SqlCommand("select * from fact where factpos=0",cn);
SqlCommand comt=new SqlCommand("select * from fact",cn);
SqlCommand comtt=new SqlCommand("select * from rules",cn);
SqlCommand com2=new SqlCommand("select distinct ruleno from rules",cn);
SqlCommand com3=new SqlCommand("select * from fact where factpos=1",cn);
SqlDataAdapter adp=new SqlDataAdapter(com);
DataTable dt=new DataTable("mydt");
adp.Fill(dt);
adp.SelectCommand=comt;
DataTable dtt=new DataTable("mydt1");
adp.Fill(dtt);
adp.SelectCommand=comtt;
DataTable dttt=new DataTable("mydt2");
adp.Fill(dttt);
adp.SelectCommand=com2;
DataTable dt1=new DataTable("mydt3");
adp.Fill(dt1);
adp.SelectCommand=com3;
DataTable dt2=new DataTable("mydt4");
adp.Fill(dt2);
int i;
for(i=0;i<dt.Rows.Count;i++)
{
listBox4.Items.Add(dt.Rows[i]["facttx"].ToString());
}
for(i=0;i<dt.Rows.Count;i++)
{
listBox7.Items.Add(dt.Rows[i]["factno"].ToString());
}
for(i=0;i<dt.Rows.Count;i++)
{
listBox2.Items.Add(dt.Rows[i]["factno"].ToString());
}
SqlCommand com1=new SqlCommand("delete from cs_tempfact",cn);
try
{
cn.Open();
com1.ExecuteNonQuery();
cn.Close();
}
catch
{
if(MessageBox.Show("数据清空出现问题","错误提示",MessageBoxButtons.RetryCancel)==DialogResult.Cancel)
Application.Exit();
}
dataGrid1.DataSource=dtt;
dataGrid2.DataSource=dtt;
dataGrid3.DataSource=dttt;
for(i=0;i<dtt.Rows.Count;i++)
{
comboBox1.Items.Add(dtt.Rows[i]["factno"].ToString());
}
for(i=0;i<dt1.Rows.Count;i++)
{
comboBox2.Items.Add(dt1.Rows[i]["ruleno"].ToString());
}
for(i=0;i<dt1.Rows.Count;i++)
{
comboBox4.Items.Add(dt1.Rows[i]["ruleno"].ToString());
}
for(i=0;i<dt2.Rows.Count;i++)
{
comboBox3.Items.Add(dt2.Rows[i]["factno"].ToString());
}
//for(i=0;i<dt.Rows.Count;i++)
//dataGrid1.
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.listBox3 = new System.Windows.Forms.ListBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.listBox4 = new System.Windows.Forms.ListBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button11 = new System.Windows.Forms.Button();
this.label12 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.button10 = new System.Windows.Forms.Button();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button9 = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle2 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.button19 = new System.Windows.Forms.Button();
this.comboBox4 = new System.Windows.Forms.ComboBox();
this.label23 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button18 = new System.Windows.Forms.Button();
this.comboBox3 = new System.Windows.Forms.ComboBox();
this.button17 = new System.Windows.Forms.Button();
this.textBox10 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.listBox7 = new System.Windows.Forms.ListBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label();
this.button16 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.listBox6 = new System.Windows.Forms.ListBox();
this.label19 = new System.Windows.Forms.Label();
this.button14 = new System.Windows.Forms.Button();
this.listBox5 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.button13 = new System.Windows.Forms.Button();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.button12 = new System.Windows.Forms.Button();
this.dataGrid3 = new System.Windows.Forms.DataGrid();
this.label15 = new System.Windows.Forms.Label();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.tabPage4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tabPage1,
this.tabPage2,
this.tabPage3,
this.tabPage4});
this.tabControl1.Location = new System.Drawing.Point(0, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(816, 712);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox1,
this.button2,
this.label1});
this.tabPage1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(808, 687);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "欢迎界面";
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(8, 56);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(752, 376);
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// button2
//
this.button2.Location = new System.Drawing.Point(344, 8);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(152, 32);
this.button2.TabIndex = 1;
this.button2.Text = "波形显示界面";
//
// label1
//
this.label1.Font = new System.Drawing.Font("楷体_GB2312", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(336, 48);
this.label1.TabIndex = 0;
this.label1.Text = "欢迎进入故障诊断专家系统";
//
// tabPage2
//
this.tabPage2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox1,
this.button1,
this.label4,
this.button3,
this.button4,
this.listBox3,
this.label5,
this.label6,
this.listBox4});
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(808, 687);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "正向推理";
this.tabPage2.Click += new System.EventHandler(this.tabPage2_Click);
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.Location = new System.Drawing.Point(112, 408);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(400, 14);
this.textBox1.TabIndex = 16;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(536, 416);
this.button1.Name = "button1";
this.button1.TabIndex = 15;
this.button1.Text = "数据刷新";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label4
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -