⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initexprofile.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
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 + -