Ejemplo n.º 1
0
 public static DatabaseEx getDbInstance()
 {
     if (dbDatabaseEx == null)
     {
         dbDatabaseEx = new DatabaseEx();
     }
     return(dbDatabaseEx);
 }
Ejemplo n.º 2
0
        private void FrmIVDataUpload_Load(object sender, EventArgs e)
        {
            timer1.Enabled = false;

            bool   blFound  = false;
            string hostInfo = Dns.GetHostName();

            System.Net.IPAddress[] addressList = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
            //IPAddress ipaddress = addressList[0];
            //string ips = ipaddress.ToString();
            //MessageBox.Show(ips);


            //获取配置节信息
            this._section = (ColorTestConfigurationSection)ConfigurationManager.GetSection("mes.ivtest");
            //增加线程个数。
            foreach (IVTestDeviceElement element in this._section.Devices)
            {
                foreach (IPAddress ipAddress in addressList)
                {
                    strIP = ipAddress.ToString();
                    if (strIP == element.Name)
                    {
                        blFound        = true;
                        _deviceElement = element;
                        break;
                    }
                }
            }
            if (blFound == false)
            {
                MessageBox.Show("此电脑的IP地址没有在配置文件中找到对应的配置,请联系IT");
                Application.Exit();
            }
            else
            {
                txtFilePath.Text = CommonFun.GetFullFile(_deviceElement.Path, _deviceElement.Format);
                //txtFilePath.Text = _deviceElement.Path;
            }

            string strSql = " select top 1 * from [dbo].[ZWIP_IV_TEST] where EQUIPMENT_CODE='"
                            + _deviceElement.EqpName + "'  order by TEST_TIME desc";

            DataTable dt = DatabaseEx.getDbInstance().getDataTable(strSql);

            if (dt != null && dt.Rows.Count > 0)
            {
                txtTestTime.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dt.Rows[0]["TEST_TIME"].ToString());
            }
            else
            {
                txtTestTime.Text = "1900-01-01 01:01:01";
            }
            txtEqpName.Text = _deviceElement.EqpName;

            btnStart.Enabled     = true;
            btnPause.Enabled     = false;
            txtEqpName.ReadOnly  = true;
            txtTestTime.ReadOnly = true;
            //btnStart_Click(null, null);

            notifyIVData.Visible = false;
        }