Files
Backend-Api/AccountManagement.Domain/AccountAgg/Account.cs
2024-10-05 19:27:04 +03:30

147 lines
4.4 KiB
C#

using System.Collections.Generic;
using _0_Framework.Domain;
using AccountManagement.Domain.AccountLeftWorkAgg;
using AccountManagement.Domain.CameraAccountAgg;
using AccountManagement.Domain.RoleAgg;
using TaskManager.Domain.PositionAgg;
namespace AccountManagement.Domain.AccountAgg
{
public class Account : EntityBase
{
public string Fullname { get; private set; }
public string Username { get; private set; }
public string Password { get; private set; }
public string Mobile { get; private set; }
public long RoleId { get; private set; }
public string RoleName { get; private set; }
public Role Role { get; private set; }
public string ProfilePhoto { get; private set; }
public string AdminAreaPermission { get; private set; }
public string ClientAriaPermission { get; private set; }
public string NationalCode { get; private set; }
public string Email { get; private set; }
public string VerifyCode { get; set; }
public string IsActiveString { get; private set; }
#region Mahan
public string PositionIsActive { get; private set; }
public long? PositionId { get; private set; }
public Position Position { get; private set; }
#endregion
public List<CameraAccount> CameraAccounts { get; private set; }
public List<AccountLeftWork> AccountLeftWorkList { get; set; }
public Account(string fullname, string username, string password, string mobile,
long roleId, string profilePhoto, string roleName, string adminAreaPermission, string clientAriaPermission)
{
Fullname = fullname;
Username = username;
Password = password;
Mobile = mobile;
RoleId = roleId;
if (roleId == 0)
RoleId = 2;
ProfilePhoto = profilePhoto;
RoleName = roleName;
AdminAreaPermission = adminAreaPermission;
ClientAriaPermission = clientAriaPermission;
IsActiveString = "true";
}
public Account(string fullname, string username, string password, string mobile, string nationalCode)
{
Fullname = fullname;
Username = username;
Password = password;
Mobile = mobile;
NationalCode = "";
RoleId = 15;
RoleName = "کارفرما";
AdminAreaPermission = "false";
ClientAriaPermission = "true";
ProfilePhoto = " ";
IsActiveString = "true";
}
public Account()
{
ProfilePhoto = " ";
}
public void Edit(string fullname, string username, string mobile,
long roleId, string profilePhoto, string roleName)
{
Fullname = fullname;
Username = username;
Mobile = mobile;
RoleId = roleId;
RoleName = roleName;
if (!string.IsNullOrWhiteSpace(profilePhoto))
ProfilePhoto = profilePhoto;
}
public void EditClient(string fullname, string username, string mobile,
string profilePhoto, string email, string nationalCode)
{
Fullname = fullname;
Username = username;
Mobile = mobile;
Email = email;
NationalCode = nationalCode;
if (!string.IsNullOrWhiteSpace(profilePhoto))
ProfilePhoto = profilePhoto;
}
public void SetVerifyCode(string verifyCode)
{
VerifyCode = verifyCode;
}
public void RemoveCode()
{
VerifyCode = "";
}
public void ChangePassword(string password)
{
Password = password;
}
public void Active()
{
this.IsActiveString = "true";
}
public void DeActive()
{
this.IsActiveString = "false";
}
#region Mahan
public void SetPosition(long positionId)
{
PositionId = positionId;
PositionIsActive = "true";
}
public void DeActivePosition()
{
PositionIsActive = "false";
}
public void RemovePosition()
{
PositionId = null;
PositionIsActive = null;
}
#endregion
}
}