using DevExpress.XtraEditors; using PublicLib; 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 KHSCALE_TP { public partial class FormLogin : Form { U3Database u3Database = new U3Database(); string m_COMP_CD = ""; string Login_ID = ""; string Login_NM = ""; public FormLogin(string COMP_CD) { InitializeComponent(); m_COMP_CD = COMP_CD; DataView grpUser = new DataView(GetUserTable()); UtilClass.SetLookup(this.lookUpEdit_User, grpUser, "USR_ID", "USR_NM", true); } private DataTable GetUserTable() { try { return u3Database.OpenSQL("select a.USR_ID, a.USR_NM from dbo.T_SYS_USER a where a.COMP_CD = '" + m_COMP_CD + "' and isnull(a.DEL_YN,'N') = 'N' and isnull(a.PRODUCTION_YN,'N') = 'Y' order by a.USR_NM" + ""); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } return null; } private void simpleButton_Cancel_Click(object sender, EventArgs e) { this.Close(); } private void simpleButton_Number_Click(object sender, EventArgs e) { bool bCehck = false; if (textEdit_PIN.Text.Length <= 3) { textEdit_PIN.Text += ((SimpleButton)sender).Text; textEdit_PIN.ForeColor = Color.Black; bCehck = true; } if (textEdit_PIN.Text.Length == 4 && bCehck) { InputCheck(); } } private void simpleButton1_X_Click(object sender, EventArgs e) { textEdit_PIN.Text = ""; textEdit_PIN.ForeColor = Color.Black; } private void simpleButton_Backspace_Click(object sender, EventArgs e) { if (textEdit_PIN.Text.Length < 1) return; textEdit_PIN.Text = textEdit_PIN.Text.Substring(0, textEdit_PIN.Text.Length - 1); textEdit_PIN.ForeColor = Color.Black; } private void InputCheck() { try { this.Cursor = Cursors.WaitCursor; DataTable dt = u3Database.OpenSQL("select a.USR_ID, a.USR_NM from dbo.T_SYS_USER a where a.COMP_CD = '" + m_COMP_CD + "' and isnull(a.DEL_YN,'N') = 'N' and isnull(a.PRODUCTION_YN,'N') = 'Y'" + " and '" + this.lookUpEdit_User.EditValue + "' = a.USR_ID and TOUCH_PIN_NO = '" + textEdit_PIN.Text + "'" + " order by a.USR_NM" + ""); if (dt != null) { if (dt.Rows.Count > 0) { ConstClass._USR_ID = dt.Rows[0]["USR_ID"].ToString(); ConstClass._USR_NM = dt.Rows[0]["USR_NM"].ToString(); this.DialogResult = DialogResult.Yes; } else { textEdit_PIN.ForeColor = Color.Red; } } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } this.Cursor = Cursors.Arrow; } } }