duheng
2024-12-05 b26ae60e85d4a03a2426e6607e7afe89e1c10a5f
WinFrmUI/HStation.WinFrmUI.Organize.Core/00-UserControl/EmloyeeInfoCtrl.cs
@@ -22,22 +22,22 @@
        int staffstatus;
        public void ShowBangDingData(HStation.Vmo.EmployeeMain employee)//展示本控件数据
        {
            //HStation.WinFrmUI.Organize.EmployeeViewModel _employee = new HStation.WinFrmUI.Organize.EmployeeViewModel(employee);
            NametextEdit.Text = employee.FirstName;//姓名
            textEditBianHao.Text = employee.ErpCode;//编号
            ZhiWutextEdit.Text = employee.PositonName;//职务
            DianHuatextEdit.Text = employee.Telephone;//电话
            textEditQianMing.Text = employee.DrawSignal;//签名
            YouXiangtextEdit.Text = employee.Email;//邮箱 
            ChongZhiimageComboBoxEdit.SelectedIndex = employee.RequirePasswordReset;//重置密码
            if (employee.StaffStatus.ToString() == "在职")
            ChongZhiimageComboBoxEdit.SelectedIndex = employee.RequirePasswordReset;
            if (employee.StaffStatus == Vmo.eJobType.exist)
            {
                 staffstatus = 1;
                ZhuangTaiimageComboBoxEdit.SelectedIndex = 1;
            }
            else
            {
                 staffstatus = 0;
                ZhuangTaiimageComboBoxEdit.SelectedIndex = 0;
            }
            ZhuangTaiimageComboBoxEdit.SelectedIndex = staffstatus;//在职状态
            EnglishNametextEdit.Text = employee.LastName;//姓名 英文
        }
@@ -45,6 +45,7 @@
        {
            error = "";
            HStation.Vmo.EmployeeMain employee = new Vmo.EmployeeMain();
            employee = _employee;
            dxValidationProviderBianHao.Validate();
            if (String.IsNullOrEmpty(NametextEdit.Text) || String.IsNullOrEmpty(textEditBianHao.Text) )
            {
@@ -73,6 +74,7 @@
                error = "请输入正确的邮箱!";
                return null;
            }
            employee.LastModifyTime = DateTime.Now.ToString();
            employee.FirstName = NametextEdit.Text;
            employee.ErpCode = textEditBianHao.Text;
            employee.PositonName = ZhiWutextEdit.Text;
@@ -80,7 +82,13 @@
            employee.DrawSignal = textEditQianMing.Text;
            employee.Email = YouXiangtextEdit.Text;
            employee.RequirePasswordReset = ChongZhiimageComboBoxEdit.SelectedIndex;
            employee.StaffStatus = Vmo.eJobType.exist;
            if (ZhuangTaiimageComboBoxEdit.SelectedIndex == 1)
            {
                employee.StaffStatus = Vmo.eJobType.exist;
            }else
            {
                employee.StaffStatus = Vmo.eJobType.leave;
            }
            employee.LastName = EnglishNametextEdit.Text;
            return employee;
        }
@@ -92,36 +100,12 @@
            error = "";
            
            this._employee = employee;
            if (_employee.ErpCode == null)//添加
            if (_employee.EmployeeID == 0)
            {
                //_employee.AddTime = DateTime.Now;
                //_employee.LastModifyTime = DateTime.Now.ToString();
                _employee = ReadCtrlData(out error);
                if (_employee == null)//出现错误并返回null和错误
                {
                    return null;
                }
                if (!string.IsNullOrEmpty(error))
                {
                    return null;
                }
                if (!checkEditCreateLogin.Checked) //没有选中创建用户
                {
                    //loginUserInfoCtrl.SetNoInput();//loginUserInfoCtrl控件不可编辑
                    return _employee;
                }
                //loginUserInfoCtrl.SetOffInput();//loginUserInfoCtrl控件可编辑
                if (loginUserInfoCtrl.NewBindingData(_employee.LoginAccount, out error) == null)//出现错误并返回null和错误
                {
                    return null;
                }
                return _employee;
            }
            else//修改
            {
                //_employee.LastModifyTime = DateTime.Now.ToString();
                _employee = ReadCtrlData(out error);
                employee.AddTime = DateTime.Now;
                if (!string.IsNullOrEmpty(error))
                {
                    return null;
@@ -132,13 +116,39 @@
                }
                else
                {
                    if (loginUserInfoCtrl.NewBindingData(_employee.LoginAccount, out error) != null)//出现错误并返回null和错误
                    if (loginUserInfoCtrl.NewBindingData(_employee.User, out error) == null)//出现错误并返回null和错误
                    {
                        return null;
                    }
                }
                return _employee;
            }
            else
            {
                _employee = ReadCtrlData(out error);
                if (_employee.EmployeeID == 0)//出现错误并返回null和错误
                {
                    error = "出现错误!ID为0!";
                    return null;
                }
                if (!string.IsNullOrEmpty(error))
                {
                    return null;
                }
                if (!checkEditCreateLogin.Checked)//判断是否新建用户
                {
                    return _employee;
                }
                else
                {
                    if (loginUserInfoCtrl.NewBindingData(_employee.User, out error) == null)//出现错误并返回null和错误
                    {
                        return null;
                    }
                }
                return _employee;
            }
        }
@@ -153,19 +163,11 @@
                return;
            }
            ShowBangDingData(employee);
            if (employee.LoginAccount != null)
            if (employee.User != null)
            {
                loginUserInfoCtrl.SetNoInput();
                checkEditCreateLogin.Visible = false;
            }
            //if (!checkEditCreateLogin.Checked)//判断该控件是否可编辑
            //{
            //    loginUserInfoCtrl.SetNoInput();
            //}
            //else
            //{
            //    loginUserInfoCtrl.SetOffInput();
            //}
        }
@@ -180,38 +182,6 @@
            }
            ShowBangDingData(employee);
        }
        //public HStation.Vmo.EmployeeMain GetBindingData(out string error)
        //{
        //    if (this._employee == null)
        //    {
        //        error = "入参为空";
        //        return null;
        //    }
        //    _employee.FirstName = NametextEdit.Text;
        //    _employee.ErpCode = textEditBianHao.Text;
        //    _employee.PositonName = ZhiWutextEdit.Text;
        //    _employee.Telephone = DianHuatextEdit.Text;
        //    _employee.DrawSignal = textEditQianMing.Text;
        //    _employee.Email = YouXiangtextEdit.Text;
        //    _employee.RequirePasswordReset = ChongZhiimageComboBoxEdit.SelectedIndex;
        //    _employee.StaffStatus = ZhuangTaiimageComboBoxEdit.SelectedIndex;
        //    _employee.LastName = EnglishNametextEdit.Text;
        //    if (!dxValidationProviderBianHao.Validate())
        //    {
        //        error = "wei......";
        //        return null;
        //    }
        //    error = "ing....";
        //    return _employee;
        //}
        private void TouXiangpictureEdit_Click(object sender, EventArgs e)
        {