예제 #1
0
        private HREmployee InputToVo(HREmployee empVo = null)
        {
            if (empVo == null)
            {
                empVo    = new HREmployee();
                empVo.Id = txtId.Text;
            }
            empVo.Address         = txtAddress.Text;
            empVo.BankCard        = txtBank.Text;
            empVo.Email           = txtEmail.Text;
            empVo.IdCard          = txtIdCard.Text;
            empVo.Name            = txtName.Text;
            empVo.Telephone       = txtPhone.Text;
            empVo.Profession      = txtPro.Text;
            empVo.School          = txtSchool.Text;
            empVo.Education       = !EmptyUtils.EmptyObj(cboEdu.SelectedValue) ? int.Parse(cboEdu.SelectedValue.ToString()) : -1;
            empVo.Sex             = !EmptyUtils.EmptyObj(cboSex.SelectedValue)? int.Parse(cboSex.SelectedValue.ToString()): -1;
            empVo.Status          = !EmptyUtils.EmptyObj(cboStatus.SelectedValue) ? int.Parse(cboStatus.SelectedValue.ToString()) : -1;
            empVo.DeptId          = !EmptyUtils.EmptyObj(cboDept.SelectedValue) ? cboDept.SelectedValue.ToString() : "";
            empVo.JobId           = !EmptyUtils.EmptyObj(cboJob.SelectedValue) ? cboJob.SelectedValue.ToString() : "";
            empVo.GraduationTime  = dtTime.Text;
            empVo.PoliticalStatus = !EmptyUtils.EmptyObj(cboPo.SelectedValue) ? int.Parse(cboPo.SelectedValue.ToString()) : -1;

            return(empVo);
        }
예제 #2
0
        /// <summary>
        /// 验证输入
        /// </summary>
        /// <returns></returns>
        private bool validateInput()
        {
            if (EmptyUtils.EmptyStr(txtUserName.Text))
            {
                MessageBoxEx.Show(this, "请输入用户名");
                txtUserName.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(txtPwd.Text))
            {
                MessageBoxEx.Show(this, "请输入密码");
                txtPwd.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyObj(cboEmp.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择员工");
                cboEmp.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyObj(cboUserType.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择用户类型");
                cboUserType.Focus();
                return(false);
            }
            return(true);
        }
예제 #3
0
        /// <summary>
        /// 验证输入
        /// </summary>
        /// <returns></returns>
        private bool validateInput()
        {
            if (EmptyUtils.EmptyObj(cboLeaveType.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择请假类型");
                cboLeaveType.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyStr(txtLeaveDay.Text))
            {
                MessageBoxEx.Show(this, "请输入请假天数");
                txtLeaveDay.Focus();
                return(false);
            }

            if (EmptyUtils.IsNaN(txtLeaveDay.Text))
            {
                MessageBoxEx.Show(this, "请假天数格式不合法,请输入数字。");
                txtLeaveDay.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(txtCause.Text))
            {
                MessageBoxEx.Show(this, "请输入请假原因");
                txtCause.Focus();
                return(false);
            }
            return(true);
        }
예제 #4
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            if (!validateInput())
            {
                return;
            }

            if (dao.FindByDate(dtStartDate.Text).Count > 0)
            {
                MessageBoxEx.Show(this, dtStartDate.Text + "已经请过假了,请选择其他日期");
                return;
            }

            HRLeave vo = new HRLeave();

            vo.Id        = UidUtils.GGuidPrefix();
            vo.EmpId     = GlobalInfo.loginEmp.Id;
            vo.Cause     = txtCause.Text;
            vo.Type      = !EmptyUtils.EmptyObj(cboLeaveType.SelectedValue) ? int.Parse(cboLeaveType.SelectedValue.ToString()) : -1;
            vo.LeaveDay  = int.Parse(txtLeaveDay.Text);
            vo.LeaveDate = dtStartDate.Text;
            vo.Status    = 1;// 提交申请
            dao.Add(vo);

            DialogResult ret = MessageBoxEx.Show(this, "请假提交成功");

            Close();
        }
예제 #5
0
        /// <summary>
        /// 验证输入
        /// </summary>
        /// <returns></returns>
        private bool validateInput()
        {
            if (EmptyUtils.EmptyObj(cboEmp.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择员工");
                cboEmp.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(dtSTime.Text))
            {
                MessageBoxEx.Show(this, "请选择合同开始时间。");
                txtSalary.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(txtProbation.Text))
            {
                MessageBoxEx.Show(this, "请输入试用期");
                txtProbation.Focus();
                return(false);
            }
            if (EmptyUtils.IsNaN(txtProbation.Text))
            {
                MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。");
                txtProbation.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyStr(txtSalary.Text))
            {
                MessageBoxEx.Show(this, "请输入工资");
                txtSalary.Focus();
                return(false);
            }
            if (EmptyUtils.IsNaN(txtSalary.Text))
            {
                MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。");
                txtSalary.Focus();
                return(false);
            }


            if (EmptyUtils.EmptyStr(dtETime.Text))
            {
                MessageBoxEx.Show(this, "请选择合同结束时间。");
                txtSalary.Focus();
                return(false);
            }

            DateTime sDt = Convert.ToDateTime(dtSTime.Text);
            DateTime eDt = Convert.ToDateTime(dtETime.Text);

            if (DateTime.Compare(sDt, eDt) > 0)
            {
                MessageBoxEx.Show(this, "合同开始时间不能大于合同结束时间。");
                dtSTime.Focus();
                return(false);
            }
            return(true);
        }
예제 #6
0
        /// <summary>
        /// 输入转VO
        /// </summary>
        /// <returns></returns>
        private HRPayroll InputToVo()
        {
            HRPayroll vo = new HRPayroll();

            vo.EmpId       = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? cboEmp.SelectedValue.ToString() : "";
            vo.PayrollDate = dtTime.Text;
            return(vo);
        }
        /// <summary>
        /// 输入转VO
        /// </summary>
        /// <returns></returns>
        private HRLeave InputToVo()
        {
            HRLeave vo = new HRLeave();

            vo.Id      = txtId.Text;
            vo.EmpId   = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? cboEmp.SelectedValue.ToString() : "";
            vo.EmpName = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? ((HREmployee)cboEmp.SelectedItem).Name : "";
            vo.Status  = !EmptyUtils.EmptyObj(cboStatus.SelectedValue) ? int.Parse(cboStatus.SelectedValue.ToString()) : -1;
            return(vo);
        }
예제 #8
0
        /// <summary>
        /// 输入转VO
        /// </summary>
        /// <returns></returns>
        private HRContract InputToVo()
        {
            HRContract vo = new HRContract();

            vo.Id        = txtId.Text;
            vo.Probation = !EmptyUtils.EmptyStr(txtProbation.Text) ? int.Parse(txtProbation.Text) : -1;
            vo.Salary    = !EmptyUtils.EmptyStr(txtSalary.Text) ? float.Parse(txtSalary.Text) : -1;
            vo.EmpId     = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? cboEmp.SelectedValue.ToString() : "";
            vo.EmpName   = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? ((HREmployee)cboEmp.SelectedItem).Name : "";
            vo.EndTime   = dtETime.Text;
            vo.StartTime = dtSTime.Text;

            return(vo);
        }
예제 #9
0
        /// <summary>
        /// 输入转VO
        /// </summary>
        /// <returns></returns>
        private HRUser InputToVo(HRUser vo)
        {
            if (vo == null)
            {
                vo    = new HRUser();
                vo.Id = txtId.Text;
            }
            if (!EmptyUtils.EmptyObj(cboEmp.SelectedItem))
            {
                HREmployee empVo = cboEmp.SelectedItem as HREmployee;

                vo.EmpId   = empVo.Id;
                vo.EmpName = empVo.Name;
            }
            vo.UserName = txtUserName.Text;
            vo.Password = txtPwd.Text;
            vo.UserType = !EmptyUtils.EmptyObj(cboUserType.SelectedValue) ? int.Parse(cboUserType.SelectedValue.ToString()) : -1;

            return(vo);
        }
예제 #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!validateInput())
            {
                return;
            }

            btnSaveEnbaled(false);

            if (opration == OP_ADD)
            {
                HRContract vo = InputToVo();

                int ret = dao.Add(vo);

                if (ret > 0)
                {
                    listSource.Add(vo);
                }
            }
            else if (opration == OP_UPDATE)
            {
                HRContract vo = list[grid.CurrentRow.Index];
                vo.Probation = !EmptyUtils.EmptyStr(txtProbation.Text) ? int.Parse(txtProbation.Text) : -1;
                vo.Salary    = !EmptyUtils.EmptyStr(txtSalary.Text) ? float.Parse(txtSalary.Text) : -1;
                vo.EmpId     = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? cboEmp.SelectedValue.ToString() : "";
                vo.EmpName   = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? ((HREmployee)cboEmp.SelectedItem).Name : "";
                vo.EndTime   = dtETime.Text;
                vo.StartTime = dtSTime.Text;

                dao.Update(vo);
                grid.Refresh();
            }

            CleanData();
        }
예제 #11
0
        /// <summary>
        /// 验证输入
        /// </summary>
        /// <returns></returns>
        private bool validateInput()
        {
            if (EmptyUtils.EmptyStr(txtName.Text))
            {
                MessageBoxEx.Show(this, "请输入姓名");
                txtName.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboSex.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择性别");
                cboSex.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboPo.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择政治面貌");
                cboPo.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboEdu.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择学历");
                cboEdu.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboEdu.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择学历");
                cboEdu.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(dtTime.Text))
            {
                MessageBoxEx.Show(this, "请选择毕业时间");
                dtTime.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyStr(txtPhone.Text))
            {
                MessageBoxEx.Show(this, "请输入电话号码");
                txtPhone.Focus();
                return(false);
            }
            if (EmptyUtils.IsNaN(txtPhone.Text))
            {
                MessageBoxEx.Show(this, "电话号码格式不正确");
                txtPhone.Focus();
                return(false);
            }

            if (EmptyUtils.EmptyStr(txtIdCard.Text))
            {
                MessageBoxEx.Show(this, "请输入身份证号码");
                txtIdCard.Focus();
                return(false);
            }
            if (txtIdCard.Text.Length != 18)
            {
                MessageBoxEx.Show(this, "身份证号码长度不正确,请输入18位身份证号码。");
                txtIdCard.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboDept.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择部门");
                cboDept.Focus();
                return(false);
            }
            if (EmptyUtils.EmptyObj(cboJob.SelectedValue))
            {
                MessageBoxEx.Show(this, "请选择职位");
                cboJob.Focus();
                return(false);
            }

            return(true);
        }