Files
Unimarc/unimarc/WindowsFormsApp1/Login.cs
2021-03-16 09:02:26 +09:00

71 lines
2.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.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class login : Form
{
Helper_DB db = new Helper_DB();
public login()
{
InitializeComponent();
}
private void login_Load(object sender, EventArgs e)
{
// 삭제대상.
ID_text.Text = "sh";
PW_text.Text = "123";
db.DBcon();
}
private void button1_Click(object sender, EventArgs e)
{
db.DBcon();
string DB_Data = db.DB_Search("User_Data", "id", ID_text.Text);
string[] result = DB_Data.Split('|');
((Main)(this.Owner)).User_Name = ID_text.Text;
if (ID_text.Text == result[1]) {
if (PW_text.Text == result[2]) {
this.DialogResult = DialogResult.OK;
this.Close();
}
else {
MessageBox.Show("ID : [" + result[1] + "] PW : [" + result[2] + "]");
// MessageBox.Show("아이디 혹은 비밀번호가 정확하지않습니다.");
}
}
else {
MessageBox.Show("아이디 혹은 비밀번호가 정확하지않습니다.");
// MessageBox.Show("ID : [" + result[1] + "] PW : [" + result[2] + "]");
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void PW_text_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) { button1_Click(null, null); }
}
private void button3_Click(object sender, EventArgs e)
{
ID_text.Text = "admin";
PW_text.Text = "admin";
button1_Click(null, null);
}
}
}