shiftDate added To RollCall

This commit is contained in:
SamSys
2025-01-07 23:19:12 +03:30
parent db79e8ecf1
commit 191831b59e
16 changed files with 9224 additions and 385 deletions

View File

@@ -17,6 +17,8 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using Microsoft.Extensions.Logging;
using System.IO.Compression;
using System.Linq;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
namespace _0_Framework.Application;
@@ -1327,7 +1329,21 @@ public static class Tools
return serializer.Deserialize<T>(bsonReader);
}
public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek)
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));
}
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);

View File

@@ -21,5 +21,7 @@ public interface ICustomizeWorkshopSettingsRepository : IRepository<long, Custom
#region Pooya
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId);
#endregion
#endregion
CustomizeWorkshopSettings GetBy(long workshopId);
}

View File

@@ -0,0 +1,101 @@
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using System.Collections.Generic;
using System;
using System.Linq;
using _0_Framework.Application;
using OfficeOpenXml.Drawing.Chart;
namespace Company.Domain.RollCallAgg.DomainService;
public interface IRollCallDomainService
{
(WorkshopShiftStatus shiftType, IrregularShift irregularShift, ICollection<CustomizeSifts> regularShifts, ICollection<CustomizeRotatingShift> rotatingShifts, TimeSpan BreakTime) GetEmployeeShiftDetails(long employeeId, long workshopId);
TimeOnly GetEmployeeOffSetForRegularSettings(long employeeId, long workshopId);
}
public class RollCallDomainService : IRollCallDomainService
{
private readonly IRollCallRepository _rollCallRepository;
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository;
public RollCallDomainService(IRollCallRepository rollCallRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository)
{
_rollCallRepository = rollCallRepository;
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
_customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
}
public (WorkshopShiftStatus shiftType, IrregularShift irregularShift, ICollection<CustomizeSifts> regularShifts, ICollection<CustomizeRotatingShift> rotatingShifts, TimeSpan BreakTime) GetEmployeeShiftDetails(long employeeId,
long workshopId)
{
var employeeSettings = _customizeWorkshopEmployeeSettingsRepository.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(workshopId, employeeId);
var offset = TimeOnly.MinValue;
WorkshopShiftStatus shiftType;
if (employeeSettings == null)
{
var workshopSettings = _customizeWorkshopSettingsRepository.GetBy(workshopId);
shiftType = workshopSettings.WorkshopShiftStatus;
return (shiftType, null,
workshopSettings.CustomizeWorkshopSettingsShifts.Select(x => (CustomizeSifts)x).ToList(),
null, TimeSpan.Zero);
}
else
{
shiftType = employeeSettings.WorkshopShiftStatus;
var breakTimeSpan = employeeSettings.BreakTime.BreakTimeType == BreakTimeType.WithTime
? employeeSettings.BreakTime.BreakTimeValue.ToTimeSpan()
: TimeSpan.Zero;
return (shiftType, employeeSettings.IrregularShift,
employeeSettings.CustomizeWorkshopEmployeeSettingsShifts.Select(x => (CustomizeSifts)x).ToList(),
employeeSettings.CustomizeRotatingShifts, breakTimeSpan);
}
}
public TimeOnly GetEmployeeOffSetForRegularSettings(long employeeId, long workshopId)
{
var workshopSettings = _customizeWorkshopSettingsRepository.GetBy(workshopId);
var employeeSettings = _customizeWorkshopEmployeeSettingsRepository.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(workshopId, employeeId);
if (workshopSettings == null)
return TimeOnly.MinValue;
if (employeeSettings == null && workshopSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular)
return Tools.CalculateOffset(workshopSettings.CustomizeWorkshopSettingsShifts
.Select(x => (CustomizeSifts)x).ToList());
if (employeeSettings == null )
return Tools.CalculateOffset(workshopSettings.CustomizeWorkshopSettingsShifts.Select(x => (CustomizeSifts)x).ToList());
if (workshopSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular && employeeSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular)
{
return Tools.CalculateOffset(workshopSettings.CustomizeWorkshopSettingsShifts.Select(x => (CustomizeSifts)x).ToList());
}
else if (employeeSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular)
{
return Tools.CalculateOffset(employeeSettings.CustomizeWorkshopEmployeeSettingsShifts
.Select(x => (CustomizeSifts)x).ToList());
}
else
{
return TimeOnly.MinValue;
}
}
}

View File

@@ -1,11 +1,22 @@
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using System;
using Company.Domain.RollCallAgg.DomainService;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using System.Collections.Generic;
using _0_Framework.Application;
using Company.Domain.EmployeeAgg;
using Company.Domain.WorkshopAgg;
namespace Company.Domain.RollCallAgg
{
public class RollCall : EntityBase
{
public RollCall(long workshopId, long employeeId, string employeeFullName, DateTime? startDate, DateTime? endDate, int year, int month, RollCallModifyType rollCallModifyType= RollCallModifyType.None)
private RollCall()
{
}
public RollCall(long workshopId, long employeeId, string employeeFullName, DateTime startDate, DateTime? endDate, int year, int month,
IRollCallDomainService service, RollCallModifyType rollCallModifyType = RollCallModifyType.None)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
@@ -15,6 +26,9 @@ namespace Company.Domain.RollCallAgg
Year = year;
Month = month;
RollCallModifyType = rollCallModifyType;
SetShiftDate(service);
}
public long WorkshopId { get; private set; }
@@ -26,6 +40,8 @@ namespace Company.Domain.RollCallAgg
public int Month { get; private set; }
public RollCallModifyType RollCallModifyType { get; private set; }
public DateTime ShiftDate { get; set; }
public void SetEndDateTime(DateTime? endDate)
{
EndDate = endDate;
@@ -36,19 +52,49 @@ namespace Company.Domain.RollCallAgg
StartDate = start;
EndDate = end;
}
public RollCall SetModifyType(RollCallModifyType modifyType)
{
RollCallModifyType = modifyType;
return this;
}
public void SetShiftDate(IRollCallDomainService service)
{
var shiftDetails = service.GetEmployeeShiftDetails(EmployeeId, WorkshopId);
var offset = service.GetEmployeeOffSetForRegularSettings(EmployeeId, WorkshopId);
ShiftDate = shiftDetails.shiftType switch
{
WorkshopShiftStatus.Regular => CalculateRegularShiftDate(StartDate!.Value, offset),
WorkshopShiftStatus.Rotating => StartDate!.Value.Date,
WorkshopShiftStatus.Irregular => StartDate!.Value.Date,
_ => throw new ArgumentOutOfRangeException()
};
}
private DateTime CalculateRegularShiftDate(DateTime startDate, TimeOnly offset)
{
DateTime nextOffSetDateTime;
if (startDate.TimeOfDay >= offset.ToTimeSpan())
{
nextOffSetDateTime = startDate.AddDays(1).Date + offset.ToTimeSpan();
}
else
nextOffSetDateTime = startDate.Date + offset.ToTimeSpan();
return nextOffSetDateTime.AddDays(-1).Date;
}
}
public enum RollCallModifyType
{
None,
CutByBgService,
EditByEmployer,
Undefined
}
None,
CutByBgService,
EditByEmployer,
Undefined
}
}

View File

@@ -392,26 +392,44 @@ public class LeaveApplication : ILeaveApplication
{
return _leaveRepository.LastLeaveMain(searchModel);
}
#region Pooya
public OperationResult ValidateNewLeaveWithExistingRollCalls(long workshopId, long employeeId, string paidLeaveType, DateTime start, DateTime end)
{
OperationResult op = new();
var rollCallsInDate = _rollCallRepository.GetEmployeeRollCallsHistoryAllInDates(workshopId, employeeId, start, end);
if (paidLeaveType == "ساعتی")
{
if (rollCallsInDate.Any(x => x.EndDate >= start && x.StartDate <= end))
return op.Failed("در این بازه زمانی رکورد حضور غیاب برای این شخص وجود دارد");
}
else
{
var rollCallsInDateGrouped = rollCallsInDate.GroupBy(x => x.StartDate.Value.Date);
if (rollCallsInDateGrouped.Any(x => x.Key.Date >= start && x.Key.Date <= end))
return op.Failed("در این روز رکورد حضور غیاب برای این شخص وجود دارد");
#region Pooya
public OperationResult ValidateNewLeaveWithExistingRollCalls(long workshopId, long employeeId, string paidLeaveType, DateTime start, DateTime end)
{
OperationResult op = new();
var rollCallsInDate = _rollCallRepository.GetEmployeeRollCallsHistoryAllInDates(workshopId, employeeId, start, end);
if (paidLeaveType == "ساعتی")
{
if (rollCallsInDate.Any(x => x.EndDate >= start && x.StartDate <= end))
return op.Failed("در این بازه زمانی رکورد حضور غیاب برای این شخص وجود دارد");
}
else
{
var rollCallsInDateGrouped = rollCallsInDate.GroupBy(x => x.DateGr.Date);
if (rollCallsInDateGrouped.Any(x => x.Key.Date >= start && x.Key.Date <= end))
return op.Failed("در این روز رکورد حضور غیاب برای این شخص وجود دارد");
}
return op.Succcedded();
}
}
return op.Succcedded();
}
public TimeSpan GetEmployeeLeaveTimeSpanInDates(long workshopId, long employeeId, string startFa, string endFa)
{
#endregion
if (startFa.TryToGeorgianDateTime(out var start) == false || endFa.TryToGeorgianDateTime(out var end) == false)
return TimeSpan.Zero;
var leaves = _leaveRepository.GetByWorkshopIdEmployeeIdInDates(workshopId, employeeId, start, end);
var timeSpanHourlyLeave = new TimeSpan(leaves.Where(x => x.PaidLeaveType != "روزانه").Sum(x => (x.EndLeaveGr - x.StartLeaveGr).Ticks));
var dailyLeaveCount = leaves.Count(x => x.PaidLeaveType == "روزانه") * new TimeSpan(1, 0, 0, 0);
return timeSpanHourlyLeave + dailyLeaveCount;
}
private TimeSpan CalculateTotalLeaveTimeSpan(List<LeavePrintViewModel> leaves)
{
var timeSpanHourlyLeave = new TimeSpan(leaves.Where(x => x.PaidLeaveType != "روزانه").Sum(x => (x.EndLeaveGr - x.StartLeaveGr).Ticks));
var dailyLeaveCount = leaves.Count(x => x.PaidLeaveType == "روزانه") * new TimeSpan(1, 0, 0, 0);
return timeSpanHourlyLeave + dailyLeaveCount;
}
#endregion
}

View File

@@ -5,11 +5,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.CheckoutAgg;
using Company.Domain.CustomizeCheckoutAgg;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.LeaveAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.RollCallAgg.DomainService;
using Company.Domain.RollCallEmployeeAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
@@ -26,8 +30,11 @@ public class RollCallApplication : IRollCallApplication
private readonly ILeaveRepository _leaveRepository;
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository;
private readonly ICheckoutRepository _checkoutRepository;
private readonly IRollCallDomainService _rollCallDomainService;
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository;
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
public RollCallApplication(IRollCallRepository rollCallRepository, IEmployeeApplication employeeApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository)
public RollCallApplication(IRollCallRepository rollCallRepository, IEmployeeApplication employeeApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository, IRollCallDomainService rollCallDomainService, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository)
{
_rollCallRepository = rollCallRepository;
_employeeApplication = employeeApplication;
@@ -36,6 +43,9 @@ public class RollCallApplication : IRollCallApplication
_leaveRepository = leaveRepository;
_customizeCheckoutRepository = customizeCheckoutRepository;
_checkoutRepository = checkoutRepository;
_rollCallDomainService = rollCallDomainService;
_customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
}
public OperationResult Create(CreateRollCall command)
@@ -46,8 +56,8 @@ public class RollCallApplication : IRollCallApplication
var yearFa = Convert.ToInt32(startDateFa.Substring(0, 4));
var monthFa = Convert.ToInt32(startDateFa.Substring(5, 2));
var employeeName = _employeeApplication.GetDetails(command.EmployeeId).EmployeeFullName;
var create = new RollCall(command.WorkshopId, command.EmployeeId, employeeName, command.StartDate, null,
yearFa, monthFa);
var create = new RollCall(command.WorkshopId, command.EmployeeId, employeeName, command.StartDate.Value, null,
yearFa, monthFa, _rollCallDomainService);
_rollCallRepository.Create(create);
_rollCallRepository.SaveChanges();
return opration.Succcedded();
@@ -369,8 +379,13 @@ public class RollCallApplication : IRollCallApplication
if (command.RollCallRecords.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime)))
return operation.Failed("ساعات شروع و پایان نمیتوانند خالی باشد");
DateTime day = command.DateFa.ToGeorgianDateTime();
#region RollCallTimes validation and parse to DateTime
var workshopSettings = _customizeWorkshopSettingsRepository.GetBy(command.WorkshopId);
var employeeSettings =
_customizeWorkshopEmployeeSettingsRepository.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(
command.WorkshopId, command.EmployeeId).WorkshopShiftStatus;
List<(TimeOnly start, TimeOnly end, long rollCallId)> preprocessedRollCalls = new();
try
@@ -392,56 +407,99 @@ public class RollCallApplication : IRollCallApplication
return operation.Failed("فرمت ساعات ورودی نادرست می باشد");
}
DateTime day = command.DateFa.ToGeorgianDateTime();
if (day == Tools.GetUndefinedDateTime())
return operation.Failed("خطای سیستمی");
DateTime previousEnd = new DateTime();
preprocessedRollCalls = preprocessedRollCalls.OrderBy(x => x.start).ToList();
List<(DateTime Start, DateTime End, long RollCallId)> result = new();
foreach (var item in preprocessedRollCalls)
if (workshopSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular || employeeSettings == WorkshopShiftStatus.Regular)
{
(DateTime Start, DateTime End, long RollCallId) rollCallWithDateTime =
new()
{
Start = new DateTime(DateOnly.FromDateTime(day), item.start),
End = new DateTime(DateOnly.FromDateTime(day), item.end),
RollCallId = item.rollCallId
};
TimeOnly offset =
_rollCallDomainService.GetEmployeeOffSetForRegularSettings(command.EmployeeId, command.WorkshopId);
if (previousEnd != new DateTime())
var startWorkingPeriod = day.Date + offset.ToTimeSpan();
foreach (var preprocessedRollCall in preprocessedRollCalls)
{
if (rollCallWithDateTime.Start < previousEnd)
DateTime startDateTime = startWorkingPeriod.Date.Add(preprocessedRollCall.start.ToTimeSpan());
if (preprocessedRollCall.start.ToTimeSpan() < offset.ToTimeSpan())
{
rollCallWithDateTime.Start = rollCallWithDateTime.Start.AddDays(1);
startDateTime = startDateTime.AddDays(1);
}
if (rollCallWithDateTime.Start == previousEnd)
return operation.Failed("ساعت ورود نمی تواند با ساعت خروج حضور غیاب دیگری در آن روز برابر باشد");
DateTime endDateTime = startDateTime.Date + preprocessedRollCall.end.ToTimeSpan();
if (startDateTime > endDateTime)
{
endDateTime = endDateTime.AddDays(1);
}
if (result.Any(x => startDateTime > x.End && endDateTime < x.Start))
return operation.Failed("بازه های وارد شده با هم تداخل دارند");
result.Add(new(startDateTime, endDateTime, preprocessedRollCall.rollCallId));
}
while (rollCallWithDateTime.Start >= rollCallWithDateTime.End)
{
rollCallWithDateTime.End = rollCallWithDateTime.End.AddDays(1);
}
result.Add(rollCallWithDateTime);
previousEnd = rollCallWithDateTime.End;
}
else
{
#region RollCallTimes validation and parse to DateTime
if (day == Tools.GetUndefinedDateTime())
return operation.Failed("خطای سیستمی");
DateTime previousEnd = new DateTime();
preprocessedRollCalls = preprocessedRollCalls.OrderBy(x => x.start).ToList();
foreach (var item in preprocessedRollCalls)
{
(DateTime Start, DateTime End, long RollCallId) rollCallWithDateTime =
new()
{
Start = new DateTime(DateOnly.FromDateTime(day), item.start),
End = new DateTime(DateOnly.FromDateTime(day), item.end),
RollCallId = item.rollCallId
};
if (previousEnd != new DateTime())
{
if (rollCallWithDateTime.Start < previousEnd)
{
rollCallWithDateTime.Start = rollCallWithDateTime.Start.AddDays(1);
}
if (rollCallWithDateTime.Start == previousEnd)
return operation.Failed("ساعت ورود نمی تواند با ساعت خروج حضور غیاب دیگری در آن روز برابر باشد");
}
while (rollCallWithDateTime.Start >= rollCallWithDateTime.End)
{
rollCallWithDateTime.End = rollCallWithDateTime.End.AddDays(1);
}
result.Add(rollCallWithDateTime);
previousEnd = rollCallWithDateTime.End;
}
var firstShiftStart = result.OrderBy(x => x.Start).FirstOrDefault().Start;
var lastShiftEnd = result.OrderByDescending(x => x.Start).FirstOrDefault().End;
var lastShiftStart = result.OrderByDescending(x => x.Start).FirstOrDefault().Start;
if (firstShiftStart.AddDays(1) < lastShiftEnd)
return operation.Failed("بازه زمانی وارد شده نا معتبر است");
if (firstShiftStart.Date != lastShiftStart.Date)
return operation.Failed("شروع رکورد حضور غیاب نمی تواند در روز های بعد از تاریخ تعیین شده باشد");
#endregion
}
var firstShiftStart = result.OrderBy(x => x.Start).FirstOrDefault().Start;
var lastShiftEnd = result.OrderByDescending(x => x.Start).FirstOrDefault().End;
var lastShiftStart = result.OrderByDescending(x => x.Start).FirstOrDefault().Start;
if (firstShiftStart.AddDays(1) < lastShiftEnd)
return operation.Failed("بازه زمانی وارد شده نا معتبر است");
if (result.Sum(x => (x.End - x.Start).TotalHours) > 24)
{
return operation.Failed("بازه زمانی نمیتواند بیشتر از 24 ساعت باشد");
}
if (firstShiftStart.Date != lastShiftStart.Date)
return operation.Failed("شروع رکورد حضور غیاب نمی تواند در روز های بعد از تاریخ تعیین شده باشد");
#endregion
//from new
foreach (var activity in result)
@@ -466,14 +524,14 @@ public class RollCallApplication : IRollCallApplication
//رول کال روز جاری
#region NewValidation
var currentDayRollCall = employeeRollCalls.FirstOrDefault(x => x.EndDate == null);
if (currentDayRollCall != null && result.Any(x => x.End >= currentDayRollCall.StartDate))
return operation.Failed("بازه های وارد شده با حضور غیاب جاری تداخل زمانی دارد");
#endregion
if (result.Any(x => employeeRollCalls.Any(y =>
y.StartDate.Value.Date != command.DateFa.ToGeorgianDateTime().Date &&
if (result.Any(x => employeeRollCalls.Any(y => y.DateGr.Date != command.DateFa.ToGeorgianDateTime().Date &&
x.End >= y.StartDate.Value && x.Start <= y.EndDate.Value)))
return operation.Failed("بازه های وارد شده با حضور غیاب های مربوط به روز های قبل و بعد تداخل زمانی دارد");
@@ -492,7 +550,7 @@ public class RollCallApplication : IRollCallApplication
var name = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId).EmployeeFullName;
var rollCallsAsEntityModels = result.Select(x => new RollCall(command.WorkshopId, command.EmployeeId, name, x.Start, x.End,
Convert.ToInt32(x.Start.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.Start.ToFarsi().Substring(5, 2)), RollCallModifyType.EditByEmployer)).ToList();
Convert.ToInt32(x.Start.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.Start.ToFarsi().Substring(5, 2)), _rollCallDomainService, RollCallModifyType.EditByEmployer)).ToList();
_rollCallRepository.RemoveEmployeeRollCallsInDate(command.WorkshopId, command.EmployeeId, date);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addShiftDateToRollCall : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "ShiftDate",
table: "RollCall",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShiftDate",
table: "RollCall");
}
}
}

View File

@@ -4002,6 +4002,9 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("ShiftDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("StartDate")
.HasColumnType("datetime2");

View File

@@ -376,6 +376,13 @@ namespace CompanyManagment.EFCore.Repository
GroupSettingsId = x.CustomizeWorkshopGroupSettingId
}).ToList();
}
#endregion
}
public CustomizeWorkshopSettings GetBy(long workshopId)
{
return _companyContext.CustomizeWorkshopSettings.AsSplitQuery()
.FirstOrDefault(x => x.WorkshopId == workshopId);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -186,6 +186,7 @@ using Company.Domain.CustomizeCheckoutAgg;
using CompanyManagment.App.Contracts.CustomizeCheckout;
using Company.Domain.WorkshopSubAccountAgg;
using Company.Domain.CustomizeCheckoutTempAgg;
using Company.Domain.RollCallAgg.DomainService;
namespace PersonalContractingParty.Config;
@@ -405,12 +406,14 @@ public class PersonalBootstrapper
services.AddTransient<ICustomizeCheckoutTempApplication, CustomizeCheckoutTempApplication>();
services.AddTransient<IWorkshopSubAccountRepository, WorkshopSubAccountRepository>();
#endregion
//=========End Of Main====================================
#endregion
//---File Project------------------------------------
services.AddTransient<IRollCallDomainService, RollCallDomainService>();
//=========End Of Main====================================
services.AddTransient<IBoardApplication, BoardApplication>();
//---File Project------------------------------------
services.AddTransient<IBoardApplication, BoardApplication>();
services.AddTransient<IBoardRepository, BoardRepository>();
services.AddTransient<IFileApplication, FileApplication>();

View File

@@ -196,21 +196,22 @@
</a>
</div>
</div>
<div class="card p-0">
<div class="card-section-btn">
<a class="btn loadingButton @(authHelper.GetPermissions().Any(x => x == 2) ? "" : "disable")" asp-area="AdminNew" asp-page="/Company/FileBackup/Index">
<svg width="50" height="50" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M42.75 7.875H11.25C10.0125 7.875 9 8.8875 9 10.125V16.875C9 18.1125 10.0125 19.125 11.25 19.125H42.75C43.9875 19.125 45 18.1125 45 16.875V10.125C45 8.8875 43.9875 7.875 42.75 7.875ZM42.75 21.375H11.25C10.0125 21.375 9 22.3875 9 23.625V30.375C9 31.6125 10.0125 32.625 11.25 32.625H42.75C43.9875 32.625 45 31.6125 45 30.375V23.625C45 22.3875 43.9875 21.375 42.75 21.375ZM42.75 34.875H11.25C10.0125 34.875 9 35.8875 9 37.125V43.875C9 45.1125 10.0125 46.125 11.25 46.125H42.75C43.9875 46.125 45 45.1125 45 43.875V37.125C45 35.8875 43.9875 34.875 42.75 34.875Z" fill="#C4E8E8"/>
<path d="M34.875 33.7492L42.75 40.0492V27.4492L34.875 33.7492Z" fill="#23A8A8"/>
<path d="M42.75 31.5C42.4125 31.5 41.9625 31.5 41.625 31.6125V36.1125C41.9625 36 42.4125 36 42.75 36C46.4625 36 49.5 39.0375 49.5 42.75C49.5 46.4625 46.4625 49.5 42.75 49.5C39.0375 49.5 36 46.4625 36 42.75C36 42.4125 36 42.075 36.1125 41.7375L32.2875 38.7C31.8375 39.9375 31.5 41.2875 31.5 42.75C31.5 48.9375 36.5625 54 42.75 54C48.9375 54 54 48.9375 54 42.75C54 36.5625 48.9375 31.5 42.75 31.5Z" fill="#23A8A8"/>
</svg>
<p class="btn-title text-nowrap" style="margin: 0 5px 0 0">بکاپ</p>
<div class="spinner-loading loading rounded-0" style="display: none;">
<div class="spinner"></div>
</div>
</a>
</div>
</div>
<div class="card p-0">
<div class="card-section-btn">
<a class="btn loadingButton @(authHelper.GetPermissions().Any(x => x == 2) ? "" : "disable")" asp-area="AdminNew" asp-page="/Company/FileBackup/Index">
<svg width="50" height="50" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M42.75 7.875H11.25C10.0125 7.875 9 8.8875 9 10.125V16.875C9 18.1125 10.0125 19.125 11.25 19.125H42.75C43.9875 19.125 45 18.1125 45 16.875V10.125C45 8.8875 43.9875 7.875 42.75 7.875ZM42.75 21.375H11.25C10.0125 21.375 9 22.3875 9 23.625V30.375C9 31.6125 10.0125 32.625 11.25 32.625H42.75C43.9875 32.625 45 31.6125 45 30.375V23.625C45 22.3875 43.9875 21.375 42.75 21.375ZM42.75 34.875H11.25C10.0125 34.875 9 35.8875 9 37.125V43.875C9 45.1125 10.0125 46.125 11.25 46.125H42.75C43.9875 46.125 45 45.1125 45 43.875V37.125C45 35.8875 43.9875 34.875 42.75 34.875Z" fill="#C4E8E8"/>
<path d="M34.875 33.7492L42.75 40.0492V27.4492L34.875 33.7492Z" fill="#23A8A8"/>
<path d="M42.75 31.5C42.4125 31.5 41.9625 31.5 41.625 31.6125V36.1125C41.9625 36 42.4125 36 42.75 36C46.4625 36 49.5 39.0375 49.5 42.75C49.5 46.4625 46.4625 49.5 42.75 49.5C39.0375 49.5 36 46.4625 36 42.75C36 42.4125 36 42.075 36.1125 41.7375L32.2875 38.7C31.8375 39.9375 31.5 41.2875 31.5 42.75C31.5 48.9375 36.5625 54 42.75 54C48.9375 54 54 48.9375 54 42.75C54 36.5625 48.9375 31.5 42.75 31.5Z" fill="#23A8A8"/>
</svg>
<p class="btn-title text-nowrap" style="margin: 0 5px 0 0">بکاپ</p>
<div class="spinner-loading loading rounded-0" style="display: none;">
<div class="spinner"></div>
</div>
</a>
</div>
</div>
</div>
</div>

View File

@@ -5,7 +5,7 @@
}
<h1>Upload File</h1>
<form asp-page-handler="Upload" method="post" enctype="multipart/form-data">
<form asp-page-handler="Upload" id="1" method="post" enctype="multipart/form-data">
<div>
<label asp-for="File">Choose a file:</label>
<input asp-for="File" type="file" required>
@@ -13,6 +13,11 @@
<button type="submit">Upload</button>
</form>
<form asp-page-handler="ShiftDate" id="8" method="post" enctype="multipart/form-data">
<button type="submit">افزودن شیفت دیت</button>
</form>
@if (ViewData["message"] != null)
{
<p>@ViewData["message"]</p>

View File

@@ -1,7 +1,10 @@
using Company.Domain.RollCallAgg.DomainService;
using CompanyManagment.App.Contracts.AndroidApkVersion;
using CompanyManagment.EFCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
{
@@ -10,12 +13,14 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
{
private readonly IAndroidApkVersionApplication _application;
[BindProperty]
[BindProperty]
public IFormFile File { get; set; }
public IndexModel(IAndroidApkVersionApplication application)
{
_application = application;
_application = application;
}
public void OnGet()
@@ -28,5 +33,25 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
ViewData["message"] = result.Message;
return Page();
}
}
public async Task<IActionResult> OnPostShiftDate()
{
//var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
//var rollCalls =
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
// .ToList();
//foreach (var rollCall in rollCalls)
//{
// rollCall.SetShiftDate(_rollCallDomainService);
// Console.WriteLine(rollCall.id);
//}
//await _context.SaveChangesAsync();
ViewData["message"] = "ÊæãÇã";
return Page();
}
}
}

View File

@@ -10,7 +10,9 @@ using System.Security.Claims;
using AccountManagement.Application.Contracts.CameraAccount;
using CompanyManagment.EFCore;
using Company.Domain.EmployeeAgg;
using Company.Domain.RollCallAgg.DomainService;
using CompanyManagment.App.Contracts.AndroidApkVersion;
using Microsoft.EntityFrameworkCore;
namespace ServiceHost.Pages
@@ -40,7 +42,9 @@ namespace ServiceHost.Pages
private readonly ICameraAccountApplication _cameraAccountApplication;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
public IndexModel(ILogger<IndexModel> logger, IAccountApplication accountApplication, IGoogleRecaptcha googleRecaptcha, ISmsService smsService, IWorker worker, IAuthHelper authHelper, ICameraAccountApplication cameraAccountApplication, IWebHostEnvironment webHostEnvironment, IAndroidApkVersionApplication androidApkVersionApplication)
public IndexModel(ILogger<IndexModel> logger, IAccountApplication accountApplication, IGoogleRecaptcha googleRecaptcha, ISmsService smsService, IWorker worker, IAuthHelper authHelper, ICameraAccountApplication cameraAccountApplication, IWebHostEnvironment webHostEnvironment, IAndroidApkVersionApplication androidApkVersionApplication)
{
_logger = logger;
_accountApplication = accountApplication;
@@ -51,11 +55,15 @@ namespace ServiceHost.Pages
_cameraAccountApplication = cameraAccountApplication;
_webHostEnvironment = webHostEnvironment;
_androidApkVersionApplication = androidApkVersionApplication;
}
}
public IActionResult OnGet()
{
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
if (User.Identity is { IsAuthenticated: true })
{
if (User.FindFirstValue("IsCamera") == "true")