104 lines
3.4 KiB
C#
104 lines
3.4 KiB
C#
using Microsoft.Azure.CosmosDB.Table;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using webapi.Domain.AggregatesModel.FlatAggregate;
|
|
using webapi.Domain.Events;
|
|
using webapi.Domain.SeedWork;
|
|
|
|
namespace webapi.Domain.AggregatesModel.UserFlatMappingAggregate
|
|
{
|
|
[Table("mdbUsersFlatsMappings")]
|
|
public class UserFlatMapping : Entity, IAggregateRoot
|
|
{
|
|
public UserFlatMapping() { }
|
|
|
|
public UserFlatMapping(Guid flatId, Guid userId, string pmsUserName, Guid id)
|
|
{
|
|
Id = id;
|
|
FlatId = flatId;
|
|
UserId = userId;
|
|
IsAutomatic = false;
|
|
PMSUserName = pmsUserName;
|
|
RequestApprovalModelDate = new RequestApprovedDate();
|
|
|
|
PartitionKey = FlatId.ToString();
|
|
RowKey = Id.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Id for identifying each mapping
|
|
/// </summary>
|
|
//private Guid _id;
|
|
//public Guid Id => _id;
|
|
|
|
/// <summary>
|
|
/// User id from mdb_UsersAuth AzureDB table
|
|
/// </summary>
|
|
public Guid UserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Flat if from mdb_Flats AzureDB table
|
|
/// </summary>
|
|
//private Guid _flatId;
|
|
public Guid FlatId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Datetime when request was approved
|
|
/// </summary>
|
|
public RequestApprovedDate RequestApprovalModelDate { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Datetime when request was approved
|
|
/// </summary>
|
|
public DateTime RequestApprovalDate
|
|
{
|
|
get
|
|
{
|
|
return RequestApprovalModelDate.Date;
|
|
}
|
|
set
|
|
{
|
|
RequestApprovalModelDate = new RequestApprovedDate(value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// UserId from Taloyhtio FBA database of the PM which approved request.Filled only when mapping is created from manual approval workflow.When mapping is created automatically it is left empty
|
|
/// </summary>
|
|
public Guid ApprovedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id of parent approval request from mdb_UsersFlatsApprovalRequests table to know form whch request this mapping was created.Filled only when mapping is created from manual approval workflow.When mapping is created automatically it is left empty
|
|
/// </summary>
|
|
public Guid ApprovalRequestId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Flag which indicates whether this mapping was created automatically based on user PIN (see 4.1. Add and manage flats in database) or from manual approval workflow
|
|
/// </summary>
|
|
public bool IsAutomatic { get; set; }
|
|
|
|
/// <summary>
|
|
/// A user name which can be imported from PMS
|
|
/// </summary>
|
|
public string PMSUserName { get; set; }
|
|
|
|
public void SetAutomatic()
|
|
{
|
|
this.IsAutomatic = true;
|
|
}
|
|
|
|
public void DeleteApprovals(Guid userId)
|
|
{
|
|
AddDomainEvent(new DeleteUserToFlatMappingApprovalDomainEvent(this.FlatId, userId));
|
|
}
|
|
|
|
//public void RevokeUserAssignment(string userName, Guid condoId, Flat flat)
|
|
//{
|
|
// AddDomainEvent(new RevokeUserAssignmentDomainEvent(userName, condoId, flat));
|
|
//}
|
|
}
|
|
} |