/// <summary>
        /// 页面加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PersonBasicForm_Load(object sender, EventArgs e)
        {
            if ("人员信息录入".Equals(Text))
            {
                LblOldPlace1.Hide();
                LblOldPlace2.Hide();

                #region 初始选项
                // 省
                Provinces = new List <string> {
                    province
                };
                CmbProvince.DataSource = Provinces;
                // 市
                Cities = new List <string> {
                    city
                };
                CmbCity.DataSource = Cities;
                // 县/区
                Places = new List <string> {
                    place
                };
                CmbPlace.DataSource = Places;
                // 初始省(优化卡顿)
                Provinces = new NativePlaceBLL().QueryProvince();
                // 婚姻状况
                Marry = new List <string> {
                    "未婚"
                };
                CmbMarry.DataSource = Marry;
                // 民族
                Nation = new List <string> {
                    "汉族"
                };
                CmbNation.DataSource = Nation;
                // 人员类别
                PersonType = new SysSettingBLL().SelectByDictName(sys_dict_type.Person);
                List <string> personTypeList = new List <string>();
                foreach (var item in PersonType)
                {
                    personTypeList.Add(item.category_name);
                }
                CmbPersonType.DataSource = personTypeList;
                // 归属地
                BelongPlace = new SysSettingBLL().SelectByDictName(sys_dict_type.BelongPlace);
                List <string> belongPlaceList = new List <string>();
                foreach (var item in BelongPlace)
                {
                    belongPlaceList.Add(item.category_name);
                }
                CmbBelongPlace.DataSource = belongPlaceList;
                #endregion
            }

            if ("人员信息修改".Equals(Text))
            {
                #region 初始选项
                person_basic pb = new person_basic();

                pb.id      = 1027;
                pb.user_id = UserInfoBLL.UserId;



                List <person_basic> list = new PersonBasicBLL().Query(pb);

                // 姓名
                TxtName.Text = list[0].name;
                // 曾用名
                TxtFormerName.Text = list[0].former_name;
                // 性别
                if (list[0].gender.Equals("男"))
                {
                    RdoMale.Checked = true;
                }
                if (list[0].gender.Equals("女"))
                {
                    RdoFemale.Checked = true;
                }
                // 身份证
                TxtIdentityNumber.Text = list[0].identity_number;
                // 出生日期
                TimeBirthDate.Value = list[0].birth_date;
                // 归属地
                BelongPlace = new SysSettingBLL().SelectByDictName(sys_dict_type.BelongPlace);
                foreach (var item in BelongPlace)
                {
                    if (item.id.Equals(list[0].belong_place_id))
                    {
                        CmbBelongPlace.DataSource = new List <string>()
                        {
                            item.category_name
                        };
                    }
                }
                // 民族
                Nation = new List <string> {
                    "汉族"
                };
                CmbNation.DataSource = Nation;
                // 地址
                TxtAddress.Text = list[0].address;
                // 籍贯
                // 省
                Provinces = new List <string> {
                    province
                };
                CmbProvince.DataSource = Provinces;
                // 市
                Cities = new List <string> {
                    city
                };
                CmbCity.DataSource = Cities;
                // 县/区
                Places = new List <string> {
                    place
                };
                CmbPlace.DataSource = Places;
                // 初始省(优化卡顿)
                Provinces = new NativePlaceBLL().QueryProvince();
                // 原籍贯
                LblOldPlace2.Text = list[0].native_place;
                // 收入状况
                TxtIncome.Text = list[0].income.ToString();
                // 性格特征
                TxtTemper.Text = list[0].temper;
                // 就业状况
                TxtJob.Text = list[0].job_status;
                // 婚姻状况
                if (list[0].marry_status)
                {
                    CmbMarry.DataSource = new List <string>()
                    {
                        "已婚"
                    }
                }
                ;
                if (!list[0].marry_status)
                {
                    CmbMarry.DataSource = new List <string>()
                    {
                        "未婚"
                    }
                }
                ;
                // 家庭状况
                TxtFamily.Text = list[0].family;
                // 重点人员类别
                PersonType = new SysSettingBLL().SelectByDictName(sys_dict_type.Person);
                foreach (var item in PersonType)
                {
                    if (item.id.Equals(list[0].person_type_id))
                    {
                        CmbPersonType.DataSource = new List <string>()
                        {
                            item.category_name
                        };
                    }
                }
                // qq
                TxtQQ.Text = list[0].qq;
                // 电话
                TxtPhone.Text = list[0].phone;
                #endregion
            }

            #region 错误提示
            LblName.Hide();
            LblFormerName.Hide();
            LblIdentityNumber.Hide();
            LblBirthDate.Hide();
            LblAddress.Hide();
            LblNativePlace.Hide();
            LblIncome.Hide();
            LblPhone.Hide();
            #endregion
        }
        /// <summary>
        /// 确认提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            person_basic pb = new person_basic();

            pb.user_id = pb.id = 1027;
            pb.user_id = UserInfoBLL.UserId;



            #region 姓名
            string name = TxtName.Text.Replace(" ", "");
            if (RegexComm.IsValidName(name))
            {
                LblName.Hide();
                pb.name = name;
            }
            else
            {
                LblName.Show();
                return;
            }
            #endregion

            #region 曾用名
            if (!string.IsNullOrEmpty(TxtFormerName.Text))
            {
                string formerName = TxtFormerName.Text.Replace(" ", "");
                if (RegexComm.IsValidName(formerName))
                {
                    LblFormerName.Hide();
                    pb.former_name = formerName;
                }
                else
                {
                    LblFormerName.Show();
                    return;
                }
            }
            #endregion

            #region 性别
            if (RdoMale.Checked)
            {
                pb.gender = RdoMale.Text;
            }
            if (RdoFemale.Checked)
            {
                pb.gender = RdoFemale.Text;
            }
            #endregion

            #region 身份证号
            if (RegexComm.IsValidIdNum(TxtIdentityNumber.Text))
            {
                LblIdentityNumber.Hide();
                pb.identity_number = TxtIdentityNumber.Text;
            }
            else
            {
                LblIdentityNumber.Show();
                return;
            }
            #endregion

            #region 出生日期
            if (DateTime.Compare(TimeBirthDate.Value, DateTime.Now) > 0)
            {
                LblBirthDate.Show();
                return;
            }
            else
            {
                LblBirthDate.Hide();
                pb.birth_date = TimeBirthDate.Value;
            }

            #endregion

            #region 籍贯
            if (CmbProvince.Text.Equals(province) || CmbCity.Text.Equals(city) || CmbPlace.Text.Equals(place))
            {
                LblNativePlace.Show();
            }
            else
            {
                LblNativePlace.Hide();
                pb.native_place = CmbProvince.Text + CmbCity.Text + CmbPlace.Text;
            }
            #endregion

            #region 婚姻状况
            if (CmbMarry.Text.Equals("已婚"))
            {
                pb.marry_status = true;
            }
            if (CmbMarry.Text.Equals("未婚"))
            {
                pb.marry_status = false;
            }
            #endregion

            #region 工作状况
            pb.job_status = TxtJob.Text;
            #endregion

            #region 收入状况
            if (!string.IsNullOrEmpty(TxtIncome.Text))
            {
                if (Convert.ToDecimal(TxtIncome.Text) < 0)
                {
                    LblIncome.Show();
                    return;
                }
                else
                {
                    LblIncome.Hide();
                    pb.income = Convert.ToDecimal(TxtIncome.Text);
                }
            }
            #endregion

            #region 性格特征
            pb.temper = TxtTemper.Text;
            #endregion

            #region 家庭成员
            pb.family = TxtFamily.Text;
            #endregion

            #region 人员类型
            PersonType = new SysSettingBLL().SelectByDictName(sys_dict_type.Person);
            foreach (var item in PersonType)
            {
                if (item.category_name.Equals(CmbPersonType.Text))
                {
                    pb.person_type_id = item.id;
                }
            }
            #endregion

            #region QQ
            pb.qq = TxtQQ.Text;
            #endregion

            #region 住址
            if (string.IsNullOrEmpty(TxtAddress.Text))
            {
                LblAddress.Show();
            }
            else
            {
                LblAddress.Hide();
                pb.address = TxtAddress.Text;
            }
            #endregion

            #region 电话
            if (!string.IsNullOrWhiteSpace(TxtPhone.Text))
            {
                string phone = TxtPhone.Text.Replace(" ", "");
                if (RegexComm.IsValidPhone(phone))
                {
                    LblPhone.Hide();
                    pb.phone = phone;
                }
                else
                {
                    LblPhone.Show();
                    return;
                }
            }
            else
            {
                LblPhone.Show();
                return;
            }
            #endregion

            #region 归属地
            BelongPlace = new SysSettingBLL().SelectByDictName(sys_dict_type.BelongPlace);
            foreach (var item in BelongPlace)
            {
                if (item.category_name.Equals(CmbBelongPlace.Text))
                {
                    pb.belong_place_id = item.id;
                }
            }
            #endregion

            #region 民族
            pb.nation = CmbNation.Text;
            #endregion

            #region 添加日期
            pb.input_time = DateTime.Now;
            #endregion

            #region 用户id
            pb.user_id = UserInfoBLL.UserId;
            #endregion

            #region  除标记
            pb.isdel = 0;
            #endregion

            #region 判断结果
            Result r;
            if (Text.Equals("人员信息录入"))
            {
                r = new PersonBasicBLL().Add(pb);
            }
            else
            {
                r = new PersonBasicBLL().Update(pb);
            }

            //if (r.Code == RES.OK)
            //{
            //    MessageBoxCustom.Show(r.Message, "", this);
            //}
            //else
            //{
            //    MessageBoxCustom.Show(r.Message, "", this);
            //}
            MessageBoxCustom.Show(r.Message, "提示", this);
            #endregion
        }