fix file session bug
This commit is contained in:
@@ -22,10 +22,11 @@ public class BoardApplication : IBoardApplication
|
||||
|
||||
var disputeResolutionPetitionDate = new DateTime();
|
||||
|
||||
disputeResolutionPetitionDate = command.DisputeResolutionPetitionDate.ToGeorgianDateTime();
|
||||
//TODO if
|
||||
//if(_BoardRepository.Exists(x=>x.Branch == command.Branch))
|
||||
// operation.Failed("fail message")
|
||||
if (!command.DisputeResolutionPetitionDate.TryToGeorgianDateTime(out disputeResolutionPetitionDate))
|
||||
{
|
||||
disputeResolutionPetitionDate = new DateTime();
|
||||
}
|
||||
|
||||
|
||||
var board = new Board(disputeResolutionPetitionDate, command.Branch, command.BoardChairman,
|
||||
command.ExpertReport,command.File_Id, command.BoardType_Id);
|
||||
@@ -41,7 +42,11 @@ public class BoardApplication : IBoardApplication
|
||||
var board = _boardRepository.Get(command.Id);
|
||||
|
||||
var disputeResolutionPetitionDate = new DateTime();
|
||||
disputeResolutionPetitionDate = command.DisputeResolutionPetitionDate.ToGeorgianDateTime();
|
||||
|
||||
if (!command.DisputeResolutionPetitionDate.TryToGeorgianDateTime(out disputeResolutionPetitionDate))
|
||||
{
|
||||
disputeResolutionPetitionDate = new DateTime();
|
||||
}
|
||||
|
||||
//TODO
|
||||
//if(_BoardRepository.Exists(x=>x.Branch == command.Branch))
|
||||
|
||||
@@ -84,6 +84,7 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
foreach (var item in files)
|
||||
{
|
||||
var file = _fileApplication.GetFileDetails(item);
|
||||
Console.WriteLine(file.Id);
|
||||
file.State = _fileStateApplication.GetFileState(file);
|
||||
|
||||
if (file.State == 0)
|
||||
|
||||
@@ -43,15 +43,19 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
if (String.IsNullOrWhiteSpace(command.Date) || String.IsNullOrWhiteSpace(command.Time))
|
||||
return operation.Failed("تاریخ و زمان رسیدگی الزامی است");
|
||||
|
||||
|
||||
var Date = new DateTime();
|
||||
|
||||
if (!command.Date.TryToGeorgianDateTime(out Date))
|
||||
{
|
||||
operation.Failed("تاریخ ")
|
||||
return operation.Failed("تاریخ جلسه وارد شده نامعتبر است ");
|
||||
}
|
||||
|
||||
if (!TimeOnly.TryParse(command.Time, out _))
|
||||
{
|
||||
return operation.Failed("ساعت جلسه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var proSession = new ProceedingSession(Date, command.Time, command.Board_Id);
|
||||
_proceedingSessionRepository.Create(proSession);
|
||||
@@ -100,8 +104,8 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
public void RemoveProceedingSessions(long boardId)
|
||||
{
|
||||
var searchModel = new ProceedingSessionSearchModel { Board_Id = boardId };
|
||||
|
||||
var searchModel = new ProceedingSessionSearchModel { Board_Id = boardId };
|
||||
|
||||
var objects = Search(searchModel);
|
||||
|
||||
_proceedingSessionRepository.RemoveProceedingSessions(objects);
|
||||
@@ -120,10 +124,10 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
List<EditProceedingSession> PSinDay = null;
|
||||
|
||||
var viewModels = new List<ProceedingSessionViewModel>();
|
||||
|
||||
|
||||
searchModel.FromDate = CreateFrom_ToDate(searchModel)[0];
|
||||
searchModel.ToDate = CreateFrom_ToDate(searchModel)[1];
|
||||
|
||||
//searchModel.FromDate = CreateFrom_ToDate(searchModel)[0];
|
||||
//searchModel.ToDate = CreateFrom_ToDate(searchModel)[1];
|
||||
|
||||
var proseedingSessions = Search(searchModel)
|
||||
.OrderBy(x => x.Date)
|
||||
@@ -131,8 +135,8 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
.GroupBy(x => x.Date)
|
||||
.ToList();
|
||||
|
||||
var files = _fileApplication.Search(new FileSearchModel
|
||||
{
|
||||
var files = _fileApplication.Search(new FileSearchModel
|
||||
{
|
||||
ArchiveNo = searchModel.File.ArchiveNo.ToString(),
|
||||
FileClass = searchModel.File.FileClass,
|
||||
UserId_RequesterOrSummoned = searchModel.UserId_RequesterOrSummoned,
|
||||
@@ -157,7 +161,7 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
return viewModels;
|
||||
}
|
||||
|
||||
|
||||
//var days = Tools.GetDaysBetweenDateGeorgian(proseedingSessions.FirstOrDefault().Date.ToGeorgianDateTime(), proseedingSessions.LastOrDefault().Date.ToGeorgianDateTime());
|
||||
//var days = Tools.GetDaysBetweenDateGeorgian(proseedingSessions.FirstOrDefault(), proseedingSessions.LastOrDefault());
|
||||
|
||||
@@ -165,7 +169,7 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
//proseedingSessions.Add(new IGrouping<string, EditProceedingSession>("14124312", new EditProceedingSession()));
|
||||
|
||||
|
||||
|
||||
|
||||
var i = 0;
|
||||
|
||||
@@ -179,7 +183,11 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
i++;
|
||||
}
|
||||
|
||||
var days = Tools.GetDaysBetweenDateGeorgian(startDate.ToGeorgianDateTime(), endDate.ToGeorgianDateTime());
|
||||
List<string> days = [];
|
||||
if (!string.IsNullOrWhiteSpace(startDate) && !string.IsNullOrWhiteSpace(endDate))
|
||||
{
|
||||
days = Tools.GetDaysBetweenDateGeorgian(startDate.ToGeorgianDateTime(), endDate.ToGeorgianDateTime());
|
||||
}
|
||||
|
||||
//foreach (var item in new List<ProceedingSessionViewModel>(viewModels))
|
||||
//{
|
||||
@@ -235,13 +243,13 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
var file_PSList = new List<File_Board_PS>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
{
|
||||
var board = _boardApplication.GetDetails(item.Board_Id);
|
||||
|
||||
if (searchModel.Board.BoardType_Id != 0 && board.BoardType_Id != searchModel.Board.BoardType_Id)
|
||||
continue;
|
||||
|
||||
if(searchModel.Board.BoardChairman != null)
|
||||
if (searchModel.Board.BoardChairman != null)
|
||||
{
|
||||
if (board.BoardChairman == null)
|
||||
continue;
|
||||
@@ -325,7 +333,7 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
{
|
||||
var pastProceedingSessions = _proceedingSessionRepository.Search(new ProceedingSessionSearchModel { Status = 1, ToDate = DateTime.Today.AddDays(-1).ToFarsi() });
|
||||
|
||||
foreach(var PS in pastProceedingSessions)
|
||||
foreach (var PS in pastProceedingSessions)
|
||||
{
|
||||
var proceedingSession = _proceedingSessionRepository.Get(PS.Id);
|
||||
proceedingSession.Edit(PS.Date.ToGeorgianDateTime(), PS.Time, PS.Board_Id, 2);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ProceedingSessionRepository : RepositoryBase<long, ProceedingSessio
|
||||
|
||||
public List<EditProceedingSession> Search(ProceedingSessionSearchModel searchModel)
|
||||
{
|
||||
var query = _context.ProceedingSessions.Select(x => new
|
||||
var query = _context.ProceedingSessions.Select(x => new
|
||||
{
|
||||
Id = x.id,
|
||||
Date = x.Date,
|
||||
@@ -40,22 +40,22 @@ public class ProceedingSessionRepository : RepositoryBase<long, ProceedingSessio
|
||||
|
||||
//TODO if
|
||||
|
||||
if(searchModel.Id != 0)
|
||||
if (searchModel.Id != 0)
|
||||
{
|
||||
query = query.Where(x => x.Id == searchModel.Id);
|
||||
}
|
||||
|
||||
if(searchModel.Board_Id != 0)
|
||||
|
||||
if (searchModel.Board_Id != 0)
|
||||
{
|
||||
query = query.Where(x => x.Board_Id == searchModel.Board_Id);
|
||||
}
|
||||
|
||||
if(searchModel.Status != 0)
|
||||
|
||||
if (searchModel.Status != 0)
|
||||
{
|
||||
query = query.Where(x => x.Status == searchModel.Status);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(searchModel.FromDate))
|
||||
if (!string.IsNullOrEmpty(searchModel.FromDate))
|
||||
{
|
||||
query = query.Where(x => x.Date >= searchModel.FromDate.ToGeorgianDateTime());
|
||||
}
|
||||
@@ -64,13 +64,26 @@ public class ProceedingSessionRepository : RepositoryBase<long, ProceedingSessio
|
||||
{
|
||||
query = query.Where(x => x.Date <= searchModel.ToDate.ToGeorgianDateTime());
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Time))
|
||||
{
|
||||
query = query.Where(x => x.Time == searchModel.Time);
|
||||
}
|
||||
|
||||
return query.Select(x => new EditProceedingSession {
|
||||
if (searchModel.Year != 0 && searchModel.Month != 0)
|
||||
{
|
||||
var start = $"{searchModel.Year:0000}/{searchModel.Month:00}/01";
|
||||
var end = start.FindeEndOfMonth();
|
||||
|
||||
|
||||
var startGr = start.ToGeorgianDateTime();
|
||||
var endGr = end.ToGeorgianDateTime();
|
||||
|
||||
query = query.Where(x => x.Date >= startGr && x.Date <= endGr);
|
||||
}
|
||||
|
||||
return query.Select(x => new EditProceedingSession
|
||||
{
|
||||
Id = x.Id,
|
||||
Date = x.Date.ToFarsi(),
|
||||
Time = x.Time,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user