remove operation result

This commit is contained in:
MahanCh
2025-04-15 15:06:17 +03:30
parent f5195ecaa2
commit 00a85e54ee
35 changed files with 109 additions and 98 deletions

View File

@@ -14,7 +14,9 @@
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
</ItemGroup>
</Project>

View File

@@ -1874,4 +1874,40 @@ public static class Tools
}
#endregion
#region Davoodi
public static List<string> GetDaysBetweenDateGeorgian(DateTime startDate, DateTime? endDate)
{
var days = new List<string>();
if (endDate == null)
endDate = DateTime.Now;
var persianStartDate = new MD.PersianDateTime.Standard.PersianDateTime(startDate);
var persianEndDate = new MD.PersianDateTime.Standard.PersianDateTime(endDate);
while (persianEndDate - persianStartDate >= TimeSpan.FromDays(0))
{
days.Add(persianStartDate.ToShortDateString());
persianStartDate = persianStartDate.AddDays(1);
}
return days;
}
public static int GetWorkingDaysDifference(DateTime? fromDate, DateTime? toDate)
{
//var workingDays = PersianDateExtensions.GetWorkingDays(new PersianDateTime(fromDate.ToFarsi()), new PersianDateTime(toDate.ToFarsi()), true);
var workingDays = PersianDateExtensions.GetWorkingDays((DateTime)fromDate, (DateTime)toDate, true);
if (fromDate > toDate)
workingDays *= -1;
return workingDays;
}
#endregion
}

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Board;

View File

@@ -1,5 +1,5 @@
using System;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.EmployeeClientTemp;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Evidence;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.EvidenceDetail;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.File1;
namespace CompanyManagment.App.Contracts.FileAlert;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.File1;
namespace CompanyManagment.App.Contracts.FileState;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.FileTiming;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.FileTitle;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Fine;
namespace CompanyManagment.App.Contracts.FineSubject;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.MasterPetition;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.PenaltyTitle;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Petition;

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.ProceedingSession;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.WorkHistory;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.Board;
using CompanyManagment.App.Contracts.Board;
@@ -32,7 +32,7 @@ public class BoardApplication : IBoardApplication
_boardRepository.Create(board);
_boardRepository.SaveChanges();
return operation.Succcedded(entityId: board.id);
return operation.Succcedded(board.id);
}
public OperationResult Edit(EditBoard command)
@@ -51,7 +51,7 @@ public class BoardApplication : IBoardApplication
command.ExpertReport,command.File_Id,command.BoardType_Id);
_boardRepository.SaveChanges();
return operation.Succcedded(entityId: board.id);
return operation.Succcedded(board.id);
}
public EditBoard GetDetails(long id)

View File

@@ -1,4 +1,4 @@
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.EmployeeClientTempAgg;
using CompanyManagment.App.Contracts.EmployeeClientTemp;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.Evidence;
using CompanyManagment.App.Contracts.Evidence;
@@ -28,7 +28,7 @@ public class EvidenceApplication : IEvidenceApplication
return operation.Succcedded(entityId: evidence.id);
return operation.Succcedded(evidence.id);
}
public OperationResult Edit(EditEvidence command)
@@ -43,7 +43,7 @@ public class EvidenceApplication : IEvidenceApplication
evidence.Edit(command.Description, command.BoardType_Id, command.File_Id);
_evidenceRepository.SaveChanges();
return operation.Succcedded(entityId: evidence.id);
return operation.Succcedded(evidence.id);
}
public OperationResult Remove(long id)
@@ -53,7 +53,7 @@ public class EvidenceApplication : IEvidenceApplication
_evidenceRepository.Remove(id);
_evidenceRepository.SaveChanges();
return operation.Succcedded("اطلاعات مدارک با موفقیت حذف شد");
return operation.Succcedded(-1, "اطلاعات مدارک با موفقیت حذف شد");
}
public EditEvidence GetDetails(long id)

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.EvidenceDetail;
using CompanyManagment.App.Contracts.EvidenceDetail;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.FileAlert;
using CompanyManagment.App.Contracts.File1;
using CompanyManagment.App.Contracts.FileAlert;
@@ -36,7 +36,7 @@ public class FileAlertApplication : IFileAlertApplication
return operation.Succcedded(entityId: fileAlert.id);
return operation.Succcedded( fileAlert.id);
}
public OperationResult Edit(EditFileAlert command)
@@ -49,7 +49,7 @@ public class FileAlertApplication : IFileAlertApplication
//fileAlert.Edit(command.Alert, command.Type);
_fileAlertRepository.SaveChanges();
return operation.Succcedded(entityId: fileAlert.id);
return operation.Succcedded(fileAlert.id);
}
public OperationResult Remove(long id)
@@ -59,7 +59,7 @@ public class FileAlertApplication : IFileAlertApplication
_fileAlertRepository.Remove(id);
_fileAlertRepository.SaveChanges();
return operation.Succcedded("عنوان با موفقیت حذف شد");
return operation.Succcedded(-1,"عنوان با موفقیت حذف شد");
}
public FileAlertViewModel GetDetails(long id)
@@ -111,7 +111,7 @@ public class FileAlertApplication : IFileAlertApplication
File_Id = file.Id,
FileState_Id = file.State,
AdditionalDeadline = 0
}).EntityId;
}).SendId;
var fileAlert = GetDetails(fileAlertId);
if (workingDaysDifference < 0)

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.File1;
using Company.Domain.ProceedingSession;
using CompanyManagment.App.Contracts.Board;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.FileState;
using CompanyManagment.App.Contracts.File1;
using CompanyManagment.App.Contracts.FileState;
@@ -30,7 +30,7 @@ public class FileStateApplication : IFileStateApplication
return operation.Succcedded(entityId: fileState.id);
return operation.Succcedded(fileState.id);
}
public OperationResult Edit(EditFileState command)
@@ -45,7 +45,7 @@ public class FileStateApplication : IFileStateApplication
//fileState.Edit(command.State, command.Type);
_fileStateRepository.SaveChanges();
return operation.Succcedded(entityId: fileState.id);
return operation.Succcedded(fileState.id);
}
//public OperationResult Remove(long id)

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.FileTiming;
using CompanyManagment.App.Contracts.FileTiming;
@@ -28,7 +28,7 @@ public class FileTimingApplication : IFileTimingApplication
return operation.Succcedded(entityId: fileTiming.id);
return operation.Succcedded(fileTiming.id);
}
public OperationResult Edit(EditFileTiming command)
@@ -43,7 +43,7 @@ public class FileTimingApplication : IFileTimingApplication
fileTiming.Edit(command.Deadline);
_fileTimingRepository.SaveChanges();
return operation.Succcedded(entityId: fileTiming.id);
return operation.Succcedded( fileTiming.id);
}
public FileTimingViewModel GetDetails(long id)

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.FileTitle;
using CompanyManagment.App.Contracts.FileTitle;
@@ -28,7 +28,7 @@ public class FileTitleApplication : IFileTitleApplication
return operation.Succcedded(entityId: fileTitle.id);
return operation.Succcedded(fileTitle.id);
}
public OperationResult Edit(EditFileTitle command)
@@ -43,7 +43,7 @@ public class FileTitleApplication : IFileTitleApplication
fileTitle.Edit(command.Title, command.Type);
_fileTitleRepository.SaveChanges();
return operation.Succcedded(entityId: fileTitle.id);
return operation.Succcedded(fileTitle.id);
}
public OperationResult Remove(long id)
@@ -53,7 +53,7 @@ public class FileTitleApplication : IFileTitleApplication
_fileTitleRepository.Remove(id);
_fileTitleRepository.SaveChanges();
return operation.Succcedded("عنوان با موفقیت حذف شد");
return operation.Succcedded(-1, "عنوان با موفقیت حذف شد");
}
public EditFileTitle GetDetails(long id)

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.FineSubjectAgg;
using CompanyManagment.App.Contracts.FineSubject;

View File

@@ -1,5 +1,5 @@
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.MasterPetition;
using CompanyManagment.App.Contracts.MasterPetition;
@@ -32,9 +32,9 @@ public class MasterPetitionApplication : IMasterPetitionApplication
_masterPetitionRepository.Create(masterPetition);
_masterPetitionRepository.SaveChanges();
return operation.Succcedded(entityId: masterPetition.id);
return operation.Succcedded(masterPetition.id);
}
public OperationResult Edit(EditMasterPetition command)
@@ -55,14 +55,14 @@ public class MasterPetitionApplication : IMasterPetitionApplication
command.Description, command.WorkHistoryDescription, command.BoardType_Id, command.File_Id);
_masterPetitionRepository.SaveChanges();
return operation.Succcedded(entityId: MasterPetition.id);
return operation.Succcedded(MasterPetition.id);
}
public EditMasterPetition GetDetails(long id)
{
return _masterPetitionRepository.GetDetails(id);
}
public EditMasterPetition GetDetails(long fileId, int boardTypeId)
{
return _masterPetitionRepository.GetDetails(fileId, boardTypeId);
@@ -71,11 +71,11 @@ public class MasterPetitionApplication : IMasterPetitionApplication
public OperationResult Remove(long id)
{
var operation = new OperationResult();
_masterPetitionRepository.Remove(id);
_masterPetitionRepository.SaveChanges();
return operation.Succcedded("اطلاعات کارشناسی با موفقیت حذف شد");
return operation.Succcedded(-1, "اطلاعات کارشناسی با موفقیت حذف شد");
}
public List<EditMasterPetition> Search(MasterPetitionSearchModel searchModel)

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.PenaltyTitle;
using CompanyManagment.App.Contracts.PenaltyTitle;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.Petition;
using CompanyManagment.App.Contracts.Petition;
@@ -39,7 +39,7 @@ public class PetitionApplication : IPetitionApplication
return operation.Succcedded(entityId: petition.id);
return operation.Succcedded(petition.id);
}
public OperationResult Edit(EditPetition command)
@@ -64,7 +64,7 @@ public class PetitionApplication : IPetitionApplication
command.TotalPenalty, command.TotalPenaltyTitles, command.Description, command.WorkHistoryDescription, command.BoardType_Id, command.File_Id);
_petitionRepository.SaveChanges();
return operation.Succcedded(entityId: petition.id);
return operation.Succcedded(petition.id);
}
public EditPetition GetDetails(long id)

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.File1;
using Company.Domain.ProceedingSession;
using CompanyManagment.App.Contracts.Board;
@@ -45,7 +45,13 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
return operation.Failed("تاریخ و زمان رسیدگی الزامی است");
var Date = new DateTime();
Date = command.Date.ToGeorgianDateTime();
if (!command.Date.TryToGeorgianDateTime(out Date))
{
operation.Failed("تاریخ ")
}
var proSession = new ProceedingSession(Date, command.Time, command.Board_Id);
_proceedingSessionRepository.Create(proSession);

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using _0_Framework_b.Application;
using _0_Framework.Application;
using Company.Domain.WorkHistory;
using CompanyManagment.App.Contracts.WorkHistory;

View File

@@ -1,4 +1,4 @@
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.File1;
using CompanyManagment.App.Contracts.FileAlert;
using CompanyManagment.App.Contracts.FileState;

View File

@@ -1,4 +1,4 @@
using _0_Framework_b.Application;
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.CaseManagement;
using CompanyManagment.App.Contracts.Board;
using CompanyManagment.App.Contracts.Contact2;
@@ -268,7 +268,7 @@ public class IndexModel : PageModel
if (command.createDiagnosisPS != null)
result = _proceedingSessionApplication.CreateProceedingSessions(
command.createDiagnosisPS,
result.EntityId
result.SendId
);
if (!result.IsSuccedded)
@@ -293,7 +293,7 @@ public class IndexModel : PageModel
if (command.createDisputeResolutionPS != null)
result = _proceedingSessionApplication.CreateProceedingSessions(
command.createDisputeResolutionPS,
result.EntityId
result.SendId
);
if (!result.IsSuccedded)
@@ -343,7 +343,7 @@ public class IndexModel : PageModel
var workResult = _workHistoryApplication.CreateWorkHistories(
command.CreateWorkHistory,
petitionResult.EntityId
petitionResult.SendId
);
if (!workResult.IsSuccedded)
@@ -351,7 +351,7 @@ public class IndexModel : PageModel
var penaltyResult = _penaltyTitleApplication.CreatePenaltyTitles(
command.CreatePenaltyTitle,
petitionResult.EntityId
petitionResult.SendId
);
if (!penaltyResult.IsSuccedded)
@@ -410,7 +410,7 @@ public class IndexModel : PageModel
var workResult = _masterWorkHistoryApplication.CreateMasterWorkHistories(
command.CreateMasterWorkHistory,
masterPetitionResult.EntityId
masterPetitionResult.SendId
);
if (!workResult.IsSuccedded)
@@ -418,7 +418,7 @@ public class IndexModel : PageModel
var penaltyResult = _masterPenaltyTitleApplication.CreateMasterPenaltyTitles(
command.CreateMasterPenaltyTitle,
masterPetitionResult.EntityId
masterPetitionResult.SendId
);
if (!penaltyResult.IsSuccedded)
@@ -471,7 +471,7 @@ public class IndexModel : PageModel
var evidenceDetail = _evidenceDetailApplication.CreateEvidenceDetail(
command.CreateEvidenceDetail,
evidenceResult.EntityId
evidenceResult.SendId
);
if (!evidenceDetail.IsSuccedded)

View File

@@ -1,33 +0,0 @@
namespace _0_Framework_b.Application
{
public class OperationResult
{
public long EntityId { get; set; }
public bool IsSuccedded { get; set; }
public string Message { get; set; }
public OperationResult()
{
IsSuccedded = false;
}
public OperationResult Succcedded(string message = "عملیات با موفقیت انجام شد", long entityId = -1)
{
EntityId = entityId;
IsSuccedded = true;
Message = message;
return this;
}
public OperationResult Failed(string message)
{
IsSuccedded = false;
Message = message;
return this;
}
}
}