Compare commits

..

1 Commits

51 changed files with 1055 additions and 429627 deletions

View File

@@ -29,11 +29,9 @@ public class PaymentGatewayResponse
public int? ErrorCode { get; set; }
[JsonPropertyName("transid")]
public string Token { get; set; }
public string TransactionId { get; set; }
public bool IsSuccess { get; set; }
public string Message { get; set; }
public bool IsSuccess => Status == "success";
}
public class WalletAmountResponse
@@ -55,12 +53,10 @@ 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 DigitalReceipt { get; set; }
public string TransactionId { get; set; }
public string TransactionId { get; set; }
public double Amount { get; set; }
}

View File

@@ -1,97 +0,0 @@
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();
}
}

View File

@@ -27,7 +27,7 @@ public interface ISmsService
Task<double> GetCreditAmount();
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId);

View File

@@ -66,11 +66,4 @@ 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; }
}

View File

@@ -18,7 +18,6 @@ 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;
@@ -804,29 +803,4 @@ 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);
}
}

View File

@@ -1,189 +0,0 @@
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; }
}

View File

@@ -1,15 +0,0 @@
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);
}

View File

@@ -18,15 +18,13 @@ public class PaymentTransaction:EntityBase
/// <param name="callBackUrl"></param>
public PaymentTransaction(long contractingPartyId,
double amount,
string contractingPartyName,string callBackUrl,
PaymentTransactionGateWay gateway)
string contractingPartyName,string callBackUrl)
{
ContractingPartyId = contractingPartyId;
Status = PaymentTransactionStatus.Pending;
Amount = amount;
ContractingPartyName = contractingPartyName;
CallBackUrl = callBackUrl;
Gateway = gateway;
}
/// <summary>
@@ -70,20 +68,13 @@ 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,string rrn,string digitalReceipt)
public void SetPaid(string cardNumber,string bankName)
{
Status = PaymentTransactionStatus.Success;
TransactionDate = DateTime.Now;
CardNumber = cardNumber;
BankName = bankName;
Rrn = rrn;
DigitalReceipt = digitalReceipt;
}
public void SetFailed()
{
@@ -94,5 +85,4 @@ public class PaymentTransaction:EntityBase
{
TransactionId = transactionId;
}
}
}

View File

@@ -11,23 +11,21 @@ namespace Company.Domain.ReportAgg
{
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
AllReport GetAllActiveWorkshops(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
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,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);

View File

@@ -1,60 +0,0 @@
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);
}
}

View File

@@ -25,5 +25,4 @@ 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; }
}

View File

@@ -1,14 +0,0 @@
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; }
}

View File

@@ -1,49 +0,0 @@
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; }
}

View File

@@ -1,43 +0,0 @@
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);
}

View File

@@ -88,9 +88,20 @@ public class GetInstitutionContractListItemsViewModel
public List<InstitutionContractListWorkshop> Workshops { get; set; }
/// <summary>
/// قرارداد ها با خدمات حضوری قرارداد
/// </summary>
public bool IsInPersonContract { get; set; }
/// <summary>
/// قرارداد های قدیمی
/// </summary>
public bool IsOldContract { get; set; }
/// <summary>
/// قرارداد هایی که برای آینده تنظیم شده اند
/// </summary>
public bool IsFutureContract { get; set; }
}
public class InstitutionContractListWorkshop

View File

@@ -17,14 +17,4 @@ public class CreatePaymentTransaction
/// مسیر برگشت پس از پرداخت
/// </summary>
public string CallBackUrl { get; set; }
/// <summary>
/// نوع درگاه
/// </summary>
public PaymentTransactionGateWay Gateway { get; set; }
}
public enum PaymentTransactionGateWay
{
AqayePardakht = 1,
SepehrPay = 2
}

View File

@@ -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, string rrn, string digitalReceipt);
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
Task<OperationResult> SetTransactionId(long id, string transactionId);
}

View File

@@ -27,8 +27,6 @@ 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; }
@@ -36,8 +34,6 @@ namespace CompanyManagment.App.Contracts.Report
public int CheckoutSignNotDone { get; set; }
public int CheckoutSignDone { get; set; }
public int CheckoutSignToBe { get; set; }
}

View File

@@ -10,23 +10,21 @@ namespace CompanyManagment.App.Contracts.Report
{
Task<AllReport> GetAllActiveWorkshops(string year, string month);
Task<AllReport> GetAllReports(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
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,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
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,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
}
}

View File

@@ -1,170 +0,0 @@
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
}

View File

@@ -1140,7 +1140,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(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.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
institutionContract.PublicId, contractingParty.id, institutionContract.id);
return new OperationResult().Succcedded();
}

View File

@@ -50,7 +50,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
command.ContractingPartyId,
command.Amount,
contractingPartyName,
command.CallBackUrl,command.Gateway);
command.CallBackUrl);
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, string rrn, string digitalReceipt)
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName)
{
var op = new OperationResult();
@@ -97,7 +97,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
{
return op.Failed("تراکنش مورد نظر یافت نشد");
}
paymentTransaction.SetPaid(cardNumber, bankName,rrn, digitalReceipt);
paymentTransaction.SetPaid(cardNumber, bankName);
_paymentTransactionRepository.SaveChanges();
return op.Succcedded();

View File

@@ -29,67 +29,67 @@ public class ReportApplication : IReportApplication
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
}
public async Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
{
return await _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
}
public async Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
{
return await _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
}
public async Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
{
return await _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
}
public async Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
{
return await _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
}
public async Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId)
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
{
return await _reportRepository.GetEmployeeContract(year, month, workshopId);
return _reportRepository.GetEmployeeContract(year, month, workshopId);
}
public async Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId)
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
{
return await _reportRepository.GetEmployeeContractSign(year, month, workshopId);
return _reportRepository.GetEmployeeContractSign(year, month, workshopId);
}
public async Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId)
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
{
return await _reportRepository.GetEmployeeCheckout(year, month, workshopId);
return _reportRepository.GetEmployeeCheckout(year, month, workshopId);
}
public async Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId)
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
{
return await _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
return _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
}
#region Print
public async Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList)
{
return await _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
return _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
}
public async Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList)
{
return await _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
return _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
}
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList)
{
return await _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
return _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
}
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList)
{
return await _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
return _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
}
#endregion

View File

@@ -13,7 +13,6 @@
</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>

View File

@@ -15,12 +15,8 @@ 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);
}
}

View File

@@ -1,30 +0,0 @@
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");
}
}
}

View File

@@ -1,40 +0,0 @@
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");
}
}
}

View File

@@ -4990,19 +4990,6 @@ 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)

View File

@@ -1691,7 +1691,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
return new List<CheckoutViewModel>();
}
#endregion
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
var query = _context.CheckoutSet
.AsSplitQuery().Select(x => new CheckoutViewModel()
{
Id = x.id,
@@ -1726,14 +1726,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
SalaryAidDateTimeGe = s.SalaryAidDateTime
}).ToList(),
HasAmountConflict = x.HasAmountConflict,
IsUpdateNeeded = x.IsUpdateNeeded,
CheckoutWarningMessageList = x.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
{
WarningMessage = wm.WarningMessage,
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
}).ToList()
HasAmountConflict = x.HasAmountConflict
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
if (searchModel.EmployeeId > 0)

View File

@@ -19,41 +19,39 @@ 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);
@@ -83,81 +81,79 @@ public class CustomizeWorkshopGroupSettingsRepository(
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);
.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;
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)
@@ -173,26 +169,23 @@ public class CustomizeWorkshopGroupSettingsRepository(
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
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()
{
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();
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)
@@ -208,52 +201,38 @@ public class CustomizeWorkshopGroupSettingsRepository(
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel()
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()
{
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();
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 names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
.Select(x => new { x.id, x.FullName }).ToList();
var employeeIds = employees.Select(x => x.EmployeeId);
var leftWork = _companyContext.LeftWorkList.Where(x =>
x.WorkshopId == workshopId &&
employeeIds.Contains(x.EmployeeId)).ToList();
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel
@@ -264,86 +243,82 @@ public class CustomizeWorkshopGroupSettingsRepository(
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(),
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
});
return joinedList.OrderBy(x=>x.HasLeft).ToList();
return joinedList.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
},
@@ -357,27 +332,23 @@ public class CustomizeWorkshopGroupSettingsRepository(
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)
@@ -389,8 +360,7 @@ public class CustomizeWorkshopGroupSettingsRepository(
_companyContext.SaveChanges();
}
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId,
long workshopId)
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId)
{
return _companyContext.CustomizeWorkshopGroupSettings
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)

View File

@@ -1135,21 +1135,21 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
if (!string.IsNullOrWhiteSpace(searchModel.ContractDateFrom) &&
!string.IsNullOrWhiteSpace(searchModel.ContractDateTo))
{
if (!searchModel.ContractDateFrom.TryToGeorgianDateTime(out var dateFrom))
if (!searchModel.ContractDateFrom.TryToGeorgianDateTime(out var dateStart))
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
if (!searchModel.ContractDateTo.TryToGeorgianDateTime(out var dateTo))
if (!searchModel.ContractDateTo.TryToGeorgianDateTime(out var dateEnd))
{
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
}
if (dateFrom > dateTo)
if (dateStart > dateEnd)
{
throw new BadRequestException("تاریخ شروع نمیتواند بزرگ تر از تاریخ پایان باشد");
}
joinedQuery = joinedQuery.Where(x =>
x.contract.ContractStartGr <= dateTo && x.contract.ContractEndGr <= dateFrom);
x.contract.ContractStartGr <= dateEnd && x.contract.ContractEndGr >= dateStart);
}
if (searchModel.HasSignature != null)
@@ -1422,23 +1422,22 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
if (!string.IsNullOrWhiteSpace(searchModel.ContractDateFrom) &&
!string.IsNullOrWhiteSpace(searchModel.ContractDateTo))
{
if (!searchModel.ContractDateFrom.TryToGeorgianDateTime(out var dateFrom))
if (!searchModel.ContractDateFrom.TryToGeorgianDateTime(out var dateStart))
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
if (!searchModel.ContractDateTo.TryToGeorgianDateTime(out var dateTo))
if (!searchModel.ContractDateTo.TryToGeorgianDateTime(out var dateEnd))
{
throw new BadRequestException("تاریخ وارد شده نامعتبر است");
}
if (dateFrom > dateTo)
if (dateStart > dateEnd)
{
throw new BadRequestException("تاریخ شروع نمیتواند بزرگ تر از تاریخ پایان باشد");
}
joinedQuery = joinedQuery.Where(x =>
x.contract.ContractStartGr <= dateTo && x.contract.ContractEndGr <= dateFrom);
x.contract.ContractStartGr <= dateEnd && x.contract.ContractEndGr >= dateStart);
}
if (searchModel.HasSignature != null)
{
var hasSignature = searchModel.HasSignature == true ? "1" : "0";
@@ -1512,10 +1511,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
#endregion
var totalAmount = await joinedQuery.SumAsync(x => x.contract.ContractAmount);
var totalAmount = await joinedQuery.Where(x=>x.contract.ContractStartGr<=DateTime.Today).SumAsync(x => x.contract.ContractAmount);
var totalDebt = await _context.FinancialStatments.Include(x => x.FinancialTransactionList)
.Where(x => joinedQuery.Select(i => i.contract.ContractingPartyId).Contains(x.ContractingPartyId))
.Where(x => joinedQuery.Where(i=>i.contract.ContractStartGr<=DateTime.Today).Select(i => i.contract.ContractingPartyId).Contains(x.ContractingPartyId))
.SelectMany(x => x.FinancialTransactionList)
.SumAsync(x => x.Deptor - x.Creditor);
var counts = new List<InstitutionContractStatusCount>();
@@ -2342,7 +2341,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,6 @@ 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; }
@@ -29,33 +27,6 @@ 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)
@@ -85,7 +56,12 @@ public class SmsService : ISmsService
}
public bool VerifySend(string number, string message)
{
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", 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) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -114,7 +90,11 @@ public class SmsService : ISmsService
public bool LoginSend(string number, string message)
{
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", 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) });
Thread.Sleep(2000);
if (verificationSendResult.IsCompletedSuccessfully)
{
@@ -139,8 +119,11 @@ public class SmsService : ISmsService
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var result = new SentSmsViewModel();
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
Thread.Sleep(2000);
if (sendResult.Message == "موفق")
@@ -165,8 +148,9 @@ public class SmsService : ISmsService
var checkLength = fullName.Length;
if (checkLength > 25)
fullName = fullName.Substring(0, 24);
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
var sendResult = smsIr.VerifySendAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
Console.WriteLine(userName + " - " + sendResult.Result.Status);
@@ -348,39 +332,18 @@ public class SmsService : ISmsService
}
}
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
public async Task<bool> SendInstitutionVerificationLink(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[]
var verificationSendResult =await SmsIr.VerifySendAsync(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();
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, "لینک تاییدیه ارتقا قرارداد مالی",
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
fullName, number, contractingPartyId, institutionContractId);
await _smsResultRepository.CreateAsync(smsResult);
await _smsResultRepository.SaveChangesAsync();
@@ -390,7 +353,7 @@ public class SmsService : ISmsService
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId)
{
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
{
new("VERIFYCODE", code)
});

View File

@@ -220,12 +220,9 @@ 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;
@@ -482,10 +479,6 @@ public class PersonalBootstrapper
services
.AddTransient<IInstitutionContractExtenstionTempRepository, InstitutionContractExtenstionTempRepository>();
services.AddTransient<IEmployeeFaceEmbeddingRepository, EmployeeFaceEmbeddingRepository>();
services.AddTransient<IEmployeeFaceEmbeddingApplication, EmployeeFaceEmbeddingApplication>();
#endregion
#region Pooya

View File

@@ -287,7 +287,7 @@
<div class="textsChart">
<p class="alltxt">
<span style="width: 40px;display: inline-block;">@Model.ContractSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.ContrcatDone</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.CheckoutSignToBe</span> : <span style="width: 62px;display: inline-block;">کل</span>
<span style="width: 40px;display: inline-block;">@Model.CheckoutDone</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>

View File

@@ -1,5 +1,4 @@
using _0_Framework.Application;
using AccountMangement.Infrastructure.EFCore;
using CompanyManagment.App.Contracts.Report;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.YearlySalary;
@@ -43,7 +42,6 @@ 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; }
@@ -51,9 +49,8 @@ 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);
@@ -76,23 +73,19 @@ public class IndexModel : PageModel
ContrcatDone = allReports.ContrcatDone;
ContractSignNotDone = allReports.ContractSignNotDone;
ContractSignDone = allReports.ContractSignDone;
ContractSignToBe = allReports.ContractSignToBe;
AllCheckout = allReports.AllCheckout;
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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -103,7 +96,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -114,7 +107,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -125,7 +118,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).GetAwaiter().GetResult();
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
return new JsonResult(new
{
success = true,
@@ -140,7 +133,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContract(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContract(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -150,7 +143,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeContractSign(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -160,7 +153,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckout(string year, string month, long workshopId)
{
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -170,7 +163,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEmployeeCheckoutSign(string year, string month, long workshopId, long accountId)
{
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
return new JsonResult(new
{
success = true,
@@ -187,14 +180,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds);
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).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds);
return Partial("PrintAll", res);
}
@@ -202,14 +195,14 @@ public class IndexModel : PageModel
{
var workshopIds = Tools.ExtractNumbers(workshopList);
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds);
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).GetAwaiter().GetResult();
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds);
return Partial("PrintAll", res);
}
//================Employee
@@ -218,7 +211,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).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -242,7 +235,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
var next = $"{year}/{month}/01";
var y = Convert.ToInt32(year);
var m = Convert.ToInt32(month);
@@ -265,7 +258,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).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
var final = new PrintEmployeeNotDone
{
@@ -284,7 +277,7 @@ public class IndexModel : PageModel
string accountFullName)
{
var workshop = _workshopApplication.GetDetails(workshopId);
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId).GetAwaiter().GetResult();
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
var final = new PrintEmployeeNotDone
{

View File

@@ -18,14 +18,9 @@ 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
@@ -39,9 +34,6 @@ 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; }
@@ -49,16 +41,14 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
IOptions<AppSettingConfiguration> appSetting,
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment)
ITemporaryClientRegistrationApplication clientRegistrationApplication)
{
_application = application;
_rollCallDomainService = rollCallDomainService;
_context = context;
_accountContext = accountContext;
_httpClientFactory = httpClientFactory;
_clientRegistrationApplication = clientRegistrationApplication;
_onlinePayment = onlinePayment;
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
}
public void OnGet()
@@ -73,7 +63,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
}
public async Task<IActionResult> OnPostShiftDate()
public IActionResult OnPostShiftDate()
{
//var startRollCall = new DateTime(2025, 2, 19);
//var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
@@ -83,116 +73,10 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
//CreateRewardForKebabMahdi().GetAwaiter().GetResult();
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();
}
}
}
SetEntityIdForCheckoutValues();
SetEntityIdForCheckoutValuesTemp();
ViewData["message"] = "ایجاد شد";
return Page();
}
public IActionResult OnPostShiftDateNew()
@@ -244,7 +128,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
if (createResponse.Status == "success")
{
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.Token));
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.TransactionId));
}
//TranslateCode(result?.ErrorCode);
@@ -811,7 +695,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 =>
@@ -866,56 +750,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();

View File

@@ -1,305 +0,0 @@
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; }
}

View File

@@ -93,8 +93,8 @@ public class FinancialController : ClientBaseController
if (gatewayResponse.IsSuccess)
{
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.Token);
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.Token));
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
}
if (gatewayResponse.ErrorCode.HasValue)

View File

@@ -8,9 +8,6 @@
Layout = "Shared/_ClientLayout";
ViewData["Title"] = " - " + "فیش حقوقی";
int i = 0;
const string hasAmountConflictText = "توجه داشته باشید این فیش حقوقی دارای تغییرات اعمال نشده میباشد. جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید!";
const string needUpdateText = "جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید";
}
@section Styles {
@@ -338,7 +335,7 @@
</span>
</div>
<div class="Rtable-cell column-heading d-none d-lg-block width11"> </div>
<div class="Rtable-cell column-heading d-none d-lg-block width2">شماره پرسنلی</div>
<div class="Rtable-cell column-heading d-none d-lg-block width2" >شماره پرسنلی</div>
<div class="Rtable-cell column-heading d-none d-md-block width3">سال</div>
<div class="Rtable-cell column-heading d-none d-md-block width4">ماه</div>
<div class="Rtable-cell column-heading d-none d-md-block width5">شماره قرارداد</div>
@@ -367,10 +364,7 @@
<div class="Rtable-cell d-lg-block d-none width11">
<div class="Rtable-cell--heading"> </div>
<div class="Rtable-cell--content">
@if (item.IsUpdateNeeded || item.HasAmountConflict)
@if (item.HasAmountConflict)
{
<svg xmlns="http://www.w3.org/2000/svg"
width="24" height="24" fill="red"
@@ -379,30 +373,11 @@
style="cursor: pointer; margin-left: 10px;"
data-bs-toggle="tooltip"
data-bs-placement="top"
title='@{
var tooltipText = ""; int messCounter = 1;
if (item.HasAmountConflict && !item.IsUpdateNeeded)
{
tooltipText += @hasAmountConflictText;
}else if (item.HasAmountConflict && item.IsUpdateNeeded)
{
foreach (var warning in item.CheckoutWarningMessageList) { tooltipText += " " + messCounter + " - " + warning.WarningMessage; messCounter++;}
tooltipText += " " + @needUpdateText; }
else if (!item.HasAmountConflict && item.IsUpdateNeeded)
{ foreach (var warning in item.CheckoutWarningMessageList) { tooltipText += " " + messCounter + " - " + warning.WarningMessage; messCounter++; }
tooltipText += " " + @needUpdateText;}
@Html.Raw(tooltipText)
}'>
<path d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" />
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zm.1-5.995a.905.905 0 0 1 1.8 0l-.35 3.5a.552.552 0 0 1-1.1 0l-.35-3.5z" />
title="توجه داشته باشید این فیش حقوقی دارای تغییرات اعمال نشده میباشد. جهت صدور فیش حقوقی استاندارد مجددا فیش را ایجاد کنید!">
<path d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zm.1-5.995a.905.905 0 0 1 1.8 0l-.35 3.5a.552.552 0 0 1-1.1 0l-.35-3.5z"/>
</svg>
}
</div>
</div>
<div class="Rtable-cell d-lg-block d-none width2">

View File

@@ -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]")]

View File

@@ -1,24 +1,14 @@
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 Microsoft.Extensions.Options;
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;
using _0_Framework.Application.PaymentGateway;
using Microsoft.Extensions.Options;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.FinancilTransaction;
namespace ServiceHost.Controllers;
@@ -28,14 +18,12 @@ 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, IOnlinePayment onlinePayment)
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting)
{
_paymentTransactionApplication = paymentTransactionApplication;
_paymentGateway = new SepehrPaymentGateway(clientFactory);
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
_financialStatmentApplication = financialStatmentApplication;
_onlinePayment = onlinePayment;
}
/// <summary>
@@ -59,103 +47,7 @@ public class GeneralController : GeneralBaseController
});
}
[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")]
[HttpPost("/api/callback")]
public async Task<IActionResult> OnGetCallBack(string? transid, string? cardnumber, string? tracking_number,
string bank, string invoice_id, string? status,CancellationToken cancellationToken)
{
@@ -178,7 +70,7 @@ public class GeneralController : GeneralBaseController
// اگر شماره کارت یا شماره پیگیری خالی باشد، تراکنش ناموفق است
if (string.IsNullOrWhiteSpace(cardnumber) || string.IsNullOrWhiteSpace(tracking_number))
{
return await HandleFailedTransaction(transaction);
return await HandleFailedTransaction(transaction, paymentTransactionId);
}
var verifyCommand = new VerifyPaymentGateWayRequest()
@@ -205,10 +97,10 @@ public class GeneralController : GeneralBaseController
var statementResult = _financialStatmentApplication.CreateFromBankGateway(command);
if (!statementResult.IsSuccedded)
{
return await HandleFailedTransaction(transaction);
return await HandleFailedTransaction(transaction, paymentTransactionId);
}
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank,null,null);
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
if (!setSuccessResult.IsSuccedded)
{
@@ -218,12 +110,12 @@ public class GeneralController : GeneralBaseController
}
// در غیر این صورت تراکنش ناموفق است
return await HandleFailedTransaction(transaction);
return await HandleFailedTransaction(transaction, paymentTransactionId);
}
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction)
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction, long transactionId)
{
var result = _paymentTransactionApplication.SetFailed(transaction.Id);
var result = _paymentTransactionApplication.SetFailed(transactionId);
if (!result.IsSuccedded)
{
return new JsonResult(result);
@@ -239,81 +131,4 @@ 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; }
}

View File

@@ -24,15 +24,12 @@ 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;
@@ -309,29 +306,11 @@ 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}");
@@ -345,7 +324,6 @@ if (builder.Environment.IsDevelopment())
await tester.Test();
}
if (app.Environment.IsDevelopment())
{
app.UseSwagger();

View File

@@ -90,8 +90,6 @@
</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" />

View File

@@ -38,12 +38,7 @@
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
},
"SmsSettings": {
"IsTestMode": true,
"TestNumbers": [ "09116967898", "09116067106", "09114221321" ]
},
"SepehrGateWayTerminalId": 99213700
}
}

View File

@@ -31,11 +31,5 @@
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
},
"SmsSettings": {
"IsTestMode": false,
"TestNumbers": []
},
"SepehrGateWayTerminalId": 99213700
}
}

View File

@@ -66,7 +66,8 @@ $(document).ready(function () {
let value = convertPersianNumbersToEnglish(element.val());
element.val(value);
});
new Cleave(this, {
new Cleave('.dateInput', {
delimiters: ['/', '/'],
blocks: [4, 2, 2],
numericOnly: true
@@ -77,7 +78,6 @@ $(document).ready(function () {
// datePattern: ['Y', 'm', 'd']
// });
});
//******************** انتخاب همه ی چک باکس ها ********************
$(".checkAll").change(function () {

View File

@@ -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 ${itemEmployee.hasLeft?'disable':''}" data-employee-id="${itemEmployee.employeeId}">
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" 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">

File diff suppressed because it is too large Load Diff