Compare commits
28 Commits
Feature/co
...
Feature/ga
| Author | SHA1 | Date | |
|---|---|---|---|
| 16c29bc2d0 | |||
|
|
57ef47473b | ||
| 8bd248c6a7 | |||
| 7f9531f07b | |||
|
|
861b214b0c | ||
|
|
690f574240 | ||
|
|
05abc67cdd | ||
| 3282825719 | |||
| cd1cf93ad1 | |||
| adef1fc15a | |||
| 597f54c062 | |||
| c0ead0a917 | |||
| 59284ffd29 | |||
| 5c7dd76e3f | |||
| dff6bc2541 | |||
| 22b67b344a | |||
|
|
d8b432ca1e | ||
| f4853b6f39 | |||
| 6ab418c4ab | |||
|
|
74dca1d2d2 | ||
|
|
a9b4eb6195 | ||
|
|
2125e15fb9 | ||
| b7f7d3b223 | |||
| 752c7c72ab | |||
| 73da938bc9 | |||
| 08574b5bb5 | |||
| 288e3a8988 | |||
| 026d8da74a |
@@ -29,9 +29,11 @@ public class PaymentGatewayResponse
|
||||
public int? ErrorCode { get; set; }
|
||||
|
||||
[JsonPropertyName("transid")]
|
||||
public string TransactionId { get; set; }
|
||||
public string Token { get; set; }
|
||||
|
||||
public bool IsSuccess => Status == "success";
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class WalletAmountResponse
|
||||
@@ -53,10 +55,12 @@ public class CreatePaymentGatewayRequest
|
||||
public string Mobile { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Description { get; set; }
|
||||
public IDictionary<string, object> ExtraData { get; set; }
|
||||
}
|
||||
|
||||
public class VerifyPaymentGateWayRequest
|
||||
{
|
||||
public string TransactionId { get; set; }
|
||||
public string DigitalReceipt { get; set; }
|
||||
public string TransactionId { get; set; }
|
||||
public double Amount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace _0_Framework.Application.PaymentGateway;
|
||||
|
||||
public class SepehrPaymentGateway:IPaymentGateway
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private const long TerminalId = 99213700;
|
||||
|
||||
public SepehrPaymentGateway(IHttpClientFactory httpClient)
|
||||
{
|
||||
_httpClient = httpClient.CreateClient();
|
||||
_httpClient.BaseAddress = new Uri("https://sepehr.shaparak.ir/Rest/V1/PeymentApi/");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task<PaymentGatewayResponse> Create(CreatePaymentGatewayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var extraData = JsonConvert.SerializeObject(command.ExtraData);
|
||||
var res = await _httpClient.PostAsJsonAsync("GetToken", new
|
||||
{
|
||||
TerminalID = TerminalId,
|
||||
Amount = command.Amount,
|
||||
InvoiceID = command.InvoiceId,
|
||||
callbackURL = command.CallBackUrl,
|
||||
payload = extraData
|
||||
}, cancellationToken: cancellationToken);
|
||||
// خواندن محتوای پاسخ
|
||||
var content = await res.Content.ReadAsStringAsync(cancellationToken);
|
||||
|
||||
// تبدیل پاسخ JSON به آبجکت داتنت
|
||||
var json = System.Text.Json.JsonDocument.Parse(content);
|
||||
|
||||
// گرفتن مقدار AccessToken
|
||||
var accessToken = json.RootElement.GetProperty("Accesstoken").ToString();
|
||||
var status = json.RootElement.GetProperty("Status").ToString();
|
||||
|
||||
return new PaymentGatewayResponse
|
||||
{
|
||||
Status = status,
|
||||
IsSuccess = status == "0",
|
||||
Token = accessToken
|
||||
};
|
||||
}
|
||||
|
||||
public string GetStartPayUrl(string token)=>
|
||||
$"https://sepehr.shaparak.ir/Payment/Pay?token={token}&terminalId={TerminalId}";
|
||||
|
||||
public async Task<PaymentGatewayResponse> Verify(VerifyPaymentGateWayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var res = await _httpClient.PostAsJsonAsync("Advice", new
|
||||
{
|
||||
digitalreceipt = command.DigitalReceipt,
|
||||
Tid = TerminalId,
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
// خواندن محتوای پاسخ
|
||||
var content = await res.Content.ReadAsStringAsync(cancellationToken);
|
||||
|
||||
// تبدیل پاسخ JSON به آبجکت داتنت
|
||||
var json = System.Text.Json.JsonDocument.Parse(content);
|
||||
|
||||
|
||||
var message = json.RootElement.GetProperty("Message").GetString();
|
||||
var status = json.RootElement.GetProperty("Status").GetString();
|
||||
return new PaymentGatewayResponse
|
||||
{
|
||||
Status = status,
|
||||
IsSuccess = status.ToLower() == "ok",
|
||||
Message = message
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Task<PaymentGatewayResponse> CreateSandBox(CreatePaymentGatewayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetStartPaySandBoxUrl(string transactionId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
@@ -66,4 +66,11 @@ public interface IAccountApplication
|
||||
public bool CheckExistClientAccount(string userName);
|
||||
List<AccountViewModel> GetAdminAccountsNew();
|
||||
|
||||
void CameraLogin(CameraLoginRequest request);
|
||||
}
|
||||
|
||||
public class CameraLoginRequest
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Exceptions;
|
||||
using AccountManagement.Domain.PositionAgg;
|
||||
using AccountManagement.Domain.SubAccountAgg;
|
||||
using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg;
|
||||
@@ -803,4 +804,29 @@ public class AccountApplication : IAccountApplication
|
||||
{
|
||||
return _accountRepository.GetAdminAccountsNew();
|
||||
}
|
||||
|
||||
public void CameraLogin(CameraLoginRequest request)
|
||||
{
|
||||
var cameraAccount = _cameraAccountRepository.GetBy(request.UserName);
|
||||
|
||||
if (cameraAccount == null)
|
||||
{
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
}
|
||||
|
||||
(bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(cameraAccount.Password, request.Password);
|
||||
|
||||
if (!result.Verified)
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
|
||||
var mobile = string.IsNullOrWhiteSpace(cameraAccount.Mobile) ? " " : cameraAccount.Mobile;
|
||||
|
||||
var authViewModel = new CameraAuthViewModel(cameraAccount.id, cameraAccount.WorkshopId,
|
||||
cameraAccount.Username, mobile, cameraAccount.WorkshopName, cameraAccount.AccountId,
|
||||
cameraAccount.IsActiveSting);
|
||||
if (cameraAccount.IsActiveSting != "true")
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
|
||||
_authHelper.CameraSignIn(authViewModel);
|
||||
}
|
||||
}
|
||||
189
Company.Domain/EmployeeFaceEmbeddingAgg/EmployeeFaceEmbedding.cs
Normal file
189
Company.Domain/EmployeeFaceEmbeddingAgg/EmployeeFaceEmbedding.cs
Normal file
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
|
||||
public class EmployeeFaceEmbedding
|
||||
{
|
||||
public EmployeeFaceEmbedding()
|
||||
{
|
||||
EmbeddingHistory = new List<EmbeddingHistoryItem>();
|
||||
MetadataHistory = new List<MetadataHistoryItem>();
|
||||
}
|
||||
|
||||
public EmployeeFaceEmbedding(string employeeFullName, long employeeId, long workshopId,
|
||||
List<double> embeddings, EmployeeFaceEmbeddingMetadata metadata)
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
EmployeeFullName = employeeFullName;
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Embeddings = embeddings;
|
||||
Metadata = metadata;
|
||||
EmbeddingHistory = new List<EmbeddingHistoryItem>();
|
||||
MetadataHistory = new List<MetadataHistoryItem>();
|
||||
CreatedAt = DateTime.UtcNow;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("employeeFullName")]
|
||||
public string EmployeeFullName { get; set; }
|
||||
|
||||
[BsonElement("employeeId")]
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
[BsonElement("workshopId")]
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
[BsonElement("embeddings")]
|
||||
public List<double> Embeddings { get; set; }
|
||||
|
||||
[BsonElement("metadata")]
|
||||
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
|
||||
|
||||
[BsonElement("embeddingHistory")]
|
||||
public List<EmbeddingHistoryItem> EmbeddingHistory { get; set; }
|
||||
|
||||
[BsonElement("metadataHistory")]
|
||||
public List<MetadataHistoryItem> MetadataHistory { get; set; }
|
||||
|
||||
[BsonElement("createdAt")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonElement("updatedAt")]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
public void UpdateEmbedding(List<double> newEmbedding, double confidence, double refinementPercentage)
|
||||
{
|
||||
if (Embeddings != null)
|
||||
{
|
||||
EmbeddingHistory.Add(new EmbeddingHistoryItem
|
||||
{
|
||||
Embedding = new List<double>(Embeddings),
|
||||
Timestamp = DateTime.UtcNow,
|
||||
Confidence = confidence,
|
||||
RefinementPercentage = refinementPercentage
|
||||
});
|
||||
}
|
||||
|
||||
Embeddings = newEmbedding;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void UpdateMetadata(EmployeeFaceEmbeddingMetadata newMetadata, double confidence, double refinementPercentage)
|
||||
{
|
||||
if (Metadata != null)
|
||||
{
|
||||
MetadataHistory.Add(new MetadataHistoryItem
|
||||
{
|
||||
Metadata = Metadata,
|
||||
Timestamp = DateTime.UtcNow,
|
||||
Confidence = confidence,
|
||||
RefinementPercentage = refinementPercentage
|
||||
});
|
||||
}
|
||||
|
||||
Metadata = newMetadata;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void UpdateEmployeeInfo(string employeeFullName, long workshopId)
|
||||
{
|
||||
EmployeeFullName = employeeFullName;
|
||||
WorkshopId = workshopId;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingMetadata
|
||||
{
|
||||
[BsonElement("avg_eye_distance_normalized")]
|
||||
public double AvgEyeDistanceNormalized { get; set; }
|
||||
|
||||
[BsonElement("avg_eye_to_face_ratio")]
|
||||
public double AvgEyeToFaceRatio { get; set; }
|
||||
|
||||
[BsonElement("avg_face_aspect_ratio")]
|
||||
public double AvgFaceAspectRatio { get; set; }
|
||||
|
||||
[BsonElement("avg_detection_confidence")]
|
||||
public double AvgDetectionConfidence { get; set; }
|
||||
|
||||
[BsonElement("avg_keypoints_normalized")]
|
||||
public EmployeeFaceEmbeddingKeypoints AvgKeypointsNormalized { get; set; }
|
||||
|
||||
[BsonElement("per_image_metadata")]
|
||||
public List<ImageMetadata> PerImageMetadata { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingKeypoints
|
||||
{
|
||||
[BsonElement("left_eye")]
|
||||
public double[] LeftEye { get; set; }
|
||||
|
||||
[BsonElement("right_eye")]
|
||||
public double[] RightEye { get; set; }
|
||||
|
||||
[BsonElement("nose")]
|
||||
public double[] Nose { get; set; }
|
||||
|
||||
[BsonElement("mouth_left")]
|
||||
public double[] MouthLeft { get; set; }
|
||||
|
||||
[BsonElement("mouth_right")]
|
||||
public double[] MouthRight { get; set; }
|
||||
}
|
||||
|
||||
public class ImageMetadata
|
||||
{
|
||||
[BsonElement("face_aspect_ratio")]
|
||||
public double FaceAspectRatio { get; set; }
|
||||
|
||||
[BsonElement("eye_distance_normalized")]
|
||||
public double EyeDistanceNormalized { get; set; }
|
||||
|
||||
[BsonElement("eye_to_face_ratio")]
|
||||
public double EyeToFaceRatio { get; set; }
|
||||
|
||||
[BsonElement("detection_confidence")]
|
||||
public double DetectionConfidence { get; set; }
|
||||
|
||||
[BsonElement("keypoints_normalized")]
|
||||
public EmployeeFaceEmbeddingKeypoints KeypointsNormalized { get; set; }
|
||||
}
|
||||
|
||||
public class EmbeddingHistoryItem
|
||||
{
|
||||
[BsonElement("embedding")]
|
||||
public List<double> Embedding { get; set; }
|
||||
|
||||
[BsonElement("timestamp")]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
[BsonElement("confidence")]
|
||||
public double Confidence { get; set; }
|
||||
|
||||
[BsonElement("refinementPercentage")]
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
public class MetadataHistoryItem
|
||||
{
|
||||
[BsonElement("metadata")]
|
||||
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
|
||||
|
||||
[BsonElement("timestamp")]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
[BsonElement("confidence")]
|
||||
public double Confidence { get; set; }
|
||||
|
||||
[BsonElement("refinementPercentage")]
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
|
||||
public interface IEmployeeFaceEmbeddingRepository
|
||||
{
|
||||
Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
|
||||
Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
|
||||
Task<EmployeeFaceEmbedding> GetByIdAsync(string id);
|
||||
Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId);
|
||||
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId);
|
||||
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds);
|
||||
Task DeleteAsync(string id);
|
||||
}
|
||||
@@ -18,13 +18,15 @@ public class PaymentTransaction:EntityBase
|
||||
/// <param name="callBackUrl"></param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
double amount,
|
||||
string contractingPartyName,string callBackUrl)
|
||||
string contractingPartyName,string callBackUrl,
|
||||
PaymentTransactionGateWay gateway)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
Status = PaymentTransactionStatus.Pending;
|
||||
Amount = amount;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
CallBackUrl = callBackUrl;
|
||||
Gateway = gateway;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,13 +70,20 @@ public class PaymentTransaction:EntityBase
|
||||
public string TransactionId { get; private set; }
|
||||
|
||||
public string CallBackUrl { get; private set; }
|
||||
public PaymentTransactionGateWay Gateway { get; private set; }
|
||||
public string Rrn { get; private set; }
|
||||
public string DigitalReceipt { get; private set; }
|
||||
|
||||
public void SetPaid(string cardNumber,string bankName)
|
||||
|
||||
public void SetPaid(string cardNumber,string bankName,string rrn,string digitalReceipt)
|
||||
{
|
||||
Status = PaymentTransactionStatus.Success;
|
||||
TransactionDate = DateTime.Now;
|
||||
CardNumber = cardNumber;
|
||||
BankName = bankName;
|
||||
Rrn = rrn;
|
||||
DigitalReceipt = digitalReceipt;
|
||||
|
||||
}
|
||||
public void SetFailed()
|
||||
{
|
||||
@@ -85,4 +94,5 @@ public class PaymentTransaction:EntityBase
|
||||
{
|
||||
TransactionId = transactionId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,21 +11,23 @@ namespace Company.Domain.ReportAgg
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
|
||||
AllReport GetAllActiveWorkshops(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace CompanyManagement.Infrastructure.Mongo.EmployeeFaceEmbeddingRepo;
|
||||
|
||||
public class EmployeeFaceEmbeddingRepository : IEmployeeFaceEmbeddingRepository
|
||||
{
|
||||
private readonly IMongoCollection<EmployeeFaceEmbedding> _employeeFaceEmbeddings;
|
||||
|
||||
public EmployeeFaceEmbeddingRepository(IMongoDatabase database)
|
||||
{
|
||||
_employeeFaceEmbeddings = database.GetCollection<EmployeeFaceEmbedding>("EmployeeFaces");
|
||||
}
|
||||
|
||||
public async Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
|
||||
{
|
||||
await _employeeFaceEmbeddings.InsertOneAsync(employeeFaceEmbedding);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
|
||||
{
|
||||
await _employeeFaceEmbeddings.ReplaceOneAsync(
|
||||
x => x.Id == employeeFaceEmbedding.Id,
|
||||
employeeFaceEmbedding);
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbedding> GetByIdAsync(string id)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.EmployeeId == employeeId)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.WorkshopId == workshopId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => workshopIds.First()==x.WorkshopId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string id)
|
||||
{
|
||||
await _employeeFaceEmbeddings.DeleteOneAsync(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,5 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
|
||||
public int LeavePermittedDays { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
|
||||
public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
public bool HasLeft { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
public class EmployeeFaceEmbeddingDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public List<double> Embeddings { get; set; }
|
||||
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
public class EmployeeFaceEmbeddingMetadataDto
|
||||
{
|
||||
public double AvgEyeDistanceNormalized { get; set; }
|
||||
public double AvgEyeToFaceRatio { get; set; }
|
||||
public double AvgFaceAspectRatio { get; set; }
|
||||
public double AvgDetectionConfidence { get; set; }
|
||||
public EmployeeFaceEmbeddingKeypointsDto AvgKeypointsNormalized { get; set; }
|
||||
public List<ImageMetadataDto> PerImageMetadata { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingKeypointsDto
|
||||
{
|
||||
public double[] LeftEye { get; set; }
|
||||
public double[] RightEye { get; set; }
|
||||
public double[] Nose { get; set; }
|
||||
public double[] MouthLeft { get; set; }
|
||||
public double[] MouthRight { get; set; }
|
||||
}
|
||||
|
||||
public class ImageMetadataDto
|
||||
{
|
||||
public double FaceAspectRatio { get; set; }
|
||||
public double EyeDistanceNormalized { get; set; }
|
||||
public double EyeToFaceRatio { get; set; }
|
||||
public double DetectionConfidence { get; set; }
|
||||
public EmployeeFaceEmbeddingKeypointsDto KeypointsNormalized { get; set; }
|
||||
}
|
||||
|
||||
public class EmbeddingHistoryItemDto
|
||||
{
|
||||
public List<double> Embedding { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
public double Confidence { get; set; }
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
public class MetadataHistoryItemDto
|
||||
{
|
||||
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
public double Confidence { get; set; }
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
/// <summary>
|
||||
/// سرویس مدیریت Embedding چهره کارکنان
|
||||
/// این سرویس فقط برای دریافت و ارسال داده است و هیچ command-driven نیست
|
||||
/// </summary>
|
||||
public interface IEmployeeFaceEmbeddingApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت embedding بر اساس شناسه
|
||||
/// </summary>
|
||||
Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت embedding بر اساس شناسه کارمند
|
||||
/// </summary>
|
||||
Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست embeddings بر اساس شناسه کارگاه
|
||||
/// </summary>
|
||||
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست embeddings بر اساس لیست شناسه کارگاهها
|
||||
/// </summary>
|
||||
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds);
|
||||
|
||||
/// <summary>
|
||||
/// ذخیره یا بهروزرسانی embedding
|
||||
/// اگر Id وجود داشته باشد، بهروزرسانی میشود، در غیر این صورت ایجاد میشود
|
||||
/// </summary>
|
||||
Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto);
|
||||
|
||||
/// <summary>
|
||||
/// حذف embedding
|
||||
/// </summary>
|
||||
Task DeleteAsync(string id);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,14 @@ public class CreatePaymentTransaction
|
||||
/// مسیر برگشت پس از پرداخت
|
||||
/// </summary>
|
||||
public string CallBackUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع درگاه
|
||||
/// </summary>
|
||||
public PaymentTransactionGateWay Gateway { get; set; }
|
||||
}
|
||||
public enum PaymentTransactionGateWay
|
||||
{
|
||||
AqayePardakht = 1,
|
||||
SepehrPay = 2
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public interface IPaymentTransactionApplication
|
||||
/// <param name="cardNumber"></param>
|
||||
/// <param name="bankName"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName, string rrn, string digitalReceipt);
|
||||
|
||||
Task<OperationResult> SetTransactionId(long id, string transactionId);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int ContractSignNotDone { get; set; }
|
||||
public int ContractSignDone { get; set; }
|
||||
|
||||
public int ContractSignToBe { get; set; }
|
||||
|
||||
//تصفیه
|
||||
public int AllCheckout { get; set; }
|
||||
public int CheckoutNotDone { get; set; }
|
||||
@@ -34,6 +36,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int CheckoutSignNotDone { get; set; }
|
||||
public int CheckoutSignDone { get; set; }
|
||||
|
||||
public int CheckoutSignToBe { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,21 +10,23 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshops(string year, string month);
|
||||
Task<AllReport> GetAllReports(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
}
|
||||
}
|
||||
|
||||
170
CompanyManagment.Application/EmployeeFaceEmbeddingApplication.cs
Normal file
170
CompanyManagment.Application/EmployeeFaceEmbeddingApplication.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class EmployeeFaceEmbeddingApplication : IEmployeeFaceEmbeddingApplication
|
||||
{
|
||||
private readonly IEmployeeFaceEmbeddingRepository _repository;
|
||||
|
||||
public EmployeeFaceEmbeddingApplication(IEmployeeFaceEmbeddingRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
return entity == null ? null : MapToDto(entity);
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId)
|
||||
{
|
||||
var entity = await _repository.GetByEmployeeIdAsync(employeeId);
|
||||
return entity == null ? null : MapToDto(entity);
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId)
|
||||
{
|
||||
var entities = await _repository.GetByWorkshopIdAsync(workshopId);
|
||||
return entities.Select(MapToDto).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds)
|
||||
{
|
||||
var entities = await _repository.GetByWorkshopIdsAsync(workshopIds);
|
||||
return entities.Select(MapToDto).ToList();
|
||||
}
|
||||
|
||||
public async Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dto.Id))
|
||||
{
|
||||
// ایجاد جدید
|
||||
var metadata = MapMetadataFromDto(dto.Metadata);
|
||||
var entity = new EmployeeFaceEmbedding(
|
||||
dto.EmployeeFullName,
|
||||
dto.EmployeeId,
|
||||
dto.WorkshopId,
|
||||
dto.Embeddings,
|
||||
metadata
|
||||
);
|
||||
|
||||
await _repository.CreateAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// بهروزرسانی
|
||||
var entity = await _repository.GetByIdAsync(dto.Id);
|
||||
if (entity == null)
|
||||
throw new Exception($"EmployeeFaceEmbedding با شناسه {dto.Id} یافت نشد");
|
||||
|
||||
entity.UpdateEmployeeInfo(dto.EmployeeFullName, dto.WorkshopId);
|
||||
entity.UpdateEmbedding(dto.Embeddings, 0, 0);
|
||||
entity.UpdateMetadata(MapMetadataFromDto(dto.Metadata), 0, 0);
|
||||
|
||||
await _repository.UpdateAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string id)
|
||||
{
|
||||
await _repository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
#region Mapping Methods
|
||||
|
||||
private EmployeeFaceEmbeddingDto MapToDto(EmployeeFaceEmbedding entity)
|
||||
{
|
||||
return new EmployeeFaceEmbeddingDto
|
||||
{
|
||||
Id = entity.Id,
|
||||
EmployeeFullName = entity.EmployeeFullName,
|
||||
EmployeeId = entity.EmployeeId,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
Embeddings = entity.Embeddings,
|
||||
Metadata = MapMetadataToDto(entity.Metadata)
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingMetadataDto MapMetadataToDto(EmployeeFaceEmbeddingMetadata metadata)
|
||||
{
|
||||
if (metadata == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingMetadataDto
|
||||
{
|
||||
AvgEyeDistanceNormalized = metadata.AvgEyeDistanceNormalized,
|
||||
AvgEyeToFaceRatio = metadata.AvgEyeToFaceRatio,
|
||||
AvgFaceAspectRatio = metadata.AvgFaceAspectRatio,
|
||||
AvgDetectionConfidence = metadata.AvgDetectionConfidence,
|
||||
AvgKeypointsNormalized = MapKeypointsToDto(metadata.AvgKeypointsNormalized),
|
||||
PerImageMetadata = metadata.PerImageMetadata?.Select(x => new ImageMetadataDto
|
||||
{
|
||||
FaceAspectRatio = x.FaceAspectRatio,
|
||||
EyeDistanceNormalized = x.EyeDistanceNormalized,
|
||||
EyeToFaceRatio = x.EyeToFaceRatio,
|
||||
DetectionConfidence = x.DetectionConfidence,
|
||||
KeypointsNormalized = MapKeypointsToDto(x.KeypointsNormalized)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingKeypointsDto MapKeypointsToDto(EmployeeFaceEmbeddingKeypoints keypoints)
|
||||
{
|
||||
if (keypoints == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingKeypointsDto
|
||||
{
|
||||
LeftEye = keypoints.LeftEye,
|
||||
RightEye = keypoints.RightEye,
|
||||
Nose = keypoints.Nose,
|
||||
MouthLeft = keypoints.MouthLeft,
|
||||
MouthRight = keypoints.MouthRight
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingMetadata MapMetadataFromDto(EmployeeFaceEmbeddingMetadataDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingMetadata
|
||||
{
|
||||
AvgEyeDistanceNormalized = dto.AvgEyeDistanceNormalized,
|
||||
AvgEyeToFaceRatio = dto.AvgEyeToFaceRatio,
|
||||
AvgFaceAspectRatio = dto.AvgFaceAspectRatio,
|
||||
AvgDetectionConfidence = dto.AvgDetectionConfidence,
|
||||
AvgKeypointsNormalized = MapKeypointsFromDto(dto.AvgKeypointsNormalized),
|
||||
PerImageMetadata = dto.PerImageMetadata?.Select(x => new ImageMetadata
|
||||
{
|
||||
FaceAspectRatio = x.FaceAspectRatio,
|
||||
EyeDistanceNormalized = x.EyeDistanceNormalized,
|
||||
EyeToFaceRatio = x.EyeToFaceRatio,
|
||||
DetectionConfidence = x.DetectionConfidence,
|
||||
KeypointsNormalized = MapKeypointsFromDto(x.KeypointsNormalized)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingKeypoints MapKeypointsFromDto(EmployeeFaceEmbeddingKeypointsDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingKeypoints
|
||||
{
|
||||
LeftEye = dto.LeftEye,
|
||||
RightEye = dto.RightEye,
|
||||
Nose = dto.Nose,
|
||||
MouthLeft = dto.MouthLeft,
|
||||
MouthRight = dto.MouthRight
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1140,7 +1140,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
@@ -1377,7 +1377,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
command.ContractingPartyId,
|
||||
command.Amount,
|
||||
contractingPartyName,
|
||||
command.CallBackUrl);
|
||||
command.CallBackUrl,command.Gateway);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
@@ -87,7 +87,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName)
|
||||
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName, string rrn, string digitalReceipt)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
{
|
||||
return op.Failed("تراکنش مورد نظر یافت نشد");
|
||||
}
|
||||
paymentTransaction.SetPaid(cardNumber, bankName);
|
||||
paymentTransaction.SetPaid(cardNumber, bankName,rrn, digitalReceipt);
|
||||
_paymentTransactionRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
|
||||
@@ -29,67 +29,67 @@ public class ReportApplication : IReportApplication
|
||||
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
#region Print
|
||||
|
||||
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.QualityTools.Testing.Fakes" Version="16.11.230815" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.5.0" />
|
||||
<PackageReference Include="Parbad.Gateway.Sepehr" Version="1.7.0" />
|
||||
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -15,8 +15,12 @@ public class PaymentTransactionMapping:IEntityTypeConfiguration<PaymentTransacti
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.BankName).HasMaxLength(50);
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.Gateway).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.ContractingPartyName).HasMaxLength(255);
|
||||
builder.Property(x => x.CallBackUrl).HasMaxLength(500);
|
||||
builder.Property(x => x.Rrn).HasMaxLength(50);
|
||||
builder.Property(x => x.DigitalReceipt).HasMaxLength(50);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11121
CompanyManagment.EFCore/Migrations/20251112143907_addGateways in transaction .Designer.cs
generated
Normal file
11121
CompanyManagment.EFCore/Migrations/20251112143907_addGateways in transaction .Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addGatewaysintransaction : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Gateway",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(35)",
|
||||
maxLength: 35,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Gateway",
|
||||
table: "PaymentTransactions");
|
||||
}
|
||||
}
|
||||
}
|
||||
11129
CompanyManagment.EFCore/Migrations/20251112151518_add rrn and digital receipt.Designer.cs
generated
Normal file
11129
CompanyManagment.EFCore/Migrations/20251112151518_add rrn and digital receipt.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addrrnanddigitalreceipt : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DigitalReceipt",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Rrn",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DigitalReceipt",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Rrn",
|
||||
table: "PaymentTransactions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4990,6 +4990,19 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("DigitalReceipt")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Gateway")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<string>("Rrn")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
|
||||
@@ -19,39 +19,41 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext, IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
public class CustomizeWorkshopGroupSettingsRepository(
|
||||
CompanyContext companyContext,
|
||||
IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopGroupSettings>(companyContext),
|
||||
ICustomizeWorkshopGroupSettingsRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository = _rollCallEmployeeRepository;
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id)
|
||||
{
|
||||
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopSettings)
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x=>x.CustomizeWorkshopSettings)
|
||||
.Include(x=> x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopSettings)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long customizeWorkshopSettingId)
|
||||
{
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
|
||||
if (workshopSettings == null)
|
||||
return new();
|
||||
|
||||
var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().Include(x=>x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x=>x.EmployeeId).ToList();
|
||||
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
var workshopId = workshopSettings.WorkshopId;
|
||||
var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
@@ -81,79 +83,81 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
|
||||
var dateNow = DateTime.Now.Date;
|
||||
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x=> new EmployeeViewModel()
|
||||
{
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x => new EmployeeViewModel()
|
||||
{
|
||||
EmployeeFullName = x.rollCallEmployee.EmployeeFullName,
|
||||
Id = x.rollCallEmployee.EmployeeId
|
||||
});
|
||||
});
|
||||
|
||||
return employees.ToList();
|
||||
return employees.ToList();
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
|
||||
|
||||
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true"&&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true" &&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWithEmployees(long groupId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupId);
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -169,23 +173,26 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -201,38 +208,52 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
var employees = entity.CustomizeWorkshopEmployeeSettingsCollection;
|
||||
if (employees.Count == 0)
|
||||
return [];
|
||||
|
||||
var workshopId = employees.FirstOrDefault()?.WorkshopId??0;
|
||||
|
||||
if (workshopId == 0)
|
||||
return [];
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId);
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
|
||||
.Select(x => new { x.id, x.FullName }).ToList();
|
||||
|
||||
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
employeeIds.Contains(x.EmployeeId)).ToList();
|
||||
|
||||
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
@@ -243,82 +264,86 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
Salary = x.Salary,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts
|
||||
.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
LeavePermittedDays = x.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts
|
||||
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
|
||||
|
||||
.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
|
||||
});
|
||||
return joinedList.ToList();
|
||||
return joinedList.OrderBy(x=>x.HasLeft).ToList();
|
||||
}
|
||||
|
||||
public EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
|
||||
return new EditCustomizeWorkshopGroupSettings()
|
||||
{
|
||||
//FridayWork = entity.FridayWork,
|
||||
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value, LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value, EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.BonusesPay.Value, BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.ShiftPay.Value, ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay =new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
@@ -332,23 +357,27 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
IsShiftChanged = entity.IsShiftChange,
|
||||
ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.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(),
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x=> new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x =>
|
||||
new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(long workshopSettingsId)
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(
|
||||
long workshopSettingsId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
}
|
||||
|
||||
public void Remove(long groupId)
|
||||
@@ -360,7 +389,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
_companyContext.SaveChanges();
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId)
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId,
|
||||
long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
|
||||
@@ -2342,7 +2342,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,8 @@ public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
private readonly bool _isDevEnvironment;
|
||||
private readonly List<string> _testNumbers;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
|
||||
|
||||
@@ -27,6 +29,33 @@ public class SmsService : ISmsService
|
||||
_smsResultRepository = smsResultRepository;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
// خواندن تنظیمات SMS از appsettings
|
||||
var smsSettings = _configuration.GetSection("SmsSettings");
|
||||
_isDevEnvironment = smsSettings.GetValue<bool>("IsTestMode");
|
||||
_testNumbers = smsSettings.GetSection("TestNumbers").Get<List<string>>() ?? new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// متد مرکزی برای ارسال پیامک که محیط dev را چک میکند
|
||||
/// </summary>
|
||||
private async Task<SmsIrResult<VerifySendResult>> VerifySendSmsAsync(string number, int templateId, VerifySendParameter[] parameters)
|
||||
{
|
||||
// اگر محیط dev است و شمارههای تست وجود دارد، به شمارههای تست ارسال میشود
|
||||
if (_isDevEnvironment && _testNumbers is { Count: > 0 })
|
||||
{
|
||||
// ارسال به همه شمارههای تست
|
||||
SmsIrResult<VerifySendResult> lastResult = null;
|
||||
foreach (var testNumber in _testNumbers)
|
||||
{
|
||||
lastResult = await SmsIr.VerifySendAsync(testNumber, templateId, parameters);
|
||||
}
|
||||
return lastResult; // برگرداندن نتیجه آخرین ارسال
|
||||
}
|
||||
else
|
||||
{
|
||||
// ارسال به شماره واقعی
|
||||
return await SmsIr.VerifySendAsync(number, templateId, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
public void Send(string number, string message)
|
||||
@@ -56,12 +85,7 @@ public class SmsService : ISmsService
|
||||
}
|
||||
public bool VerifySend(string number, string message)
|
||||
{
|
||||
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var verificationSendResult = smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
@@ -90,11 +114,7 @@ public class SmsService : ISmsService
|
||||
|
||||
public bool LoginSend(string number, string message)
|
||||
{
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var verificationSendResult = smsIr.VerifySendAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
@@ -119,11 +139,8 @@ public class SmsService : ISmsService
|
||||
|
||||
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
|
||||
{
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new SentSmsViewModel();
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
@@ -148,9 +165,8 @@ public class SmsService : ISmsService
|
||||
var checkLength = fullName.Length;
|
||||
if (checkLength > 25)
|
||||
fullName = fullName.Substring(0, 24);
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
var sendResult = smsIr.VerifySendAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
|
||||
|
||||
Console.WriteLine(userName + " - " + sendResult.Result.Status);
|
||||
@@ -332,18 +348,39 @@ public class SmsService : ISmsService
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
|
||||
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
|
||||
|
||||
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> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
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();
|
||||
@@ -353,7 +390,7 @@ public class SmsService : ISmsService
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
@@ -220,9 +220,12 @@ using CompanyManagment.App.Contracts.PaymentInstrument;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.AuthorizedPerson;
|
||||
using Company.Domain.AuthorizedPersonAgg;
|
||||
using Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
using Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
using Company.Domain.LawAgg;
|
||||
using CompanyManagement.Infrastructure.Mongo.EmployeeFaceEmbeddingRepo;
|
||||
using CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;
|
||||
using CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -479,6 +482,10 @@ public class PersonalBootstrapper
|
||||
|
||||
services
|
||||
.AddTransient<IInstitutionContractExtenstionTempRepository, InstitutionContractExtenstionTempRepository>();
|
||||
|
||||
services.AddTransient<IEmployeeFaceEmbeddingRepository, EmployeeFaceEmbeddingRepository>();
|
||||
services.AddTransient<IEmployeeFaceEmbeddingApplication, EmployeeFaceEmbeddingApplication>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
|
||||
<div class="textsChart">
|
||||
<p class="alltxt">
|
||||
<span style="width: 40px;display: inline-block;">@Model.ContrcatDone</span> : <span style="width: 62px;display: inline-block;">کل</span>
|
||||
<span style="width: 40px;display: inline-block;">@Model.ContractSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
|
||||
</p>
|
||||
<p class="alldonetxt">
|
||||
<span style="width: 40px;display: inline-block;">@Model.ContractSignDone</span> : <span style="width: 62px;display: inline-block;color: #283344;">انجام شده</span>
|
||||
@@ -353,7 +353,7 @@
|
||||
|
||||
<div class="textsChart">
|
||||
<p class="alltxt">
|
||||
<span style="width: 40px;display: inline-block;">@Model.CheckoutDone</span> : <span style="width: 62px;display: inline-block;">کل</span>
|
||||
<span style="width: 40px;display: inline-block;">@Model.CheckoutSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
|
||||
</p>
|
||||
<p class="alldonetxt">
|
||||
<span style="width: 40px;display: inline-block;">@Model.CheckoutSignDone</span> : <span style="width: 62px;display: inline-block;color: #283344;">انجام شده</span>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using CompanyManagment.App.Contracts.Report;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
@@ -42,6 +43,7 @@ public class IndexModel : PageModel
|
||||
public int ContrcatDone { get; set; }
|
||||
public int ContractSignNotDone { get; set; }
|
||||
public int ContractSignDone { get; set; }
|
||||
public int ContractSignToBe { get; set; }
|
||||
|
||||
//تصفیه
|
||||
public int AllCheckout { get; set; }
|
||||
@@ -49,8 +51,9 @@ public class IndexModel : PageModel
|
||||
public int CheckoutDone { get; set; }
|
||||
public int CheckoutSignNotDone { get; set; }
|
||||
public int CheckoutSignDone { get; set; }
|
||||
public int CheckoutSignToBe { get; set; }
|
||||
|
||||
public async Task OnGet(string year, string month)
|
||||
public async Task OnGet(string year, string month)
|
||||
{
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
var allReports = await _reportApplication.GetAllReports(year, month);
|
||||
@@ -73,19 +76,23 @@ public class IndexModel : PageModel
|
||||
ContrcatDone = allReports.ContrcatDone;
|
||||
ContractSignNotDone = allReports.ContractSignNotDone;
|
||||
ContractSignDone = allReports.ContractSignDone;
|
||||
AllCheckout = allReports.AllCheckout;
|
||||
ContractSignToBe = allReports.ContractSignToBe;
|
||||
|
||||
AllCheckout = allReports.AllCheckout;
|
||||
CheckoutNotDone = allReports.CheckoutNotDone;
|
||||
CheckoutDone = allReports.CheckoutDone;
|
||||
CheckoutSignNotDone = allReports.CheckoutSignNotDone;
|
||||
CheckoutSignDone = allReports.CheckoutSignDone;
|
||||
|
||||
CheckoutSignToBe = allReports.CheckoutSignToBe;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region workshopFirstLoad
|
||||
|
||||
public IActionResult OnGetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -96,7 +103,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -107,7 +114,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -118,7 +125,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -133,7 +140,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetEmployeeContract(string year, string month, long workshopId)
|
||||
{
|
||||
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -143,7 +150,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetEmployeeContractSign(string year, string month, long workshopId)
|
||||
{
|
||||
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -153,7 +160,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetEmployeeCheckout(string year, string month, long workshopId)
|
||||
{
|
||||
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -163,7 +170,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public IActionResult OnGetEmployeeCheckoutSign(string year, string month, long workshopId, long accountId)
|
||||
{
|
||||
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -180,14 +187,14 @@ public class IndexModel : PageModel
|
||||
{
|
||||
|
||||
var workshopIds = Tools.ExtractNumbers(workshopList);
|
||||
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds);
|
||||
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
|
||||
return Partial("PrintAll", res);
|
||||
}
|
||||
|
||||
public IActionResult OnGetPrintAllContractSignDone(string year, string month, long accountId, string workshopList)
|
||||
{
|
||||
var workshopIds = Tools.ExtractNumbers(workshopList);
|
||||
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds);
|
||||
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
|
||||
return Partial("PrintAll", res);
|
||||
}
|
||||
|
||||
@@ -195,14 +202,14 @@ public class IndexModel : PageModel
|
||||
{
|
||||
var workshopIds = Tools.ExtractNumbers(workshopList);
|
||||
|
||||
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds);
|
||||
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
|
||||
return Partial("PrintAll", res);
|
||||
}
|
||||
|
||||
public IActionResult OnGetPrintAllCheckoutSignDone(string year, string month, long accountId, string workshopList)
|
||||
{
|
||||
var workshopIds = Tools.ExtractNumbers(workshopList);
|
||||
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds);
|
||||
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
|
||||
return Partial("PrintAll", res);
|
||||
}
|
||||
//================Employee
|
||||
@@ -211,7 +218,7 @@ public class IndexModel : PageModel
|
||||
public IActionResult OnGetPrintEmployeeContract(string year, string month, long workshopId, string accountFullName)
|
||||
{
|
||||
var workshop = _workshopApplication.GetDetails(workshopId);
|
||||
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
|
||||
var next = $"{year}/{month}/01";
|
||||
var y = Convert.ToInt32(year);
|
||||
var m = Convert.ToInt32(month);
|
||||
@@ -235,7 +242,7 @@ public class IndexModel : PageModel
|
||||
string accountFullName)
|
||||
{
|
||||
var workshop = _workshopApplication.GetDetails(workshopId);
|
||||
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
|
||||
var next = $"{year}/{month}/01";
|
||||
var y = Convert.ToInt32(year);
|
||||
var m = Convert.ToInt32(month);
|
||||
@@ -258,7 +265,7 @@ public class IndexModel : PageModel
|
||||
public IActionResult OnGetPrintEmployeeCheckout(string year, string month, long workshopId, string accountFullName)
|
||||
{
|
||||
var workshop = _workshopApplication.GetDetails(workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
|
||||
|
||||
var final = new PrintEmployeeNotDone
|
||||
{
|
||||
@@ -277,7 +284,7 @@ public class IndexModel : PageModel
|
||||
string accountFullName)
|
||||
{
|
||||
var workshop = _workshopApplication.GetDetails(workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
|
||||
|
||||
var final = new PrintEmployeeNotDone
|
||||
{
|
||||
|
||||
@@ -18,9 +18,14 @@ using System.Text.Json.Serialization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Parbad;
|
||||
using Parbad.AspNetCore;
|
||||
using Parbad.Gateway.Sepehr;
|
||||
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
@@ -34,6 +39,9 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
private readonly AccountContext _accountContext;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IOnlinePayment _onlinePayment;
|
||||
|
||||
|
||||
|
||||
[BindProperty] public IFormFile File { get; set; }
|
||||
@@ -41,14 +49,16 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
|
||||
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
|
||||
IOptions<AppSettingConfiguration> appSetting,
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication)
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
_onlinePayment = onlinePayment;
|
||||
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
@@ -63,7 +73,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
}
|
||||
|
||||
|
||||
public IActionResult OnPostShiftDate()
|
||||
public async Task<IActionResult> OnPostShiftDate()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 2, 19);
|
||||
//var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
|
||||
@@ -73,10 +83,116 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
//CreateRewardForKebabMahdi().GetAwaiter().GetResult();
|
||||
SetEntityIdForCheckoutValues();
|
||||
SetEntityIdForCheckoutValuesTemp();
|
||||
ViewData["message"] = "ایجاد شد";
|
||||
return Page();
|
||||
|
||||
var callBack = Url.Action("Verify", "General", null, Request.Scheme);
|
||||
|
||||
|
||||
var amount = 10000;
|
||||
var transaction = new PaymentTransaction(30427, amount, "سید حسن مصباح", "https://client.gozareshgir.ir", PaymentTransactionGateWay.SepehrPay);
|
||||
|
||||
_context.PaymentTransactions.Add(transaction);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var command = new CreatePaymentGatewayRequest()
|
||||
{
|
||||
InvoiceId = transaction.id.ToString(),
|
||||
Amount = amount,
|
||||
CallBackUrl = callBack
|
||||
};
|
||||
|
||||
var createRes = await _paymentGateway.Create(command);
|
||||
|
||||
if (createRes.IsSuccess)
|
||||
{
|
||||
var payUrl = _paymentGateway.GetStartPayUrl(createRes.Token);
|
||||
return Redirect(payUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest(createRes.Status + "خطا در ارسال به درگاه پرداخت");
|
||||
}
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task CreateDadmehrWorkshopFaceEmbedding()
|
||||
{
|
||||
var basePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "faces");
|
||||
|
||||
if (!Directory.Exists(basePath))
|
||||
{
|
||||
ViewData["message"] = "مسیر پوشه یافت نشد";
|
||||
return;
|
||||
}
|
||||
|
||||
var directories = Directory.GetDirectories(basePath);
|
||||
|
||||
var client = new HttpClient();
|
||||
|
||||
foreach (var mainDirectory in directories)
|
||||
{
|
||||
var subDirectories = Directory.GetDirectories(mainDirectory);
|
||||
var workshopName = Path.GetFileName(mainDirectory);
|
||||
foreach (var directory in subDirectories)
|
||||
{
|
||||
var directoryName = Path.GetFileName(directory);
|
||||
|
||||
var employee = await _context.Employees
|
||||
.FirstOrDefaultAsync(x => x.id == Convert.ToInt64(directoryName));
|
||||
var fullname = employee != null ? employee.FullName : "نامشخص";
|
||||
|
||||
var imageFiles = Directory.GetFiles(directory, "*.*")
|
||||
.Take(2)
|
||||
.ToArray();
|
||||
|
||||
if (imageFiles.Length < 2)
|
||||
{
|
||||
Console.WriteLine($"تعداد تصاویر کافی برای {directoryName} وجود ندارد");
|
||||
continue;
|
||||
}
|
||||
|
||||
using var formData = new MultipartFormDataContent();
|
||||
formData.Add(new StringContent(directoryName), "employee_id");
|
||||
formData.Add(new StringContent(workshopName), "workshop_id");
|
||||
formData.Add(new StringContent(fullname), "employee_full_name");
|
||||
|
||||
FileStream file1Stream = null;
|
||||
FileStream file2Stream = null;
|
||||
|
||||
try
|
||||
{
|
||||
// ارسال فایل اول
|
||||
file1Stream = new FileStream(imageFiles[0], FileMode.Open, FileAccess.Read);
|
||||
var file1Content = new StreamContent(file1Stream);
|
||||
file1Content.Headers.ContentType =
|
||||
new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg");
|
||||
formData.Add(file1Content, "picture1", Path.GetFileName(imageFiles[0]));
|
||||
|
||||
// ارسال فایل دوم
|
||||
file2Stream = new FileStream(imageFiles[1], FileMode.Open, FileAccess.Read);
|
||||
var file2Content = new StreamContent(file2Stream);
|
||||
file2Content.Headers.ContentType =
|
||||
new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg");
|
||||
formData.Add(file2Content, "picture2", Path.GetFileName(imageFiles[1]));
|
||||
|
||||
var response = await client.PostAsync("http://127.0.0.1:8000/embeddings", formData);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine($"✓ {directoryName}: {result}");
|
||||
}
|
||||
else
|
||||
{
|
||||
var error = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine($"✗ {directoryName}: {response.StatusCode} - {error}");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
file1Stream?.Dispose();
|
||||
file2Stream?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult OnPostShiftDateNew()
|
||||
@@ -128,7 +244,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
|
||||
if (createResponse.Status == "success")
|
||||
{
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.TransactionId));
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.Token));
|
||||
}
|
||||
|
||||
//TranslateCode(result?.ErrorCode);
|
||||
@@ -695,7 +811,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
//TODO: set data for institution price
|
||||
var workshops = item.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).ToList()
|
||||
.DistinctBy(x=>x.id).ToList();
|
||||
.DistinctBy(x => x.id).ToList();
|
||||
|
||||
var initialWorkshop = workshops
|
||||
.Select(w =>
|
||||
@@ -750,56 +866,56 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
|
||||
//var oneMonthSum = current.Sum(x => x.Price);
|
||||
item.contract.SetWorkshopGroup(group);
|
||||
// var totalPaymentAndWorkshopList = await _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(oneMonthSum,duration: InstitutionContractDuration.TwelveMonths,false);
|
||||
// item.contract.SetAmount(totalPaymentAndWorkshopList.OneTimeTotalPaymentStr.MoneyToDouble(),
|
||||
// totalPaymentAndWorkshopList.OneTimeValueAddedTaxStr.MoneyToDouble(),totalPaymentAndWorkshopList.DiscountedAmountForOneMonth.MoneyToDouble());
|
||||
// var totalPaymentAndWorkshopList = await _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(oneMonthSum,duration: InstitutionContractDuration.TwelveMonths,false);
|
||||
// item.contract.SetAmount(totalPaymentAndWorkshopList.OneTimeTotalPaymentStr.MoneyToDouble(),
|
||||
// totalPaymentAndWorkshopList.OneTimeValueAddedTaxStr.MoneyToDouble(),totalPaymentAndWorkshopList.DiscountedAmountForOneMonth.MoneyToDouble());
|
||||
}
|
||||
|
||||
var remoteIds = remoteContractsQuery.Select(x => x.contract.id);
|
||||
var inPersonContracts =await query
|
||||
.Where(x=>!remoteIds.Contains(x.contractingParty.id)).ToListAsync();
|
||||
var inPersonContracts = await query
|
||||
.Where(x => !remoteIds.Contains(x.contractingParty.id)).ToListAsync();
|
||||
foreach (var item in inPersonContracts)
|
||||
{
|
||||
var workshops = item.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).ToList()
|
||||
.DistinctBy(x=>x.id).ToList();
|
||||
.DistinctBy(x => x.id).ToList();
|
||||
|
||||
var initialWorkshop = workshops
|
||||
.Select(w =>
|
||||
{
|
||||
var personnelCount =
|
||||
w.LeftWorks.Count(lw => lw.StartWorkDate <= today && lw.LeftWorkDate >= today);
|
||||
|
||||
|
||||
bool hasRollCallPlan = true;
|
||||
bool hasRollCallPlanInPerson = false;
|
||||
bool hasCustomizeCheckoutPlan = w.id == 170;
|
||||
bool hasContractPlan = true;
|
||||
bool hasContractPlanInPerson = true;
|
||||
bool hasInsurancePlan =true;
|
||||
bool hasInsurancePlan = true;
|
||||
bool hasInsurancePlanInPerson = true;
|
||||
|
||||
var initial = InstitutionContractWorkshopInitial.CreateManual(w.WorkshopFullName, hasRollCallPlan,
|
||||
hasRollCallPlanInPerson,hasCustomizeCheckoutPlan,
|
||||
hasContractPlan,hasContractPlanInPerson,
|
||||
hasInsurancePlan,hasInsurancePlanInPerson,personnelCount,0,
|
||||
|
||||
var initial = InstitutionContractWorkshopInitial.CreateManual(w.WorkshopFullName,
|
||||
hasRollCallPlan,
|
||||
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan,
|
||||
hasContractPlan, hasContractPlanInPerson,
|
||||
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, 0,
|
||||
w.id, w.WorkshopEmployers.Select(x => x.EmployerId
|
||||
).ToList());
|
||||
return initial;
|
||||
}).ToList();
|
||||
|
||||
var group = new InstitutionContractWorkshopGroup(item.contract.id, initialWorkshop);
|
||||
|
||||
|
||||
await _context.AddAsync(group);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
||||
initialWorkshop.ForEach(x =>
|
||||
{
|
||||
var workshopId = workshops.First(w => x.WorkshopId.Value == w.id).id;
|
||||
x.SetWorkshopId(workshopId);
|
||||
});
|
||||
|
||||
|
||||
item.contract.SetWorkshopGroup(group);
|
||||
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
305
ServiceHost/Areas/Camera/Controllers/CameraController.cs
Normal file
305
ServiceHost/Areas/Camera/Controllers/CameraController.cs
Normal file
@@ -0,0 +1,305 @@
|
||||
using ServiceHost.BaseControllers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Exceptions;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using AccountManagement.Application.Contracts.CameraAccount;
|
||||
using AccountManagement.Domain.TaskAgg;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.RollCallService;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace ServiceHost.Areas.Camera.Controllers;
|
||||
|
||||
public class CameraController : CameraBaseController
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly IRollCallApplication _rollCallApplication;
|
||||
private readonly IRollCallServiceApplication _rollCallServiceApplication;
|
||||
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IPersonnelCodeApplication _personnelCodeApplication;
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly ICameraAccountApplication _cameraAccountApplication;
|
||||
private readonly IEmployeeFaceEmbeddingApplication _employeeFaceEmbeddingApplication;
|
||||
private long _workshopId;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly HttpClient _faceEmbeddingHttpClient;
|
||||
|
||||
public CameraController(IWebHostEnvironment webHostEnvironment,
|
||||
IConfiguration configuration,
|
||||
IEmployeeApplication employeeApplication,
|
||||
IRollCallApplication rollCallApplication,
|
||||
IAuthHelper authHelper,
|
||||
IRollCallServiceApplication rollCallServiceApplication,
|
||||
IRollCallEmployeeApplication rollCallEmployeeApplication,
|
||||
IPersonnelCodeApplication personnelCodeApplication,
|
||||
IAccountApplication accountApplication,
|
||||
IPasswordHasher passwordHasher,
|
||||
ICameraAccountApplication cameraAccountApplication,
|
||||
IEmployeeFaceEmbeddingApplication employeeFaceEmbeddingApplication, IHttpClientFactory httpClientFactory)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_configuration = configuration;
|
||||
_employeeApplication = employeeApplication;
|
||||
_rollCallApplication = rollCallApplication;
|
||||
_authHelper = authHelper;
|
||||
_rollCallServiceApplication = rollCallServiceApplication;
|
||||
_rollCallEmployeeApplication = rollCallEmployeeApplication;
|
||||
_personnelCodeApplication = personnelCodeApplication;
|
||||
_accountApplication = accountApplication;
|
||||
_passwordHasher = passwordHasher;
|
||||
_cameraAccountApplication = cameraAccountApplication;
|
||||
_employeeFaceEmbeddingApplication = employeeFaceEmbeddingApplication;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_faceEmbeddingHttpClient = httpClientFactory.CreateClient();
|
||||
_faceEmbeddingHttpClient.BaseAddress = new Uri("http://localhost:8000/");
|
||||
_workshopId= authHelper.GetWorkshopId();
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("login")]
|
||||
[AllowAnonymous]
|
||||
public IActionResult CameraLogin([FromBody] CameraLoginRequest request)
|
||||
{
|
||||
_accountApplication.CameraLogin(request);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("embedding")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<List<EmployeeFaceEmbeddingDto>>> WorkshopEmbedding()
|
||||
{
|
||||
if (!User.Identity?.IsAuthenticated ?? false)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
_workshopId = _authHelper.GetWorkshopId();
|
||||
var data = await _employeeFaceEmbeddingApplication
|
||||
.GetByWorkshopIdsAsync([_workshopId]);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[HttpPost("flag/{employeeId:long}")]
|
||||
public async Task<IActionResult> GetFlag(long employeeId)
|
||||
{
|
||||
var flagId = _rollCallApplication.Flag(employeeId, _workshopId);
|
||||
return Ok(new
|
||||
{
|
||||
flagId = flagId,
|
||||
status = flagId == 0 ? "enter": "exit"
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("exit")]
|
||||
public IActionResult Exit([FromBody]RollCallExitRequest request)
|
||||
{
|
||||
var employeeId = request.EmployeeId;
|
||||
var flagId = request.FlagId;
|
||||
bool rollCallEmployee = _rollCallEmployeeApplication.IsEmployeeRollCallActive(employeeId,
|
||||
_workshopId);
|
||||
|
||||
if (!rollCallEmployee)
|
||||
{
|
||||
throw new BadRequestException("پرسنل مورد نظر غیر فعال است");
|
||||
}
|
||||
|
||||
_faceEmbeddingHttpClient.PostAsync("embeddings/refine",
|
||||
JsonContent.Create(new {
|
||||
employeeId,
|
||||
workshopId = _workshopId,
|
||||
embedding =request.Embeddings ,
|
||||
confidence =request.Confidence ,
|
||||
metadata =new{},
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
||||
var repeatStatus = _rollCallApplication.CheckRepeat(employeeId, _workshopId);
|
||||
switch (repeatStatus)
|
||||
{
|
||||
case "IncomRegistred-InvalidOut":
|
||||
throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید");
|
||||
|
||||
case "outRegistred-InvalidIncom":
|
||||
throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید");
|
||||
|
||||
}
|
||||
|
||||
var res = _rollCallApplication.Edit(flagId);
|
||||
|
||||
if (res.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = true,
|
||||
});
|
||||
}
|
||||
|
||||
throw new BadRequestException(res.Message);
|
||||
}
|
||||
|
||||
[HttpPost("enter")]
|
||||
public IActionResult Enter([FromBody]RollCallEnterRequest request)
|
||||
{
|
||||
var employeeId = request.EmployeeId;
|
||||
var now = DateTime.Now;
|
||||
var command = new CreateRollCall()
|
||||
{
|
||||
WorkshopId = _workshopId,
|
||||
EmployeeId = request.EmployeeId,
|
||||
StartDate = now,
|
||||
};
|
||||
bool rollCallEmployee = _rollCallEmployeeApplication.IsEmployeeRollCallActive(employeeId,
|
||||
_workshopId);
|
||||
|
||||
if (!rollCallEmployee)
|
||||
{
|
||||
throw new BadRequestException("پرسنل مورد نظر غیر فعال است");
|
||||
}
|
||||
|
||||
_faceEmbeddingHttpClient.PostAsync("embeddings/refine",
|
||||
JsonContent.Create(new {
|
||||
employeeId,
|
||||
workshopId = _workshopId,
|
||||
embedding =request.Embeddings ,
|
||||
confidence =request.Confidence ,
|
||||
metadata =new{},
|
||||
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
||||
var repeatStatus = _rollCallApplication.CheckRepeat(employeeId, _workshopId);
|
||||
switch (repeatStatus)
|
||||
{
|
||||
case "IncomRegistred-InvalidOut":
|
||||
throw new BadRequestException("شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید");
|
||||
|
||||
case "outRegistred-InvalidIncom":
|
||||
throw new BadRequestException("شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید");
|
||||
|
||||
}
|
||||
|
||||
|
||||
var res = _rollCallApplication.Create(command);
|
||||
if (res.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = true,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("SendPersonelCodeToGetEmployeeId")]
|
||||
public IActionResult SendPersonelCodeToGetEmployeeId(long personelCode, long workshopId)
|
||||
{
|
||||
long employeeId = _personnelCodeApplication.GetEmployeeIdByPersonelCode(personelCode, workshopId);
|
||||
|
||||
if (employeeId == 0)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = false,
|
||||
message = "کد پرسنلی یافت نشد",
|
||||
});
|
||||
}
|
||||
|
||||
bool rollcallEmployee = _rollCallEmployeeApplication.IsEmployeeRollCallActive(employeeId, workshopId);
|
||||
if (!rollcallEmployee)
|
||||
{
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = false,
|
||||
message = "پرسنل مورد نظر غیر فعال است",
|
||||
});
|
||||
}
|
||||
|
||||
var repeatStatus = _rollCallApplication.CheckRepeat(employeeId, workshopId);
|
||||
switch (repeatStatus)
|
||||
{
|
||||
case "IncomRegistred-InvalidOut":
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = false,
|
||||
message = "شما به تازگی ثبت ورود نموده اید ,تا 2 دقیقه نمی توانید ثبت خروج نمایید",
|
||||
});
|
||||
case "outRegistred-InvalidIncom":
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = false,
|
||||
message = "شما به تازگی ثبت خروج نموده اید تا 2 دقیقه نمی توانید ثبت ورود نمایید",
|
||||
});
|
||||
}
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
isSuccess = true,
|
||||
message = "",
|
||||
personId = $"{employeeId}",
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("EmployeeFlag")]
|
||||
public IActionResult EmployeeFlag(long employeeId, long workshopId)
|
||||
{
|
||||
var employee = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
var employeeFullName = employee?.EmployeeFullName ?? string.Empty;
|
||||
var flagId = _rollCallApplication.Flag(employeeId, workshopId);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
employeeName = employeeFullName,
|
||||
flag = flagId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("Logout")]
|
||||
public IActionResult Logout()
|
||||
{
|
||||
_accountApplication.Logout();
|
||||
return new JsonResult(new { isSuccess = true });
|
||||
}
|
||||
}
|
||||
|
||||
public class RollCallExitRequest:RollCallEnterRequest
|
||||
{
|
||||
public long FlagId { get; set; }
|
||||
}
|
||||
public class RollCallEnterRequest
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public List<double> Embeddings { get; set; }
|
||||
public float Confidence { get; set; }
|
||||
}
|
||||
|
||||
public class CameraFlagRequest
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
}
|
||||
@@ -93,8 +93,8 @@ public class FinancialController : ClientBaseController
|
||||
|
||||
if (gatewayResponse.IsSuccess)
|
||||
{
|
||||
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
|
||||
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.Token);
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.Token));
|
||||
}
|
||||
|
||||
if (gatewayResponse.ErrorCode.HasValue)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace ServiceHost.BaseControllers;
|
||||
|
||||
|
||||
//[ApiExplorerSettings(GroupName = "Camera")]
|
||||
[ApiExplorerSettings(GroupName = "Camera")]
|
||||
[Authorize(Policy = "CameraArea")]
|
||||
[Area("Camera")]
|
||||
[Route("api/[area]/[controller]")]
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.BankAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
using System.Globalization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Microsoft.Extensions.Options;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using Newtonsoft.Json;
|
||||
using NuGet.Protocol;
|
||||
using Parbad;
|
||||
using ServiceHost.BaseControllers;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
|
||||
namespace ServiceHost.Controllers;
|
||||
|
||||
@@ -18,12 +28,14 @@ public class GeneralController : GeneralBaseController
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IFinancialStatmentApplication _financialStatmentApplication;
|
||||
private readonly IOnlinePayment _onlinePayment;
|
||||
|
||||
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting)
|
||||
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting, IOnlinePayment onlinePayment)
|
||||
{
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
|
||||
_paymentGateway = new SepehrPaymentGateway(clientFactory);
|
||||
_financialStatmentApplication = financialStatmentApplication;
|
||||
_onlinePayment = onlinePayment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,7 +59,103 @@ public class GeneralController : GeneralBaseController
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("/api/callback")]
|
||||
|
||||
[HttpGet("/api/callback"), HttpPost("/api/callback")]
|
||||
public async Task<IActionResult> Verify(SepehrGatewayPayResponse payResponse)
|
||||
{
|
||||
if (!long.TryParse(payResponse.invoiceid, out var paymentTransactionId))
|
||||
{
|
||||
return BadRequest("Invalid invoice_id");
|
||||
}
|
||||
|
||||
var transaction = await _paymentTransactionApplication.GetDetails(paymentTransactionId);
|
||||
|
||||
if (transaction == null)
|
||||
{
|
||||
return NotFound("Transaction not found");
|
||||
}
|
||||
|
||||
if (transaction.Status != PaymentTransactionStatus.Pending)
|
||||
{
|
||||
return BadRequest("این تراکنش قبلا پرداخت شده است");
|
||||
}
|
||||
|
||||
|
||||
if (payResponse.respcode != 0)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction);
|
||||
}
|
||||
|
||||
var verifyCommand = new VerifyPaymentGateWayRequest()
|
||||
{
|
||||
Amount = transaction.Amount,
|
||||
TransactionId = payResponse.invoiceid,
|
||||
DigitalReceipt = payResponse.digitalreceipt
|
||||
};
|
||||
var verifyRes = await _paymentGateway.Verify(verifyCommand, CancellationToken.None);
|
||||
|
||||
|
||||
|
||||
|
||||
if (verifyRes.IsSuccess)
|
||||
{
|
||||
var command = new CreateFinancialStatment()
|
||||
{
|
||||
ContractingPartyId = transaction.ContractingPartyId,
|
||||
Deptor = 0,
|
||||
Creditor = transaction.Amount,
|
||||
DeptorString = "0",
|
||||
TypeOfTransaction = "credit",
|
||||
DescriptionOption = "بابت قرارداد مابین (روابط کار)",
|
||||
Description = "درگاه بانکی",
|
||||
|
||||
};
|
||||
var statementResult = _financialStatmentApplication.CreateFromBankGateway(command);
|
||||
if (!statementResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(statementResult);
|
||||
}
|
||||
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, payResponse.cardnumber, payResponse.issuerbank, payResponse.rrn.ToString(), payResponse.digitalreceipt);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction);
|
||||
}
|
||||
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, true, transaction.Id));
|
||||
}
|
||||
|
||||
// در غیر این صورت تراکنش ناموفق است
|
||||
return await HandleFailedTransaction(transaction);
|
||||
|
||||
|
||||
//var data = JsonConvert.SerializeObject(invoice.AdditionalData);
|
||||
//var statics =
|
||||
//JsonConvert.SerializeObject(res);
|
||||
|
||||
//await _onlinePayment.CancelAsync(invoice);
|
||||
//return new JsonResult(new
|
||||
//{
|
||||
// data,
|
||||
// statics
|
||||
//});
|
||||
|
||||
//// Check if the invoice is new, or it's already processed before.
|
||||
//if (invoice.Status != PaymentFetchResultStatus.ReadyForVerifying)
|
||||
//{
|
||||
// // You can also see if the invoice is already verified before.
|
||||
// var isAlreadyVerified = invoice.IsAlreadyVerified;
|
||||
|
||||
// return Content("The payment was not successful.");
|
||||
//}
|
||||
|
||||
//// Note: Save the verifyResult.TransactionCode in your database.
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("/api/callback3232")]
|
||||
public async Task<IActionResult> OnGetCallBack(string? transid, string? cardnumber, string? tracking_number,
|
||||
string bank, string invoice_id, string? status,CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -70,7 +178,7 @@ public class GeneralController : GeneralBaseController
|
||||
// اگر شماره کارت یا شماره پیگیری خالی باشد، تراکنش ناموفق است
|
||||
if (string.IsNullOrWhiteSpace(cardnumber) || string.IsNullOrWhiteSpace(tracking_number))
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
return await HandleFailedTransaction(transaction);
|
||||
}
|
||||
|
||||
var verifyCommand = new VerifyPaymentGateWayRequest()
|
||||
@@ -97,10 +205,10 @@ public class GeneralController : GeneralBaseController
|
||||
var statementResult = _financialStatmentApplication.CreateFromBankGateway(command);
|
||||
if (!statementResult.IsSuccedded)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
return await HandleFailedTransaction(transaction);
|
||||
}
|
||||
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank,null,null);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
@@ -110,12 +218,12 @@ public class GeneralController : GeneralBaseController
|
||||
}
|
||||
|
||||
// در غیر این صورت تراکنش ناموفق است
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
return await HandleFailedTransaction(transaction);
|
||||
}
|
||||
|
||||
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction, long transactionId)
|
||||
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction)
|
||||
{
|
||||
var result = _paymentTransactionApplication.SetFailed(transactionId);
|
||||
var result = _paymentTransactionApplication.SetFailed(transaction.Id);
|
||||
if (!result.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(result);
|
||||
@@ -131,4 +239,81 @@ public class GeneralController : GeneralBaseController
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class TokenReq
|
||||
{
|
||||
|
||||
public long Amount { get; set; }
|
||||
|
||||
public string CallbackUrl { get; set; }
|
||||
[Display(Name = "شماره فاکتور")]
|
||||
[MaxLength(100)]
|
||||
[Required]
|
||||
[Key]
|
||||
// be ezaye har pazirande bayad yekta bashad
|
||||
public string invoiceID { get; set; }
|
||||
[Required]
|
||||
public long terminalID { get; set; }
|
||||
/*
|
||||
* JSON Bashad
|
||||
* etelaate takmili site harchi
|
||||
* nabayad char khas dashte bashe (*'"xp_%!+- ...)
|
||||
*/
|
||||
public string Payload { get; set; } = "";
|
||||
public string email { get; set; }
|
||||
}
|
||||
public class TokenResp
|
||||
{
|
||||
// if 0 = success
|
||||
public int Status { get; set; }
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
public class PayRequest
|
||||
{
|
||||
[Required]
|
||||
[MaxLength(3000)]
|
||||
public string token { get; set; }
|
||||
[Required]
|
||||
public long terminalID { get; set; }
|
||||
public string nationalCode { get; set; }
|
||||
|
||||
}
|
||||
public class SepehrGatewayPayResponse
|
||||
{
|
||||
/* 0 yni movafaq
|
||||
* -1 yni enseraf
|
||||
* -2 yni etmam zaman
|
||||
*/
|
||||
public int respcode { get; set; }
|
||||
[Display(Name = "متن نتیجه تراکنش")]
|
||||
public string respmsg { get; set; }
|
||||
[Display(Name = "مبلغ کسر شده از مشتری")]
|
||||
public long amount { get; set; }
|
||||
[Display(Name = " شماره فاکتور ")]
|
||||
public string invoiceid { get; set; }
|
||||
[Display(Name = " اطلاعاتی که پذیرنده ارسال کرد ")]
|
||||
public string payload { get; set; }
|
||||
[Display(Name = " شماره ترمینال ")]
|
||||
public long terminalid { get; set; }
|
||||
[Display(Name = " شماره پیگیری ")]
|
||||
public long tracenumber { get; set; }
|
||||
// bayad negah dari she hatman to db
|
||||
[Display(Name = " شماره سند بانکی ")]
|
||||
public long rrn { get; set; }
|
||||
[Display(Name = " زمان و تاریخ پرداخت ")]
|
||||
public string datepaid { get; set; }
|
||||
[Display(Name = " رسید دیجیتال ")]
|
||||
public string digitalreceipt { get; set; }
|
||||
[Display(Name = " نام بانک صادر کننده کارت ")]
|
||||
public string issuerbank { get; set; }
|
||||
[Display(Name = " شماره کارت ")]
|
||||
public string cardnumber { get; set; }
|
||||
}
|
||||
|
||||
public class AdviceReq
|
||||
{
|
||||
[Display(Name = " رسید دیجیتال ")]
|
||||
public string digitalreceipt { get; set; }
|
||||
public long Tid { get; set; }
|
||||
}
|
||||
@@ -24,12 +24,15 @@ using ServiceHost.Test;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using _0_Framework.InfraStructure.Mongo;
|
||||
using Bogus;
|
||||
using CompanyManagment.EFCore.Services;
|
||||
using Microsoft.AspNetCore.CookiePolicy;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using MongoDB.Driver;
|
||||
using Parbad.Builder;
|
||||
using Parbad.Gateway.Sepehr;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
|
||||
|
||||
@@ -306,11 +309,29 @@ builder.Services.AddCors(options =>
|
||||
|
||||
builder.Services.AddExceptionHandler<CustomExceptionHandler>();
|
||||
|
||||
var sepehrTerminalId = builder.Configuration.GetValue<long>("SepehrGateWayTerminalId");
|
||||
|
||||
builder.Services.AddParbad().ConfigureGateways(gateways =>
|
||||
{
|
||||
gateways.AddSepehr().WithAccounts(accounts =>
|
||||
{
|
||||
accounts.AddInMemory(account =>
|
||||
{
|
||||
account.TerminalId = sepehrTerminalId;
|
||||
account.Name="Sepehr Account";
|
||||
});
|
||||
});
|
||||
}).ConfigureHttpContext(httpContext=>httpContext.UseDefaultAspNetCore())
|
||||
.ConfigureStorage(storage =>
|
||||
{
|
||||
storage.UseMemoryCache();
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
app.UseCors("AllowSpecificOrigins");
|
||||
|
||||
|
||||
|
||||
#region Mahan
|
||||
|
||||
//app.UseStatusCodePagesWithRedirects("/error/{0}");
|
||||
@@ -324,6 +345,7 @@ if (builder.Environment.IsDevelopment())
|
||||
await tester.Test();
|
||||
}
|
||||
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.5.0" />
|
||||
<PackageReference Include="Parbad.AspNetCore" Version="1.5.0" />
|
||||
<PackageReference Include="Parbad.Storage.Cache" Version="1.5.0" />
|
||||
<PackageReference Include="SocialExplorer.FastDBF" Version="1.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="8.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />
|
||||
|
||||
@@ -38,7 +38,12 @@
|
||||
"MongoDb": {
|
||||
"ConnectionString": "mongodb://localhost:27017",
|
||||
"DatabaseName": "Gozareshgir"
|
||||
}
|
||||
},
|
||||
"SmsSettings": {
|
||||
"IsTestMode": true,
|
||||
"TestNumbers": [ "09116967898", "09116067106", "09114221321" ]
|
||||
},
|
||||
"SepehrGateWayTerminalId": 99213700
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,5 +31,11 @@
|
||||
"MongoDb": {
|
||||
"ConnectionString": "mongodb://localhost:27017",
|
||||
"DatabaseName": "Gozareshgir"
|
||||
}
|
||||
},
|
||||
"SmsSettings": {
|
||||
"IsTestMode": false,
|
||||
"TestNumbers": []
|
||||
},
|
||||
"SepehrGateWayTerminalId": 99213700
|
||||
|
||||
}
|
||||
|
||||
@@ -254,14 +254,14 @@ function loadEmployeeAjax(groupSettingId) {
|
||||
<input type="text" class="form-control" id="searchEmployee" placeholder="جستجو ..." />
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
console.log(responseDataEmployee);
|
||||
responseDataEmployee.forEach(function (itemEmployee) {
|
||||
if (itemEmployee.isShiftChanged === true) {
|
||||
isShiftChangedGlobal = true;
|
||||
}
|
||||
|
||||
htmlEmployee += `<div></div>
|
||||
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" data-employee-id="${itemEmployee.employeeId}">
|
||||
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee ${itemEmployee.hasLeft?'disable':''}" data-employee-id="${itemEmployee.employeeId}">
|
||||
<div class="Rtable-cell width1 widthMobile1">
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="d-flex justify-content-center row-index2">
|
||||
|
||||
404520
ServiceHost/wwwroot/embeddings.json
Normal file
404520
ServiceHost/wwwroot/embeddings.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user