88 lines
3.0 KiB
C#
88 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Project.Dialog
|
|
{
|
|
public partial class fLogin : Form
|
|
{
|
|
public fLogin()
|
|
{
|
|
InitializeComponent();
|
|
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) => {
|
|
if (e1.KeyCode == Keys.Escape) this.Close();
|
|
};
|
|
}
|
|
private void fLogin_Load(object sender, EventArgs e)
|
|
{
|
|
this.tbID.Text = Pub.setting.lastid;
|
|
this.Show();
|
|
Application.DoEvents();
|
|
|
|
if (this.tbID.Text.isEmpty() == false) tbPW.Focus();
|
|
else tbID.Focus();
|
|
}
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (this.tbID.Text.isEmpty())
|
|
{
|
|
tbID.Focus();
|
|
return;
|
|
}
|
|
if(this.tbPW.Text.isEmpty())
|
|
{
|
|
tbPW.Focus();
|
|
return;
|
|
}
|
|
|
|
//180605
|
|
Pub.setting.lastid = tbID.Text.Trim();
|
|
Pub.setting.Save();
|
|
|
|
var encpass = Pub.MakePasswordEnc(tbPW.Text.Trim());
|
|
var ta = new dsMSSQLTableAdapters.UsersTableAdapter();
|
|
try
|
|
{
|
|
var users = ta.GetIDPW(encpass, tbID.Text.Trim());
|
|
if (users.Rows.Count < 1)
|
|
{
|
|
Util.MsgE("No user");
|
|
tbPW.SelectAll();
|
|
tbPW.Focus();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
var userdr = users.Rows[0] as dsMSSQL.UsersRow;
|
|
FCOMMON.info.Login.no = userdr.id;
|
|
FCOMMON.info.Login.nameK = userdr.name;
|
|
FCOMMON.info.Login.dept = userdr.dept;
|
|
FCOMMON.info.Login.level = userdr.level;
|
|
FCOMMON.info.Login.email = userdr.email;
|
|
FCOMMON.info.Login.nameE = userdr.nameE;
|
|
FCOMMON.info.Login.hp = userdr.hp;
|
|
FCOMMON.info.Login.tel = userdr.tel;
|
|
FCOMMON.info.Login.title = userdr.ads_title;
|
|
}
|
|
DialogResult = DialogResult.OK;
|
|
}catch (Exception ex)
|
|
{
|
|
Util.MsgE("데이터베이스 조회 실패 다음 오류 메세지를 참고하세요.\n\n"+ ex.Message + "\n\n증상이 동일 할 경우 서버가 접속가능한지 먼저 확인하세요");
|
|
DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|