103 lines
3.2 KiB
C#
103 lines
3.2 KiB
C#
using HRM.BO;
|
|
using System.Security.Claims;
|
|
using System;
|
|
using System.Net.Mail;
|
|
|
|
namespace HRM.UI.MODELS
|
|
{
|
|
public class CurrentMobileUser
|
|
{
|
|
private int? _pKID;
|
|
public int? PKID
|
|
{
|
|
get
|
|
{
|
|
if (this._pKID == null)
|
|
{
|
|
throw new Exception("Employee-ID cann't be null, Self-service login");
|
|
}
|
|
return this._pKID;
|
|
}
|
|
set { _pKID = value; }
|
|
}
|
|
public string EmployeeNo { get; set; }
|
|
public string EmailAddress { get; set; }
|
|
public string Name { get; set; }
|
|
public string Designation { get; set; }
|
|
public int? PayrollTypeID { get; set; }
|
|
public CurrentMobileUser()
|
|
{
|
|
this.PKID = null;
|
|
this.EmployeeNo = null;
|
|
this.EmailAddress = null;
|
|
this.Name = null;
|
|
this.Designation = null;
|
|
this.PayrollTypeID = null;
|
|
}
|
|
public static CurrentMobileUser GetCurrentUser(ClaimsPrincipal principal)
|
|
{
|
|
if (principal == null || principal.Identity == null || principal.Identity.IsAuthenticated == false)
|
|
return null;
|
|
|
|
|
|
CurrentMobileUser oUser = new CurrentMobileUser();
|
|
foreach (Claim item in principal.Claims)
|
|
{
|
|
if (item.Type == "PKID")
|
|
oUser.PKID = Convert.ToInt32(item.Value);
|
|
|
|
if (item.Type == "EmployeeNo")
|
|
oUser.EmployeeNo = item.Value;
|
|
|
|
if (item.Type == "EmailAddress")
|
|
oUser.EmailAddress = item.Value;
|
|
|
|
if (item.Type == "Name")
|
|
oUser.Name = item.Value;
|
|
|
|
if (item.Type == "Designation")
|
|
oUser.Designation = item.Value;
|
|
|
|
if (item.Type == "PayrollTypeID" && item.Value != "0")
|
|
oUser.PayrollTypeID = Convert.ToInt32(item.Value);
|
|
}
|
|
return oUser;
|
|
}
|
|
}
|
|
public class UserTModel : AuditTrailBase
|
|
{
|
|
public UserTModel()
|
|
{
|
|
Designation = string.Empty;
|
|
Name = string.Empty;
|
|
EmployeeNo = string.Empty;
|
|
EmailAddress = string.Empty;
|
|
Image = string.Empty;
|
|
IsLoggedIn = false;
|
|
Token = string.Empty;
|
|
MobileMenu = "1,2,3,4,5,6,7,8,9";
|
|
}
|
|
|
|
public int PKID { get; set; }
|
|
public string EmailAddress { get; set; }
|
|
public string Name { get; set; }
|
|
public string Designation { get; set; }
|
|
public string EmployeeNo { get; set; }
|
|
public int? PayrollTypeID { get; set; }
|
|
public string Image { get; set; }
|
|
|
|
public bool IsLoggedIn { get; set; }
|
|
public string Token { get; set; }
|
|
public string MobileMenu { get; set; }
|
|
|
|
|
|
public string Department { get; set; }
|
|
public string Location { get; set; }
|
|
public DateTime JoiningDate { get; set; }
|
|
|
|
public string FatherName { get; set; }
|
|
public string MotherName { get; set; }
|
|
public string Gender { get; set; }
|
|
public DateTime BirthDate { get; set; }
|
|
}
|
|
} |