workingHoursTemp ReModify

This commit is contained in:
samsys
2024-07-09 19:06:41 +03:30
parent d2a5d3cb4b
commit 080131c14d
11 changed files with 30 additions and 52 deletions

View File

@@ -168,8 +168,8 @@ public class SmsService : ISmsService
var res = new List<ApiResultViewModel>();
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970,1,1)).TotalSeconds;
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
int? fromDateUnixTime = null; // unix time - for instance: 1700598600
int? toDateUnixTime = null; // unix time - for instance: 1703190600
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
int pageNumber = 2;
int pageSize = 100; // max: 100
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");

View File

@@ -1,4 +1,5 @@
namespace AccountManagement.Application.Contracts.Task;
#nullable enable
namespace AccountManagement.Application.Contracts.Task;
public class CompleteTaskViewModel
{

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application.Contracts.Task;

View File

@@ -12,5 +12,5 @@ public interface IWorkingHoursItemsRepository : IRepository<long, WorkingHoursIt
List<WorkingHoursItemsViewModel> GetWorkingHoursItems();
List<WorkingHoursItemsViewModel> GetWorkingHoursItemListByHoursId(long id);
WorkingHoursItemsViewModel GetByWorkingHoursId(long id);
ComputingViewModel GetWorkingHourSByRollCall(long workshopId, long employeeId, DateTime start, DateTime end);
}

View File

@@ -20,5 +20,5 @@ public interface IWorkingHoursTempRepository : IRepository<long, WorkingHoursTem
Task<List<EditContract>> Correct();
void RemoveWorkingHoursTempAndItems(long workshopId, long employeeId);
ComputingViewModel GetWorkingHourSByRollCall(long workshopId, long employeeId, DateTime start, DateTime end);
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.WorkingHoursTemp;

View File

@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Contract;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.WorkingHoursTemp;

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.WorkingHoursTemp;

View File

@@ -112,8 +112,5 @@ public class WorkingHoursItemsRepository : RepositoryBase<long, WorkingHoursItem
.SingleOrDefault(x => x.WorkingHoursId == id);
}
public ComputingViewModel GetWorkingHourSByRollCall(long workshopId, long employeeId, DateTime start, DateTime end)
{
throw new NotImplementedException();
}
}

View File

@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.WorkingHoursAgg;
using Company.Domain.WorkingHoursTempAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.WorkingHours;
@@ -15,33 +15,25 @@ using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>, IWorkingHoursTempRepository
{
private readonly CompanyContext _context;
private readonly IWorkingHoursApplication _workingHoursApplication;
private readonly IWorkingHoursItemsApplication _workingHoursItemsApplication;
public WorkingHoursTempRepository(CompanyContext context, IWorkingHoursApplication workingHoursRepository,
IWorkingHoursItemsApplication workingHoursItemsRepository) : base(context)
public WorkingHoursTempRepository(CompanyContext context) : base(context)
{
_context = context;
_workingHoursApplication = workingHoursRepository;
_workingHoursItemsApplication = workingHoursItemsRepository;
}
public WorkingHoursTempViewModel GetDetails(long id)
{
throw new NotImplementedException();
throw new System.NotImplementedException();
}
[SuppressMessage("ReSharper.DPA", "DPA0009: High execution time of DB command", MessageId = "time: 1291ms")]
public CreateWorkingHoursTemp GetByWorkshopIdAndEmployeeId(long workshopId, long employeeId)
{
var workingHoursAndItems = _context.WorkingHoursTemps
.Include(x => x.WorkingHoursTempItemList)
.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId);
.Include(x => x.WorkingHoursTempItemList)
.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId);
if (workingHoursAndItems == null)
@@ -2254,14 +2246,13 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
}
}
}
public CreateWorkingHoursTemp GetByContractId(long contractId)
{
var workingHours = _context.WorkingHoursSet
.Include(x => x.WorkingHoursItemsList)
.FirstOrDefault(x => x.ContractId == contractId);
.Include(x => x.WorkingHoursItemsList)
.FirstOrDefault(x => x.ContractId == contractId);
if (workingHours != null)
{
@@ -3050,7 +3041,7 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
public CreateWorkingHoursTemp GetByContractIdConvertToShiftwork4(long contractId)
{
var workingHours = _context.WorkingHoursSet
.Include(x => x.WorkingHoursItemsList)
.Include(x => x.WorkingHoursItemsList)
.FirstOrDefault(x => x.ContractId == contractId);
if (workingHours != null)
@@ -4157,8 +4148,8 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
public CreateWorkingHoursTemp GetByWorkshopIdAndEmployeeIdToShiftwork4(long workshopId, long employeeId)
{
var contract = _context.Contracts.Where(x => x.EmployeeId == employeeId && x.WorkshopIds == workshopId)
.OrderByDescending(x => x.ContarctStart)
.FirstOrDefault();
.OrderByDescending(x => x.ContarctStart)
.FirstOrDefault();
if (contract != null)
{
var workingHours = _context.WorkingHoursSet
@@ -5268,7 +5259,6 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
{
return new CreateWorkingHoursTemp();
}
}
public async Task<List<EditContract>> Correct()
@@ -5303,15 +5293,15 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
});
return contracts.OrderBy(x=>x.Id).Take(100).ToList();
return contracts.OrderBy(x => x.Id).Take(100).ToList();
#endregion
}
public void RemoveWorkingHoursTempAndItems(long workshopId, long employeeId)
{
var workingHoursAndItems = _context.WorkingHoursTemps
@@ -5331,4 +5321,5 @@ public class WorkingHoursTempRepository : RepositoryBase<long, WorkingHoursTemp>
}
}
}

View File

@@ -321,7 +321,6 @@ namespace _0_Framework_b.Application
var persianStartDate = new MD.PersianDateTime.Standard.PersianDateTime(startDate);
var persianEndDate = new MD.PersianDateTime.Standard.PersianDateTime(endDate);
var i = 0;
while (persianEndDate - persianStartDate >= TimeSpan.FromDays(0))
{