private void Form1_Load(object sender, EventArgs e) { int searchCount = 0; //string localHostName = Dns.GetHostName();//本机名 //System.Net.IPAddress[] addressList = Dns.GetHostAddresses(localHostName); //foreach (IPAddress ip in addressList) //{ // string sql = "SELECT ID FROM dbo.S_REGISTER_T WHERE IP='" + Function_BLL.EncryptDES(ip.ToString(), "SKQ") + "' AND MAC='" + Function_BLL.EncryptDES(Function_BLL.GetMacBySendARP(ip.ToString()), "57858808") + "' AND HOSTNAME='" + Function_BLL.EncryptDES(localHostName, "57858808") + "';"; // DataTable dt = new DataTable(); // dt = ClsCommon.dbSql.ExecuteDataTable(sql); // if (dt.Rows.Count > 0) // { // searchCount = searchCount + 1; // } //} //if (searchCount == 0) //{ // MessageBox.Show("软件没有注册,请注册后重新登录!"); // Application.Exit(); //} try { List <UsersObject> uos = User_BLL.GetAllUser(); List <UsersObject> uosX = new List <UsersObject>(); int j = 0; for (int i = 0; i < uos.Count; i++) { if (!(uos[i].h_Permissions.Equals("超级管理员"))) { uosX.Add(uos[i]); } else { break; } } if (uosX.Count > 0) { foreach (UsersObject uo in uosX) { userName.Items.Add(uo.h_UserName); } if (userName.Items.Count - 1 < ClsCommon.selectRecord) { } userName.SelectedIndex = ClsCommon.selectRecord; } } catch (Exception ex) { MessageBox.Show("请检查数据库是否正确或网线是否连通," + ex.ToString()); Application.Exit(); } }