refactor: comment out unused methods and clean up repository interfaces

This commit is contained in:
2025-12-30 11:37:33 +03:30
parent 836e721b6f
commit 12318a6a51
7 changed files with 44 additions and 46 deletions

View File

@@ -34,7 +34,7 @@ public interface IAccountApplication
OperationResult DeActive(long id); OperationResult DeActive(long id);
OperationResult DirectLogin(long id); OperationResult DirectLogin(long id);
AccountLeftWorkViewModel WorkshopList(long accountId); // AccountLeftWorkViewModel WorkshopList(long accountId);
OperationResult SaveWorkshopAccount( OperationResult SaveWorkshopAccount(
List<WorkshopAccountlistViewModel> workshopAccountList, List<WorkshopAccountlistViewModel> workshopAccountList,
string startDate, string startDate,

View File

@@ -745,25 +745,25 @@ public class AccountApplication : IAccountApplication
} }
public AccountLeftWorkViewModel WorkshopList(long accountId) // public AccountLeftWorkViewModel WorkshopList(long accountId)
{ // {
string fullname = this._accountRepository.GetById(accountId).Fullname; // string fullname = this._accountRepository.GetById(accountId).Fullname;
List<WorkshopAccountlistViewModel> source = _accountLeftworkRepository.WorkshopList(accountId); // List<WorkshopAccountlistViewModel> source = _accountLeftworkRepository.WorkshopList(accountId);
List<long> userWorkshopIds = source.Select(x => x.WorkshopId).ToList(); // List<long> userWorkshopIds = source.Select(x => x.WorkshopId).ToList();
List<WorkshopSelectList> allWorkshops = this._accountLeftworkRepository.GetAllWorkshops(); // List<WorkshopSelectList> allWorkshops = this._accountLeftworkRepository.GetAllWorkshops();
List<AccountViewModel> accountSelectList = this._accountRepository.GetAdminAccountSelectList(); // List<AccountViewModel> accountSelectList = this._accountRepository.GetAdminAccountSelectList();
(string StartWorkFa, string LeftWorkFa) byAccountId = this._accountLeftworkRepository.GetByAccountId(accountId); // (string StartWorkFa, string LeftWorkFa) byAccountId = this._accountLeftworkRepository.GetByAccountId(accountId);
return new AccountLeftWorkViewModel() // return new AccountLeftWorkViewModel()
{ // {
AccountId = accountId, // AccountId = accountId,
AccountFullName = fullname, // AccountFullName = fullname,
StartDateFa = byAccountId.StartWorkFa, // StartDateFa = byAccountId.StartWorkFa,
LeftDateFa = byAccountId.LeftWorkFa, // LeftDateFa = byAccountId.LeftWorkFa,
WorkshopAccountlist = source, // WorkshopAccountlist = source,
WorkshopSelectList = new SelectList(allWorkshops.Where(x => !userWorkshopIds.Contains(x.Id)), "Id", "WorkshopFullName"), // WorkshopSelectList = new SelectList(allWorkshops.Where(x => !userWorkshopIds.Contains(x.Id)), "Id", "WorkshopFullName"),
AccountSelectList = new SelectList(accountSelectList, "Id", "Fullname") // AccountSelectList = new SelectList(accountSelectList, "Id", "Fullname")
}; // };
} // }
public OperationResult SaveWorkshopAccount( public OperationResult SaveWorkshopAccount(
List<WorkshopAccountlistViewModel> workshopAccountList, List<WorkshopAccountlistViewModel> workshopAccountList,

View File

@@ -10,7 +10,7 @@ public interface IAccountLeftworkRepository : IRepository<long, AccountLeftWork>
{ {
(string StartWorkFa, string LeftWorkFa) GetByAccountId(long accountId); (string StartWorkFa, string LeftWorkFa) GetByAccountId(long accountId);
List<WorkshopAccountlistViewModel> WorkshopList(long accountId); List<WorkshopAccountlistViewModel> WorkshopList(long accountId);
List<WorkshopSelectList> GetAllWorkshops(); // List<WorkshopSelectList> GetAllWorkshops();
OperationResult CopyWorkshopToNewAccount(long currentAccountId, long newAccountId); OperationResult CopyWorkshopToNewAccount(long currentAccountId, long newAccountId);

View File

@@ -18,14 +18,13 @@ public class AccountLeftworkRepository : RepositoryBase<long, AccountLeftWork>,
{ {
private readonly AccountContext _accountContext; private readonly AccountContext _accountContext;
private readonly IWorkshopAccountRepository _workshopAccountRepository; private readonly IWorkshopAccountRepository _workshopAccountRepository;
private readonly IWorkshopApplication _workshopApplication;
public AccountLeftworkRepository(AccountContext accountContext, IWorkshopAccountRepository workshopAccountRepository, IWorkshopApplication workshopApplication) : base(accountContext) public AccountLeftworkRepository(AccountContext accountContext,
IWorkshopAccountRepository workshopAccountRepository) : base(accountContext)
{ {
_accountContext = accountContext; _accountContext = accountContext;
_workshopAccountRepository = workshopAccountRepository; _workshopAccountRepository = workshopAccountRepository;
_workshopApplication = workshopApplication; }
}
public (string StartWorkFa, string LeftWorkFa) GetByAccountId(long accountId) public (string StartWorkFa, string LeftWorkFa) GetByAccountId(long accountId)
{ {
@@ -58,14 +57,14 @@ public class AccountLeftworkRepository : RepositoryBase<long, AccountLeftWork>,
}).ToList(); }).ToList();
} }
public List<WorkshopSelectList> GetAllWorkshops() // public List<WorkshopSelectList> GetAllWorkshops()
{ // {
return this._workshopApplication.GetWorkshopAll().Select(x => new WorkshopSelectList() // return this._workshopApplication.GetWorkshopAll().Select(x => new WorkshopSelectList()
{ // {
Id = x.Id, // Id = x.Id,
WorkshopFullName = x.WorkshopFullName // WorkshopFullName = x.WorkshopFullName
}).ToList(); // }).ToList();
} // }
public OperationResult CopyWorkshopToNewAccount(long currentAccountId, long newAccountId) public OperationResult CopyWorkshopToNewAccount(long currentAccountId, long newAccountId)
{ {

View File

@@ -268,10 +268,10 @@
href="#showmodal=@Url.Page("./Index", "Edit", new { Id = item.Id })"> href="#showmodal=@Url.Page("./Index", "Edit", new { Id = item.Id })">
<i class="fa fa-edit faSize"></i> <i class="fa fa-edit faSize"></i>
</a> </a>
<a class="btn btn-success pull-right m-rl-5 red" @* <a class="btn btn-success pull-right m-rl-5 red" *@
href="#showmodal=@Url.Page("./Index", "AccountWorkshop", new { item.Id })"> @* href="#showmodal=@Url.Page("./Index", "AccountWorkshop", new { item.Id })"> *@
<i class="fa fa-edit faSize"></i> @* <i class="fa fa-edit faSize"></i> *@
</a> @* </a> *@
@if (item.IsActiveString == "true" && item.Role != "مدیر سیستم") @if (item.IsActiveString == "true" && item.Role != "مدیر سیستم")
{ {
<a onclick="deActive(@item.Id,'@item.Fullname')" class="btn btn-danger pull-right m-rl-5 red"> <i class="fa faSize fa-trash"></i></a> <a onclick="deActive(@item.Id,'@item.Fullname')" class="btn btn-danger pull-right m-rl-5 red"> <i class="fa faSize fa-trash"></i></a>

View File

@@ -316,14 +316,14 @@ public class IndexModel : PageModel
}); });
} }
public IActionResult OnGetAccountWorkshop(long id) // public IActionResult OnGetAccountWorkshop(long id)
{ // {
var res = _accountApplication.WorkshopList(id); // var res = _accountApplication.WorkshopList(id);
//
//
//
return Partial("AccountLeftWork", res); // return Partial("AccountLeftWork", res);
} // }
public IActionResult OnPostCreateAccountLeftWork( public IActionResult OnPostCreateAccountLeftWork(
List<WorkshopAccountlistViewModel> workshopAccountlistViewModel, List<WorkshopAccountlistViewModel> workshopAccountlistViewModel,

View File

@@ -415,7 +415,6 @@ if (app.Environment.IsDevelopment())
} }
#endregion #endregion
//Create Http Pipeline //Create Http Pipeline
#region Create Http Pipeline #region Create Http Pipeline