add sms templates
This commit is contained in:
@@ -26,6 +26,10 @@ public interface ISmsService
|
||||
#region Mahan
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -330,8 +330,30 @@ public class SmsService : ISmsService
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("#FULLNAME#", fullName),
|
||||
new("#CODE1#",firstPart),
|
||||
new("#CODE2#",secondPart)
|
||||
});
|
||||
return verificationSendResult.Status == 0;
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("#VERIFYCODE#", code)
|
||||
});
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Application;
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.CustomizeWorkshopSettingsAgg;
|
||||
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
|
||||
@@ -11,7 +12,10 @@ using System.Linq;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext, IAuthHelper authHelper, IEmployeeRepository employeeRepository)
|
||||
public class CustomizeWorkshopSettingsRepository(
|
||||
CompanyContext companyContext,
|
||||
IAuthHelper authHelper,
|
||||
IEmployeeRepository employeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
@@ -43,23 +47,31 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
GroupName = x.GroupName,
|
||||
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
|
||||
{
|
||||
var employee = employees.First(e => e.Id == y.EmployeeId);
|
||||
try
|
||||
{
|
||||
var employee = employees.First(e => e.Id == y.EmployeeId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
return new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
Id = y.id,
|
||||
EmployeeId = y.EmployeeId,
|
||||
IsSettingChanged = y.IsSettingChanged,
|
||||
IsShiftChanged = y.IsShiftChanged,
|
||||
Name = $"{employee}",
|
||||
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Name = $":",
|
||||
// RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
|
||||
// new CustomizeWorkshopShiftViewModel()
|
||||
// {
|
||||
// EndTime = s.EndTime.ToString("HH:mm"),
|
||||
// Placement = s.Placement,
|
||||
// StartTime = s.StartTime.ToString("HH:mm")
|
||||
// }).ToList(),
|
||||
Salary = y.Salary,
|
||||
|
||||
};
|
||||
}).ToList(),
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
@@ -71,15 +83,16 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.
|
||||
Select(r=>new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm"), EndTime = r.EndTime.ToString("HH:mm")}).ToList()
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r =>
|
||||
new CustomizeRotatingShiftsViewModel()
|
||||
{ StartTime = r.StartTime.ToString("HH:mm"), EndTime = r.EndTime.ToString("HH:mm") })
|
||||
.ToList()
|
||||
}).ToList(),
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId)
|
||||
@@ -116,11 +129,12 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
Salary = y.Salary,
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
CustomizeRotatingShiftsViewModels = y.CustomizeRotatingShifts.Select(r =>
|
||||
new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = y.LeavePermittedDays,
|
||||
IrregularShift = y.IrregularShift,
|
||||
WorkshopShiftStatus = y.WorkshopShiftStatus
|
||||
@@ -133,19 +147,16 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
EndTime = s.EndTime.ToString("HH:mm"),
|
||||
Placement = s.Placement,
|
||||
StartTime = s.StartTime.ToString("HH:mm")
|
||||
|
||||
}).ToList(),
|
||||
MainGroup = x.MainGroup,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts.Select(r =>
|
||||
new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift
|
||||
|
||||
|
||||
|
||||
}).ToList(),
|
||||
};
|
||||
}
|
||||
@@ -153,8 +164,8 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
|
||||
public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery()
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
@@ -228,23 +239,25 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
MaxMonthDays = entity.MaxMonthDays,
|
||||
Id = entity.id,
|
||||
ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
BonusesPaysInEndOfMonth = entity.BonusesPaysInEndOfMonth,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
|
||||
OffDays = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
};
|
||||
return viewModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId)
|
||||
{
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery()
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
if (entity == null)
|
||||
{
|
||||
return new();
|
||||
@@ -262,21 +275,20 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
HolidayWork = entity.HolidayWork,
|
||||
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
|
||||
OffDays = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public List<ChangedGroupedViewModel> GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId)
|
||||
{
|
||||
|
||||
|
||||
var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
where groupSetting.IsShiftChange // Filter parent tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged// Filter child tables where isChange is true
|
||||
join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals
|
||||
employeeSettings.CustomizeWorkshopGroupSettingId
|
||||
where employeeSettings.IsShiftChanged // Filter child tables where isChange is true
|
||||
join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped
|
||||
group new { employee.FullName, groupSetting.GroupName } by groupSetting.id
|
||||
into grouped
|
||||
select new ChangedGroupedViewModel
|
||||
{
|
||||
GroupName = grouped.First().GroupName,
|
||||
@@ -284,7 +296,6 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
};
|
||||
|
||||
return result.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CustomizeWorkshopSettingsViewModel GetWorkshopIncludeGroupsByWorkshopId(long workshopId)
|
||||
@@ -314,27 +325,27 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
BreakTime = g.BreakTime,
|
||||
HolidayWork = g.HolidayWork,
|
||||
FridayWork = g.FridayWork,
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r => new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime = r.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = g.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
|
||||
CustomizeRotatingShiftsViewModels = g.CustomizeRotatingShifts.Select(r =>
|
||||
new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = r.EndTime.ToString("HH:mm"),
|
||||
StartTime = r.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = g.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
}).ToList(),
|
||||
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
return customizeWorkshopSettings;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
|
||||
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId,
|
||||
long employeeId)
|
||||
{
|
||||
var employee = _companyContext.CustomizeWorkshopSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
if (employee == null)
|
||||
@@ -361,11 +372,13 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsWithMonthlySalary(long workshopId)
|
||||
{
|
||||
var query = _companyContext.CustomizeWorkshopGroupSettings.Where(x => x.MainGroup == false).Include(x => x)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection).Where(x => x.CustomizeWorkshopEmployeeSettingsCollection.Any(y =>
|
||||
y.WorkshopId == workshopId)).SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection).Where(x =>
|
||||
x.CustomizeWorkshopEmployeeSettingsCollection.Any(y =>
|
||||
y.WorkshopId == workshopId)).SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.Salary > 0).Select(x =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
@@ -380,8 +393,10 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByWorkshopId(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId).Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).SelectMany(x => x.CustomizeWorkshopGroupSettingsCollection
|
||||
return _companyContext.CustomizeWorkshopSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId)
|
||||
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).SelectMany(x => x
|
||||
.CustomizeWorkshopGroupSettingsCollection
|
||||
.SelectMany(y => y.CustomizeWorkshopEmployeeSettingsCollection))
|
||||
.Select(x => new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user