Compare commits
2 Commits
Feature/ro
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| 595b2c8a2d | |||
| 6b6b0767e3 |
@@ -27,10 +27,9 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
namespace _0_Framework.Application.Sms;
|
||||
|
||||
public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
|
||||
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository)
|
||||
public SmsService(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_smsResultRepository = smsResultRepository;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
}
|
||||
@@ -332,7 +330,7 @@ public class SmsService : ISmsService
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
@@ -343,25 +341,15 @@ public class SmsService : ISmsService
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
@@ -79,5 +79,4 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
#endregion
|
||||
|
||||
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace Company.Domain.RollCallAgg
|
||||
DateTime endSearch);
|
||||
void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date);
|
||||
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(IEnumerable<long> employeeIds,
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public class SmsResult: EntityBase
|
||||
{
|
||||
public SmsResult(int messageId, string status,string typeOfSms,
|
||||
string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
public SmsResult(int messageId, string status,string typeOfSms, string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
{
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
|
||||
@@ -76,7 +76,6 @@ public interface IEmployeeApplication
|
||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||
|
||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -266,7 +266,8 @@ public class InstitutionContractPrintViewModel
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDateTime { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <summary>
|
||||
/// گزارش آنلاین حضور غیاب
|
||||
/// </summary>
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// گزارش آفلاین حضور غیاب کارگاه
|
||||
@@ -126,13 +126,6 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <returns></returns>
|
||||
OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
|
||||
}
|
||||
|
||||
public class WorkshopCurrentDayRollCallSearchModel
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public int PersonnelCode { get; set; }
|
||||
}
|
||||
|
||||
public class ReCalculateRollCallValues
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
@@ -373,9 +373,7 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderBy(x => x.Color switch { "orange" => 0, "white" => 1, "red" => 2, "green" => 3, "black" => 4, _ => 5 })
|
||||
.ToList();
|
||||
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1676,10 +1676,6 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1141,7 +1141,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
entity.PublicId);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
@@ -1378,7 +1378,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
institutionContract.PublicId);
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +144,9 @@ public class RollCallApplication : IRollCallApplication
|
||||
return _rollCallRepository.GetWorkshopRollCallHistory(searchModel);
|
||||
}
|
||||
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId, WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
{
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId, searchModel);
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
}
|
||||
|
||||
public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate,
|
||||
|
||||
@@ -1062,29 +1062,5 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
|
||||
|
||||
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
|
||||
|
||||
|
||||
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
|
||||
|
||||
|
||||
var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
||||
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id));
|
||||
|
||||
|
||||
return await employeesQuery.Select(x => new EmployeeSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FullName
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
@@ -2343,7 +2343,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
entity.PublicId);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -2740,7 +2740,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
VerifyDateTime = institution.VerifyCodeCreation.ToFarsi(),
|
||||
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
|
||||
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
|
||||
Workshops = institution.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
|
||||
{
|
||||
|
||||
@@ -1052,11 +1052,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
|
||||
//گزارش آنلاین حضور غیاب کارگاه
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,
|
||||
WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
{
|
||||
var date = DateTime.Now.Date;
|
||||
|
||||
|
||||
|
||||
//get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی
|
||||
var leaves = _context.LeaveList
|
||||
.Where(x =>
|
||||
@@ -1070,11 +1070,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
//var workingEmployees =
|
||||
// _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.StartWorkDate < date && x.LeftWorkDate.Date > date);
|
||||
|
||||
if (searchModel.PersonnelCode>0)
|
||||
{
|
||||
personnelCodes = personnelCodes.Where(x=>x.PersonnelCode == searchModel.PersonnelCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//get activated employees
|
||||
var activeEmployees =
|
||||
@@ -1088,15 +1084,6 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
x.WorkshopId == workshopId && (x.ShiftDate.Date == date || x.EndDate == null) && x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
|
||||
|
||||
if (searchModel.EmployeeId>0)
|
||||
{
|
||||
leaves = leaves.Where(x=>x.WorkshopId == searchModel.EmployeeId);
|
||||
personnelCodes = personnelCodes.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
activeEmployees = activeEmployees.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
rollCallsQuery = rollCallsQuery.Where(x=>x.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var mustBePresent = activeEmployees.Where(x => !leaves.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -56,7 +56,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentDayAjax(string type, long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -83,7 +83,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentAjaxCount(long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class RollCallController:ClientBaseController
|
||||
{
|
||||
private long _workshopId;
|
||||
private readonly IRollCallApplication _rollCallApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
|
||||
public RollCallController(IRollCallApplication rollCallApplication,IAuthHelper authHelper, IEmployeeApplication employeeApplication)
|
||||
{
|
||||
_rollCallApplication = rollCallApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
[HttpGet("current-day")]
|
||||
public ActionResult<CurrentDayRollCall> GetCurrentDay(WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
{
|
||||
var res = _rollCallApplication.GetWorkshopCurrentDayRollCalls(_workshopId, searchModel);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet("employee-select-list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
|
||||
{
|
||||
var res = await _employeeApplication.GetWorkingEmployeesSelectList(_workshopId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -143,7 +143,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
Reference in New Issue
Block a user