private void machineLoginStart() { try { //用来终止登录线程 setLoginResult("正在登录中...请稍后"); disabledControls(); clearControls(); string d = mc.GetCpuID(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) { machinecode = machinecode.Insert(i, "-"); } DataTable dt1 = LinkMySql.MySqlQuery("select * from " + Global.sqlUserTable + " where machinecode='" + machinecode + "' and registtime=(select min(registtime) from " + Global.sqlUserTable + " where machinecode='" + machinecode + "') and isdel='1'"); if (dt1 != null && dt1.Rows.Count > 0) { DataRow dr1 = dt1.Rows[0]; Global.user_name = dr1["user_name"].ToString(); Global.user_realname = dr1["user_realname"].ToString(); Global.user_province = dr1["user_province"].ToString(); Global.user_vali = dr1["user_vali"].ToString(); Global.allowlogin = dr1["allowlogin"].ToString(); Global.loginType = "2"; if (dr1["allowlogin"].ToString().Equals("1")) { string mysql = "UPDATE " + Global.sqlUserTable + " SET `online`='2',lastloginip='" + getIP.GetWebIP() + "',lastlogintime=now(),lastloginplace='" + getIP.GetWebCity() + "',soft_version='" + Global.version + "',onlinetime=now() " + " where user_name='" + Global.user_name + "'"; int res = LinkMySql.MySqlExcute(mysql); if (res == 0) { setLoginResult("登录失败,请稍后重试!"); return; } //clearUserProfile();//清空用户配置文档 loginToMain(); } else { setLoginResult("您没有使用权限!"); } } else { setLoginResult("请您进行申请,并由管理员为您开通以后再进行此项操作。"); } enabledControls(); } catch (Exception err) { MessageBox.Show(err.Message, "友情提示"); throw err; } }
private void machineLoginStart() { setLoginResult("正在登录中...请稍后"); string d = mc.GetCpuID(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) { machinecode = machinecode.Insert(i, "-"); } DataSet ds1 = lms.conn("select * from " + Global.sqlUserTable + " where machinecode='" + machinecode + "'and registtime=(select min(registtime) from " + Global.sqlUserTable + " where machinecode='" + machinecode + "') and isdel='1'"); DataTable dt1 = ds1.Tables[0]; if (dt1 != null && dt1.Rows.Count > 0) { DataRow dr1 = dt1.Rows[0]; Global.user_name = dr1["user_name"].ToString(); Global.user_realname = dr1["user_realname"].ToString(); Global.user_province = dr1["user_province"].ToString(); Global.user_vali = dr1["user_vali"].ToString(); Global.allowlogin = dr1["allowlogin"].ToString(); Global.loginType = "2"; if (dr1["allowlogin"].ToString().Equals("1")) { string mysql = "UPDATE " + Global.sqlUserTable + " SET `online`='2',lastloginip='" + getIP.GetWebIP() + "',lastlogintime=now(),lastloginplace='" + getIP.GetWebCity() + "' where user_name='" + Global.user_name + "'"; lms.conn(mysql); clearUserProfile(); while (Global.main_msg.Length > 0)//确保main界面上方滚动条的文字已经读入 { this.DialogResult = DialogResult.OK; break; } } else { setLoginResult("您没有使用权限!"); } } else { setLoginResult("请您进行申请,并由管理员为您开通以后再进行此项操作。"); } }
private void Regist_Load(object sender, EventArgs e) { MachineCode mc = new MachineCode(); //string a = mc.GetCpuInfo(); string b = mc.GetHDid(); //string c = mc.GetMoAddress(); string d = mc.GetCpuID(); //string ee = mc.GetHardDiskID(); //string f = mc.GetHostName(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) { machinecode = machinecode.Insert(i, "-"); } textBox8.Text = machinecode; }
private void Regist_Load(object sender, EventArgs e) { MachineCode mc = new MachineCode(); //string a = mc.GetCpuInfo(); string b = mc.GetHDid(); //string c = mc.GetMoAddress(); string d = mc.GetCpuID(); //string ee = mc.GetHardDiskID(); //string f = mc.GetHostName(); string g = mc.GetMacAddress(); string machinecode = d + g; for (int i = 4; i < machinecode.Length; i += 5) machinecode = machinecode.Insert(i, "-"); textBox8.Text = machinecode; }