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; }
///
/// UserAccessType.Status: Approved (5) = live; NewNotYetApprove (2) = requested, not live yet;
/// DeletedNotYetApprove (3) = removal requested, still live until approved.
///
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; }
/// Who requested this pending row: CreatedBy for a new access, ModifiedBy for a removal.
public int MakerID { get; set; }
public string MakerLoginID { get; set; }
/// When it was requested: CreatedDate for a new access, ModifiedDate for a removal.
public DateTime? RequestDate { get; set; }
#endregion
}
#endregion
#region UserAccessType Service
public interface IUserAccessTypeService
{
UserAccessType Get(int id);
List Get();
List GetByUserID(int userID);
int Save(UserAccessType item);
void Save(List userAccessTypes);
void Delete(int id);
// Maker-checker (Authentication > User Access Type)
/// Maker: records the wanted payroll types of a user as pending changes. Returns how many rows changed.
int RequestChange(int userID, List payrollTypeIDs, int makerID);
/// Checker: makes every pending change of the user live.
void Approve(int userID, int approverID);
/// Checker: drops every pending change of the user; access stays as it was.
void Reject(int userID);
/// Every row waiting for approval, of every user, with user, payroll type and maker for display.
List GetPending();
}
#endregion
}