bd28d75c23f08e5c4585269bf53ef6bca25388c6.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace FPER
  9. {
  10. public partial class frmLogin : Form
  11. {
  12. public frmLogin()
  13. {
  14. InitializeComponent();
  15. }
  16. MDIParent parent;
  17. Form showForm;
  18. ReceiverConfigVo configVO;
  19. int sIncorrectPassword = 0;
  20. private void btnCancel_Click(object sender, EventArgs e)
  21. {
  22. try
  23. {
  24. this.Close();
  25. }
  26. catch (Exception ex)
  27. {
  28. Util.UErrorMessage(ex, 0, 0);
  29. }
  30. }
  31. public void SetShowForm(Form showForm)
  32. {
  33. try
  34. {
  35. this.showForm = showForm;
  36. }
  37. catch (Exception ex)
  38. {
  39. Util.UErrorMessage(ex, 0, 0);
  40. }
  41. }
  42. private void frmLogin_Load(object sender, EventArgs e)
  43. {
  44. try
  45. {
  46. //txtMasterUserId.Text = "";
  47. txtMasterPassword.Text = "";
  48. }
  49. catch (Exception ex)
  50. {
  51. Util.UErrorMessage(ex, 0, 0);
  52. }
  53. }
  54. public void setParent(MDIParent parent)
  55. {
  56. try
  57. {
  58. this.parent = parent;
  59. this.configVO = this.parent.MyConfigVO;
  60. txtMasterUserId.Text = this.configVO.Master_user_id;
  61. txtMasterPassword.Focus();
  62. }
  63. catch (Exception ex)
  64. {
  65. Util.UErrorMessage(ex, 0, 0);
  66. }
  67. }
  68. private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)
  69. {
  70. try
  71. {
  72. if (this.parent != null)
  73. {
  74. this.parent.CloseLoginForm();
  75. }
  76. }
  77. catch (Exception ex)
  78. {
  79. Util.UErrorMessage(ex, 0, 0);
  80. }
  81. }
  82. private void txtMasterPassword_KeyDown(object sender, KeyEventArgs e)
  83. {
  84. try
  85. {
  86. if (e.KeyCode == Keys.Enter) btnOK_Click(this.btnOK, System.EventArgs.Empty);
  87. if (e.KeyCode == Keys.Back) txtMasterPassword.Text = "";
  88. }
  89. catch (Exception ex)
  90. {
  91. Util.UErrorMessage(ex, 0, 0);
  92. }
  93. }
  94. private void btnOK_Click(object sender, EventArgs e)
  95. {
  96. try
  97. {
  98. Util.ChkTxtBox(txtMasterUserId, "관리자ID");
  99. //Util.ChkTxtBox(txtMasterPassword, "관리자암호");
  100. string userId = txtMasterUserId.Text.Trim().ToLower();
  101. string passwd = txtMasterPassword.Text.Trim().ToLower();
  102. if (userId.Equals(this.configVO.Master_user_id.ToLower()))
  103. {
  104. if (passwd.Equals(this.configVO.Master_password.ToLower()))
  105. {
  106. this.Close();
  107. if (this.showForm != null)
  108. {
  109. //this.showForm.Show();
  110. this.parent.ShowChildForm(showForm);
  111. }
  112. }
  113. else
  114. {
  115. sIncorrectPassword++;
  116. if (sIncorrectPassword > 3)
  117. {
  118. MessageBox.Show("암호입력 오류 횟수가 3회를 초과 하였습니다. ", Application.ProductName);
  119. this.Close();
  120. }
  121. else
  122. {
  123. MessageBox.Show("암호가 일치하지 않습니다.", Application.ProductName);
  124. }
  125. }
  126. }
  127. else
  128. {
  129. MessageBox.Show("관리자ID가 올바르지 않습니다.", Application.ProductName);
  130. }
  131. }
  132. catch (Exception ex)
  133. {
  134. Util.UErrorMessage(ex, 0, 0);
  135. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  136. }
  137. }
  138. }
  139. }