190 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			190 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
| using System;
 | |
| using System.Linq;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Drawing;
 | |
| using System.Data;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| using INT_LKD.Forms;
 | |
| using INT_LKD.Part11_UserManager;
 | |
| using INT_LKD.DataStore;
 | |
| using INT_LKD.DialogForms;
 | |
| 
 | |
| namespace INT_LKD.Controls
 | |
| {
 | |
|     public partial class ControlMenuUserMyPage : UserControl
 | |
|     {
 | |
|         #region Field
 | |
|         private FormMenu m_ParentForm;
 | |
|         private int m_FirstLineNumber;
 | |
|         #endregion
 | |
| 
 | |
|         #region Constructor
 | |
|         public ControlMenuUserMyPage(FormMenu parent)
 | |
|         {
 | |
|             InitializeComponent();
 | |
| 
 | |
|             this.ParentForm = parent;
 | |
| 
 | |
|             this.Initialize();
 | |
|             this.DefaultSetting();
 | |
|             this.InitializeDesign();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Property
 | |
|         public FormMenu ParentForm
 | |
|         {
 | |
|             get { return this.m_ParentForm; }
 | |
|             private set { this.m_ParentForm = value; }
 | |
|         }
 | |
| 
 | |
|         public int FirstLineNumber
 | |
|         {
 | |
|             get { return this.m_FirstLineNumber; }
 | |
|             set { this.m_FirstLineNumber = value; }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Method
 | |
|         private void Initialize()
 | |
|         {
 | |
|             this.smartGroupBox1.Text = "User > UserEditor";
 | |
|         }
 | |
|         public void DefaultSetting()
 | |
|         {
 | |
|             this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
 | |
|             this.smartKeyboard.Show();
 | |
|         }
 | |
|         public void InitializeDesign()
 | |
|         {
 | |
|             switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE)
 | |
|             {
 | |
|                 case Define.E_LanguageID.Chinese:
 | |
|                     this.labelTitleID.Text = "用户名";
 | |
|                     this.labelTitleNew.Text = "新的";
 | |
|                     this.labelTitleVerify.Text = "核实";
 | |
|                     this.buttonChange.ButtonText = "改变";
 | |
|                     break;
 | |
|                 default:
 | |
|                     this.labelTitleID.Text = "ID";
 | |
|                     this.labelTitleNew.Text = "New";
 | |
|                     this.labelTitleVerify.Text = "Verify";
 | |
|                     this.buttonChange.ButtonText = "Change";
 | |
|                     break;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void UpdateDisplayID()
 | |
|         {
 | |
|             this.labelID.Text = this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.ID;
 | |
|         }
 | |
| 
 | |
|         public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t user)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 if (user.status == 0)
 | |
|                 {
 | |
|                     string code = "", message1 = "", message2 = "";
 | |
| 
 | |
|                     switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE)
 | |
|                     {
 | |
|                         case Define.E_LanguageID.Korean:
 | |
|                             code = "비밀번호 변경";
 | |
|                             message1 = "비밀번호가 변경되었습니다.";
 | |
|                             message2 = "";
 | |
|                             break;
 | |
|                         case Define.E_LanguageID.English:
 | |
|                             code = "Change Password";
 | |
|                             message1 = "Password has been changed.";
 | |
|                             message2 = "";
 | |
|                             break;
 | |
|                         case Define.E_LanguageID.Chinese:
 | |
|                             code = "更改密码";
 | |
|                             message1 = "您的密码已更改。";
 | |
|                             message2 = "";
 | |
|                             break;
 | |
|                         default:
 | |
|                             break;
 | |
|                     }
 | |
| 
 | |
|                     // 비밀번호가 변경되었습니다.
 | |
|                     DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0);
 | |
|                     dlg.ShowDialog();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     DialogFormMessage myMsg = new DialogFormMessage(null, user.status, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
|                     myMsg.ShowDialog();
 | |
|                 }
 | |
|             }
 | |
|             catch (Exception ex)
 | |
|             {
 | |
|                 FormMain.Exception(ex);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public void DisplayRefresh()
 | |
|         {
 | |
|             this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplayMode = Define.E_DisplayModeStore.UserMyPage;
 | |
|             this.ParentForm.ParentForm.SetDisplayMode(Define.E_EquipmentMode.Menu);
 | |
| 
 | |
|             this.UpdateDisplayID();
 | |
| 
 | |
|             this.textBoxNewPassword.Text = "";
 | |
|             this.textBoxVerifyPassword.Text = "";
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Event Handler
 | |
|         private void smartKeyboard_OnXKeyClick(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void textBoxNewPassword_GotFocus(object sender, EventArgs e)
 | |
|         {
 | |
|             this.smartKeyboard.TargetInputObject = this.textBoxNewPassword;
 | |
| 
 | |
|             this.textBoxNewPassword.Select(this.textBoxNewPassword.Text.Length, 0);
 | |
|         }
 | |
|         private void textBoxVerifyPassword_GotFocus(object sender, EventArgs e)
 | |
|         {
 | |
|             this.smartKeyboard.TargetInputObject = this.textBoxVerifyPassword;
 | |
| 
 | |
|             this.textBoxVerifyPassword.Select(this.textBoxVerifyPassword.Text.Length, 0);
 | |
|         }
 | |
| 
 | |
|         private void buttonChangePassword_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string detail = "";
 | |
| 
 | |
|             // Check Password
 | |
|             if (this.textBoxNewPassword.Text.Length < 6 || this.textBoxVerifyPassword.Text.Length < 6)
 | |
|             {
 | |
|                 // PASSWORD : 6~20자 입력하세요
 | |
|                 DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
|                 msg.ShowDialog();
 | |
| 
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             if (this.textBoxNewPassword.Text != this.textBoxVerifyPassword.Text)
 | |
|             {
 | |
|                 // 비밀번호가 동일하지 않습니다
 | |
|                 DialogFormMessage myMsg = new DialogFormMessage(null, 17, this.ParentForm.ParentForm.SystemConfig.LANGUAGE);
 | |
|                 myMsg.ShowDialog();
 | |
| 
 | |
|                 return;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 UserManager.UserManager_UserModifyPW(this.labelID.Text, this.textBoxVerifyPassword.Text);
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| }
 |