| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 | using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace FPER{    public partial class frmLogin : Form    {        public frmLogin()        {            InitializeComponent();        }        MDIParent parent;        Form showForm;        ReceiverConfigVo configVO;        int sIncorrectPassword = 0;        private void btnCancel_Click(object sender, EventArgs e)        {            try            {                this.Close();            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        public void SetShowForm(Form showForm)        {            try            {                this.showForm = showForm;            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        private void frmLogin_Load(object sender, EventArgs e)        {            try            {                //txtMasterUserId.Text = "";                txtMasterPassword.Text = "";            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        public void setParent(MDIParent parent)        {            try            {                this.parent = parent;                this.configVO = this.parent.MyConfigVO;                txtMasterUserId.Text = this.configVO.Master_user_id;                txtMasterPassword.Focus();            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)        {            try            {                if (this.parent != null)                {                    this.parent.CloseLoginForm();                }            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        private void txtMasterPassword_KeyDown(object sender, KeyEventArgs e)        {            try            {                if (e.KeyCode == Keys.Enter) btnOK_Click(this.btnOK, System.EventArgs.Empty);                if (e.KeyCode == Keys.Back) txtMasterPassword.Text = "";            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);            }        }        private void btnOK_Click(object sender, EventArgs e)        {            try            {                Util.ChkTxtBox(txtMasterUserId, "관리자ID");                //Util.ChkTxtBox(txtMasterPassword, "관리자암호");                string userId = txtMasterUserId.Text.Trim().ToLower();                string passwd = txtMasterPassword.Text.Trim().ToLower();                if (userId.Equals(this.configVO.Master_user_id.ToLower()))                {                    if (passwd.Equals(this.configVO.Master_password.ToLower()))                    {                        this.Close();                        if (this.showForm != null)                        {                            //this.showForm.Show();                            this.parent.ShowChildForm(showForm);                        }                    }                    else                    {                        sIncorrectPassword++;                        if (sIncorrectPassword > 3)                        {                            MessageBox.Show("암호입력 오류 횟수가 3회를 초과 하였습니다. ", Application.ProductName);                            this.Close();                        }                        else                        {                            MessageBox.Show("암호가 일치하지 않습니다.", Application.ProductName);                        }                    }                }                else                {                    MessageBox.Show("관리자ID가 올바르지 않습니다.", Application.ProductName);                }            }            catch (Exception ex)            {                Util.UErrorMessage(ex, 0, 0);                //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);            }        }    }}
 |