private void btnTest_Click(object sender, EventArgs e) { frmLogin login = new frmLogin(); string account = "Administrator"; string pwd = ""; if (!login.Login(ref account, ref pwd, LoginFlags.loginNormal)) { return; } string connstr = string.Format("{0}:{1}", tbAddress.Text, tbPort.Text); int iRet = L3Session.Open(connstr, account, pwd); if (iRet == 0) { MessageBox.Show("连接测试成功!"); L3Session.Close(); } else { string msg = string.Format("连接测试失败!错误码:0x{0:X}", iRet); MessageBox.Show(msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { if (flag != "999") { Log("2"); L3Session.Close(); L3Session.Dispose(); CommDataMag.CommonMethed.FlushMemory(); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { //if (L3Session.Opened) //{ // //登录时,记录账号、IP等信息 // string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); // string strsql = "insert into TS_USER_LOGIN(userid,ip,pcname,flag,version) values ('"; // strsql += labelUser.Text + "','" + GetLocalIP() + "','" + GetComputerName() + "','退出','" + version + "')"; // exeSql(L3DataAdapter, strsql); //} L3Session.Close(); L3Session.Dispose(); CommDataMag.CommonMethed.FlushMemory(); }
private void OnLogout(object sender, EventArgs e) { L3Session.Close(); labelUser.Text = "未登录"; menuLogin.Enabled = true; menuChangePassWord.Enabled = false; menuLogout.Enabled = false; l3DataBoxTeamID.Text = ""; l3DataBoxShiftID.Text = ""; L3DataAdapter.ReCheckAccessRights(); }
private void timer3_Tick(object sender, EventArgs e) { try { if (L3Session.Opened) { if (existms() == "否") { timer3.Enabled = false; L3Session.Close(); labelUser.Text = "未登录"; menuLogin.Enabled = true; menuChangePassWord.Enabled = false; menuLogout.Enabled = false; l3DataBoxTeamID.Text = ""; l3DataBoxShiftID.Text = ""; L3DataAdapter.ReCheckAccessRights(); } } } catch { } }
private void btnTest_Click(object sender, EventArgs e) { //frmLogin login = new frmLogin(); string account = "Administrator"; string pwd = ""; //if (!login.Login(ref account, ref pwd, LoginFlags.loginNormal)) // return; string connstr = string.Format("{0}:{1}", tbAddress.Text, tbPort.Text); connstr = connstr.Replace("1089", "2525"); int iRet = L3Session.Open(connstr, account, pwd); if (iRet == 0) { MessageBox.Show("连接测试成功!"); L3Session.Close(); } else { string msg = string.Format("连接测试失败!错误码:0x{0:X}", iRet); if (msg.Contains("A0001400")) { msg = "服务器无效或已死机!"; } else if (msg.Contains("A0000402")) { msg = "密码错误!"; } else if (msg.Contains("A0000400")) { msg = "用户名不存在!"; } MessageBox.Show(msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }