238 lines
10 KiB
C#
238 lines
10 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using ITC81DB_0H.Forms;
|
|
using ITC81DB_0H_ImageDll;
|
|
|
|
namespace ITC81DB_0H.DialogForms
|
|
{
|
|
public partial class DialogFormLogOn : Form
|
|
{
|
|
#region Field
|
|
private FormMain m_ParentForm;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public DialogFormLogOn(FormMain parent, DataStore.LanguageID language)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.ParentForm = parent;
|
|
|
|
this.InitializeDesign(language);
|
|
this.DefaultSetting();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public FormMain ParentForm
|
|
{
|
|
get { return this.m_ParentForm; }
|
|
set { this.m_ParentForm = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
public void InitializeDesign(DataStore.LanguageID language)
|
|
{
|
|
Class1 images = new Class1();
|
|
|
|
if (language == DataStore.LanguageID.English)
|
|
{
|
|
this.smartForm1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundUserLogin));
|
|
|
|
this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginCancelDisable));
|
|
this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginCancelDown));
|
|
this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginCancelUp));
|
|
this.buttonLogon.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginDisable));
|
|
this.buttonLogon.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginDown));
|
|
this.buttonLogon.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainLoginUp));
|
|
}
|
|
else if (language == DataStore.LanguageID.Chinese)
|
|
{
|
|
this.smartForm1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundUserLogin));
|
|
|
|
this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginCancelDisable));
|
|
this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginCancelDown));
|
|
this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginCancelUp));
|
|
this.buttonLogon.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginLoginDisable));
|
|
this.buttonLogon.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginLoginDown));
|
|
this.buttonLogon.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLoginLoginUp));
|
|
}
|
|
else if (language == DataStore.LanguageID.Czech)
|
|
{
|
|
}
|
|
else if (language == DataStore.LanguageID.Russian)
|
|
{
|
|
this.smartForm1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundUserLogin));
|
|
|
|
this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginCancelDisable));
|
|
this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginCancelDown));
|
|
this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginCancelUp));
|
|
this.buttonLogon.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginLoginDisable));
|
|
this.buttonLogon.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginLoginDown));
|
|
this.buttonLogon.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusMainLoginLoginUp));
|
|
}
|
|
else if (language == DataStore.LanguageID.German)
|
|
{
|
|
this.smartForm1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundUserLogin));
|
|
|
|
this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginCancelDisable));
|
|
this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginCancelDown));
|
|
this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginCancelUp));
|
|
this.buttonLogon.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginDisable));
|
|
this.buttonLogon.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginDown));
|
|
this.buttonLogon.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerFormMainLoginUp));
|
|
}
|
|
else
|
|
{
|
|
this.smartForm1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundUserLogin));
|
|
|
|
this.buttonCancel.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginCancelDisable));
|
|
this.buttonCancel.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginCancelDown));
|
|
this.buttonCancel.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginCancelUp));
|
|
this.buttonLogon.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginDisable));
|
|
this.buttonLogon.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginDown));
|
|
this.buttonLogon.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainLoginUp));
|
|
}
|
|
}
|
|
private void DefaultSetting()
|
|
{
|
|
this.textBoxID.Text = "";
|
|
this.textBoxPassword.Text = "";
|
|
|
|
this.Location = new Point(0, 65);
|
|
|
|
this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
|
|
this.smartKeyboard.Show();
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void buttonLogon_Click(object sender, EventArgs e)
|
|
{
|
|
UserItem user = null;
|
|
|
|
user = this.ParentForm.CurrentUser.FindUser(this.textBoxID.Text);
|
|
|
|
if (user != null)
|
|
{
|
|
if (user.Password == this.textBoxPassword.Text)
|
|
{
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.ID = user.ID;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Password = user.Password;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = user.Group;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(33, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(32, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
private void buttonCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
|
|
private void textBoxID_GotFocus(object sender, EventArgs e)
|
|
{
|
|
this.smartKeyboard.TargetInputObject = this.textBoxID;
|
|
|
|
this.textBoxID.Select(this.textBoxID.Text.Length, 0);
|
|
}
|
|
private void textBoxPassword_GotFocus(object sender, EventArgs e)
|
|
{
|
|
this.smartKeyboard.TargetInputObject = this.textBoxPassword;
|
|
|
|
this.textBoxPassword.Select(this.textBoxPassword.Text.Length, 0);
|
|
}
|
|
|
|
private void smartKeyboard_OnXKeyClick(object sender, EventArgs e)
|
|
{
|
|
//this.smartKeyboard.Show();
|
|
}
|
|
#endregion
|
|
|
|
private void textBoxID_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar == '\r')
|
|
{
|
|
UserItem user = null;
|
|
|
|
user = this.ParentForm.CurrentUser.FindUser(this.textBoxID.Text);
|
|
|
|
if (user != null)
|
|
{
|
|
if (user.Password == this.textBoxPassword.Text)
|
|
{
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.ID = user.ID;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Password = user.Password;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = user.Group;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(33, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(32, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void textBoxPassword_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar == '\r')
|
|
{
|
|
UserItem user = null;
|
|
|
|
user = this.ParentForm.CurrentUser.FindUser(this.textBoxID.Text);
|
|
|
|
if (user != null)
|
|
{
|
|
if (user.Password == this.textBoxPassword.Text)
|
|
{
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.ID = user.ID;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Password = user.Password;
|
|
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = user.Group;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(33, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DialogFormMessage myMsg = new DialogFormMessage(32, this.ParentForm.SystemConfig1.Language);
|
|
myMsg.ShowDialog();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |