merge from feature/file/session
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -52,81 +52,81 @@ public static class Tools
|
||||
/// <param name="endDate"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <returns></returns>
|
||||
public static (int countWorkingDays,DateTime startWork,DateTime endWork,bool hasStartWorkInMonth,bool hasLeftWorkInMonth) GetEmployeeInsuranceWorkingDays(DateTime startWork,DateTime? leftWork,DateTime startDate,
|
||||
DateTime endDate,long employeeId)
|
||||
public static (int countWorkingDays, DateTime startWork, DateTime endWork, bool hasStartWorkInMonth, bool hasLeftWorkInMonth) GetEmployeeInsuranceWorkingDays(DateTime startWork, DateTime? leftWork, DateTime startDate,
|
||||
DateTime endDate, long employeeId)
|
||||
{
|
||||
DateTime start = startDate;
|
||||
DateTime start = startDate;
|
||||
DateTime end = endDate;
|
||||
bool startWorkInMonth = false;
|
||||
bool endWorkInMonth = false;
|
||||
|
||||
|
||||
//اگر شروع بکار پرسنل در ماه مشخص شده لیست بیمه بود
|
||||
if (startWork >= startDate)
|
||||
{
|
||||
start = startWork;
|
||||
startWorkInMonth = true;
|
||||
start = startWork;
|
||||
startWorkInMonth = true;
|
||||
}
|
||||
|
||||
if(leftWork == null)
|
||||
if (leftWork == null)
|
||||
leftWork = DateTime.MinValue;
|
||||
//اگر ترک کار پرسنل در ماه مشخص شده لیست بیمه بود
|
||||
if (leftWork != DateTime.MinValue && leftWork.Value < endDate)
|
||||
{
|
||||
end = leftWork.Value;
|
||||
end = leftWork.Value;
|
||||
endWorkInMonth = true;
|
||||
}
|
||||
|
||||
int countDays = (int)(end - start).TotalDays +1;
|
||||
int countDays = (int)(end - start).TotalDays + 1;
|
||||
|
||||
|
||||
//روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
|
||||
switch (employeeId)
|
||||
{
|
||||
|
||||
//case 3812://ثابت- کسری حاجی پور
|
||||
// countWorkingDays = 15;
|
||||
// break;
|
||||
case 40463://ثابت
|
||||
countDays = 10;
|
||||
break;
|
||||
case 40469://ثابت
|
||||
countDays = 7;
|
||||
break;
|
||||
//case 9950://ثابت
|
||||
// countDays = 15;
|
||||
//break;
|
||||
case 9640://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
case 40998://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
case 6219://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
//case 7897://ثابت
|
||||
// countWorkingDays = 15;
|
||||
//case 3812://ثابت- کسری حاجی پور
|
||||
// countWorkingDays = 15;
|
||||
// break;
|
||||
case 40463://ثابت
|
||||
countDays = 10;
|
||||
break;
|
||||
case 40469://ثابت
|
||||
countDays = 7;
|
||||
break;
|
||||
//case 9950://ثابت
|
||||
// countDays = 15;
|
||||
//break;
|
||||
case 9640://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
case 40998://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
case 6219://ثابت
|
||||
countDays = 15;
|
||||
break;
|
||||
//case 7897://ثابت
|
||||
// countWorkingDays = 15;
|
||||
}
|
||||
|
||||
|
||||
return (countDays,start,end,startWorkInMonth,endWorkInMonth);
|
||||
return (countDays, start, end, startWorkInMonth, endWorkInMonth);
|
||||
}
|
||||
/// <summary>
|
||||
/// محاسبه سن
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
public static (int yearCount, int monthCount, int dayCount) GetAge(DateTime startDate, DateTime endDate)
|
||||
/// <summary>
|
||||
/// محاسبه سن
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
public static (int yearCount, int monthCount, int dayCount) GetAge(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
|
||||
|
||||
var startFa = startDate.ToFarsi();
|
||||
int startYear = Convert.ToInt32(startFa.Substring(0, 4));
|
||||
int startMonth = Convert.ToInt32(startFa.Substring(5, 2));
|
||||
int startDay = Convert.ToInt32(startFa.Substring(8, 2));
|
||||
var start = new PersianDateTime(startYear, startMonth, startDay);
|
||||
|
||||
|
||||
|
||||
var endFa = endDate.ToFarsi();
|
||||
int endYear = Convert.ToInt32(endFa.Substring(0, 4));
|
||||
int endMonth = Convert.ToInt32(endFa.Substring(5, 2));
|
||||
@@ -141,7 +141,7 @@ public static class Tools
|
||||
if (firstYearCounter > end)
|
||||
{
|
||||
start = start.AddYears(-1);
|
||||
|
||||
|
||||
var endMonthCounter = new PersianDateTime(end.Year, end.Month, start.Day);
|
||||
|
||||
for (var monthCounter = start; monthCounter <= end; monthCounter = monthCounter.AddMonths(1))
|
||||
@@ -193,7 +193,7 @@ public static class Tools
|
||||
if (yearCouner.Year == end.Year)
|
||||
{
|
||||
|
||||
var endMonthCounter = new PersianDateTime(end.Year, end.Month, (yearCouner.Day > end.Day ? end.Day : yearCouner.Day));
|
||||
var endMonthCounter = new PersianDateTime(end.Year, end.Month, (yearCouner.Day > end.Day ? end.Day : yearCouner.Day));
|
||||
|
||||
if (yearCouner.Day <= end.Day)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ public static class Tools
|
||||
|
||||
Console.ResetColor();
|
||||
Console.WriteLine($"old: [{years} year] ، [{months} month] ، [{days} day]");
|
||||
return (years,months,days);
|
||||
return (years, months, days);
|
||||
}
|
||||
|
||||
public static string ToFarsi(this DateTime? date)
|
||||
@@ -397,9 +397,9 @@ public static class Tools
|
||||
|
||||
public static DateTime ToGeorgianDateTime(this string persianDate)
|
||||
{
|
||||
persianDate = persianDate.ToEnglishNumber();
|
||||
try
|
||||
{
|
||||
persianDate = persianDate.ToEnglishNumber();
|
||||
var year = Convert.ToInt32(persianDate.Substring(0, 4));
|
||||
var month = Convert.ToInt32(persianDate.Substring(5, 2));
|
||||
var day = Convert.ToInt32(persianDate.Substring(8, 2));
|
||||
@@ -1267,16 +1267,16 @@ public static class Tools
|
||||
var part5 = parts[5].Substring(0, 2);
|
||||
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
PersianCalendar pc = new PersianCalendar();
|
||||
dateTime = pc.ToDateTime(int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]), int.Parse(parts[4]), int.Parse(part5), 0, 0, 0);
|
||||
|
||||
dateTime = pc.ToDateTime(int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]), int.Parse(parts[4]), int.Parse(part5), 0, 0, 0);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1384,8 +1384,8 @@ public static class Tools
|
||||
}
|
||||
public static DateTime FindFirstDayOfMonthGr(this DateTime date)
|
||||
{
|
||||
var pc = new PersianCalendar();
|
||||
return ($"{pc.GetYear(date)}/{pc.GetMonth(date):00}/01").ToGeorgianDateTime();
|
||||
var pc = new PersianCalendar();
|
||||
return ($"{pc.GetYear(date)}/{pc.GetMonth(date):00}/01").ToGeorgianDateTime();
|
||||
}
|
||||
#region Mahan
|
||||
|
||||
@@ -1588,19 +1588,19 @@ public static class Tools
|
||||
|
||||
public static TimeOnly CalculateOffset(ICollection<CustomizeSifts> shiftDetailsRegularShifts)
|
||||
{
|
||||
if (!shiftDetailsRegularShifts.Any())
|
||||
{
|
||||
return TimeOnly.MinValue;
|
||||
}
|
||||
var date = new DateOnly();
|
||||
var firstStartShift = new DateTime(date, shiftDetailsRegularShifts.MinBy(x => x.Placement).StartTime);
|
||||
var lastEndShift = new DateTime(date, shiftDetailsRegularShifts.MaxBy(x => x.Placement).EndTime);
|
||||
if (lastEndShift > firstStartShift)
|
||||
firstStartShift = firstStartShift.AddDays(1);
|
||||
var offSet = (firstStartShift - lastEndShift).Divide(2);
|
||||
return TimeOnly.FromDateTime(lastEndShift.Add(offSet));
|
||||
if (!shiftDetailsRegularShifts.Any())
|
||||
{
|
||||
return TimeOnly.MinValue;
|
||||
}
|
||||
var date = new DateOnly();
|
||||
var firstStartShift = new DateTime(date, shiftDetailsRegularShifts.MinBy(x => x.Placement).StartTime);
|
||||
var lastEndShift = new DateTime(date, shiftDetailsRegularShifts.MaxBy(x => x.Placement).EndTime);
|
||||
if (lastEndShift > firstStartShift)
|
||||
firstStartShift = firstStartShift.AddDays(1);
|
||||
var offSet = (firstStartShift - lastEndShift).Divide(2);
|
||||
return TimeOnly.FromDateTime(lastEndShift.Add(offSet));
|
||||
}
|
||||
public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek)
|
||||
public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek)
|
||||
{
|
||||
int numberOfNextDayOfWeek = ((int)dayOfWeek - (int)date.DayOfWeek + 7) % 7;
|
||||
return date.AddDays(numberOfNextDayOfWeek == 0 ? 7 : numberOfNextDayOfWeek);
|
||||
@@ -1772,75 +1772,75 @@ public static class Tools
|
||||
public static string ToFarsiHoursAndMinutes(int hours, int minutes, string emptyValue = "")
|
||||
{
|
||||
|
||||
string message = emptyValue;
|
||||
if (hours > 0 && minutes > 0)
|
||||
{
|
||||
string message = emptyValue;
|
||||
if (hours > 0 && minutes > 0)
|
||||
{
|
||||
|
||||
message = hours + " " + "ساعت و" + " " + minutes + " " + "دقیقه";
|
||||
}
|
||||
else if (hours > 0 && minutes == 0)
|
||||
{
|
||||
message = hours + " " + "ساعت و" + " " + minutes + " " + "دقیقه";
|
||||
}
|
||||
else if (hours > 0 && minutes == 0)
|
||||
{
|
||||
|
||||
message = hours + " " + "ساعت ";
|
||||
}
|
||||
else if (hours == 0 && minutes > 0)
|
||||
{
|
||||
message = hours + " " + "ساعت ";
|
||||
}
|
||||
else if (hours == 0 && minutes > 0)
|
||||
{
|
||||
|
||||
message = minutes + " " + "دقیقه";
|
||||
}
|
||||
message = minutes + " " + "دقیقه";
|
||||
}
|
||||
|
||||
return message;
|
||||
return message;
|
||||
}
|
||||
public static string ToFarsiHoursAndMinutes(this TimeSpan timeSpan, string emptyValue = "")
|
||||
public static string ToFarsiHoursAndMinutes(this TimeSpan timeSpan, string emptyValue = "")
|
||||
{
|
||||
var hours = (int)timeSpan.TotalHours;
|
||||
var minutes = timeSpan.Minutes;
|
||||
string message = emptyValue;
|
||||
if (hours > 0 && minutes > 0)
|
||||
{
|
||||
var hours = (int)timeSpan.TotalHours;
|
||||
var minutes = timeSpan.Minutes;
|
||||
string message = emptyValue;
|
||||
if (hours > 0 && minutes > 0)
|
||||
{
|
||||
|
||||
message = hours + " " + "ساعت و" + " " + minutes + " " + "دقیقه";
|
||||
}
|
||||
else if (hours > 0 && minutes == 0)
|
||||
{
|
||||
message = hours + " " + "ساعت و" + " " + minutes + " " + "دقیقه";
|
||||
}
|
||||
else if (hours > 0 && minutes == 0)
|
||||
{
|
||||
|
||||
message = hours + " " + "ساعت ";
|
||||
}
|
||||
else if (hours == 0 && minutes > 0)
|
||||
{
|
||||
message = hours + " " + "ساعت ";
|
||||
}
|
||||
else if (hours == 0 && minutes > 0)
|
||||
{
|
||||
|
||||
message = minutes + " " + "دقیقه";
|
||||
}
|
||||
message = minutes + " " + "دقیقه";
|
||||
}
|
||||
|
||||
return message;
|
||||
return message;
|
||||
}
|
||||
public static string ToFarsiDaysAndHoursAndMinutes(this TimeSpan timeSpan, string emptyValue = "")
|
||||
{
|
||||
var hours = (int)timeSpan.TotalHours;
|
||||
var minutes = timeSpan.Minutes;
|
||||
var days = hours / 24;
|
||||
hours = hours % 24;
|
||||
string message = "";
|
||||
public static string ToFarsiDaysAndHoursAndMinutes(this TimeSpan timeSpan, string emptyValue = "")
|
||||
{
|
||||
var hours = (int)timeSpan.TotalHours;
|
||||
var minutes = timeSpan.Minutes;
|
||||
var days = hours / 24;
|
||||
hours = hours % 24;
|
||||
string message = "";
|
||||
|
||||
if (days > 0)
|
||||
message += days + " " + "روز";
|
||||
if (hours > 0)
|
||||
if (message == "")
|
||||
message += hours + " " + "ساعت";
|
||||
else
|
||||
message += " و " + hours + " " + "ساعت";
|
||||
if (minutes > 0)
|
||||
if (message == "")
|
||||
message += minutes + " " + "دقیقه";
|
||||
else
|
||||
message += " و " + minutes + " " + "دقیقه";
|
||||
if (days > 0)
|
||||
message += days + " " + "روز";
|
||||
if (hours > 0)
|
||||
if (message == "")
|
||||
message += hours + " " + "ساعت";
|
||||
else
|
||||
message += " و " + hours + " " + "ساعت";
|
||||
if (minutes > 0)
|
||||
if (message == "")
|
||||
message += minutes + " " + "دقیقه";
|
||||
else
|
||||
message += " و " + minutes + " " + "دقیقه";
|
||||
|
||||
if (message == "")
|
||||
message = emptyValue;
|
||||
return message;
|
||||
}
|
||||
if (message == "")
|
||||
message = emptyValue;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static bool ArePropertiesEqual<T>(this T obj1, T obj2)
|
||||
public static bool ArePropertiesEqual<T>(this T obj1, T obj2)
|
||||
{
|
||||
// If either object is null, they can't be equal
|
||||
if (obj1 == null || obj2 == null)
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework_b.Domain;
|
||||
using CompanyManagment.App.Contracts.FileAlert;
|
||||
|
||||
@@ -10,4 +11,5 @@ public interface IFileAlertRepository : IRepository<long, FileAlert>
|
||||
FileAlertViewModel GetDetails(long id);
|
||||
void Remove(long id);
|
||||
List<EditFileAlert> Search(FileAlertSearchModel searchModel);
|
||||
Task<List<FileAlertViewModel>> GetFileAlerts();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Board;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Evidence;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EvidenceDetail;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.File1;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FileAlert;
|
||||
@@ -13,4 +14,5 @@ public interface IFileAlertApplication
|
||||
List<EditFileAlert> Search(FileAlertSearchModel searchModel);
|
||||
List<FileAlertViewModel> GetFilesAlerts(List<FileViewModel> files);
|
||||
int getMaximumAdditionalDeadlineTimes(int additionalDeadline);
|
||||
Task<List<FileAlertViewModel>> GetFileAlerts();
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FileTiming;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.FileTitle;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.MasterPetition;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.PenaltyTitle;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Petition;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ProceedingSession;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
|
||||
|
||||
namespace CompanyManagment.App.Contracts.WorkHistory;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,17 +22,18 @@ 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);
|
||||
_boardRepository.Create(board);
|
||||
_boardRepository.SaveChanges();
|
||||
|
||||
return operation.Succcedded(entityId: board.id);
|
||||
return operation.Succcedded(board.id);
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditBoard command)
|
||||
@@ -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))
|
||||
@@ -51,7 +56,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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using _0_Framework_b.Application;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework_b.Application;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.FileAlert;
|
||||
using CompanyManagment.App.Contracts.File1;
|
||||
using CompanyManagment.App.Contracts.FileAlert;
|
||||
@@ -36,7 +37,7 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
|
||||
|
||||
|
||||
return operation.Succcedded(entityId: fileAlert.id);
|
||||
return operation.Succcedded( fileAlert.id);
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditFileAlert command)
|
||||
@@ -49,7 +50,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 +60,7 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
_fileAlertRepository.Remove(id);
|
||||
_fileAlertRepository.SaveChanges();
|
||||
|
||||
return operation.Succcedded("عنوان با موفقیت حذف شد");
|
||||
return operation.Succcedded(-1,"عنوان با موفقیت حذف شد");
|
||||
}
|
||||
|
||||
public FileAlertViewModel GetDetails(long id)
|
||||
@@ -81,6 +82,9 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
var fileStates = _fileStateApplication.Search(new FileStateSearchModel());
|
||||
var fileAlertsVM = new List<FileAlertViewModel>();
|
||||
|
||||
#if DEBUG
|
||||
files = files.Take(5).ToList();
|
||||
#endif
|
||||
foreach (var item in files)
|
||||
{
|
||||
var file = _fileApplication.GetFileDetails(item);
|
||||
@@ -88,7 +92,7 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
|
||||
if (file.State == 0)
|
||||
continue;
|
||||
|
||||
//
|
||||
file.StateDate = _fileStateApplication.GetFileStateDate(file);
|
||||
var today = DateTime.Now.Date;
|
||||
|
||||
@@ -111,7 +115,7 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
File_Id = file.Id,
|
||||
FileState_Id = file.State,
|
||||
AdditionalDeadline = 0
|
||||
}).EntityId;
|
||||
}).SendId;
|
||||
|
||||
var fileAlert = GetDetails(fileAlertId);
|
||||
if (workingDaysDifference < 0)
|
||||
@@ -175,4 +179,8 @@ public class FileAlertApplication : IFileAlertApplication
|
||||
return 0;
|
||||
}
|
||||
|
||||
public async Task<List<FileAlertViewModel>> GetFileAlerts()
|
||||
{
|
||||
return await _fileAlertRepository.GetFileAlerts();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
@@ -43,9 +43,19 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
if (String.IsNullOrWhiteSpace(command.Date) || String.IsNullOrWhiteSpace(command.Time))
|
||||
return operation.Failed("تاریخ و زمان رسیدگی الزامی است");
|
||||
|
||||
|
||||
var Date = new DateTime();
|
||||
Date = command.Date.ToGeorgianDateTime();
|
||||
|
||||
if (!command.Date.TryToGeorgianDateTime(out Date))
|
||||
{
|
||||
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);
|
||||
@@ -94,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);
|
||||
@@ -114,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)
|
||||
@@ -125,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,
|
||||
@@ -151,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());
|
||||
|
||||
@@ -159,7 +169,7 @@ public class ProceedingSessionApplication : IProceedingSessionApplication
|
||||
|
||||
//proseedingSessions.Add(new IGrouping<string, EditProceedingSession>("14124312", new EditProceedingSession()));
|
||||
|
||||
|
||||
|
||||
|
||||
var i = 0;
|
||||
|
||||
@@ -173,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))
|
||||
//{
|
||||
@@ -229,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;
|
||||
@@ -319,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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework_b.InfraStructure;
|
||||
using Company.Domain.File1;
|
||||
using Company.Domain.FileAlert;
|
||||
using CompanyManagment.App.Contracts.File1;
|
||||
using CompanyManagment.App.Contracts.FileAlert;
|
||||
using CompanyManagment.App.Contracts.FileState;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -44,16 +51,252 @@ public class FileAlertRepository : RepositoryBase<long, FileAlert>, IFileAlertRe
|
||||
});
|
||||
|
||||
//TODO if
|
||||
if(searchModel.FileState_Id != 0)
|
||||
if (searchModel.FileState_Id != 0)
|
||||
{
|
||||
query = query.Where(x => x.FileState_Id == searchModel.FileState_Id);
|
||||
}
|
||||
|
||||
if(searchModel.File_Id != 0)
|
||||
|
||||
if (searchModel.File_Id != 0)
|
||||
{
|
||||
query = query.Where(x => x.File_Id == searchModel.File_Id);
|
||||
}
|
||||
|
||||
return query.OrderByDescending(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
#region Mahan
|
||||
public async Task<List<FileAlertViewModel>> GetFileAlerts()
|
||||
{
|
||||
var today = DateTime.Today;
|
||||
var fileAlertsVM = new List<FileAlertViewModel>();
|
||||
|
||||
var fileStates = await _context.FileStates.Include(x => x.FileTiming).Select(x => new
|
||||
{
|
||||
Id = x.id,
|
||||
x.FileTiming_Id,
|
||||
x.State,
|
||||
x.Title,
|
||||
x.FileTiming.Deadline
|
||||
}).ToListAsync();
|
||||
|
||||
var files = await _context.Files.Where(x => x.Status == FileEnums.ACTIVE)
|
||||
.Include(x => x.BoardsList).ThenInclude(x => x.ProceedingSessionsList)
|
||||
.Include(x => x.PetitionsList)
|
||||
.Where(file =>
|
||||
file.FileClass == null
|
||||
|| file.HasMandate != 2
|
||||
|| (file.BoardsList.Any(a => a.BoardType_Id == 1 && a.DisputeResolutionPetitionDate == new DateTime()))
|
||||
|| (file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 1 && a.DisputeResolutionPetitionDate != new DateTime() &&
|
||||
a.ProceedingSessionsList.Count == 0))
|
||||
|| (file.BoardsList.Any(a => a.BoardType_Id == 1 && a.ProceedingSessionsList.Count != 0) &&
|
||||
(file.PetitionsList.Any(x => x.BoardType_Id == 1) == false))
|
||||
|| (file.PetitionsList.Any(x => x.BoardType_Id == 1) && file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 2 && a.DisputeResolutionPetitionDate == new DateTime()))
|
||||
|| (file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 2 && a.DisputeResolutionPetitionDate != new DateTime() &&
|
||||
a.ProceedingSessionsList.Count == 0))
|
||||
|| (file.PetitionsList.Any(x => x.BoardType_Id == 2) == false)
|
||||
).ToListAsync();
|
||||
|
||||
var fileWithState = files.Select(x =>
|
||||
{
|
||||
if (x.id == 74)
|
||||
{
|
||||
|
||||
}
|
||||
var state = GetFileState(x);
|
||||
return new
|
||||
{
|
||||
File = x,
|
||||
State = state,
|
||||
StateDate = GetFileStateDate(x, state)
|
||||
};
|
||||
}).Where(x => x.StateDate > today).ToList();
|
||||
|
||||
|
||||
foreach (var file in fileWithState)
|
||||
{
|
||||
if (file.File.FileAlertsList.Count == 0)
|
||||
{
|
||||
var dueDate = file.StateDate + TimeSpan.FromDays(fileStates.Where(x => x.State == file.State).FirstOrDefault().Deadline);
|
||||
var workingDaysDifference = Tools.GetWorkingDaysDifference(today, dueDate);
|
||||
|
||||
if (workingDaysDifference <= 1)
|
||||
{
|
||||
var fileAlertEntity = new FileAlert(file.File.id, file.State, 0);
|
||||
Create(fileAlertEntity);
|
||||
SaveChanges();
|
||||
var fileState = fileStates.FirstOrDefault(x => x.Id == file.State);
|
||||
|
||||
var fileAlert = new FileAlertViewModel()
|
||||
{
|
||||
AdditionalDeadline = fileAlertEntity.AdditionalDeadline,
|
||||
FileState = new FileStateViewModel()
|
||||
{
|
||||
State = fileState?.State ?? 0,
|
||||
Id = fileState.Id,
|
||||
FileTiming_Id = fileState.FileTiming_Id,
|
||||
Title = fileState.Title
|
||||
},
|
||||
Id = fileAlertEntity.id,
|
||||
FileState_Id = fileAlertEntity.FileState_Id,
|
||||
File_Id = fileAlertEntity.File_Id,
|
||||
IsExpired = false
|
||||
};
|
||||
if (workingDaysDifference < 0)
|
||||
fileAlert.IsExpired = true;
|
||||
|
||||
fileAlertsVM.Add(fileAlert);
|
||||
}
|
||||
}
|
||||
|
||||
else if (file.File.FileAlertsList.Count == 1)
|
||||
{
|
||||
var dueDate = file.StateDate + TimeSpan.FromDays(fileStates.Where(x => x.State == file.State).FirstOrDefault().Deadline);
|
||||
var workingDaysDifference = Tools.GetWorkingDaysDifference(today, dueDate);
|
||||
|
||||
if (workingDaysDifference <= 1)
|
||||
{
|
||||
var fileAlertEntity = file.File.FileAlertsList.First();
|
||||
var fileState = fileStates.FirstOrDefault(x => x.Id == file.State);
|
||||
|
||||
var fileAlert = new FileAlertViewModel()
|
||||
{
|
||||
AdditionalDeadline = fileAlertEntity.AdditionalDeadline,
|
||||
FileState = new FileStateViewModel()
|
||||
{
|
||||
State = fileState?.State ?? 0,
|
||||
Id = fileState.Id,
|
||||
FileTiming_Id = fileState.FileTiming_Id,
|
||||
Title = fileState.Title
|
||||
},
|
||||
Id = fileAlertEntity.id,
|
||||
FileState_Id = fileAlertEntity.FileState_Id,
|
||||
File_Id = fileAlertEntity.File_Id,
|
||||
IsExpired = false
|
||||
};
|
||||
if (workingDaysDifference < 0)
|
||||
fileAlert.IsExpired = true;
|
||||
|
||||
fileAlertsVM.Add(fileAlert);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
var totalAdditionalDeadline = file.File.FileAlertsList.Sum(x => x.AdditionalDeadline);
|
||||
var dueDate = file.StateDate + TimeSpan.FromDays(fileStates.Where(x => x.State == file.State).FirstOrDefault().Deadline) + TimeSpan.FromDays(totalAdditionalDeadline);
|
||||
var workingDaysDifference = Tools.GetWorkingDaysDifference(today, dueDate);
|
||||
|
||||
if (workingDaysDifference <= 1)
|
||||
{
|
||||
var fileAlertEntity = file.File.FileAlertsList.Last();
|
||||
|
||||
var fileState = fileStates.FirstOrDefault(x => x.Id == file.State);
|
||||
|
||||
var fileAlert = new FileAlertViewModel()
|
||||
{
|
||||
AdditionalDeadline = fileAlertEntity.AdditionalDeadline,
|
||||
FileState = new FileStateViewModel()
|
||||
{
|
||||
State = fileState?.State ?? 0,
|
||||
Id = fileState.Id,
|
||||
FileTiming_Id = fileState.FileTiming_Id,
|
||||
Title = fileState.Title
|
||||
},
|
||||
Id = fileAlertEntity.id,
|
||||
FileState_Id = fileAlertEntity.FileState_Id,
|
||||
File_Id = fileAlertEntity.File_Id,
|
||||
IsExpired = false
|
||||
};
|
||||
if (workingDaysDifference < 0)
|
||||
fileAlert.IsExpired = true;
|
||||
|
||||
fileAlertsVM.Add(fileAlert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fileAlertsVM;
|
||||
}
|
||||
public int GetFileState(File1 file)
|
||||
{
|
||||
//if (file.FileClass == null || (file.FileClass != null && file.DiagnosisBoard.DisputeResolutionPetitionDate == null))
|
||||
if (file.FileClass == null)
|
||||
return FileStateEnums.FILE_CLASS_NOT_REGISTERED;
|
||||
|
||||
//if (file.HasMandate != 2 || (file.HasMandate == 2 && file.DiagnosisBoard.DisputeResolutionPetitionDate == null))
|
||||
if (file.HasMandate != 2)
|
||||
return FileStateEnums.MANDATE_NOT_REGISTERED;
|
||||
|
||||
if ((file.BoardsList.Any(a => a.BoardType_Id == 1 && a.DisputeResolutionPetitionDate == new DateTime())))
|
||||
return FileStateEnums.NO_PETITION_DATE_ISSUED;
|
||||
|
||||
if ((file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 1 && a.DisputeResolutionPetitionDate != new DateTime() &&
|
||||
a.ProceedingSessionsList.Count == 1)))
|
||||
return FileStateEnums.NO_DIAGNOSIS_INVITATION_ISSUED;
|
||||
|
||||
if ((file.BoardsList.Any(a => a.BoardType_Id == 1 && a.ProceedingSessionsList.Count > 1) &&
|
||||
(file.PetitionsList.Any(x => x.BoardType_Id == 1) == false)))
|
||||
return FileStateEnums.NO_DIAGNOSIS_PETITION_ISSUED;
|
||||
|
||||
if ((file.PetitionsList.Any(x => x.BoardType_Id == 1) && file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 2 && a.DisputeResolutionPetitionDate == new DateTime()) || file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 2) == false))
|
||||
return FileStateEnums.PROTEST_NOT_REGISTERED;
|
||||
|
||||
if ((file.BoardsList.Any(a =>
|
||||
a.BoardType_Id == 2 && a.DisputeResolutionPetitionDate != new DateTime() &&
|
||||
a.ProceedingSessionsList.Count == 1)))
|
||||
return FileStateEnums.NO_DISPUTE_INVITATION_ISSUED;
|
||||
|
||||
if ((file.PetitionsList.Any(x => x.BoardType_Id == 2) == false))
|
||||
return FileStateEnums.NO_DISPUTE_PETITION_ISSUED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
public DateTime? GetFileStateDate(File1 file, int state)
|
||||
{
|
||||
var diagnosisBoard = file.BoardsList.FirstOrDefault(x => x.BoardType_Id == 1);
|
||||
var diagnosisPetition = file.PetitionsList.FirstOrDefault(x => x.BoardType_Id == 1);
|
||||
var disputeResolutionBoard = file.BoardsList.FirstOrDefault(x => x.BoardType_Id == 2);
|
||||
switch (state)
|
||||
{
|
||||
case FileStateEnums.FILE_CLASS_NOT_REGISTERED:
|
||||
return file.ClientVisitDate;
|
||||
|
||||
case FileStateEnums.MANDATE_NOT_REGISTERED:
|
||||
return file.ClientVisitDate;
|
||||
|
||||
case FileStateEnums.NO_PETITION_DATE_ISSUED:
|
||||
return file.ClientVisitDate;
|
||||
|
||||
case FileStateEnums.NO_DIAGNOSIS_INVITATION_ISSUED:
|
||||
return diagnosisBoard?.DisputeResolutionPetitionDate;
|
||||
|
||||
case FileStateEnums.NO_DIAGNOSIS_PETITION_ISSUED:
|
||||
var lastDiagnosisPs = file.BoardsList.First(x => x.BoardType_Id == 1).ProceedingSessionsList.LastOrDefault();
|
||||
|
||||
return lastDiagnosisPs.Date;
|
||||
|
||||
case FileStateEnums.PROTEST_NOT_REGISTERED:
|
||||
return diagnosisPetition?
|
||||
.NotificationPetitionDate;
|
||||
|
||||
case FileStateEnums.NO_DISPUTE_INVITATION_ISSUED:
|
||||
return disputeResolutionBoard?.DisputeResolutionPetitionDate;
|
||||
|
||||
case FileStateEnums.NO_DISPUTE_PETITION_ISSUED:
|
||||
var lastDisputeResolutionPs = file.BoardsList.First(x => x.BoardType_Id == 2).ProceedingSessionsList.LastOrDefault();
|
||||
return lastDisputeResolutionPs?.Date;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
@@ -30,12 +30,13 @@ public class AlertsModel : PageModel
|
||||
_fileStateApplication = fileStateApplication;
|
||||
}
|
||||
|
||||
public void OnGet(FileAlertSearchModel searchModel)
|
||||
public async Task OnGet(FileAlertSearchModel searchModel)
|
||||
{
|
||||
var files = _fileApplication.Search(new FileSearchModel
|
||||
{ ArchiveNo = searchModel.ArchiveNo, FileClass = searchModel.FileClass, Status = FileEnums.ACTIVE });
|
||||
|
||||
viewModels = _fileAlertApplication.GetFilesAlerts(files);
|
||||
viewModels = _fileAlertApplication.GetFilesAlerts(files.Where(x=>x.Id == 74).ToList());
|
||||
viewModels =await _fileAlertApplication.GetFileAlerts();
|
||||
|
||||
if (searchModel.FileState_Id != 0)
|
||||
viewModels = viewModels.Where(x => x.FileState_Id == searchModel.FileState_Id).ToList();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user