INT_PT002/INT_PT002/Controls/User/ControlMenuUserMyPage.cs

166 lines
5.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_PT002.Forms;
using INT_PT002.Part11_UserManager;
using INT_PT002.DataStore;
using INT_PT002.DialogForms;
namespace INT_PT002.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();
}
#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();
}
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;
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
}
}