c# A卡测试框架工具集

68 篇文章 1 订阅

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;
using System.Threading;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class LOGIN : Form
    {
        public LOGIN()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            System.Environment.Exit(1);
        }

        private void LOGIN_Load(object sender, EventArgs e)
        {
            this.textBox1.Focus();//焦点
            //this.textBox1.SelectAll();//选中
        }

        public void Errlog(String Err_Str)//生成Log记录
        {
            FileStream fs = new FileStream("Err.log", FileMode.Create, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            sw.WriteLine(Err_Str);
            sw.Close();
            fs.Close();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                BaseDataOperation MyQyLogin = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
                if (MyQyLogin.Querying_Login_Info(1, textBox1.Text.ToString()))
                {
                    textBox2.Enabled = true;
                    textBox1.Enabled = false;
                    this.textBox2.Focus();
                    this.textBox2.SelectAll();
                }
                else
                {
                    label1.Text = "帐号错误";
                    this.textBox1.Focus();
                    this.textBox1.SelectAll();
                }
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text.Length >= 1)
            {
                label1.Text = "";
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                BaseDataOperation MyQyLogin = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
                if (MyQyLogin.Querying_Login_Info(2, textBox2.Text.ToString()))
                {
                    textBox2.Enabled = false;
                    button1.Enabled = true;
                    button1.Focus();
                }
                else
                {
                    label2.Text = "密码错误";
                    textBox2.Focus();
                    textBox2.SelectAll();
                }
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            if (textBox2.Text.Length >= 1)
            {
                label2.Text = "";
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();//隐身登陆界面
            Select_Operation_Items MyFrom = new Select_Operation_Items();
            MyFrom.StartPosition = FormStartPosition.CenterScreen;
            MyFrom.Show();
            //this.Close();
        }
    }
}

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Windows.Forms;
using System.Diagnostics;
using System.Collections;
using System.Web;
using System.Drawing;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public class BaseDataOperation:LOGIN
    {
        private String SERVER;
        private String DATABASE;
        private String UID;
        private String PWD;
        public List<String> KeyValues;


        public BaseDataOperation(String SERVER, String DATABASE, String UID, String PWD)
        {
            this.SERVER = SERVER;
            this.DATABASE = DATABASE;
            this.UID = UID;
            this.PWD = PWD;
        }

        public Boolean Querying_Login_Info(int Status,String Login_Str)//查询核对登陆信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand("usp_Querying_Login_Info",conn);//设置存储过程
                cmd.CommandType = CommandType.StoredProcedure;//启动数据库存储过程
                cmd.Parameters.Add("@Login_Str", Login_Str);
                cmd.Parameters.Add("@Status",Status);
                cmd.Parameters.Add("@rs",1);//设置返回值
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动输出返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Flag = false;
                this.Errlog(ex.ToString());
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        public Boolean Insert_Update_BiosInfo(String Table_Name, String Code_Name, String Product_Name, String Bios_Config_File, String Bios_Date
            , String Bios_PN, String Bios_VerSion, String StoredProcedure_Str)//插入或更新BIOS信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str, conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Table_Name", Table_Name);
                cmd.Parameters.Add("@Code_Name", Code_Name);
                cmd.Parameters.Add("@Product_Name", Product_Name);
                cmd.Parameters.Add("@Bios_Config_File", Bios_Config_File);
                cmd.Parameters.Add("@Bios_Date", Bios_Date);
                cmd.Parameters.Add("@Bios_PN", Bios_PN);
                cmd.Parameters.Add("@Bios_VerSion", Bios_VerSion);
                cmd.Parameters.Add("@rs", 1);
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("更新或插入BIOS信息成功!!", "系统提示", MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("更新或插入BIOS信息失败!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }
        public Boolean Insert_Update_OrderInfo(String Code_Name, String Call_Diag_Name, String StoredProcedure_Str)//查询订单名称是否存在
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str,conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Code_Name", Code_Name);
                cmd.Parameters.Add("@Call_Diag_Name", Call_Diag_Name);
                cmd.Parameters.Add("@rs",1);
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("更新或插入订单信息成功!!", "系统提示", MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("更新或插入订单信息失败!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        public Boolean Insert_Update_BiosItems(String Code_Name, int Bios_Particle_Number, String StoredProcedure_Str)//插入或更新Bios项信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server="+this.SERVER+";database="+this.DATABASE+";uid="+this.UID+";pwd="+this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str, conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Code_Name", Code_Name);
                cmd.Parameters.Add("@Bios_Particle_Number", Bios_Particle_Number);
                cmd.Parameters.Add("@rs",1);//设置返回值
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("插入或更新员工信息成功!!", "系统提示", MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("插入或更新员工信息成功!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }
        public Boolean Insert_Update_Employee(String Line_BOdy, String Job_Number, String Mac_Address, String StoredProcedure_Str)//插入或更新员工信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn=new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str,conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Line_BOdy", Line_BOdy);
                cmd.Parameters.Add("@Job_Number", Job_Number);
                cmd.Parameters.Add("@Mac_Address", Mac_Address);
                cmd.Parameters.Add("@rs",1);//设置返回值
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("插入或更新员工信息成功!!", "系统提示", MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("插入或更新员工信息成功!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        public Boolean AddOrUpdate_DiagPackage_Name(String Diag_Script_Name, String StoredProcedure_Str)//添加Diag包名称
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str,conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Diag_Script_Name", Diag_Script_Name);
                cmd.Parameters.Add("@rs",1);//设置返回值
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("插入Diag包数据成功!!", "系统提示", MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("插入Diag包数据失败!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }
        public Boolean Insert_Update_LineBodyProgram(String Code_Name, String Line_BOdy, String StoredProcedure_Str)//插入或更新换线信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(StoredProcedure_Str,conn);
                cmd.CommandType = CommandType.StoredProcedure;//启动存储过程
                cmd.Parameters.Add("@Code_Name", Code_Name);
                cmd.Parameters.Add("@Line_BOdy", Line_BOdy);
                cmd.Parameters.Add("@rs",1);//设置返回值
                cmd.Parameters["@rs"].Direction = ParameterDirection.Output;//启动返回
                cmd.ExecuteScalar();
                if ((int)cmd.Parameters["@rs"].Value == 0)
                {
                    MessageBox.Show("插入换线数据成功!!","系统提示",MessageBoxButtons.OK);
                    conn.Close();
                    Flag = true;
                }
                else
                {
                    MessageBox.Show("插入换线数据失败!!","系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
                    conn.Close();
                    Flag = false;
                }
            }
            catch (Exception ex)
            {
                Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }
        public Boolean Read_Trandsfer_Line_Info(String Select_Str, String str)//读取换线信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand sqlComm = new SqlCommand(Select_Str,conn);
                SqlDataReader reader = sqlComm.ExecuteReader();
                KeyValues = new List<String>();
                while (reader.Read())
                {
                    KeyValues.Add(reader[str].ToString());
                }
                reader.Close();
                conn.Close();
                Flag = true;
            }
            catch (Exception ex)
            {
                Flag = false;
                this.Errlog(ex.ToString());
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        public Boolean Read_Bios_Info_Storage(String Sql)//读取数据库BIOS_1信息并存储
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand sqlComm = new SqlCommand(Sql,conn);
                SqlDataReader reader = sqlComm.ExecuteReader();
                KeyValues = new List<string>();
                while (reader.Read())
                {
                    KeyValues.Add(reader["Product_Name"].ToString());
                    KeyValues.Add(reader["Bios_Config_File"].ToString());
                    KeyValues.Add(reader["Bios_Date"].ToString());
                    KeyValues.Add(reader["Bios_PN"].ToString());
                    KeyValues.Add(reader["Bios_VerSion"].ToString());
                }
                reader.Close();
                conn.Close();
                Flag = true;
            }
            catch (Exception ex)
            {
                this.Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        public Boolean Read_Select_Operstion_Items_Info(String Sql)//读取数据库选择操作信息
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = "server=" + this.SERVER + ";database=" + this.DATABASE + ";uid=" + this.UID + ";pwd=" + this.PWD;
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                //String Sql = "select * from Select_Operation_Items";
                SqlCommand sqlComm = new SqlCommand(Sql,conn);
                SqlDataReader reader = sqlComm.ExecuteReader();
                KeyValues = new List<string>();
                while (reader.Read())
                {
                   // MessageBox.Show(reader["Item_Name"].ToString());
                    KeyValues.Add(reader["Item_Name"].ToString());
                }
                reader.Close();
                conn.Close();
                Flag = true;
            }
            catch (Exception ex)
            {
                this.Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(),"系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            return Flag;
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // BaseDataOperation
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.ClientSize = new System.Drawing.Size(539, 327);
            this.Name = "BaseDataOperation";
            //this.Load += new System.EventHandler(this.BaseDataOperation_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class Select_Operation_Items : Form
    {
        public Select_Operation_Items()
        {
            InitializeComponent();
        }

        private void Select_Operation_Items_FormClosed(object sender, FormClosedEventArgs e)
        {
            //System.Environment.Exit(1);
        }

        private void Select_Operation_Items_FormClosing(object sender, FormClosingEventArgs e)
        {
            System.Environment.Exit(1);
        }

        private void Select_Operation_Items_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyQueryingSOIL = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyQueryingSOIL.Read_Select_Operstion_Items_Info("select * from Select_Operation_Items"))
            {
                foreach(String ss in MyQueryingSOIL.KeyValues)
                {
                    comboBox1.Items.Add(ss.ToString());
                }
            }
            /*LOGIN MyLg = new LOGIN();
            MyLg.StartPosition = FormStartPosition.CenterScreen;
            MyLg.Show();
            this.Hide();*/
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length >= 1)
            {
                if (comboBox1.Text == "换线生产")
                {
                    this.Hide();
                    Transfer_line MyTl = new Transfer_line();
                    MyTl.StartPosition = FormStartPosition.CenterScreen;
                    MyTl.Show();
                }
                else if (comboBox1.Text == "添加订单信息")
                {
                    this.Hide();
                    AddOrderInfo MyAi = new AddOrderInfo();
                    MyAi.StartPosition = FormStartPosition.CenterScreen;
                    MyAi.Show();
                }
                else if (comboBox1.Text == "添加员工和站位捆绑信息")
                {
                    this.Hide();
                    Add_Emloyee_Info MyAei = new Add_Emloyee_Info();
                    MyAei.StartPosition = FormStartPosition.CenterScreen;
                    MyAei.Show();
                }
                else if (comboBox1.Text == "添加BIOS档案")
                {
                    this.Hide();
                    AddBios_Items MyAbi = new AddBios_Items();
                    MyAbi.StartPosition = FormStartPosition.CenterScreen;
                    MyAbi.Show();
                }
                else if (comboBox1.Text == "添加BIOS_1信息")
                {
                    this.Hide();
                    AddBIOS_1_Info MyAB_1_I = new AddBIOS_1_Info();
                    MyAB_1_I.StartPosition = FormStartPosition.CenterScreen;
                    MyAB_1_I.Show();
                }
                else if (comboBox1.Text == "添加BIOS_2信息")
                {
                    this.Hide();
                    AddBios_2_Info MyAB_2_I = new AddBios_2_Info();
                    MyAB_2_I.StartPosition = FormStartPosition.CenterScreen;
                    MyAB_2_I.Show();
                }
                else if (comboBox1.Text == "查询测试数据")
                {
                    this.Hide();
                    Querying_Test_Data MyQtd = new Querying_Test_Data();
                    MyQtd.StartPosition = FormStartPosition.CenterScreen;
                    MyQtd.Show();
                }
                else if (comboBox1.Text == "添加DIAG包")
                {
                    this.Hide();
                    AddDiagPackageing MyAdpck = new AddDiagPackageing();
                    MyAdpck.StartPosition = FormStartPosition.CenterScreen;
                    MyAdpck.Show();
                }
            }
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Windows.Forms;
using System.Diagnostics;
using System.Collections;
using System.Web;
using System.Drawing;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class Querying_Test_Data : Form
    {
        public Querying_Test_Data()
        {
            InitializeComponent();
        }

        private void Querying_Test_Data_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items Qtd = new Select_Operation_Items();
            Qtd.Show();
            //System.Environment.Exit(0);
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 2)
            {
                comboBox1.Enabled = false;
                comboBox2.Enabled = true;
                comboBox2.Focus();
            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.Text.Length >= 2)
            {
                comboBox2.Enabled = false;
                textBox1.Enabled = true;
                textBox1.Focus();
                textBox1.SelectAll();
            }
        }

        public Boolean QueryingTestData(String ProcStoredProcedure_Str)
        {
            Boolean Flag = false;
            String Conn_Str = String.Empty;
            Conn_Str = @"server=SERVER2\SERVER2;database=E_Graphics_Card;uid=sa;pwd=adminsystem";
            SqlConnection conn = new SqlConnection(Conn_Str);
            conn.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(ProcStoredProcedure_Str,conn);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();
                sda.Fill(ds, "cs");
                dataGridView1.DataSource = ds.Tables[0];
                dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                dataGridView1.ReadOnly = true;
                dataGridView1.DefaultCellStyle.SelectionBackColor = Color.YellowGreen;
                this.label1.Text = "已查询到数据:" + (dataGridView1.Rows.Count - 1).ToString() + "条";
                Flag = true;
            }
            catch (Exception ex)
            {
                //Errlog(ex.ToString());
                Flag = false;
                MessageBox.Show(ex.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return Flag;
        }

        private void AutoSizeColumn(DataGridView dgViewFiles)
        {
            int width = 0;
            //使列自使用宽度
            //对于DataGridView的每一个列都调整
            for (int i = 0; i < dgViewFiles.Columns.Count; i++)
            {
                //将每一列都调整为自动适应模式
                dgViewFiles.AutoResizeColumn(i, DataGridViewAutoSizeColumnMode.AllCells);
                //记录整个DataGridView的宽度
                width += dgViewFiles.Columns[i].Width;
            }
            //判断调整后的宽度与原来设定的宽度的关系,如果是调整后的宽度大于原来设定的宽度,
            //则将DataGridView的列自动调整模式设置为显示的列即可,
            //如果是小于原来设定的宽度,将模式改为填充。
            if (width > dgViewFiles.Size.Width)
            {
                dgViewFiles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            }
            else
            {
                dgViewFiles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            //冻结某列 从左开始 0,1,2
            dgViewFiles.Columns[1].Frozen = true;
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length >= 4)
                {
                    textBox1.Enabled = false;
                    button1.Enabled = true;
                    button1.Focus();
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String Sql = String.Empty;
            if (comboBox1.Text.ToString().ToUpper() == "WINDOWS")
            {
                Sql = "SELECT * FROM Graogucs_Card_Win WHERE " + comboBox2.Text.ToString() + "=" + @"'" + textBox1.Text.ToString() + @"'";
                if(QueryingTestData(Sql)==true)
                    AutoSizeColumn(dataGridView1);
            }
            else if (comboBox1.Text.ToString().ToUpper() == "DIAG")
            {
                Sql = "SELECT * FROM Graogucs_Card_Diag WHERE " + comboBox2.Text.ToString() + "=" + @"'" + textBox1.Text.ToString() + @"'";
                if(QueryingTestData(Sql)==true)
                    AutoSizeColumn(dataGridView1);
            }
        }

        private void Querying_Test_Data_Load(object sender, EventArgs e)
        {

        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class Transfer_line : Form
    {
        public Transfer_line()
        {
            InitializeComponent();
        }

        private void Transfer_line_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items TL = new Select_Operation_Items();
            TL.Show();
            //System.Environment.Exit(0);
        }

        private void Transfer_line_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyTlL = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL.Read_Trandsfer_Line_Info("select * from Test_Lin_Info", "Test_Line"))
            {
                foreach (String nn in MyTlL.KeyValues)
                {
                    this.comboBox1.Items.Add(nn);
                }
                comboBox1.Enabled = true;
            }
            BaseDataOperation MyTlL_1 = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL_1.Read_Trandsfer_Line_Info("select * from NB_Diag_Test_Args", "Code_Name"))
            {
                foreach (String nn in MyTlL_1.KeyValues)
                {
                    this.comboBox2.Items.Add(nn);
                }
                //comboBox2.Enabled = true;
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length >= 5)
            {
                comboBox1.Enabled = false;
                comboBox2.Enabled = true;
                comboBox2.Focus();
            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.Text.Length >= 5)
            {
                comboBox2.Enabled = false;
                button1.Enabled = true;
                button1.Focus();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyIn_Up_tl = new BaseDataOperation(@"SERVER2\SERVER2","E_Graphics_Card","sa","adminsystem");
            if (MyIn_Up_tl.Insert_Update_LineBodyProgram(comboBox2.Text.ToString().ToUpper(), comboBox1.Text.ToString().ToUpper(), "usp_Insert_Update_Line_Body_Program"))
            {
                System.Environment.Exit(0);
            }
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class AddBIOS_1_Info : Form
    {
        public AddBIOS_1_Info()
        {
            InitializeComponent();
        }

        private void AddBIOS_1_Info_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items AB1 = new Select_Operation_Items();
            AB1.Show();
            //System.Environment.Exit(1);
        }

        private void AddBIOS_1_Info_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyTlL_1 = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL_1.Read_Trandsfer_Line_Info("select * from NB_Diag_Test_Args", "Code_Name"))
            {
                foreach (String nn in MyTlL_1.KeyValues)
                {
                    this.comboBox1.Items.Add(nn);
                }
                comboBox1.Enabled = true;
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 6)
            {
                BaseDataOperation MyRB_1_I = new BaseDataOperation(@"SERVER2\SERVER2","E_Graphics_Card","sa","adminsystem");
                if (MyRB_1_I.Read_Bios_Info_Storage("select * from NB_Diag_Test_Args where Code_Name="+@"'"+comboBox1.Text.ToString().ToUpper()+@"'"))
                {
                    textBox1.Text = MyRB_1_I.KeyValues[0].ToString().ToUpper();
                    textBox2.Text = MyRB_1_I.KeyValues[1].ToString().ToUpper();
                    textBox3.Text = MyRB_1_I.KeyValues[2].ToString().ToUpper();
                    textBox4.Text = MyRB_1_I.KeyValues[3].ToString().ToUpper();
                    textBox5.Text = MyRB_1_I.KeyValues[4].ToString().ToUpper();
                }
                comboBox1.Enabled = false;
                textBox1.Enabled = true;
                textBox1.Focus();
                textBox2.SelectAll();
            }
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length > 5)
                {
                    textBox1.Enabled = false;
                    textBox2.Enabled = true;
                    textBox2.Focus();
                    textBox2.SelectAll();
                }
            }
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox2.Text.Length > 5)
                {
                    textBox2.Enabled = false;
                    textBox3.Enabled = true;
                    textBox3.Focus();
                    textBox3.SelectAll();
                }
            }
        }

        private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox3.Text.Length > 5)
                {
                    textBox3.Enabled = false;
                    textBox4.Enabled = true;
                    textBox4.Focus();
                    textBox4.SelectAll();
                }
            }
        }

        private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox4.Text.Length > 5)
                {
                    textBox4.Enabled = false;
                    textBox5.Enabled = true;
                    textBox5.Focus();
                    textBox5.SelectAll();
                }
            }
        }

        private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox5.Text.Length > 5)
                {
                    textBox5.Enabled = false;
                    button1.Enabled = true;
                    button1.Focus();
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyAB_1_I = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyAB_1_I.Insert_Update_BiosInfo("NB_Diag_Test_Args", comboBox1.Text.ToString().ToUpper(),
                textBox1.Text.ToString().ToUpper(), textBox2.Text.ToString().ToUpper(), textBox3.Text.ToString().ToUpper(),
                textBox4.Text.ToString().ToUpper(), textBox5.Text.ToString().ToUpper(), "usp_Insert_Update_Bios_Info_Args"))
            {
                System.Environment.Exit(0);
            }
        }

    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class AddBios_2_Info : Form
    {
        public AddBios_2_Info()
        {
            InitializeComponent();
        }

        private void AddBios_2_Info_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items AB2 = new Select_Operation_Items();
            AB2.Show();
            //System.Environment.Exit(0);
        }

        private void AddBios_2_Info_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyTlL_2 = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL_2.Read_Trandsfer_Line_Info("select * from NB_Diag_Test_Args", "Code_Name"))
            {
                foreach (String nn in MyTlL_2.KeyValues)
                {
                    this.comboBox1.Items.Add(nn);
                }
                this.comboBox1.Enabled = true;
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 6)
            {
                BaseDataOperation MyRB_1_I = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
                if (MyRB_1_I.Read_Bios_Info_Storage("select * from NB_Diag_Test_Args where Code_Name=" + @"'" + comboBox1.Text.ToString().ToUpper() + @"'"))
                {
                    textBox1.Text = MyRB_1_I.KeyValues[0].ToString().ToUpper();
                    textBox2.Text = MyRB_1_I.KeyValues[1].ToString().ToUpper();
                    textBox3.Text = MyRB_1_I.KeyValues[2].ToString().ToUpper();
                    textBox4.Text = MyRB_1_I.KeyValues[3].ToString().ToUpper();
                    textBox5.Text = MyRB_1_I.KeyValues[4].ToString().ToUpper();
                }
                comboBox1.Enabled = false;
                textBox1.Enabled = true;
                textBox1.Focus();
                textBox2.SelectAll();
            }
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length > 5)
                {
                    textBox1.Enabled = false;
                    textBox2.Enabled = true;
                    textBox2.Focus();
                    textBox2.SelectAll();
                }
            }
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox2.Text.Length > 5)
                {
                    textBox2.Enabled = false;
                    textBox3.Enabled = true;
                    textBox3.Focus();
                    textBox3.SelectAll();
                }
            }
        }

        private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox3.Text.Length > 5)
                {
                    textBox3.Enabled = false;
                    textBox4.Enabled = true;
                    textBox4.Focus();
                    textBox4.SelectAll();
                }
            }
        }

        private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox4.Text.Length > 5)
                {
                    textBox4.Enabled = false;
                    textBox5.Enabled = true;
                    textBox5.Focus();
                    textBox5.SelectAll();
                }
            }
        }

        private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox5.Text.Length > 5)
                {
                    textBox5.Enabled = false;
                    button1.Enabled = true;
                    button1.Focus();
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyAB_1_I = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyAB_1_I.Insert_Update_BiosInfo("NB_Diag_Test_Args_Bios2", comboBox1.Text.ToString().ToUpper(),
                textBox1.Text.ToString().ToUpper(), textBox2.Text.ToString().ToUpper(), textBox3.Text.ToString().ToUpper(),
                textBox4.Text.ToString().ToUpper(), textBox5.Text.ToString().ToUpper(), "usp_Insert_Update_Bios_Info_Args"))
            {
                System.Environment.Exit(0);
            }
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class AddBios_Items : Form
    {
        public AddBios_Items()
        {
            InitializeComponent();
        }

        private void AddBios_Items_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items ABI = new Select_Operation_Items();
            ABI.Show();
            //System.Environment.Exit(1);
        }

        private void AddBios_Items_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyTlL_1 = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL_1.Read_Trandsfer_Line_Info("select * from NB_Diag_Test_Args", "Code_Name"))
            {
                foreach (String nn in MyTlL_1.KeyValues)
                {
                    this.comboBox1.Items.Add(nn);
                }
                comboBox1.Enabled = true;
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 5)
            {
                comboBox1.Enabled = false;
                comboBox2.Enabled = true;
                comboBox2.Focus();
                comboBox2.SelectAll();
            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.Text.Length >= 1)
            {
                comboBox2.Enabled = false;
                button1.Enabled = true;
                button1.Focus();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyInUpBiosIs = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyInUpBiosIs.Insert_Update_BiosItems(comboBox1.Text.ToString().ToUpper(), Convert.ToInt32(comboBox2.Text.ToString()), "usp_Insert_Update_BIOSParticleNumberData"))
            {
                System.Environment.Exit(0);
            }
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class AddDiagPackageing : Form
    {
        public AddDiagPackageing()
        {
            InitializeComponent();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length > 4)
                {
                    textBox1.Enabled = false;
                    button1.Enabled = true;
                    button1.Focus();
                }
            }
        }

        private void AddDiagPackageing_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items ADP = new Select_Operation_Items();
            ADP.Show();
            //System.Environment.Exit(0);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyAdan = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyAdan.AddOrUpdate_DiagPackage_Name(textBox1.Text.ToString().ToUpper(), "usp_AddDiagpackage_Name"))
            {
                System.Environment.Exit(0);
            }
        }

        private void AddDiagPackageing_Load(object sender, EventArgs e)
        {

        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class AddOrderInfo : Form
    {
        public AddOrderInfo()
        {
            InitializeComponent();
        }

        private void AddOrderInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items AOI = new Select_Operation_Items();
            AOI.Show();
            //System.Environment.Exit(0);
        }

        private void AddOrderInfo_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyAoidiag = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyAoidiag.Read_Trandsfer_Line_Info("select * from Diag_Packing_Name", "Diag_Script_Name"))
            {
                foreach (String ss in MyAoidiag.KeyValues)
                    comboBox1.Items.Add(ss);
                textBox1.Enabled = true;
                textBox1.Focus();
                textBox1.SelectAll();
            }
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length >= 5)
                {
                    textBox1.Enabled = false;
                    comboBox1.Enabled = true;
                    comboBox1.Focus();
                }
                else
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 3)
            {
                comboBox1.Enabled = false;
                button1.Enabled = true;
                button1.Focus();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyIn_Up_OrderInfo = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyIn_Up_OrderInfo.Insert_Update_OrderInfo(textBox1.Text.ToString().ToUpper(), comboBox1.Text.ToString().ToUpper(), "usp_Insert_Update_Order_Info"))
            {
                System.Environment.Exit(0);
            }
        }
    }
}
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Diag_Transfer_Line_Tools_V1._00
{
    public partial class Add_Emloyee_Info : Form
    {
        public Add_Emloyee_Info()
        {
            InitializeComponent();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if (textBox1.Text.Length >= 6)
                {
                    textBox1.Enabled = false;
                    comboBox1.Enabled = true;
                    comboBox1.Focus();
                    comboBox1.SelectAll();
                }
            }
        }

        private void Add_Emloyee_Info_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            Select_Operation_Items Aei = new Select_Operation_Items();
            Aei.Show();
            //System.Environment.Exit(0);
        }

        private void Add_Emloyee_Info_Load(object sender, EventArgs e)
        {
            BaseDataOperation MyTlL = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyTlL.Read_Trandsfer_Line_Info("select * from Test_Lin_Info", "Test_Line"))
            {
                foreach (String nn in MyTlL.KeyValues)
                {
                    this.comboBox1.Items.Add(nn);
                }
                textBox1.Enabled = true;
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text.Length > 5)
            {
                comboBox1.Enabled = false;
                textBox2.Enabled = true;
                textBox2.Focus();
                textBox2.SelectAll();
            }
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (textBox2.Text.Length >= 12)
            {
                textBox2.Enabled = false;
                button1.Enabled = true;
                button1.Focus();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BaseDataOperation MyInUp_EmployeeInfo = new BaseDataOperation(@"SERVER2\SERVER2", "E_Graphics_Card", "sa", "adminsystem");
            if (MyInUp_EmployeeInfo.Insert_Update_Employee(comboBox1.Text.ToString().ToUpper(), textBox1.Text.ToString().ToUpper(), textBox2.Text.ToString().ToUpper(), "usp_Insert_Update_Emloyee"))
            {
                System.Environment.Exit(0);
            }
        }
    }
}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值