using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace OASystem.Domain.Dtos.System
{
///
/// 员工表查询dto
///
public class UserDto : DtoBase
{
///
/// 公司Id
///
public int CompanyId { get; set; }
///
/// 部门Id
///
public int DepId { get;set; }
///
/// 岗位Id
///
public int JobPostId { get; set; }
}
///
/// 修改用户信息
///
public class EditUserDto
{
///
/// 当前用户ID
///
public int CurrUserId { get; set; }
///
/// 用户Id
///
public int Id { get; set; }
///
/// 工号
///
public string Number { get; set; }
///
/// 公司Id
///
public int CompanyId { get; set; }
///
/// 部门Id
///
public int DepId { get; set; }
///
/// 岗位Id
///
public int JobPostId { get; set; }
///
/// 分机号
///
public string Ext { get; set; }
///
/// 试用期
///
public string UsePeriod { get; set; }
/////
///// 人事审核 0未审核(初始状态) 1 已通过(可用)2已拒绝
/////
//public int HrAudit { get; set; }
}
///
/// 修改个人信息
///
public class EditMyUserDto
{
///
/// 用户Id
///
public int Id { get; set; }
///
/// 中文姓名
///
public string CnName { get; set; }
///
/// 英文姓名
///
public string EnName { get; set; }
///
/// 性别0 男1 女 2 未设置
///
public int Sex { get; set; }
private string phone;
///
/// 手机号
///
public string Phone
{
get
{
return phone;
}
set
{
if (Regex.IsMatch(value, @"^[1]+[2,3,4,5,6,7,8,9]+\d{9}"))
{
phone = value;
}
else
{
phone = "";
}
}
}
private string urgentPhone;
///
/// 紧急联系人 手机号
///
public string UrgentPhone
{
get { return urgentPhone; }
set
{
if (Regex.IsMatch(value, @"^[1]+[2,3,4,5,6,7,8,9]+\d{9}"))
{
urgentPhone = value;
}
else
{
urgentPhone = "";
}
}
}
private string email;
///
/// 邮箱
///
public string Email
{
get { return email; }
set
{
if (Regex.IsMatch(value, @"^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(com|cn|net)$"))
{
email = value;
}
else
{
email = "";
}
}
}
///
/// 住址
///
public string Address { get; set; }
///
/// 入职时间
///
public DateTime Edate { get; set; }
///
/// 生日
///
public DateTime Birthday { get; set; }
///
/// 身份证号码
///
public string IDCard { get; set; }
///
/// 毕业学校
///
public string GraduateInstitutions { get; set; }
///
/// 专业
///
public string Professional { get; set; }
///
/// 学历
///
public int Education { get; set; }
///
/// 学历类型
///
public int TheOrAdultEducation { get; set; }
///
/// 婚姻状态
///
public string MaritalStatus { get; set; }
///
/// 家庭地址
///
public string HomeAddress { get; set; }
///
/// 工作经历
///
public string WorkExperience { get; set; }
///
/// 证书上传
///
public string Certificate { get; set; }
}
///
/// 删除用户信息
/// 即为离职
///
public class UserDelDto : PortDtoBase
{
///
/// 数据Id
///
public int Id { get; set; }
///
/// 操作人Id
///
public int OperateUserId { get; set; }
}
public class PersonnelAuditDto
{
public int UserId { get; set; }
///
/// 数据Id
///
public int Id { get; set; }
///
/// 审核是否通过 1:通过 2拒绝
///
public int IsAudit { get; set; }
}
public class QueryUserByDepartDto
{
public int DepartId { get; set; }
}
public class UserInfoDto : PortDtoBase
{
public int Id { get; set; }
}
public class EditUserInfoDto
{
public int CurrUserId { get; set; }
public int Id { get; set; }
///
/// 中文姓名
///
public string CnName { get; set; }
///
/// 英文姓名
///
public string EnName { get; set; }
///
/// 工号
///
public string Number { get; set; }
///
/// 公司Id
///
public int CompanyId { get; set; }
///
/// 部门Id
///
public int DepId { get; set; }
///
/// 岗位Id
///
public int JobPostId { get; set; }
///
/// 密码
///
public string Password { get; set; }
///
/// 确认密码
///
public string ComfirmPassword { get; set; }
///
/// 性别0 男 1 女 2 未设置
///
public int Sex { get; set; }
///
/// 分机号
///
public string Ext { get; set; }
///
/// 手机号
///
public string Phone { get; set; }
///
/// 紧急联系人 手机号
///
public string UrgentPhone { get; set; }
///
/// 邮箱
///
public string Email { get; set; }
///
/// 住址
///
public string Address { get; set; }
///
/// 入职时间
///
public string? Edate { get; set; } = null;
/////
///// 离职时间
/////
//public DateTime Rdate { get; set; }
/////
///// 工龄
/////
//public int Seniority { get; set; }
/////
///// 生日
/////
//public string? Birthday { get; set; } = null;
///
/// 身份证号码
///
public string IDCard { get; set; }
/////
///// 开始工作时
/////
//public string? StartWorkDate { get; set; }= null;
///
/// 毕业学校
///
public string GraduateInstitutions { get; set; }
///
/// 专业
///
public string Professional { get; set; }
///
/// 学历
/// 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生
///
public int Education { get; set; }
///
/// 学历类型
///0 未设置 1 成教 2 统招 3 留学
///
public int TheOrAdultEducation { get; set; }
///
/// 婚姻状态
///
public string MaritalStatus { get; set; }
///
/// 家庭地址
///
public string HomeAddress { get; set; }
///
/// 试用期
///
public string UsePeriod { get; set; }
///
/// 工作经历
///
public string WorkExperience { get; set; }
///
/// 证书上传
///
public string Certificate { get; set; }
/////
///// 企微Id
/////
//public string QiyeChatUserId { get; set; }
///
/// 备注
///
public string Remark { get; set; }
}
public class EditUserInfoDtoValidator : AbstractValidator
{
public EditUserInfoDtoValidator()
{
//RuleFor(x => x.CurrUserId).LessThan(1).WithMessage("暂无修改权限!");
RuleFor(x => x.CnName).NotEmpty().WithMessage("姓名不能为空!");
RuleFor(x => x.EnName).NotEmpty().WithMessage("英文名不能为空!");
RuleFor(x => x.Number).NotEmpty().WithMessage("工号不能为空!");
RuleFor(x => x.Password).NotEmpty().WithMessage("密码不能为空!")
.Length(6, 20).WithMessage("密码长度必须在6到20个字符之间!");
RuleFor(x => x.ComfirmPassword).NotEmpty().WithMessage("确认密码不能为空!")
.Equal(x => x.Password).WithMessage("两次密码输入不一致!");
RuleFor(x => x.Sex).InclusiveBetween(0,2).WithMessage("性别:0 男;1 女;2 未设置;");
RuleFor(x => x.Phone).NotEmpty().WithMessage("手机号不能为空!");
RuleFor(x => x.UrgentPhone).NotEmpty().WithMessage("手机号不能为空!");
RuleFor(x => x.Email).NotEmpty().WithMessage("邮箱不能为空!");
RuleFor(x => x.Address).NotEmpty().WithMessage("住址不能为空!");
//RuleFor(x => x.Edate).NotEmpty().WithMessage("入职时间不能为空!");
//RuleFor(x => x.Birthday).NotEmpty().WithMessage("生日不能为空!");
RuleFor(x => x.IDCard).NotEmpty().WithMessage("身份证号码不能为空!");
RuleFor(x => x.TheOrAdultEducation).InclusiveBetween(0, 3).WithMessage("学历类型 0 未设置 1 成教 2 统招 3 留学");
RuleFor(x => x.Education).InclusiveBetween(0, 6).WithMessage("学历 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生");
}
}
}