?? initexprofile.cs
字號:
?namespace Imps.Client.Pc.Provsion2
{
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Utils;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Common;
using Imps.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class InitExProfile : ProfileControlBase
{
private XComboBox cboBloodType;
private XComboBox cboPrimaryEmail;
private IContainer components;
private DateTimeSelectControl ctlDateTime;
private XLabel label1;
private XLabel label2;
private XLabel label3;
private XLabel label4;
private XLabel lblBirthday;
private XLabel lblBloodType;
private XLabel lblExtend;
private XLabel lblHomePhone_Nav;
private XLabel lblOtherEmail;
private XLabel lblOtherPhone_Nav;
private XLabel lblPersonalEmail_Nav;
private XLabel lblRelation;
private XLabel lblSeperate;
private XLabel lblWorkEmail_Nav;
private XLabel lblWorkPhone_Nav;
private TextBox txtHomePhone;
private TextBox txtHoroscope;
private TextBox txtLunarAnimal;
private TextBox txtOtherEmail;
private TextBox txtOtherPhone;
private TextBox txtPersonalEmail;
private TextBox txtWorkEmail;
private TextBox txtWorkPhone;
public InitExProfile(ProvsionData pdata) : base(pdata)
{
this.InitializeComponent();
this.LoadResource();
this.Init();
base.Load += new EventHandler(this.InitExProfile_Load);
}
private bool CheckData()
{
if (!StringHelper.IsAscii(this.txtHomePhone.Text))
{
BalloonHelper.ShowBallon(this.txtHomePhone, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!StringHelper.IsAscii(this.txtWorkPhone.Text))
{
BalloonHelper.ShowBallon(this.txtWorkPhone, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!StringHelper.IsAscii(this.txtOtherPhone.Text))
{
BalloonHelper.ShowBallon(this.txtOtherPhone, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!StringHelper.IsAscii(this.txtPersonalEmail.Text))
{
BalloonHelper.ShowBallon(this.txtPersonalEmail, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!StringHelper.IsAscii(this.txtWorkEmail.Text))
{
BalloonHelper.ShowBallon(this.txtWorkEmail, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!StringHelper.IsAscii(this.txtOtherEmail.Text))
{
BalloonHelper.ShowBallon(this.txtOtherEmail, StringTable.MsgAsciiOnly, "請注意", ToolTipIcon.Info, 0x5dc);
return false;
}
if (!this.CheckMail(this.txtPersonalEmail))
{
BalloonHelper.ShowBallon(this.txtPersonalEmail, "個人電子郵件地址不正確!", "錯誤!", ToolTipIcon.Error, 0x5dc);
return false;
}
if (!this.CheckMail(this.txtWorkEmail))
{
BalloonHelper.ShowBallon(this.txtWorkEmail, "工作電子郵件地址不正確!", "錯誤!", ToolTipIcon.Error, 0x5dc);
return false;
}
if (!this.CheckMail(this.txtOtherEmail))
{
BalloonHelper.ShowBallon(this.txtOtherEmail, "其他電子郵件地址不正確!", "錯誤!", ToolTipIcon.Error, 0x5dc);
return false;
}
DateTime? selectedDateTime = this.ctlDateTime.SelectedDateTime;
if ((selectedDateTime.HasValue && !(this.ctlDateTime.SelectedYearText == "1900")) && ImpsHelper.IsBirthdayValid(selectedDateTime.Value, 0, 0x63, Imps.Client.Core.User.ServerTime))
{
return true;
}
BalloonHelper.ShowInputErrorBallon(this.ctlDateTime, StringTable.PersonalInfo.MsgInvalidAge, StringTable.Options.TitleInvalidInput);
return false;
}
private bool CheckMail(TextBox txtControl)
{
if ((txtControl.Text.Trim() != "") && !StringHelper.IsEmail(txtControl.Text))
{
txtControl.Focus();
txtControl.SelectAll();
return false;
}
return true;
}
private void ctlDateTime_SelectedDateTimeChange(object sender, EventArgs e)
{
this.FormatHoroscopeAndLunarAnimal();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void FormatHoroscopeAndLunarAnimal()
{
try
{
this.txtLunarAnimal.Text = this.ctlDateTime.LunalAnimal;
this.txtHoroscope.Text = IMPSEnums.GetEnumDescription<Horoscope>(this.ctlDateTime.Horoscope);
}
catch
{
}
}
public override bool GetValidData()
{
if (!this.CheckData())
{
return false;
}
base._pdata.ProvsionUserInfo.HomePhone.ProposedValue = this.txtHomePhone.Text;
base._pdata.ProvsionUserInfo.OtherPhone.ProposedValue = this.txtOtherPhone.Text;
base._pdata.ProvsionUserInfo.WorkPhone.ProposedValue = this.txtWorkPhone.Text;
base._pdata.ProvsionUserInfo.PersonalEmail.ProposedValue = this.txtPersonalEmail.Text;
base._pdata.ProvsionUserInfo.WorkEmail.ProposedValue = this.txtWorkEmail.Text;
base._pdata.ProvsionUserInfo.OtherEmail.ProposedValue = this.txtOtherEmail.Text;
try
{
base._pdata.ProvsionUserInfo.PrimaryEmail.ProposedValue = (EmailUseType) Enum.Parse(typeof(EmailUseType), this.cboPrimaryEmail.SelectedValue.ToString());
}
catch
{
}
if (this.cboBloodType.SelectedValue != null)
{
base._pdata.ProvsionUserInfo.BloodType.ProposedValue = (BloodType) this.cboBloodType.SelectedValue;
}
DateTime? selectedDateTime = this.ctlDateTime.SelectedDateTime;
if (selectedDateTime.HasValue)
{
base._pdata.ProvsionUserInfo.BirthDate.ProposedValue = selectedDateTime;
}
else
{
base._pdata.ProvsionUserInfo.BirthDate.ProposedValue = new DateTime?(this.ctlDateTime.MinDateTime);
}
base._pdata.ProvsionUserInfo.BirthDateValid.ProposedValue = this.ctlDateTime.SelectedDay != 0;
return true;
}
private void Init()
{
this.ctlDateTime.MinDateTime = new DateTime(0x76c, 1, 1);
this.ctlDateTime.MaxDateTime = DateTime.Today;
List<IMPSEnums.EnumDescription<BloodType>> enumDescriptionList = IMPSEnums.GetEnumDescriptionList<BloodType>();
this.cboBloodType.DataSource = enumDescriptionList;
this.cboPrimaryEmail.DataSource = IMPSEnums.GetEnumDescriptionList<EmailUseType>();
ControlHelper.ForceControlImeDisable(this.txtWorkPhone);
ControlHelper.ForceControlImeDisable(this.txtHomePhone);
ControlHelper.ForceControlImeDisable(this.txtOtherPhone);
ControlHelper.ForceControlImeDisable(this.txtPersonalEmail);
ControlHelper.ForceControlImeDisable(this.txtWorkEmail);
ControlHelper.ForceControlImeDisable(this.txtOtherEmail);
}
private void InitExProfile_Load(object sender, EventArgs e)
{
this.ShowUserProfile();
}
private void InitializeComponent()
{
this.ctlDateTime = new DateTimeSelectControl();
this.txtHoroscope = new TextBox();
this.cboBloodType = new XComboBox();
this.txtLunarAnimal = new TextBox();
this.cboPrimaryEmail = new XComboBox();
this.txtOtherEmail = new TextBox();
this.txtWorkEmail = new TextBox();
this.txtPersonalEmail = new TextBox();
this.txtOtherPhone = new TextBox();
this.txtWorkPhone = new TextBox();
this.txtHomePhone = new TextBox();
this.lblOtherEmail = new XLabel();
this.lblWorkEmail_Nav = new XLabel();
this.lblPersonalEmail_Nav = new XLabel();
this.label1 = new XLabel();
this.lblOtherPhone_Nav = new XLabel();
this.lblWorkPhone_Nav = new XLabel();
this.lblHomePhone_Nav = new XLabel();
this.lblExtend = new XLabel();
this.lblSeperate = new XLabel();
this.lblBirthday = new XLabel();
this.lblBloodType = new XLabel();
this.label2 = new XLabel();
this.lblRelation = new XLabel();
this.label3 = new XLabel();
this.label4 = new XLabel();
base.SuspendLayout();
this.ctlDateTime.AutoSize = true;
this.ctlDateTime.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.ctlDateTime.BackColor = Color.Transparent;
this.ctlDateTime.Location = new Point(20, 0x35);
this.ctlDateTime.MaxDateTime = new DateTime(0x7d6, 5, 0x16, 0, 0, 0, 0);
this.ctlDateTime.MinDateTime = new DateTime(0L);
this.ctlDateTime.Name = "ctlDateTime";
this.ctlDateTime.NullYear = 0x76c;
this.ctlDateTime.SelectedDateTime = new DateTime(0x76c, 1, 1, 0, 0, 0, 0);
this.ctlDateTime.SelectedDay = 1;
this.ctlDateTime.SelectedMonth = 1;
this.ctlDateTime.SelectedYearText = "";
this.ctlDateTime.Size = new Size(0xa7, 0x18);
this.ctlDateTime.TabIndex = 3;
this.ctlDateTime.SelectedDateTimeChange += new EventHandler(this.ctlDateTime_SelectedDateTimeChange);
this.txtHoroscope.Location = new Point(0xd8, 0x60);
this.txtHoroscope.Name = "txtHoroscope";
this.txtHoroscope.ReadOnly = true;
this.txtHoroscope.Size = new Size(100, 20);
this.txtHoroscope.TabIndex = 5;
this.cboBloodType.BackColor = Color.White;
this.cboBloodType.DisplayMember = "Description";
this.cboBloodType.DropDownStyle = ComboBoxStyle.DropDownList;
this.cboBloodType.FormattingEnabled = true;
this.cboBloodType.Location = new Point(20, 0x62);
this.cboBloodType.Name = "cboBloodType";
this.cboBloodType.Size = new Size(0xa7, 0x15);
this.cboBloodType.TabIndex = 7;
this.cboBloodType.ValueMember = "Value";
this.txtLunarAnimal.Location = new Point(0xd9, 0x35);
this.txtLunarAnimal.Name = "txtLunarAnimal";
this.txtLunarAnimal.ReadOnly = true;
this.txtLunarAnimal.Size = new Size(100, 20);
this.txtLunarAnimal.TabIndex = 9;
this.cboPrimaryEmail.BackColor = Color.White;
this.cboPrimaryEmail.DisplayMember = "Description";
this.cboPrimaryEmail.DropDownStyle = ComboBoxStyle.DropDownList;
this.cboPrimaryEmail.FormattingEnabled = true;
this.cboPrimaryEmail.Location = new Point(20, 0x143);
this.cboPrimaryEmail.Name = "cboPrimaryEmail";
this.cboPrimaryEmail.Size = new Size(0x13d, 0x15);
this.cboPrimaryEmail.TabIndex = 0x19;
this.cboPrimaryEmail.ValueMember = "Value";
this.txtOtherEmail.Location = new Point(0xb0, 0x112);
this.txtOtherEmail.MaxLength = 0x40;
this.txtOtherEmail.Name = "txtOtherEmail";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -