HRM-10/HRM.BO/User/UserAccessType.cs
2026-11-16 19:28:49 +06:00

73 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
namespace HRM.BO
{
#region UserAccessType
public class UserAccessType : BasicBaseObject
{
#region Constructor
public UserAccessType()
{
PayrollTypeID = 0;
UserID = 0;
UserObj = null;
// A row nobody approved yet is never live access (see UserAccessTypeMakerChecker_DB_Changes.sql).
AccessTypeStatus = EnumAuthStatus.NewNotYetApprove;
}
#endregion
#region Properties
public int PayrollTypeID { get; set; }
public string Description { get; set; }
public int UserID { get; set; }
public User UserObj { get; set; }
/// <summary>
/// UserAccessType.Status: Approved (5) = live; NewNotYetApprove (2) = requested, not live yet;
/// DeletedNotYetApprove (3) = removal requested, still live until approved.
/// </summary>
public EnumAuthStatus AccessTypeStatus { get; set; }
public int? ApprovedBy { get; set; }
public DateTime? ApprovedDate { get; set; }
// Filled only by GetPending (the Pending approvals list), for display.
public string UserName { get; set; }
public string LoginID { get; set; }
/// <summary>Who requested this pending row: CreatedBy for a new access, ModifiedBy for a removal.</summary>
public int MakerID { get; set; }
public string MakerLoginID { get; set; }
/// <summary>When it was requested: CreatedDate for a new access, ModifiedDate for a removal.</summary>
public DateTime? RequestDate { get; set; }
#endregion
}
#endregion
#region UserAccessType Service
public interface IUserAccessTypeService
{
UserAccessType Get(int id);
List<UserAccessType> Get();
List<UserAccessType> GetByUserID(int userID);
int Save(UserAccessType item);
void Save(List<UserAccessType> userAccessTypes);
void Delete(int id);
// Maker-checker (Authentication > User Access Type)
/// <summary>Maker: records the wanted payroll types of a user as pending changes. Returns how many rows changed.</summary>
int RequestChange(int userID, List<int> payrollTypeIDs, int makerID);
/// <summary>Checker: makes every pending change of the user live.</summary>
void Approve(int userID, int approverID);
/// <summary>Checker: drops every pending change of the user; access stays as it was.</summary>
void Reject(int userID);
/// <summary>Every row waiting for approval, of every user, with user, payroll type and maker for display.</summary>
List<UserAccessType> GetPending();
}
#endregion
}