demo20230512/Models/User.cs

59 lines
2.3 KiB
C#
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Identity.EntityFramework;
using Resources;
namespace Weee.Models
{
[Table("UsersProfile")]
public class User : IdentityUser
{
//to do : this property should merge into UserName in IdentityUser
[Required(ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "RequiredMessage")]
//[RegularExpression("[a-zA-Z0-9]{5,25}", ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "UserAccountNameRegx")]
[Display(Name = "UserAccountName", ResourceType = typeof(Resource))]
[MaxLength(256)]
[MinLength(5)]
[Index("AccountNameInex", IsUnique = true)]
public override string UserName { get; set; }
[Display(Name = "UserName", ResourceType = typeof(Resource))]
[Required(ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "RequiredMessage")]
public string Name { get; set; }
[Display(Name = "UserDepartment", ResourceType = typeof(Resource))]
public string Department { get; set; }
[Display(Name = "UserJob", ResourceType = typeof(Resource))]
public string Job { get; set; }
//to do : this property should merge into Email in IdentityUser
[Display(Name = "UserEmail", ResourceType = typeof(Resource))]
[Required(ErrorMessageResourceType = typeof(Resource),
ErrorMessageResourceName = "RequiredMessage")]
public override string Email { get; set; }
//to do : this property should merge into PhoneNumber in IdentityUser
[Display(Name = "UserPhoneNumber", ResourceType = typeof(Resource))]
public override string PhoneNumber { get; set; }
[Display(Name = "UserMobileNumber", ResourceType = typeof(Resource))]
public string MobileNumber { get; set; }
public int? CompanyID { get; set; }
[ForeignKey("CompanyID")]
public virtual Company Company { get; set; }
public string DefaultPassword { get; set; }
public bool IsCompanyAdmin { get; set; }
public bool IsSystemAdmin { get; set; }
}
}