chat 서버 기능 추가
This commit is contained in:
@@ -4,6 +4,8 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -17,7 +19,8 @@ namespace Project.Dialog
|
||||
this.tbID.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) tbPW.Focus(); };
|
||||
this.tbPW.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Enter) btLogin.PerformClick(); };
|
||||
this.KeyPreview = true;
|
||||
this.KeyDown += (s1, e1) => {
|
||||
this.KeyDown += (s1, e1) =>
|
||||
{
|
||||
if (e1.KeyCode == Keys.Escape) this.Close();
|
||||
};
|
||||
}
|
||||
@@ -37,7 +40,7 @@ namespace Project.Dialog
|
||||
|
||||
//마지막으로사용한 부서이름
|
||||
if (Pub.setting.lastdpt.isEmpty()) this.cmbDept.SelectedIndex = -1;
|
||||
else this.cmbDept.Text =Pub.setting.lastdpt;
|
||||
else this.cmbDept.Text = Pub.setting.lastdpt;
|
||||
//foreach (var item in dlist)
|
||||
// if (item != "") this.cmbDept.Items.Add(item);
|
||||
//if (cmbDept.Items.Count > 0) cmbDept.SelectedIndex = 0;
|
||||
@@ -50,18 +53,18 @@ namespace Project.Dialog
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (this.tbID.Text.isEmpty())
|
||||
{
|
||||
tbID.Focus();
|
||||
return;
|
||||
}
|
||||
if(this.tbPW.Text.isEmpty())
|
||||
if (this.tbPW.Text.isEmpty())
|
||||
{
|
||||
tbPW.Focus();
|
||||
return;
|
||||
}
|
||||
if(cmbDept.SelectedIndex < 0)
|
||||
if (cmbDept.SelectedIndex < 0)
|
||||
{
|
||||
FCOMMON.Util.MsgE("소속 부서를 선택하세요");
|
||||
cmbDept.Focus();
|
||||
@@ -97,11 +100,11 @@ namespace Project.Dialog
|
||||
var ta = new dsMSSQLTableAdapters.UsersTableAdapter();
|
||||
try
|
||||
{
|
||||
var users = ta.GetIDPW(encpass, tbID.Text.Trim());
|
||||
var users = ta.GetIDPW(encpass, tbID.Text.Trim());
|
||||
if (users.Rows.Count != 1)
|
||||
{
|
||||
users = ta.GetByNamePw(tbID.Text.Trim(), encpass);
|
||||
if(users.Rows.Count != 1)
|
||||
if (users.Rows.Count != 1)
|
||||
{
|
||||
Util.MsgE("입력한 사용자 계정이 존재하지 않습니다");
|
||||
tbPW.SelectAll();
|
||||
@@ -114,7 +117,7 @@ namespace Project.Dialog
|
||||
var userdr = users.Rows[0] as dsMSSQL.UsersRow;
|
||||
var taGrpUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();
|
||||
var Exist = taGrpUser.ExistCheck(gCode, userdr.id) > 0;
|
||||
if (userdr.level < 9 && Exist==false)
|
||||
if (userdr.level < 9 && Exist == false)
|
||||
{
|
||||
Util.MsgE("입력한 사용자는 지정한 부서에 접속할 권한이 없습니다");
|
||||
return;
|
||||
@@ -136,18 +139,65 @@ namespace Project.Dialog
|
||||
FCOMMON.info.Login.permission = 0;
|
||||
FCOMMON.info.Login.gpermission = int.Parse(gperm);
|
||||
|
||||
//로그인정보 기록
|
||||
AddLoginInfo();
|
||||
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n"+ ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요");
|
||||
Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n" + ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요");
|
||||
DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AddLoginInfo()
|
||||
{
|
||||
string ip = string.Empty;
|
||||
string hostname = Dns.GetHostName();
|
||||
string fullname = System.Net.Dns.GetHostEntry("").HostName;
|
||||
|
||||
var nif = NetworkInterface.GetAllNetworkInterfaces();
|
||||
var host = Dns.GetHostEntry(hostname);
|
||||
foreach (IPAddress r in host.AddressList)
|
||||
{
|
||||
string str = r.ToString();
|
||||
|
||||
if (str != "" && str.Substring(0, 3) == "10.")
|
||||
{
|
||||
ip = str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ip == "" || hostname == "") return;
|
||||
|
||||
try
|
||||
{
|
||||
var db = new EEEntitiesMain();
|
||||
db.EETGW_LoginInfo.Add(new EETGW_LoginInfo
|
||||
{
|
||||
uid = FCOMMON.info.Login.no,
|
||||
hostname = fullname,
|
||||
ip = ip,
|
||||
login = DateTime.Now,
|
||||
wuid = FCOMMON.info.Login.no,
|
||||
wdate = DateTime.Now
|
||||
});
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FCOMMON.Util.MsgE(ex.Message);
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void label3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user