Compare commits
98 Commits
Feature/au
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| f112bab021 | |||
| 8b39eed7bb | |||
| 07851ff7c8 | |||
| 07b2596a6a | |||
| 7dce7f5bc8 | |||
| 7ac078c631 | |||
| 265d5f8b22 | |||
| cf5c9f29cf | |||
| 7448ddc79c | |||
| 3f1a6f3387 | |||
| 95d4dfe568 | |||
| 3258deeb2c | |||
| 783fffa0c2 | |||
| 16c29bc2d0 | |||
|
|
57ef47473b | ||
|
|
e00c93b23d | ||
| 8bd248c6a7 | |||
| 7f9531f07b | |||
| 0b439d0268 | |||
|
|
861b214b0c | ||
|
|
690f574240 | ||
|
|
05abc67cdd | ||
| 3282825719 | |||
| cd1cf93ad1 | |||
| adef1fc15a | |||
| 597f54c062 | |||
| c0ead0a917 | |||
| 59284ffd29 | |||
| 5c7dd76e3f | |||
| dff6bc2541 | |||
| 22b67b344a | |||
|
|
d8b432ca1e | ||
| f4853b6f39 | |||
| 6ab418c4ab | |||
|
|
74dca1d2d2 | ||
|
|
a9b4eb6195 | ||
|
|
2125e15fb9 | ||
| b7f7d3b223 | |||
| 752c7c72ab | |||
| 18c27d7a9a | |||
| 73da938bc9 | |||
|
|
c080e11fe0 | ||
|
|
0eb9ecc373 | ||
| 470651cb76 | |||
| 2a9d9574e3 | |||
|
|
7b1542d5c6 | ||
|
|
981fd2d4ee | ||
|
|
7f3f785e39 | ||
| ca1ef420af | |||
| d7baf358cc | |||
|
|
676c8d2fa6 | ||
|
|
632ab3631b | ||
| 595b2c8a2d | |||
| c7bace728e | |||
| 08574b5bb5 | |||
| 288e3a8988 | |||
| 8134216a4a | |||
|
|
3d013cfa60 | ||
| 30bfc96cbe | |||
| 5d55118c3c | |||
| 280db87408 | |||
| c5a1e5c274 | |||
| 4c6de6a76f | |||
| 25c7b67eb5 | |||
| 19b390b17d | |||
| 026d8da74a | |||
| 6b6b0767e3 | |||
| 3d86ba401f | |||
| 6a6e2e532a | |||
| ca6638d6a3 | |||
| 608fb824dc | |||
| 4686151bbb | |||
| d7fae42e4f | |||
| 2cfe480733 | |||
|
|
c574ce534d | ||
| 174edbf87d | |||
| a827470831 | |||
| c9b61c3fc6 | |||
| 45002b88c4 | |||
| 0bacb24aa2 | |||
| 7fd8851f71 | |||
| bc6ae854f8 | |||
| 68f1f81b53 | |||
| d4c2ab939e | |||
| 5822005b68 | |||
| 53aeb60861 | |||
| c2a08d9c33 | |||
| 85e2481680 | |||
| b711e803a9 | |||
| 232a834dc9 | |||
| 55f7b4f7c0 | |||
| c5b521bc50 | |||
| acdd7de4f6 | |||
| 78458f24e5 | |||
| fde58a7c75 | |||
|
|
dbddccf011 | ||
| 7d6b57affd | |||
| c8018948c2 |
15
0_Framework/Application/Enums/TypeOfCheckoutWarning.cs
Normal file
15
0_Framework/Application/Enums/TypeOfCheckoutWarning.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace _0_Framework.Application.Enums;
|
||||
|
||||
public enum TypeOfCheckoutWarning
|
||||
{
|
||||
/// <summary>
|
||||
/// هشدار های متفرقه
|
||||
/// </summary>
|
||||
OthersWarning,
|
||||
/// <summary>
|
||||
/// هشدار سهم بیمه کارگر
|
||||
/// </summary>
|
||||
InsuranceEmployeeShare,
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _0_Framework.Application.FaceEmbedding;
|
||||
|
||||
/// <summary>
|
||||
/// سرویس اطلاعرسانی تغییرات Face Embedding
|
||||
/// </summary>
|
||||
public interface IFaceEmbeddingNotificationService
|
||||
{
|
||||
/// <summary>
|
||||
/// اطلاعرسانی ایجاد یا بهروزرسانی Embedding
|
||||
/// </summary>
|
||||
Task NotifyEmbeddingCreatedAsync(long workshopId, long employeeId, string employeeFullName);
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعرسانی حذف Embedding
|
||||
/// </summary>
|
||||
Task NotifyEmbeddingDeletedAsync(long workshopId, long employeeId);
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعرسانی بهبود Embedding
|
||||
/// </summary>
|
||||
Task NotifyEmbeddingRefinedAsync(long workshopId, long employeeId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _0_Framework.Application.FaceEmbedding;
|
||||
|
||||
public interface IFaceEmbeddingService
|
||||
{
|
||||
Task<OperationResult> GenerateEmbeddingsAsync(long employeeId, long workshopId, string employeeFullName, string picture1Path, string picture2Path);
|
||||
Task<OperationResult> GenerateEmbeddingsFromStreamAsync(long employeeId, long workshopId, string employeeFullName, Stream picture1Stream, Stream picture2Stream);
|
||||
Task<OperationResult> RefineEmbeddingAsync(long employeeId, long workshopId, float[] embedding, float confidence, Dictionary<string, object> metadata = null);
|
||||
Task<OperationResult> DeleteEmbeddingAsync(long employeeId, long workshopId);
|
||||
Task<OperationResult<FaceEmbeddingResponse>> GetEmbeddingAsync(long employeeId, long workshopId);
|
||||
}
|
||||
|
||||
public class FaceEmbeddingResponse
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public float[] Embedding { get; set; }
|
||||
public float Confidence { get; set; }
|
||||
public Dictionary<string, object> Metadata { get; set; }
|
||||
}
|
||||
@@ -29,9 +29,11 @@ public class PaymentGatewayResponse
|
||||
public int? ErrorCode { get; set; }
|
||||
|
||||
[JsonPropertyName("transid")]
|
||||
public string TransactionId { get; set; }
|
||||
public string Token { get; set; }
|
||||
|
||||
public bool IsSuccess => Status == "success";
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class WalletAmountResponse
|
||||
@@ -53,10 +55,12 @@ public class CreatePaymentGatewayRequest
|
||||
public string Mobile { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Description { get; set; }
|
||||
public IDictionary<string, object> ExtraData { get; set; }
|
||||
}
|
||||
|
||||
public class VerifyPaymentGateWayRequest
|
||||
{
|
||||
public string TransactionId { get; set; }
|
||||
public string DigitalReceipt { get; set; }
|
||||
public string TransactionId { get; set; }
|
||||
public double Amount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace _0_Framework.Application.PaymentGateway;
|
||||
|
||||
public class SepehrPaymentGateway:IPaymentGateway
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private const long TerminalId = 99213700;
|
||||
|
||||
public SepehrPaymentGateway(IHttpClientFactory httpClient)
|
||||
{
|
||||
_httpClient = httpClient.CreateClient();
|
||||
_httpClient.BaseAddress = new Uri("https://sepehr.shaparak.ir/Rest/V1/PeymentApi/");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task<PaymentGatewayResponse> Create(CreatePaymentGatewayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var extraData = JsonConvert.SerializeObject(command.ExtraData);
|
||||
var res = await _httpClient.PostAsJsonAsync("GetToken", new
|
||||
{
|
||||
TerminalID = TerminalId,
|
||||
Amount = command.Amount,
|
||||
InvoiceID = command.InvoiceId,
|
||||
callbackURL = command.CallBackUrl,
|
||||
payload = extraData
|
||||
}, cancellationToken: cancellationToken);
|
||||
// خواندن محتوای پاسخ
|
||||
var content = await res.Content.ReadAsStringAsync(cancellationToken);
|
||||
|
||||
// تبدیل پاسخ JSON به آبجکت داتنت
|
||||
var json = System.Text.Json.JsonDocument.Parse(content);
|
||||
|
||||
// گرفتن مقدار AccessToken
|
||||
var accessToken = json.RootElement.GetProperty("Accesstoken").ToString();
|
||||
var status = json.RootElement.GetProperty("Status").ToString();
|
||||
|
||||
return new PaymentGatewayResponse
|
||||
{
|
||||
Status = status,
|
||||
IsSuccess = status == "0",
|
||||
Token = accessToken
|
||||
};
|
||||
}
|
||||
|
||||
public string GetStartPayUrl(string token)=>
|
||||
$"https://sepehr.shaparak.ir/Payment/Pay?token={token}&terminalId={TerminalId}";
|
||||
|
||||
public async Task<PaymentGatewayResponse> Verify(VerifyPaymentGateWayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var res = await _httpClient.PostAsJsonAsync("Advice", new
|
||||
{
|
||||
digitalreceipt = command.DigitalReceipt,
|
||||
Tid = TerminalId,
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
// خواندن محتوای پاسخ
|
||||
var content = await res.Content.ReadAsStringAsync(cancellationToken);
|
||||
|
||||
// تبدیل پاسخ JSON به آبجکت داتنت
|
||||
var json = System.Text.Json.JsonDocument.Parse(content);
|
||||
|
||||
|
||||
var message = json.RootElement.GetProperty("Message").GetString();
|
||||
var status = json.RootElement.GetProperty("Status").GetString();
|
||||
return new PaymentGatewayResponse
|
||||
{
|
||||
Status = status,
|
||||
IsSuccess = status.ToLower() == "ok",
|
||||
Message = message
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Task<PaymentGatewayResponse> CreateSandBox(CreatePaymentGatewayRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetStartPaySandBoxUrl(string transactionId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -27,9 +27,10 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
346
0_Framework/InfraStructure/FaceEmbeddingService.cs
Normal file
346
0_Framework/InfraStructure/FaceEmbeddingService.cs
Normal file
@@ -0,0 +1,346 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _0_Framework.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// پیادهسازی سرویس ارتباط با API پایتون برای مدیریت Embeddings چهره
|
||||
/// </summary>
|
||||
public class FaceEmbeddingService : IFaceEmbeddingService
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly ILogger<FaceEmbeddingService> _logger;
|
||||
private readonly IFaceEmbeddingNotificationService _notificationService;
|
||||
private readonly string _apiBaseUrl;
|
||||
|
||||
public FaceEmbeddingService(IHttpClientFactory httpClientFactory, ILogger<FaceEmbeddingService> logger,
|
||||
IFaceEmbeddingNotificationService notificationService = null)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_logger = logger;
|
||||
_notificationService = notificationService;
|
||||
_apiBaseUrl = "http://localhost:8000";
|
||||
}
|
||||
|
||||
public async Task<OperationResult> GenerateEmbeddingsAsync(long employeeId, long workshopId,
|
||||
string employeeFullName, string picture1Path, string picture2Path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
using var content = new MultipartFormDataContent();
|
||||
|
||||
// Add form fields
|
||||
content.Add(new StringContent(employeeId.ToString()), "employee_id");
|
||||
content.Add(new StringContent(workshopId.ToString()), "workshop_id");
|
||||
content.Add(new StringContent(employeeFullName ?? ""), "employee_full_name");
|
||||
|
||||
// Add picture files
|
||||
if (File.Exists(picture1Path))
|
||||
{
|
||||
var picture1Bytes = await File.ReadAllBytesAsync(picture1Path);
|
||||
var picture1Content = new ByteArrayContent(picture1Bytes);
|
||||
picture1Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
|
||||
content.Add(picture1Content, "picture1", "1.jpg");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Picture1 not found at path: {Path}", picture1Path);
|
||||
return new OperationResult { IsSuccedded = false, Message = "تصویر اول یافت نشد" };
|
||||
}
|
||||
|
||||
if (File.Exists(picture2Path))
|
||||
{
|
||||
var picture2Bytes = await File.ReadAllBytesAsync(picture2Path);
|
||||
var picture2Content = new ByteArrayContent(picture2Bytes);
|
||||
picture2Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
|
||||
content.Add(picture2Content, "picture2", "2.jpg");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Picture2 not found at path: {Path}", picture2Path);
|
||||
return new OperationResult { IsSuccedded = false, Message = "تصویر دوم یافت نشد" };
|
||||
}
|
||||
|
||||
// Send request to Python API
|
||||
var response = await httpClient.PostAsync("embeddings", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogInformation("Embeddings generated successfully for Employee {EmployeeId}, Workshop {WorkshopId}",
|
||||
employeeId, workshopId);
|
||||
|
||||
// ارسال اطلاعرسانی به سایر سیستمها
|
||||
if (_notificationService != null)
|
||||
{
|
||||
await _notificationService.NotifyEmbeddingCreatedAsync(workshopId, employeeId, employeeFullName);
|
||||
}
|
||||
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = true,
|
||||
Message = "Embedding با موفقیت ایجاد شد"
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogError("Failed to generate embeddings. Status: {StatusCode}, Error: {Error}",
|
||||
response.StatusCode, errorContent);
|
||||
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = $"خطا در تولید Embedding: {response.StatusCode}"
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_logger.LogError(ex, "HTTP error while calling embeddings API for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطا در ارتباط با سرور Embedding"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while calling embeddings API for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطای غیرمنتظره در تولید Embedding"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<OperationResult> GenerateEmbeddingsFromStreamAsync(long employeeId, long workshopId,
|
||||
string employeeFullName, Stream picture1Stream, Stream picture2Stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
using var content = new MultipartFormDataContent();
|
||||
|
||||
// Add form fields
|
||||
content.Add(new StringContent(employeeId.ToString()), "employee_id");
|
||||
content.Add(new StringContent(workshopId.ToString()), "workshop_id");
|
||||
content.Add(new StringContent(employeeFullName ?? ""), "employee_full_name");
|
||||
|
||||
// Add picture streams
|
||||
var picture1Content = new StreamContent(picture1Stream);
|
||||
picture1Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
|
||||
content.Add(picture1Content, "picture1", "1.jpg");
|
||||
|
||||
var picture2Content = new StreamContent(picture2Stream);
|
||||
picture2Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
|
||||
content.Add(picture2Content, "picture2", "2.jpg");
|
||||
|
||||
// Send request to Python API
|
||||
var response = await httpClient.PostAsync("embeddings", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation("Embeddings generated successfully from streams for Employee {EmployeeId}", employeeId);
|
||||
|
||||
// ارسال اطلاعرسانی به سایر سیستمها
|
||||
if (_notificationService != null)
|
||||
{
|
||||
await _notificationService.NotifyEmbeddingCreatedAsync(workshopId, employeeId, employeeFullName);
|
||||
}
|
||||
|
||||
return new OperationResult { IsSuccedded = true, Message = "Embedding با موفقیت ایجاد شد" };
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogError("Failed to generate embeddings from streams. Status: {StatusCode}, Error: {Error}",
|
||||
response.StatusCode, errorContent);
|
||||
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = $"خطا در تولید Embedding: {response.StatusCode}"
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while generating embeddings from streams for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطا در تولید Embedding"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<OperationResult> RefineEmbeddingAsync(long employeeId, long workshopId, float[] embedding,
|
||||
float confidence, Dictionary<string, object> metadata = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
var requestBody = new
|
||||
{
|
||||
employeeId,
|
||||
workshopId,
|
||||
embedding,
|
||||
confidence,
|
||||
metadata = metadata ?? new Dictionary<string, object>()
|
||||
};
|
||||
|
||||
var response = await httpClient.PostAsJsonAsync("embeddings/refine", requestBody);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation("Embedding refined successfully for Employee {EmployeeId}", employeeId);
|
||||
|
||||
// ارسال اطلاعرسانی به سایر سیستمها
|
||||
if (_notificationService != null)
|
||||
{
|
||||
await _notificationService.NotifyEmbeddingRefinedAsync(workshopId, employeeId);
|
||||
}
|
||||
|
||||
return new OperationResult { IsSuccedded = true, Message = "Embedding بهبود یافت" };
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogError("Failed to refine embedding. Status: {StatusCode}, Error: {Error}",
|
||||
response.StatusCode, errorContent);
|
||||
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = $"خطا در بهبود Embedding: {response.StatusCode}"
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while refining embedding for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطا در بهبود Embedding"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<OperationResult> DeleteEmbeddingAsync(long employeeId, long workshopId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
var response = await httpClient.DeleteAsync($"embeddings/{workshopId}/{employeeId}");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation("Embedding deleted successfully for Employee {EmployeeId}", employeeId);
|
||||
|
||||
// ارسال اطلاعرسانی به سایر سیستمها
|
||||
if (_notificationService != null)
|
||||
{
|
||||
await _notificationService.NotifyEmbeddingDeletedAsync(workshopId, employeeId);
|
||||
}
|
||||
|
||||
return new OperationResult { IsSuccedded = true, Message = "Embedding حذف شد" };
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogError("Failed to delete embedding. Status: {StatusCode}, Error: {Error}",
|
||||
response.StatusCode, errorContent);
|
||||
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = $"خطا در حذف Embedding: {response.StatusCode}"
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while deleting embedding for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطا در حذف Embedding"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<OperationResult<FaceEmbeddingResponse>> GetEmbeddingAsync(long employeeId, long workshopId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
var response = await httpClient.GetAsync($"embeddings/{workshopId}/{employeeId}");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var embeddingData = JsonSerializer.Deserialize<FaceEmbeddingResponse>(content,
|
||||
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
|
||||
_logger.LogInformation("Embedding retrieved successfully for Employee {EmployeeId}", employeeId);
|
||||
|
||||
return new OperationResult<FaceEmbeddingResponse>
|
||||
{
|
||||
IsSuccedded = true,
|
||||
Message = "Embedding دریافت شد",
|
||||
Data = embeddingData
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
_logger.LogError("Failed to get embedding. Status: {StatusCode}, Error: {Error}",
|
||||
response.StatusCode, errorContent);
|
||||
|
||||
return new OperationResult<FaceEmbeddingResponse>
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = $"خطا در دریافت Embedding: {response.StatusCode}"
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while getting embedding for Employee {EmployeeId}", employeeId);
|
||||
return new OperationResult<FaceEmbeddingResponse>
|
||||
{
|
||||
IsSuccedded = false,
|
||||
Message = "خطا در دریافت Embedding"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
|
||||
namespace _0_Framework.InfraStructure;
|
||||
|
||||
/// <summary>
|
||||
/// پیادهسازی پیشفرض (بدون عملیات) برای IFaceEmbeddingNotificationService
|
||||
/// این کلاس زمانی استفاده میشود که SignalR در دسترس نباشد
|
||||
/// </summary>
|
||||
public class NullFaceEmbeddingNotificationService : IFaceEmbeddingNotificationService
|
||||
{
|
||||
public Task NotifyEmbeddingCreatedAsync(long workshopId, long employeeId, string employeeFullName)
|
||||
{
|
||||
// هیچ عملیاتی انجام نمیدهد
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task NotifyEmbeddingDeletedAsync(long workshopId, long employeeId)
|
||||
{
|
||||
// هیچ عملیاتی انجام نمیدهد
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task NotifyEmbeddingRefinedAsync(long workshopId, long employeeId)
|
||||
{
|
||||
// هیچ عملیاتی انجام نمیدهد
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
624
ANDROID_SIGNALR_GUIDE.md
Normal file
624
ANDROID_SIGNALR_GUIDE.md
Normal file
@@ -0,0 +1,624 @@
|
||||
# راهنمای اتصال اپلیکیشن Android به SignalR برای Face Embedding
|
||||
|
||||
## 1. افزودن کتابخانه SignalR به پروژه Android
|
||||
|
||||
در فایل `build.gradle` (Module: app) خود، dependency زیر را اضافه کنید:
|
||||
|
||||
```gradle
|
||||
dependencies {
|
||||
// SignalR for Android
|
||||
implementation 'com.microsoft.signalr:signalr:7.0.0'
|
||||
|
||||
// اگر از Kotlin استفاده میکنید:
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
|
||||
|
||||
// برای JSON پردازش:
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
}
|
||||
```
|
||||
|
||||
## 2. اضافه کردن Permission در AndroidManifest.xml
|
||||
|
||||
```xml
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
```
|
||||
|
||||
## 3. کد Java/Kotlin برای اتصال به SignalR
|
||||
|
||||
### نسخه Java:
|
||||
|
||||
```java
|
||||
import com.microsoft.signalr.HubConnection;
|
||||
import com.microsoft.signalr.HubConnectionBuilder;
|
||||
import com.microsoft.signalr.HubConnectionState;
|
||||
import com.google.gson.JsonObject;
|
||||
import android.util.Log;
|
||||
|
||||
public class FaceEmbeddingSignalRClient {
|
||||
private static final String TAG = "FaceEmbeddingHub";
|
||||
private HubConnection hubConnection;
|
||||
private String serverUrl = "http://YOUR_SERVER_IP:PORT/trackingFaceEmbeddingHub"; // آدرس سرور خود را وارد کنید
|
||||
private long workshopId;
|
||||
|
||||
public FaceEmbeddingSignalRClient(long workshopId) {
|
||||
this.workshopId = workshopId;
|
||||
initializeSignalR();
|
||||
}
|
||||
|
||||
private void initializeSignalR() {
|
||||
// ایجاد اتصال SignalR
|
||||
hubConnection = HubConnectionBuilder
|
||||
.create(serverUrl)
|
||||
.build();
|
||||
|
||||
// دریافت رویداد ایجاد Embedding
|
||||
hubConnection.on("EmbeddingCreated", (data) -> {
|
||||
JsonObject jsonData = (JsonObject) data;
|
||||
long employeeId = jsonData.get("employeeId").getAsLong();
|
||||
String employeeFullName = jsonData.get("employeeFullName").getAsString();
|
||||
String timestamp = jsonData.get("timestamp").getAsString();
|
||||
|
||||
Log.d(TAG, "Embedding Created - Employee: " + employeeFullName + " (ID: " + employeeId + ")");
|
||||
|
||||
// اینجا میتوانید دادههای جدید را از سرور بگیرید یا UI را بروزرسانی کنید
|
||||
onEmbeddingCreated(employeeId, employeeFullName, timestamp);
|
||||
|
||||
}, JsonObject.class);
|
||||
|
||||
// دریافت رویداد حذف Embedding
|
||||
hubConnection.on("EmbeddingDeleted", (data) -> {
|
||||
JsonObject jsonData = (JsonObject) data;
|
||||
long employeeId = jsonData.get("employeeId").getAsLong();
|
||||
String timestamp = jsonData.get("timestamp").getAsString();
|
||||
|
||||
Log.d(TAG, "Embedding Deleted - Employee ID: " + employeeId);
|
||||
onEmbeddingDeleted(employeeId, timestamp);
|
||||
|
||||
}, JsonObject.class);
|
||||
|
||||
// دریافت رویداد بهبود Embedding
|
||||
hubConnection.on("EmbeddingRefined", (data) -> {
|
||||
JsonObject jsonData = (JsonObject) data;
|
||||
long employeeId = jsonData.get("employeeId").getAsLong();
|
||||
String timestamp = jsonData.get("timestamp").getAsString();
|
||||
|
||||
Log.d(TAG, "Embedding Refined - Employee ID: " + employeeId);
|
||||
onEmbeddingRefined(employeeId, timestamp);
|
||||
|
||||
}, JsonObject.class);
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
if (hubConnection.getConnectionState() == HubConnectionState.DISCONNECTED) {
|
||||
hubConnection.start()
|
||||
.doOnComplete(() -> {
|
||||
Log.d(TAG, "Connected to SignalR Hub");
|
||||
joinWorkshopGroup();
|
||||
})
|
||||
.doOnError(error -> {
|
||||
Log.e(TAG, "Error connecting to SignalR: " + error.getMessage());
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private void joinWorkshopGroup() {
|
||||
// عضویت در گروه مخصوص این کارگاه
|
||||
hubConnection.send("JoinWorkshopGroup", workshopId);
|
||||
Log.d(TAG, "Joined workshop group: " + workshopId);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (hubConnection.getConnectionState() == HubConnectionState.CONNECTED) {
|
||||
// خروج از گروه
|
||||
hubConnection.send("LeaveWorkshopGroup", workshopId);
|
||||
|
||||
hubConnection.stop();
|
||||
Log.d(TAG, "Disconnected from SignalR Hub");
|
||||
}
|
||||
}
|
||||
|
||||
// این متدها را در Activity/Fragment خود override کنید
|
||||
protected void onEmbeddingCreated(long employeeId, String employeeFullName, String timestamp) {
|
||||
// اینجا UI را بروزرسانی کنید یا داده جدید را بگیرید
|
||||
}
|
||||
|
||||
protected void onEmbeddingDeleted(long employeeId, String timestamp) {
|
||||
// اینجا UI را بروزرسانی کنید
|
||||
}
|
||||
|
||||
protected void onEmbeddingRefined(long employeeId, String timestamp) {
|
||||
// اینجا UI را بروزرسانی کنید
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### نسخه Kotlin:
|
||||
|
||||
```kotlin
|
||||
import com.microsoft.signalr.HubConnection
|
||||
import com.microsoft.signalr.HubConnectionBuilder
|
||||
import com.microsoft.signalr.HubConnectionState
|
||||
import com.google.gson.JsonObject
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class FaceEmbeddingSignalRClient(private val workshopId: Long) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "FaceEmbeddingHub"
|
||||
}
|
||||
|
||||
private lateinit var hubConnection: HubConnection
|
||||
private val serverUrl = "http://YOUR_SERVER_IP:PORT/trackingFaceEmbeddingHub" // آدرس سرور خود را وارد کنید
|
||||
|
||||
init {
|
||||
initializeSignalR()
|
||||
}
|
||||
|
||||
private fun initializeSignalR() {
|
||||
hubConnection = HubConnectionBuilder
|
||||
.create(serverUrl)
|
||||
.build()
|
||||
|
||||
// دریافت رویداد ایجاد Embedding
|
||||
hubConnection.on("EmbeddingCreated", { data: JsonObject ->
|
||||
val employeeId = data.get("employeeId").asLong
|
||||
val employeeFullName = data.get("employeeFullName").asString
|
||||
val timestamp = data.get("timestamp").asString
|
||||
|
||||
Log.d(TAG, "Embedding Created - Employee: $employeeFullName (ID: $employeeId)")
|
||||
onEmbeddingCreated(employeeId, employeeFullName, timestamp)
|
||||
}, JsonObject::class.java)
|
||||
|
||||
// دریافت رویداد حذف Embedding
|
||||
hubConnection.on("EmbeddingDeleted", { data: JsonObject ->
|
||||
val employeeId = data.get("employeeId").asLong
|
||||
val timestamp = data.get("timestamp").asString
|
||||
|
||||
Log.d(TAG, "Embedding Deleted - Employee ID: $employeeId")
|
||||
onEmbeddingDeleted(employeeId, timestamp)
|
||||
}, JsonObject::class.java)
|
||||
|
||||
// دریافت رویداد بهبود Embedding
|
||||
hubConnection.on("EmbeddingRefined", { data: JsonObject ->
|
||||
val employeeId = data.get("employeeId").asLong
|
||||
val timestamp = data.get("timestamp").asString
|
||||
|
||||
Log.d(TAG, "Embedding Refined - Employee ID: $employeeId")
|
||||
onEmbeddingRefined(employeeId, timestamp)
|
||||
}, JsonObject::class.java)
|
||||
}
|
||||
|
||||
fun connect() {
|
||||
if (hubConnection.connectionState == HubConnectionState.DISCONNECTED) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
hubConnection.start().blockingAwait()
|
||||
Log.d(TAG, "Connected to SignalR Hub")
|
||||
joinWorkshopGroup()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error connecting to SignalR: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun joinWorkshopGroup() {
|
||||
hubConnection.send("JoinWorkshopGroup", workshopId)
|
||||
Log.d(TAG, "Joined workshop group: $workshopId")
|
||||
}
|
||||
|
||||
fun disconnect() {
|
||||
if (hubConnection.connectionState == HubConnectionState.CONNECTED) {
|
||||
hubConnection.send("LeaveWorkshopGroup", workshopId)
|
||||
hubConnection.stop()
|
||||
Log.d(TAG, "Disconnected from SignalR Hub")
|
||||
}
|
||||
}
|
||||
|
||||
// این متدها را override کنید
|
||||
open fun onEmbeddingCreated(employeeId: Long, employeeFullName: String, timestamp: String) {
|
||||
// اینجا UI را بروزرسانی کنید یا داده جدید را بگیرید
|
||||
}
|
||||
|
||||
open fun onEmbeddingDeleted(employeeId: Long, timestamp: String) {
|
||||
// اینجا UI را بروزرسانی کنید
|
||||
}
|
||||
|
||||
open fun onEmbeddingRefined(employeeId: Long, timestamp: String) {
|
||||
// اینجا UI را بروزرسانی کنید
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 4. استفاده در Activity یا Fragment
|
||||
|
||||
### مثال با Login و دریافت WorkshopId
|
||||
|
||||
#### Java:
|
||||
```java
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
Button btnLogin = findViewById(R.id.btnLogin);
|
||||
btnLogin.setOnClickListener(v -> performLogin());
|
||||
}
|
||||
|
||||
private void performLogin() {
|
||||
// فراخوانی API لاگین
|
||||
// فرض کنید response شامل workshopId است
|
||||
|
||||
// مثال ساده (باید از Retrofit یا کتابخانه مشابه استفاده کنید):
|
||||
// LoginResponse response = apiService.login(username, password);
|
||||
// long workshopId = response.getWorkshopId();
|
||||
|
||||
long workshopId = 123; // این را از response دریافت کنید
|
||||
|
||||
// ذخیره workshopId
|
||||
SharedPreferences prefs = getSharedPreferences("AppPrefs", MODE_PRIVATE);
|
||||
prefs.edit().putLong("workshopId", workshopId).apply();
|
||||
|
||||
// رفتن به صفحه اصلی
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private FaceEmbeddingSignalRClient signalRClient;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// دریافت workshopId از SharedPreferences
|
||||
SharedPreferences prefs = getSharedPreferences("AppPrefs", MODE_PRIVATE);
|
||||
long workshopId = prefs.getLong("workshopId", 0);
|
||||
|
||||
if (workshopId == 0) {
|
||||
// اگر workshopId وجود نداره، برگرد به صفحه لاگین
|
||||
Intent intent = new Intent(this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// ایجاد و اتصال SignalR
|
||||
signalRClient = new FaceEmbeddingSignalRClient(workshopId) {
|
||||
@Override
|
||||
protected void onEmbeddingCreated(long employeeId, String employeeFullName, String timestamp) {
|
||||
runOnUiThread(() -> {
|
||||
// بروزرسانی UI
|
||||
Toast.makeText(MainActivity.this,
|
||||
"Embedding ایجاد شد برای: " + employeeFullName,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
// دریافت دادههای جدید از API
|
||||
refreshEmployeeList();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEmbeddingDeleted(long employeeId, String timestamp) {
|
||||
runOnUiThread(() -> {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEmbeddingRefined(long employeeId, String timestamp) {
|
||||
runOnUiThread(() -> {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
signalRClient.connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (signalRClient != null) {
|
||||
signalRClient.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshEmployeeList() {
|
||||
// دریافت لیست جدید کارمندان از API
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Kotlin:
|
||||
```kotlin
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
|
||||
val btnLogin = findViewById<Button>(R.id.btnLogin)
|
||||
btnLogin.setOnClickListener { performLogin() }
|
||||
}
|
||||
|
||||
private fun performLogin() {
|
||||
// فراخوانی API لاگین
|
||||
// فرض کنید response شامل workshopId است
|
||||
|
||||
// مثال ساده (باید از Retrofit یا کتابخانه مشابه استفاده کنید):
|
||||
// val response = apiService.login(username, password)
|
||||
// val workshopId = response.workshopId
|
||||
|
||||
val workshopId = 123L // این را از response دریافت کنید
|
||||
|
||||
// ذخیره workshopId
|
||||
val prefs = getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
|
||||
prefs.edit().putLong("workshopId", workshopId).apply()
|
||||
|
||||
// رفتن به صفحه اصلی
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var signalRClient: FaceEmbeddingSignalRClient
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
// دریافت workshopId از SharedPreferences
|
||||
val prefs = getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
|
||||
val workshopId = prefs.getLong("workshopId", 0L)
|
||||
|
||||
if (workshopId == 0L) {
|
||||
// اگر workshopId وجود نداره، برگرد به صفحه لاگین
|
||||
val intent = Intent(this, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
// ایجاد و اتصال SignalR
|
||||
signalRClient = object : FaceEmbeddingSignalRClient(workshopId) {
|
||||
override fun onEmbeddingCreated(employeeId: Long, employeeFullName: String, timestamp: String) {
|
||||
runOnUiThread {
|
||||
// بروزرسانی UI
|
||||
Toast.makeText(this@MainActivity,
|
||||
"Embedding ایجاد شد برای: $employeeFullName",
|
||||
Toast.LENGTH_SHORT).show()
|
||||
|
||||
// دریافت دادههای جدید از API
|
||||
refreshEmployeeList()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEmbeddingDeleted(employeeId: Long, timestamp: String) {
|
||||
runOnUiThread {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEmbeddingRefined(employeeId: Long, timestamp: String) {
|
||||
runOnUiThread {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signalRClient.connect()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
signalRClient.disconnect()
|
||||
}
|
||||
|
||||
private fun refreshEmployeeList() {
|
||||
// دریافت لیست جدید کارمندان از API
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### مثال ساده بدون Login:
|
||||
اگر workshopId را از قبل میدانید:
|
||||
|
||||
#### Java:
|
||||
```java
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private FaceEmbeddingSignalRClient signalRClient;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
long workshopId = 123; // شناسه کارگاه خود را وارد کنید
|
||||
|
||||
signalRClient = new FaceEmbeddingSignalRClient(workshopId) {
|
||||
@Override
|
||||
protected void onEmbeddingCreated(long employeeId, String employeeFullName, String timestamp) {
|
||||
runOnUiThread(() -> {
|
||||
// بروزرسانی UI
|
||||
Toast.makeText(MainActivity.this,
|
||||
"Embedding ایجاد شد برای: " + employeeFullName,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
// دریافت دادههای جدید از API
|
||||
refreshEmployeeList();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEmbeddingDeleted(long employeeId, String timestamp) {
|
||||
runOnUiThread(() -> {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
signalRClient.connect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (signalRClient != null) {
|
||||
signalRClient.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshEmployeeList() {
|
||||
// دریافت لیست جدید کارمندان از API
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Kotlin:
|
||||
```kotlin
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var signalRClient: FaceEmbeddingSignalRClient
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
val workshopId = 123L // شناسه کارگاه خود را وارد کنید
|
||||
|
||||
signalRClient = object : FaceEmbeddingSignalRClient(workshopId) {
|
||||
override fun onEmbeddingCreated(employeeId: Long, employeeFullName: String, timestamp: String) {
|
||||
runOnUiThread {
|
||||
// بروزرسانی UI
|
||||
Toast.makeText(this@MainActivity,
|
||||
"Embedding ایجاد شد برای: $employeeFullName",
|
||||
Toast.LENGTH_SHORT).show()
|
||||
|
||||
// دریافت دادههای جدید از API
|
||||
refreshEmployeeList()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEmbeddingDeleted(employeeId: Long, timestamp: String) {
|
||||
runOnUiThread {
|
||||
// بروزرسانی UI
|
||||
refreshEmployeeList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signalRClient.connect()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
signalRClient.disconnect()
|
||||
}
|
||||
|
||||
private fun refreshEmployeeList() {
|
||||
// دریافت لیست جدید کارمندان از API
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 5. نکات مهم
|
||||
|
||||
### آدرس سرور
|
||||
- اگر روی شبیهساز اندروید تست میکنید و سرور روی localhost اجرا میشود، از آدرس `http://10.0.2.2:PORT` استفاده کنید
|
||||
- اگر روی دستگاه فیزیکی تست میکنید، از آدرس IP شبکه محلی سرور استفاده کنید (مثل `http://192.168.1.100:PORT`)
|
||||
- PORT پیشفرض معمولاً 5000 یا 5001 است (بسته به کانفیگ پروژه شما)
|
||||
|
||||
### دریافت WorkshopId از Login
|
||||
بعد از login موفق، workshopId را از سرور دریافت کنید و در SharedPreferences یا یک Singleton ذخیره کنید:
|
||||
|
||||
```java
|
||||
// بعد از login موفق
|
||||
SharedPreferences prefs = getSharedPreferences("AppPrefs", MODE_PRIVATE);
|
||||
prefs.edit().putLong("workshopId", workshopId).apply();
|
||||
|
||||
// استفاده در Activity
|
||||
long workshopId = prefs.getLong("workshopId", 0);
|
||||
```
|
||||
|
||||
یا در Kotlin:
|
||||
|
||||
```kotlin
|
||||
// بعد از login موفق
|
||||
val prefs = getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
|
||||
prefs.edit().putLong("workshopId", workshopId).apply()
|
||||
|
||||
// استفاده در Activity
|
||||
val workshopId = prefs.getLong("workshopId", 0L)
|
||||
```
|
||||
|
||||
### مدیریت اتصال
|
||||
برای reconnection خودکار:
|
||||
|
||||
```java
|
||||
hubConnection.onClosed(exception -> {
|
||||
Log.e(TAG, "Connection closed. Attempting to reconnect...");
|
||||
new Handler().postDelayed(() -> connect(), 5000); // تلاش مجدد بعد از 5 ثانیه
|
||||
});
|
||||
```
|
||||
|
||||
### Thread Safety
|
||||
همیشه UI updates را در main thread انجام دهید:
|
||||
|
||||
```java
|
||||
runOnUiThread(() -> {
|
||||
// UI updates here
|
||||
});
|
||||
```
|
||||
|
||||
## 6. تست اتصال
|
||||
|
||||
برای تست میتوانید:
|
||||
1. اپلیکیشن را اجرا کنید
|
||||
2. از طریق Postman یا Swagger یک Embedding ایجاد کنید
|
||||
3. باید در Logcat پیام "Embedding Created" را ببینید
|
||||
|
||||
## 7. خطایابی (Debugging)
|
||||
|
||||
برای دیدن جزئیات بیشتر:
|
||||
|
||||
```java
|
||||
hubConnection = HubConnectionBuilder
|
||||
.create(serverUrl)
|
||||
.withHttpConnectionOptions(options -> {
|
||||
options.setLogging(LogLevel.TRACE);
|
||||
})
|
||||
.build();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## خلاصه Endpoints
|
||||
|
||||
| نوع رویداد | متد SignalR | پارامترهای دریافتی |
|
||||
|-----------|-------------|---------------------|
|
||||
| ایجاد Embedding | `EmbeddingCreated` | workshopId, employeeId, employeeFullName, timestamp |
|
||||
| حذف Embedding | `EmbeddingDeleted` | workshopId, employeeId, timestamp |
|
||||
| بهبود Embedding | `EmbeddingRefined` | workshopId, employeeId, timestamp |
|
||||
|
||||
| متد ارسالی | پارامتر | توضیحات |
|
||||
|-----------|---------|---------|
|
||||
| `JoinWorkshopGroup` | workshopId | عضویت در گروه کارگاه |
|
||||
| `LeaveWorkshopGroup` | workshopId | خروج از گروه کارگاه |
|
||||
|
||||
@@ -66,4 +66,11 @@ public interface IAccountApplication
|
||||
public bool CheckExistClientAccount(string userName);
|
||||
List<AccountViewModel> GetAdminAccountsNew();
|
||||
|
||||
void CameraLogin(CameraLoginRequest request);
|
||||
}
|
||||
|
||||
public class CameraLoginRequest
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Exceptions;
|
||||
using AccountManagement.Domain.PositionAgg;
|
||||
using AccountManagement.Domain.SubAccountAgg;
|
||||
using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg;
|
||||
@@ -803,4 +804,29 @@ public class AccountApplication : IAccountApplication
|
||||
{
|
||||
return _accountRepository.GetAdminAccountsNew();
|
||||
}
|
||||
|
||||
public void CameraLogin(CameraLoginRequest request)
|
||||
{
|
||||
var cameraAccount = _cameraAccountRepository.GetBy(request.UserName);
|
||||
|
||||
if (cameraAccount == null)
|
||||
{
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
}
|
||||
|
||||
(bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(cameraAccount.Password, request.Password);
|
||||
|
||||
if (!result.Verified)
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
|
||||
var mobile = string.IsNullOrWhiteSpace(cameraAccount.Mobile) ? " " : cameraAccount.Mobile;
|
||||
|
||||
var authViewModel = new CameraAuthViewModel(cameraAccount.id, cameraAccount.WorkshopId,
|
||||
cameraAccount.Username, mobile, cameraAccount.WorkshopName, cameraAccount.AccountId,
|
||||
cameraAccount.IsActiveSting);
|
||||
if (cameraAccount.IsActiveSting != "true")
|
||||
throw new BadRequestException(ApplicationMessages.WrongUserPass);
|
||||
|
||||
_authHelper.CameraSignIn(authViewModel);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
|
||||
namespace Company.Domain.AndroidApkVersionAgg;
|
||||
|
||||
@@ -8,14 +9,17 @@ public class AndroidApkVersion:EntityBase
|
||||
{
|
||||
private AndroidApkVersion () { }
|
||||
|
||||
public AndroidApkVersion( string versionName,string versionCode, IsActive isActive, string path)
|
||||
public AndroidApkVersion( string versionName,string versionCode, IsActive isActive, string path, ApkType apkType, bool isForce = false)
|
||||
{
|
||||
|
||||
VersionName = versionName;
|
||||
VersionCode = versionCode;
|
||||
IsActive = isActive;
|
||||
Path = path;
|
||||
Title = $"Gozareshgir-{versionName}-{CreationDate:g}";
|
||||
ApkType = apkType;
|
||||
IsForce = isForce;
|
||||
var appName = apkType == ApkType.WebView ? "Gozareshgir-WebView" : "Gozareshgir-FaceDetection";
|
||||
Title = $"{appName}-{versionName}-{CreationDate:g}";
|
||||
}
|
||||
|
||||
public string Title { get; private set; }
|
||||
@@ -23,6 +27,9 @@ public class AndroidApkVersion:EntityBase
|
||||
public string VersionCode{ get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public string Path { get; set; }
|
||||
public ApkType ApkType { get; private set; }
|
||||
public bool IsForce { get; private set; }
|
||||
|
||||
|
||||
public void Active()
|
||||
{
|
||||
@@ -33,4 +40,4 @@ public class AndroidApkVersion:EntityBase
|
||||
{
|
||||
IsActive = IsActive.False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework_b.Domain;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
|
||||
namespace Company.Domain.AndroidApkVersionAgg;
|
||||
|
||||
public interface IAndroidApkVersionRepository:IRepository<long,AndroidApkVersion>
|
||||
{
|
||||
IQueryable<AndroidApkVersion> GetActives();
|
||||
IQueryable<AndroidApkVersion> GetActives(ApkType apkType);
|
||||
AndroidApkVersion GetLatestActive(ApkType apkType);
|
||||
void Remove(AndroidApkVersion entity);
|
||||
System.Threading.Tasks.Task<string> GetLatestActiveVersionPath();
|
||||
System.Threading.Tasks.Task<string> GetLatestActiveVersionPath(ApkType apkType);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
@@ -12,25 +13,25 @@ namespace Company.Domain.CheckoutAgg;
|
||||
|
||||
public class Checkout : EntityBase
|
||||
{
|
||||
private Checkout()
|
||||
{
|
||||
|
||||
}
|
||||
public Checkout()
|
||||
{
|
||||
}
|
||||
|
||||
public Checkout(string employeeFullName, string fathersName, string nationalCode, string dateOfBirth,
|
||||
long employeeId, string workshopName, long workshopId, string contractNo, DateTime contractStart,
|
||||
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
|
||||
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
|
||||
double monthlySalary, double baseYearsPay, double consumableItems, double housingAllowance,
|
||||
double overtimePay, double nightworkPay, double fridayPay, double missionPay, double shiftPay,
|
||||
double familyAllowance, double bonusesPay, double yearsPay, double leavePay,
|
||||
double insuranceDeduction, double taxDeducation, double installmentDeduction,
|
||||
double salaryAidDeduction, double absenceDeduction, string sumOfWorkingDays
|
||||
, string archiveCode, string personnelCode,
|
||||
, string archiveCode, string personnelCode,
|
||||
string totalClaims, string totalDeductions, double totalPayment, string signature, double marriedAllowance, bool leaveCheckout,
|
||||
double creditLeaves, double absencePeriod, double averageHoursPerDay, bool hasRollCall, string overTimeWorkvalue,
|
||||
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
|
||||
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
|
||||
ICollection<CheckoutLoanInstallment> loanInstallments,
|
||||
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall,TimeSpan employeeMandatoryHours)
|
||||
ICollection<CheckoutSalaryAid> salaryAids, CheckoutRollCall checkoutRollCall, TimeSpan employeeMandatoryHours, bool hasInsuranceShareTheSameAsList)
|
||||
{
|
||||
EmployeeFullName = employeeFullName;
|
||||
FathersName = fathersName;
|
||||
@@ -91,6 +92,7 @@ public class Checkout : EntityBase
|
||||
SalaryAids = salaryAids;
|
||||
CheckoutRollCall = checkoutRollCall;
|
||||
EmployeeMandatoryHours = employeeMandatoryHours;
|
||||
HasInsuranceShareTheSameAsList = hasInsuranceShareTheSameAsList;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +101,7 @@ public class Checkout : EntityBase
|
||||
public string Signature { get; private set; }
|
||||
public string FathersName { get; private set; }
|
||||
public string NationalCode { get; private set; }
|
||||
public string DateOfBirth { get; private set; }
|
||||
public string DateOfBirth { get; private set; }
|
||||
public long EmployeeId { get; private set; }
|
||||
|
||||
public string WorkshopName { get; private set; }
|
||||
@@ -135,7 +137,7 @@ public class Checkout : EntityBase
|
||||
public double SalaryAidDeduction { get; private set; }
|
||||
|
||||
public double AbsenceDeduction { get; private set; }
|
||||
|
||||
|
||||
public string SumOfWorkingDays { get; private set; }
|
||||
public string ArchiveCode { get; private set; }
|
||||
public string PersonnelCode { get; private set; }
|
||||
@@ -157,58 +159,70 @@ public class Checkout : EntityBase
|
||||
//میانگین ساعت کار در یک روز
|
||||
public double AverageHoursPerDay { get; private set; }
|
||||
public bool HasRollCall { get; private set; }
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
public string OverTimeWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
public string OverNightWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار غیبت
|
||||
/// </summary>
|
||||
public string AbsenceValue { get; private set; }
|
||||
public string AbsenceValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
|
||||
/// </summary>
|
||||
public bool HasAmountConflict { get; private set; }
|
||||
/// <summary>
|
||||
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
|
||||
/// </summary>
|
||||
public bool HasAmountConflict { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// ساعت موظفی پرسنل در ماه
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// ساعت موظفی پرسنل در ماه
|
||||
/// </summary>
|
||||
public TimeSpan EmployeeMandatoryHours { get; set; }
|
||||
|
||||
#region valueObjects
|
||||
|
||||
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
||||
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
||||
/// <summary>
|
||||
/// آیا حق بیمه مشابه لیست بیمه حساب شده؟
|
||||
/// </summary>
|
||||
public bool HasInsuranceShareTheSameAsList { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا فیش نیاز به بروزرسانی دارد
|
||||
/// </summary>
|
||||
public bool IsUpdateNeeded { get; private set; }
|
||||
|
||||
public List<CheckoutWarningMessage> CheckoutWarningMessageList { get; set; }
|
||||
|
||||
#region valueObjects
|
||||
|
||||
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
||||
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
||||
public CheckoutRollCall CheckoutRollCall { get; private set; }
|
||||
#endregion
|
||||
|
||||
@@ -277,7 +291,7 @@ public class Checkout : EntityBase
|
||||
var year = contarctStart.ToFarsiYear();
|
||||
var sumYear = year.Substring(Math.Max(0, year.Length - 2));
|
||||
|
||||
|
||||
|
||||
ContractNo = archiveCode + "/" + personnelCode + "/" + sumYear + "/" + month;
|
||||
}
|
||||
public void Active()
|
||||
@@ -312,7 +326,7 @@ public class Checkout : EntityBase
|
||||
}
|
||||
|
||||
|
||||
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids,double salaryAidAmount)
|
||||
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids, double salaryAidAmount)
|
||||
{
|
||||
SalaryAids = salaryAids;
|
||||
SalaryAidDeduction = salaryAidAmount;
|
||||
@@ -330,30 +344,45 @@ public class Checkout : EntityBase
|
||||
|
||||
public void SetAmountConflict(bool hasAmountConflict)
|
||||
{
|
||||
HasAmountConflict = hasAmountConflict;
|
||||
HasAmountConflict = hasAmountConflict;
|
||||
}
|
||||
|
||||
public void SetEmployeeMandatoryHours(TimeSpan employeeMandatoryHours)
|
||||
{
|
||||
EmployeeMandatoryHours = employeeMandatoryHours;
|
||||
}
|
||||
|
||||
public void SetInsuranceShare()
|
||||
{
|
||||
HasInsuranceShareTheSameAsList = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نیاز به آپدیت
|
||||
/// </summary>
|
||||
public void SetUpdateNeeded()
|
||||
{
|
||||
IsUpdateNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class CheckoutRollCall
|
||||
{
|
||||
private CheckoutRollCall(){}
|
||||
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
|
||||
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
|
||||
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
|
||||
{
|
||||
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
|
||||
TotalPresentTimeSpan = totalPresentTimeSpan;
|
||||
TotalBreakTimeSpan = totalBreakTimeSpan;
|
||||
TotalWorkingTimeSpan = totalWorkingTimeSpan;
|
||||
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
|
||||
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
|
||||
RollCallDaysCollection = rollCallDaysCollection;
|
||||
}
|
||||
private CheckoutRollCall() { }
|
||||
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
|
||||
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
|
||||
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
|
||||
{
|
||||
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
|
||||
TotalPresentTimeSpan = totalPresentTimeSpan;
|
||||
TotalBreakTimeSpan = totalBreakTimeSpan;
|
||||
TotalWorkingTimeSpan = totalWorkingTimeSpan;
|
||||
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
|
||||
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
|
||||
RollCallDaysCollection = rollCallDaysCollection;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -394,27 +423,27 @@ public class CheckoutRollCall
|
||||
|
||||
public class CheckoutRollCallDay
|
||||
{
|
||||
private CheckoutRollCallDay(){}
|
||||
public CheckoutRollCallDay(DateTime date, string firstStartDate, string firstEndDate,
|
||||
string secondStartDate, string secondEndDate, TimeSpan breakTimeSpan,
|
||||
bool isSliced, TimeSpan workingTimeSpan, bool isAbsent, bool isFriday,
|
||||
bool isHoliday, string leaveType)
|
||||
{
|
||||
Date = date;
|
||||
FirstStartDate = firstStartDate;
|
||||
FirstEndDate = firstEndDate;
|
||||
SecondStartDate = secondStartDate;
|
||||
SecondEndDate = secondEndDate;
|
||||
BreakTimeSpan = breakTimeSpan;
|
||||
IsSliced = isSliced;
|
||||
WorkingTimeSpan = workingTimeSpan;
|
||||
IsAbsent = isAbsent;
|
||||
IsFriday = isFriday;
|
||||
IsHoliday = isHoliday;
|
||||
LeaveType = leaveType;
|
||||
}
|
||||
private CheckoutRollCallDay() { }
|
||||
public CheckoutRollCallDay(DateTime date, string firstStartDate, string firstEndDate,
|
||||
string secondStartDate, string secondEndDate, TimeSpan breakTimeSpan,
|
||||
bool isSliced, TimeSpan workingTimeSpan, bool isAbsent, bool isFriday,
|
||||
bool isHoliday, string leaveType)
|
||||
{
|
||||
Date = date;
|
||||
FirstStartDate = firstStartDate;
|
||||
FirstEndDate = firstEndDate;
|
||||
SecondStartDate = secondStartDate;
|
||||
SecondEndDate = secondEndDate;
|
||||
BreakTimeSpan = breakTimeSpan;
|
||||
IsSliced = isSliced;
|
||||
WorkingTimeSpan = workingTimeSpan;
|
||||
IsAbsent = isAbsent;
|
||||
IsFriday = isFriday;
|
||||
IsHoliday = isHoliday;
|
||||
LeaveType = leaveType;
|
||||
}
|
||||
|
||||
public long Id { get; set; }
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ
|
||||
@@ -458,12 +487,12 @@ public class CheckoutRollCallDay
|
||||
/// <summary>
|
||||
/// آیا غیبت است
|
||||
/// </summary>
|
||||
public bool IsAbsent { get; private set; }
|
||||
public bool IsAbsent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا جمعه است
|
||||
/// </summary>
|
||||
public bool IsFriday { get; private set; }
|
||||
public bool IsFriday { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا تعطیل رسمی است
|
||||
@@ -475,6 +504,6 @@ public class CheckoutRollCallDay
|
||||
/// </summary>
|
||||
public string LeaveType { get; private set; }
|
||||
|
||||
public long CheckoutId { get; set; }
|
||||
public long CheckoutId { get; set; }
|
||||
|
||||
}
|
||||
32
Company.Domain/CheckoutAgg/CheckoutWarningMessage.cs
Normal file
32
Company.Domain/CheckoutAgg/CheckoutWarningMessage.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.CheckoutAgg;
|
||||
|
||||
public class CheckoutWarningMessage : EntityBaseWithoutCreationDate
|
||||
{
|
||||
public CheckoutWarningMessage(string warningMessage, long checkoutId, TypeOfCheckoutWarning typeOfCheckoutWarning)
|
||||
{
|
||||
WarningMessage = warningMessage;
|
||||
CheckoutId = checkoutId;
|
||||
TypeOfCheckoutWarning = typeOfCheckoutWarning;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پیام هشدار
|
||||
/// </summary>
|
||||
public string WarningMessage { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آی دی فیش حقوقی
|
||||
/// </summary>
|
||||
public long CheckoutId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; private set; }
|
||||
|
||||
public Checkout Checkout { get; set; }
|
||||
}
|
||||
189
Company.Domain/EmployeeFaceEmbeddingAgg/EmployeeFaceEmbedding.cs
Normal file
189
Company.Domain/EmployeeFaceEmbeddingAgg/EmployeeFaceEmbedding.cs
Normal file
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
|
||||
public class EmployeeFaceEmbedding
|
||||
{
|
||||
public EmployeeFaceEmbedding()
|
||||
{
|
||||
EmbeddingHistory = new List<EmbeddingHistoryItem>();
|
||||
MetadataHistory = new List<MetadataHistoryItem>();
|
||||
}
|
||||
|
||||
public EmployeeFaceEmbedding(string employeeFullName, long employeeId, long workshopId,
|
||||
List<double> embeddings, EmployeeFaceEmbeddingMetadata metadata)
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
EmployeeFullName = employeeFullName;
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Embeddings = embeddings;
|
||||
Metadata = metadata;
|
||||
EmbeddingHistory = new List<EmbeddingHistoryItem>();
|
||||
MetadataHistory = new List<MetadataHistoryItem>();
|
||||
CreatedAt = DateTime.UtcNow;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public string Id { get; set; }
|
||||
|
||||
[BsonElement("employeeFullName")]
|
||||
public string EmployeeFullName { get; set; }
|
||||
|
||||
[BsonElement("employeeId")]
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
[BsonElement("workshopId")]
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
[BsonElement("embeddings")]
|
||||
public List<double> Embeddings { get; set; }
|
||||
|
||||
[BsonElement("metadata")]
|
||||
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
|
||||
|
||||
[BsonElement("embeddingHistory")]
|
||||
public List<EmbeddingHistoryItem> EmbeddingHistory { get; set; }
|
||||
|
||||
[BsonElement("metadataHistory")]
|
||||
public List<MetadataHistoryItem> MetadataHistory { get; set; }
|
||||
|
||||
[BsonElement("createdAt")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[BsonElement("updatedAt")]
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
public void UpdateEmbedding(List<double> newEmbedding, double confidence, double refinementPercentage)
|
||||
{
|
||||
if (Embeddings != null)
|
||||
{
|
||||
EmbeddingHistory.Add(new EmbeddingHistoryItem
|
||||
{
|
||||
Embedding = new List<double>(Embeddings),
|
||||
Timestamp = DateTime.UtcNow,
|
||||
Confidence = confidence,
|
||||
RefinementPercentage = refinementPercentage
|
||||
});
|
||||
}
|
||||
|
||||
Embeddings = newEmbedding;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void UpdateMetadata(EmployeeFaceEmbeddingMetadata newMetadata, double confidence, double refinementPercentage)
|
||||
{
|
||||
if (Metadata != null)
|
||||
{
|
||||
MetadataHistory.Add(new MetadataHistoryItem
|
||||
{
|
||||
Metadata = Metadata,
|
||||
Timestamp = DateTime.UtcNow,
|
||||
Confidence = confidence,
|
||||
RefinementPercentage = refinementPercentage
|
||||
});
|
||||
}
|
||||
|
||||
Metadata = newMetadata;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void UpdateEmployeeInfo(string employeeFullName, long workshopId)
|
||||
{
|
||||
EmployeeFullName = employeeFullName;
|
||||
WorkshopId = workshopId;
|
||||
UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingMetadata
|
||||
{
|
||||
[BsonElement("avg_eye_distance_normalized")]
|
||||
public double AvgEyeDistanceNormalized { get; set; }
|
||||
|
||||
[BsonElement("avg_eye_to_face_ratio")]
|
||||
public double AvgEyeToFaceRatio { get; set; }
|
||||
|
||||
[BsonElement("avg_face_aspect_ratio")]
|
||||
public double AvgFaceAspectRatio { get; set; }
|
||||
|
||||
[BsonElement("avg_detection_confidence")]
|
||||
public double AvgDetectionConfidence { get; set; }
|
||||
|
||||
[BsonElement("avg_keypoints_normalized")]
|
||||
public EmployeeFaceEmbeddingKeypoints AvgKeypointsNormalized { get; set; }
|
||||
|
||||
[BsonElement("per_image_metadata")]
|
||||
public List<ImageMetadata> PerImageMetadata { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingKeypoints
|
||||
{
|
||||
[BsonElement("left_eye")]
|
||||
public double[] LeftEye { get; set; }
|
||||
|
||||
[BsonElement("right_eye")]
|
||||
public double[] RightEye { get; set; }
|
||||
|
||||
[BsonElement("nose")]
|
||||
public double[] Nose { get; set; }
|
||||
|
||||
[BsonElement("mouth_left")]
|
||||
public double[] MouthLeft { get; set; }
|
||||
|
||||
[BsonElement("mouth_right")]
|
||||
public double[] MouthRight { get; set; }
|
||||
}
|
||||
|
||||
public class ImageMetadata
|
||||
{
|
||||
[BsonElement("face_aspect_ratio")]
|
||||
public double FaceAspectRatio { get; set; }
|
||||
|
||||
[BsonElement("eye_distance_normalized")]
|
||||
public double EyeDistanceNormalized { get; set; }
|
||||
|
||||
[BsonElement("eye_to_face_ratio")]
|
||||
public double EyeToFaceRatio { get; set; }
|
||||
|
||||
[BsonElement("detection_confidence")]
|
||||
public double DetectionConfidence { get; set; }
|
||||
|
||||
[BsonElement("keypoints_normalized")]
|
||||
public EmployeeFaceEmbeddingKeypoints KeypointsNormalized { get; set; }
|
||||
}
|
||||
|
||||
public class EmbeddingHistoryItem
|
||||
{
|
||||
[BsonElement("embedding")]
|
||||
public List<double> Embedding { get; set; }
|
||||
|
||||
[BsonElement("timestamp")]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
[BsonElement("confidence")]
|
||||
public double Confidence { get; set; }
|
||||
|
||||
[BsonElement("refinementPercentage")]
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
public class MetadataHistoryItem
|
||||
{
|
||||
[BsonElement("metadata")]
|
||||
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
|
||||
|
||||
[BsonElement("timestamp")]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
[BsonElement("confidence")]
|
||||
public double Confidence { get; set; }
|
||||
|
||||
[BsonElement("refinementPercentage")]
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
|
||||
public interface IEmployeeFaceEmbeddingRepository
|
||||
{
|
||||
Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
|
||||
Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
|
||||
Task<EmployeeFaceEmbedding> GetByIdAsync(string id);
|
||||
Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId);
|
||||
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId);
|
||||
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds);
|
||||
Task DeleteAsync(string id);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
@@ -65,12 +66,16 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upgrade(Amendment)
|
||||
#region Upgrade(Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
#endregion
|
||||
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using System.Security.Cryptography;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using OfficeOpenXml.Table.PivotTable;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
@@ -126,6 +125,8 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public string VerifyCode { get; private set; }
|
||||
public DateTime VerifyCodeCreation { get; private set; }
|
||||
public string VerifierFullName { get; private set; }
|
||||
public string VerifierPhoneNumber { get; private set; }
|
||||
|
||||
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
|
||||
|
||||
@@ -226,10 +227,12 @@ public class InstitutionContract : EntityBase
|
||||
}
|
||||
|
||||
|
||||
public void SetVerifyCode(string code)
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
}
|
||||
|
||||
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
|
||||
@@ -277,11 +280,19 @@ public class InstitutionContractAmendment : EntityBase
|
||||
|
||||
public long LawId { get; set; }
|
||||
|
||||
public void SetVerifyCode(string code)
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerificationCreation = DateTime.Now;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
}
|
||||
|
||||
public string VerifierPhoneNumber { get; private set; }
|
||||
|
||||
public string VerifierFullName { get; private set; }
|
||||
|
||||
public DateTime VerifyCodeCreation { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentChange : EntityBase
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
|
||||
public class InstitutionContractAmendmentTemp
|
||||
{
|
||||
public InstitutionContractAmendmentTemp(List<InstitutionContractAmendmentTempPrevWorkshop> prevWorkshops,
|
||||
long institutionContractId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
PrevWorkshops = prevWorkshops;
|
||||
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
|
||||
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
|
||||
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
|
||||
x.CurrentWorkshopId, 0)).ToList();
|
||||
InstitutionContractId = institutionContractId;
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; }
|
||||
public long InstitutionContractId { get; private set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
|
||||
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base(
|
||||
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
|
||||
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
|
||||
{
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ اختلاف کارگاه جدید با کارگاه قبلی(مبلغ اصلی ارتقاء)
|
||||
/// </summary>
|
||||
public double PriceDifference { get; private set; }
|
||||
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price,double priceDifference)
|
||||
{
|
||||
base.Edit(workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance,
|
||||
insuranceInPerson, rollCall, customizeCheckout, price);
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempPrevWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson,
|
||||
bool rollCall, bool rollCallInPerson, bool customizeCheckout, double price, long workshopId,
|
||||
long currentWorkshopId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
RollCallInPerson = rollCallInPerson;
|
||||
Price = price;
|
||||
WorkshopId = workshopId;
|
||||
CurrentWorkshopId = currentWorkshopId;
|
||||
}
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; private set; }
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; private set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; private set; }
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout, bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
Price = price;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,14 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
||||
List<EmployeeInsurancListDataViewModel> GetEmployeeInsuranceDataAmonthAgo(DateTime currentMonthStartDate, long workshopId);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات بیمه کارکنان برای استفاده در فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// بدست آوردن اطلاعات محاسباتی ماه پرسنل برای ویرایش
|
||||
/// </summary>
|
||||
|
||||
@@ -18,13 +18,15 @@ public class PaymentTransaction:EntityBase
|
||||
/// <param name="callBackUrl"></param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
double amount,
|
||||
string contractingPartyName,string callBackUrl)
|
||||
string contractingPartyName,string callBackUrl,
|
||||
PaymentTransactionGateWay gateway)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
Status = PaymentTransactionStatus.Pending;
|
||||
Amount = amount;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
CallBackUrl = callBackUrl;
|
||||
Gateway = gateway;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,13 +70,20 @@ public class PaymentTransaction:EntityBase
|
||||
public string TransactionId { get; private set; }
|
||||
|
||||
public string CallBackUrl { get; private set; }
|
||||
public PaymentTransactionGateWay Gateway { get; private set; }
|
||||
public string Rrn { get; private set; }
|
||||
public string DigitalReceipt { get; private set; }
|
||||
|
||||
public void SetPaid(string cardNumber,string bankName)
|
||||
|
||||
public void SetPaid(string cardNumber,string bankName,string rrn,string digitalReceipt)
|
||||
{
|
||||
Status = PaymentTransactionStatus.Success;
|
||||
TransactionDate = DateTime.Now;
|
||||
CardNumber = cardNumber;
|
||||
BankName = bankName;
|
||||
Rrn = rrn;
|
||||
DigitalReceipt = digitalReceipt;
|
||||
|
||||
}
|
||||
public void SetFailed()
|
||||
{
|
||||
@@ -85,4 +94,5 @@ public class PaymentTransaction:EntityBase
|
||||
{
|
||||
TransactionId = transactionId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,21 +11,23 @@ namespace Company.Domain.ReportAgg
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
|
||||
AllReport GetAllActiveWorkshops(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
|
||||
|
||||
|
||||
@@ -26,5 +26,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg
|
||||
List<RollCallEmployeeStatusViewModel> GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr);
|
||||
List<RollCallEmployeeStatusViewModel> GetByWorkshopIdInDates(long workshopId, DateTime start, DateTime end);
|
||||
bool IsActiveInPeriod(long employeeId, long workshopId, DateTime startDate, DateTime endDate);
|
||||
}
|
||||
void RemoveRange(IEnumerable<RollCallEmployeeStatus> rollCallEmployeeStatusList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public class SmsResult: EntityBase
|
||||
{
|
||||
public SmsResult(int messageId, string status,string typeOfSms, string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
public SmsResult(int messageId, string status,string typeOfSms,
|
||||
string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
{
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
|
||||
@@ -12,9 +12,7 @@ public class CaseHistoryRollCallExcelForEmployeeViewModel
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string TotalWorkingHoursFa { get; set; }
|
||||
public string TotalWorkingTimeSpan { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public List<RollCallItemForEmployeeExcelViewModel> RollCalls { get; set; }
|
||||
}
|
||||
|
||||
@@ -40,7 +38,8 @@ public class RollCallItemForEmployeeExcelViewModel
|
||||
public bool HasLeave { get; set; }
|
||||
|
||||
public string TotalWorkingHours { get; set; }
|
||||
|
||||
public string EnterTimeDifferences { get; set; }
|
||||
public string ExitTimeDifferences { get; set; }
|
||||
}
|
||||
|
||||
public class RollCallTimeExcelViewModel
|
||||
|
||||
@@ -113,11 +113,12 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
worksheet.Cells[i + row + 1, 1].Value = i + 1;
|
||||
worksheet.Cells[i + row + 1, 2].Value = rollCall.DayOfWeekFa;
|
||||
worksheet.Cells[i + row + 1, 3].Value = rollCall.DateFa;
|
||||
worksheet.Cells[i + row + 1, 4].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 4].Value = rollCall.EnterTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 5].Value = rollCall.StartsItems;
|
||||
worksheet.Cells[i + row + 1, 6].Value = rollCall.EndsItems;
|
||||
worksheet.Cells[i + row + 1, 7].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty ? "ندارد" : rollCall.TotalWorkingHours;
|
||||
worksheet.Cells[i + row + 1, 7].Value = rollCall.ExitTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty
|
||||
? "ندارد" : rollCall.TotalWorkingHours;
|
||||
|
||||
// Style data cells
|
||||
for (int j = 1; j <= 8; j++)
|
||||
@@ -307,6 +308,49 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
return package.GetAsByteArray();
|
||||
}
|
||||
|
||||
private string CalculateExitMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
private string CalculateEntryMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace CompanyManagement.Infrastructure.Mongo.EmployeeFaceEmbeddingRepo;
|
||||
|
||||
public class EmployeeFaceEmbeddingRepository : IEmployeeFaceEmbeddingRepository
|
||||
{
|
||||
private readonly IMongoCollection<EmployeeFaceEmbedding> _employeeFaceEmbeddings;
|
||||
|
||||
public EmployeeFaceEmbeddingRepository(IMongoDatabase database)
|
||||
{
|
||||
_employeeFaceEmbeddings = database.GetCollection<EmployeeFaceEmbedding>("EmployeeFaces");
|
||||
}
|
||||
|
||||
public async Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
|
||||
{
|
||||
await _employeeFaceEmbeddings.InsertOneAsync(employeeFaceEmbedding);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
|
||||
{
|
||||
await _employeeFaceEmbeddings.ReplaceOneAsync(
|
||||
x => x.Id == employeeFaceEmbedding.Id,
|
||||
employeeFaceEmbedding);
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbedding> GetByIdAsync(string id)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.EmployeeId == employeeId)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => x.WorkshopId == workshopId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds)
|
||||
{
|
||||
return await _employeeFaceEmbeddings
|
||||
.Find(x => workshopIds.First()==x.WorkshopId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string id)
|
||||
{
|
||||
await _employeeFaceEmbeddings.DeleteOneAsync(x => x.Id == id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
|
||||
public enum ApkType
|
||||
{
|
||||
WebView,
|
||||
FaceDetection
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
|
||||
public record AndroidApkVersionInfo(int LatestVersionCode, string LatestVersionName, bool ShouldUpdate, bool IsForceUpdate, string DownloadUrl, string ReleaseNotes);
|
||||
|
||||
public interface IAndroidApkVersionApplication
|
||||
{
|
||||
Task<OperationResult> CreateAndActive(IFormFile file);
|
||||
Task<OperationResult> CreateAndDeActive(IFormFile file);
|
||||
Task<string> GetLatestActiveVersionPath();
|
||||
Task<OperationResult> CreateAndActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false);
|
||||
Task<OperationResult> CreateAndDeActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false);
|
||||
Task<string> GetLatestActiveVersionPath(ApkType apkType);
|
||||
Task<AndroidApkVersionInfo> GetLatestActiveInfo(ApkType apkType, int currentVersionCode);
|
||||
OperationResult Remove(long id);
|
||||
|
||||
bool HasAndroidApkToDownload();
|
||||
bool HasAndroidApkToDownload(ApkType apkType);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
@@ -133,6 +134,15 @@ public class CheckoutViewModel
|
||||
/// </summary>
|
||||
public string TotalPaidLeave { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا فیش نیاز به بروزرسانی دارد
|
||||
/// </summary>
|
||||
public bool IsUpdateNeeded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست پیام های هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public List<CheckoutWarningMessageModel> CheckoutWarningMessageList { get; set; }
|
||||
|
||||
public bool HasSignCheckout { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Checkout;
|
||||
|
||||
/// <summary>
|
||||
/// مدل هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public class CheckoutWarningMessageModel
|
||||
{
|
||||
/// <summary>
|
||||
/// پیام هشدار
|
||||
/// </summary>
|
||||
public string WarningMessage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آی دی فیش حقوقی
|
||||
/// </summary>
|
||||
public long CheckoutId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; set; }
|
||||
}
|
||||
@@ -25,4 +25,5 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
|
||||
public int LeavePermittedDays { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
|
||||
public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
public bool HasLeft { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
public class EmployeeFaceEmbeddingDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public List<double> Embeddings { get; set; }
|
||||
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
public class EmployeeFaceEmbeddingMetadataDto
|
||||
{
|
||||
public double AvgEyeDistanceNormalized { get; set; }
|
||||
public double AvgEyeToFaceRatio { get; set; }
|
||||
public double AvgFaceAspectRatio { get; set; }
|
||||
public double AvgDetectionConfidence { get; set; }
|
||||
public EmployeeFaceEmbeddingKeypointsDto AvgKeypointsNormalized { get; set; }
|
||||
public List<ImageMetadataDto> PerImageMetadata { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeFaceEmbeddingKeypointsDto
|
||||
{
|
||||
public double[] LeftEye { get; set; }
|
||||
public double[] RightEye { get; set; }
|
||||
public double[] Nose { get; set; }
|
||||
public double[] MouthLeft { get; set; }
|
||||
public double[] MouthRight { get; set; }
|
||||
}
|
||||
|
||||
public class ImageMetadataDto
|
||||
{
|
||||
public double FaceAspectRatio { get; set; }
|
||||
public double EyeDistanceNormalized { get; set; }
|
||||
public double EyeToFaceRatio { get; set; }
|
||||
public double DetectionConfidence { get; set; }
|
||||
public EmployeeFaceEmbeddingKeypointsDto KeypointsNormalized { get; set; }
|
||||
}
|
||||
|
||||
public class EmbeddingHistoryItemDto
|
||||
{
|
||||
public List<double> Embedding { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
public double Confidence { get; set; }
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
public class MetadataHistoryItemDto
|
||||
{
|
||||
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
public double Confidence { get; set; }
|
||||
public double RefinementPercentage { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
/// <summary>
|
||||
/// سرویس مدیریت Embedding چهره کارکنان
|
||||
/// این سرویس فقط برای دریافت و ارسال داده است و هیچ command-driven نیست
|
||||
/// </summary>
|
||||
public interface IEmployeeFaceEmbeddingApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت embedding بر اساس شناسه
|
||||
/// </summary>
|
||||
Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت embedding بر اساس شناسه کارمند
|
||||
/// </summary>
|
||||
Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست embeddings بر اساس شناسه کارگاه
|
||||
/// </summary>
|
||||
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست embeddings بر اساس لیست شناسه کارگاهها
|
||||
/// </summary>
|
||||
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds);
|
||||
|
||||
/// <summary>
|
||||
/// ذخیره یا بهروزرسانی embedding
|
||||
/// اگر Id وجود داشته باشد، بهروزرسانی میشود، در غیر این صورت ایجاد میشود
|
||||
/// </summary>
|
||||
Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto);
|
||||
|
||||
/// <summary>
|
||||
/// حذف embedding
|
||||
/// </summary>
|
||||
Task DeleteAsync(string id);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Server.HttpSys;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
@@ -87,12 +90,17 @@ public class GetInstitutionContractListItemsViewModel
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
public List<InstitutionContractListWorkshop> Workshops { get; set; }
|
||||
|
||||
public bool IsInPersonContract { get; set; }
|
||||
|
||||
public bool IsOldContract { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractListWorkshop
|
||||
{
|
||||
public string WorkshopName { get; set; }
|
||||
public int EmployeeCount { get; set; }
|
||||
public string Price { get; set; }
|
||||
public WorkshopServicesViewModel WorkshopServices { get; set; }
|
||||
}
|
||||
|
||||
@@ -100,22 +108,31 @@ public class WorkshopServicesViewModel
|
||||
{
|
||||
public bool Insurance { get; set; }
|
||||
public string InsuranceLabel => "ارسال لیست بیمه";
|
||||
public string InsurancePrice { get; set; }
|
||||
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
public string InsuranceInPersonLabel => "خدمات مستقیم";
|
||||
|
||||
public string InsuranceInPersonPrice { get; set; }
|
||||
|
||||
|
||||
public bool Contract { get; set; }
|
||||
public string ContractLabel => "قرارداد و تصفیه حساب";
|
||||
|
||||
public string ContractPrice { get; set; }
|
||||
|
||||
|
||||
public bool ContractInPerson { get; set; }
|
||||
public string ContractInPersonLabel => "خدمات مستقیم";
|
||||
|
||||
public string ContractInPersonPrice { get; set; }
|
||||
|
||||
public bool RollCall { get; set; }
|
||||
public string RollCallLabel => "ساعت حضور و غیاب";
|
||||
|
||||
public string RollCallPrice { get; set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
public string RollCallInPersonLabel => "خدمات مستقیم";
|
||||
|
||||
public string RollCallInPersonPrice { get; set; }
|
||||
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
public string CustomizeCheckoutLabel => "فیش غیر رسمی";
|
||||
public string CustomizeCheckoutPrice { get; set; }
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
@@ -77,6 +78,8 @@ public interface IInstitutionContractApplication
|
||||
/// <returns>لیست قراردادها برای چاپ</returns>
|
||||
List<InstitutionContractViewModel> PrintAll(List<long> id);
|
||||
|
||||
|
||||
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
||||
/// <summary>
|
||||
/// چاپ یک قرارداد
|
||||
/// </summary>
|
||||
@@ -234,26 +237,56 @@ public interface IInstitutionContractApplication
|
||||
#region Upgrade (Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Task<OperationResult> ResendVerifyLink(long institutionContractId);
|
||||
|
||||
/// <summary>
|
||||
/// دیتای پرینت قرارداد مالی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
|
||||
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
|
||||
}
|
||||
|
||||
public class InsitutionContractAmendmentPaymentRequest
|
||||
public class GetInstitutionContractWorkshopsDetails
|
||||
{
|
||||
List<WorkshopTempViewModel> Workshops { get; set; }
|
||||
public long InstitutionContractId { get; set; }
|
||||
public List<InstitutionContractListWorkshop> Workshops { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class InsitutionContractAmendmentPaymentResponse
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
{
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
|
||||
public InstitutionContratVerificationParty FirstParty { get; set; }
|
||||
public InstitutionContratVerificationParty SecondParty { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public string OneMonthAmount { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
public string Obligation { get; set; }
|
||||
}
|
||||
|
||||
public class InsertAmendmentTempWorkshopResponse
|
||||
{
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentWorkshopsResponse
|
||||
@@ -261,7 +294,9 @@ public class InstitutionContractAmendmentWorkshopsResponse
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<WorkshopTempViewModel> Workshops { get; set; }
|
||||
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
|
||||
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentResponse
|
||||
{
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public string OneMonthAmount { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractAmendmentTempWorkshopViewModel
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
|
||||
public double Price{ get; set; }
|
||||
public string PriceStr{ get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -31,6 +31,50 @@ public interface IInsuranceListApplication
|
||||
double GetRoundValue(double value);
|
||||
OperationResult ConfirmInsuranceList(long id);
|
||||
|
||||
#region New
|
||||
/// <summary>
|
||||
/// دستمزد روزانه مشاغل مقطوع بیمه
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="startDateGr"></param>
|
||||
/// <param name="endDateGr"></param>
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="population"></param>
|
||||
/// <param name="insuranceJobId"></param>
|
||||
/// <returns></returns>
|
||||
double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr,
|
||||
DateTime? endDateGr, long jobId, string population, long? insuranceJobId);
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه مزایای ماهانه
|
||||
/// </summary>
|
||||
/// <param name="endMonthCurrentDay"></param>
|
||||
/// <param name="consumableItemsItemValue"></param>
|
||||
/// <param name="housingAllowanceItemValue"></param>
|
||||
/// <param name="maritalStatus"></param>
|
||||
/// <param name="countWorkingDays"></param>
|
||||
/// <param name="typeOfInsuranceSendWorkshop"></param>
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="includeStatus"></param>
|
||||
/// <returns></returns>
|
||||
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue,
|
||||
double housingAllowanceItemValue, double maritalStatus, int countWorkingDays,
|
||||
string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="yearlysalaryItemValue"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <returns></returns>
|
||||
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year);
|
||||
|
||||
#endregion
|
||||
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);
|
||||
|
||||
//farokhiChanges
|
||||
|
||||
@@ -17,4 +17,14 @@ public class CreatePaymentTransaction
|
||||
/// مسیر برگشت پس از پرداخت
|
||||
/// </summary>
|
||||
public string CallBackUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع درگاه
|
||||
/// </summary>
|
||||
public PaymentTransactionGateWay Gateway { get; set; }
|
||||
}
|
||||
public enum PaymentTransactionGateWay
|
||||
{
|
||||
AqayePardakht = 1,
|
||||
SepehrPay = 2
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public interface IPaymentTransactionApplication
|
||||
/// <param name="cardNumber"></param>
|
||||
/// <param name="bankName"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName, string rrn, string digitalReceipt);
|
||||
|
||||
Task<OperationResult> SetTransactionId(long id, string transactionId);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int ContractSignNotDone { get; set; }
|
||||
public int ContractSignDone { get; set; }
|
||||
|
||||
public int ContractSignToBe { get; set; }
|
||||
|
||||
//تصفیه
|
||||
public int AllCheckout { get; set; }
|
||||
public int CheckoutNotDone { get; set; }
|
||||
@@ -34,6 +36,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int CheckoutSignNotDone { get; set; }
|
||||
public int CheckoutSignDone { get; set; }
|
||||
|
||||
public int CheckoutSignToBe { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,21 +10,23 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshops(string year, string month);
|
||||
Task<AllReport> GetAllReports(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using AccountManagement.Domain.TaskAgg;
|
||||
using ApkReader;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.Application.Helpers;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
@@ -24,7 +22,7 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
_taskRepository = taskRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> CreateAndActive(IFormFile file)
|
||||
public async Task<OperationResult> CreateAndActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false)
|
||||
{
|
||||
OperationResult op = new OperationResult();
|
||||
|
||||
@@ -36,22 +34,26 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
if (Path.GetExtension(file.FileName).ToLower() != ".apk")
|
||||
return op.Failed("لطفا فایلی با پسوند .apk وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(versionName))
|
||||
return op.Failed("لطفا نام ورژن را وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(versionCode))
|
||||
return op.Failed("لطفا کد ورژن را وارد کنید");
|
||||
|
||||
#endregion
|
||||
|
||||
var activeApks = _androidApkVersionRepository.GetActives();
|
||||
var activeApks = _androidApkVersionRepository.GetActives(apkType);
|
||||
|
||||
await activeApks.ExecuteUpdateAsync(setter => setter.SetProperty(e => e.IsActive, IsActive.False));
|
||||
_androidApkVersionRepository.SaveChanges();
|
||||
|
||||
var folderName = apkType == ApkType.WebView ? "GozreshgirWebView" : "GozreshgirFaceDetection";
|
||||
var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
|
||||
"Apk", "Android", "GozreshgirWebView");
|
||||
"Apk", "Android", folderName);
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
//var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
|
||||
|
||||
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}{Path.GetExtension(file.FileName)}";
|
||||
|
||||
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{versionName}{Path.GetExtension(file.FileName)}";
|
||||
|
||||
string filepath = Path.Combine(path, uniqueFileName);
|
||||
|
||||
@@ -60,13 +62,13 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
await file.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
var entity = new AndroidApkVersion("0", "0", IsActive.True, filepath);
|
||||
var entity = new AndroidApkVersion(versionName, versionCode, IsActive.True, filepath,apkType,isForce);
|
||||
_androidApkVersionRepository.Create(entity);
|
||||
_androidApkVersionRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> CreateAndDeActive(IFormFile file)
|
||||
public async Task<OperationResult> CreateAndDeActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false)
|
||||
{
|
||||
OperationResult op = new OperationResult();
|
||||
|
||||
@@ -78,18 +80,22 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
if (Path.GetExtension(file.FileName).ToLower() != ".apk")
|
||||
return op.Failed("لطفا فایلی با پسوند .apk وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(versionName))
|
||||
return op.Failed("لطفا نام ورژن را وارد کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(versionCode))
|
||||
return op.Failed("لطفا کد ورژن را وارد کنید");
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
var folderName = apkType == ApkType.WebView ? "GozreshgirWebView" : "GozreshgirFaceDetection";
|
||||
var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
|
||||
"Apk", "Android", "GozreshgirWebView");
|
||||
"Apk", "Android", folderName);
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
|
||||
|
||||
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{apk.VersionName}{Path.GetExtension(file.FileName)}";
|
||||
|
||||
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{versionName}{Path.GetExtension(file.FileName)}";
|
||||
|
||||
string filepath = Path.Combine(path, uniqueFileName);
|
||||
|
||||
@@ -98,14 +104,15 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
await file.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
var entity = new AndroidApkVersion(apk.VersionName, apk.VersionCode, IsActive.False, filepath);
|
||||
var entity = new AndroidApkVersion(versionName, versionCode, IsActive.False, filepath,apkType);
|
||||
_androidApkVersionRepository.Create(entity);
|
||||
_androidApkVersionRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<string> GetLatestActiveVersionPath()
|
||||
public async Task<string> GetLatestActiveVersionPath(ApkType apkType)
|
||||
{
|
||||
return await _androidApkVersionRepository.GetLatestActiveVersionPath();
|
||||
return await _androidApkVersionRepository.GetLatestActiveVersionPath(apkType);
|
||||
}
|
||||
|
||||
public OperationResult Remove(long id)
|
||||
@@ -127,8 +134,22 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public bool HasAndroidApkToDownload()
|
||||
public bool HasAndroidApkToDownload(ApkType apkType)
|
||||
{
|
||||
return _androidApkVersionRepository.Exists(x => x.IsActive == IsActive.True);
|
||||
return _androidApkVersionRepository.Exists(x => x.IsActive == IsActive.True && x.ApkType == apkType);
|
||||
}
|
||||
|
||||
public Task<AndroidApkVersionInfo> GetLatestActiveInfo(ApkType apkType, int currentVersionCode)
|
||||
{
|
||||
var latest = _androidApkVersionRepository.GetLatestActive(apkType);
|
||||
if (latest == null)
|
||||
return Task.FromResult(new AndroidApkVersionInfo(0, "0", false, false, string.Empty, string.Empty));
|
||||
|
||||
// Return API endpoint for downloading APK file
|
||||
var fileUrl = $"/api/android-apk/download?type={apkType}";
|
||||
int latestCode = 0;
|
||||
int.TryParse(latest.VersionCode, out latestCode);
|
||||
var shouldUpdate = latestCode > currentVersionCode;
|
||||
return Task.FromResult(new AndroidApkVersionInfo(latestCode, latest.VersionName, shouldUpdate, latest.IsForce, fileUrl, "Bug fixes and improvements"));
|
||||
}
|
||||
}
|
||||
@@ -193,8 +193,19 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
//حق بیمه سهم کارگر
|
||||
#region InsuranceDeduction
|
||||
|
||||
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
|
||||
var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
|
||||
double insuranceDeduction = 0;
|
||||
bool hasInsuranceShareTheSameAsList = false;
|
||||
if (command.InsuranceDeduction == 0)
|
||||
{
|
||||
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
|
||||
insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
insuranceDeduction = command.InsuranceDeduction;
|
||||
hasInsuranceShareTheSameAsList = true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -375,7 +386,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
|
||||
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
|
||||
, command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute,
|
||||
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours);
|
||||
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours, hasInsuranceShareTheSameAsList);
|
||||
|
||||
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
|
||||
//_checkoutRepository.SaveChanges();
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ApkReader" Version="2.0.1.1" />
|
||||
<PackageReference Include="AndroidXml" Version="1.1.24" />
|
||||
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -373,7 +373,9 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
}).OrderBy(x => x.Color switch { "orange" => 0, "white" => 1, "red" => 2, "green" => 3, "black" => 4, _ => 5 })
|
||||
.ToList();
|
||||
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ using Company.Domain.LeftWorkAgg;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -61,29 +62,31 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
private readonly IEmployeeAuthorizeTempRepository _employeeAuthorizeTempRepository;
|
||||
private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
|
||||
private readonly IFaceEmbeddingService _faceEmbeddingService;
|
||||
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_uidService = uidService;
|
||||
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
||||
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
}
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IFaceEmbeddingService faceEmbeddingService) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_uidService = uidService;
|
||||
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
||||
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
_faceEmbeddingService = faceEmbeddingService;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateEmployee command)
|
||||
public OperationResult Create(CreateEmployee command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
if (_EmployeeRepository.Exists(x =>
|
||||
@@ -1122,6 +1125,12 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
rollCallEmployee.HasImage();
|
||||
_rollCallEmployeeRepository.Create(rollCallEmployee);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
string employeeFullName = employee.FName + " " + employee.LName;
|
||||
var res = _faceEmbeddingService.GenerateEmbeddingsAsync(employee.id,command.WorkshopId,employeeFullName, filePath1,filePath2).GetAwaiter().GetResult();
|
||||
if (!res.IsSuccedded)
|
||||
{
|
||||
return op.Failed(res.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
170
CompanyManagment.Application/EmployeeFaceEmbeddingApplication.cs
Normal file
170
CompanyManagment.Application/EmployeeFaceEmbeddingApplication.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.EmployeeFaceEmbeddingAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class EmployeeFaceEmbeddingApplication : IEmployeeFaceEmbeddingApplication
|
||||
{
|
||||
private readonly IEmployeeFaceEmbeddingRepository _repository;
|
||||
|
||||
public EmployeeFaceEmbeddingApplication(IEmployeeFaceEmbeddingRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
return entity == null ? null : MapToDto(entity);
|
||||
}
|
||||
|
||||
public async Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId)
|
||||
{
|
||||
var entity = await _repository.GetByEmployeeIdAsync(employeeId);
|
||||
return entity == null ? null : MapToDto(entity);
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId)
|
||||
{
|
||||
var entities = await _repository.GetByWorkshopIdAsync(workshopId);
|
||||
return entities.Select(MapToDto).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds)
|
||||
{
|
||||
var entities = await _repository.GetByWorkshopIdsAsync(workshopIds);
|
||||
return entities.Select(MapToDto).ToList();
|
||||
}
|
||||
|
||||
public async Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dto.Id))
|
||||
{
|
||||
// ایجاد جدید
|
||||
var metadata = MapMetadataFromDto(dto.Metadata);
|
||||
var entity = new EmployeeFaceEmbedding(
|
||||
dto.EmployeeFullName,
|
||||
dto.EmployeeId,
|
||||
dto.WorkshopId,
|
||||
dto.Embeddings,
|
||||
metadata
|
||||
);
|
||||
|
||||
await _repository.CreateAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// بهروزرسانی
|
||||
var entity = await _repository.GetByIdAsync(dto.Id);
|
||||
if (entity == null)
|
||||
throw new Exception($"EmployeeFaceEmbedding با شناسه {dto.Id} یافت نشد");
|
||||
|
||||
entity.UpdateEmployeeInfo(dto.EmployeeFullName, dto.WorkshopId);
|
||||
entity.UpdateEmbedding(dto.Embeddings, 0, 0);
|
||||
entity.UpdateMetadata(MapMetadataFromDto(dto.Metadata), 0, 0);
|
||||
|
||||
await _repository.UpdateAsync(entity);
|
||||
return entity.Id;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string id)
|
||||
{
|
||||
await _repository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
#region Mapping Methods
|
||||
|
||||
private EmployeeFaceEmbeddingDto MapToDto(EmployeeFaceEmbedding entity)
|
||||
{
|
||||
return new EmployeeFaceEmbeddingDto
|
||||
{
|
||||
Id = entity.Id,
|
||||
EmployeeFullName = entity.EmployeeFullName,
|
||||
EmployeeId = entity.EmployeeId,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
Embeddings = entity.Embeddings,
|
||||
Metadata = MapMetadataToDto(entity.Metadata)
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingMetadataDto MapMetadataToDto(EmployeeFaceEmbeddingMetadata metadata)
|
||||
{
|
||||
if (metadata == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingMetadataDto
|
||||
{
|
||||
AvgEyeDistanceNormalized = metadata.AvgEyeDistanceNormalized,
|
||||
AvgEyeToFaceRatio = metadata.AvgEyeToFaceRatio,
|
||||
AvgFaceAspectRatio = metadata.AvgFaceAspectRatio,
|
||||
AvgDetectionConfidence = metadata.AvgDetectionConfidence,
|
||||
AvgKeypointsNormalized = MapKeypointsToDto(metadata.AvgKeypointsNormalized),
|
||||
PerImageMetadata = metadata.PerImageMetadata?.Select(x => new ImageMetadataDto
|
||||
{
|
||||
FaceAspectRatio = x.FaceAspectRatio,
|
||||
EyeDistanceNormalized = x.EyeDistanceNormalized,
|
||||
EyeToFaceRatio = x.EyeToFaceRatio,
|
||||
DetectionConfidence = x.DetectionConfidence,
|
||||
KeypointsNormalized = MapKeypointsToDto(x.KeypointsNormalized)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingKeypointsDto MapKeypointsToDto(EmployeeFaceEmbeddingKeypoints keypoints)
|
||||
{
|
||||
if (keypoints == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingKeypointsDto
|
||||
{
|
||||
LeftEye = keypoints.LeftEye,
|
||||
RightEye = keypoints.RightEye,
|
||||
Nose = keypoints.Nose,
|
||||
MouthLeft = keypoints.MouthLeft,
|
||||
MouthRight = keypoints.MouthRight
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingMetadata MapMetadataFromDto(EmployeeFaceEmbeddingMetadataDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingMetadata
|
||||
{
|
||||
AvgEyeDistanceNormalized = dto.AvgEyeDistanceNormalized,
|
||||
AvgEyeToFaceRatio = dto.AvgEyeToFaceRatio,
|
||||
AvgFaceAspectRatio = dto.AvgFaceAspectRatio,
|
||||
AvgDetectionConfidence = dto.AvgDetectionConfidence,
|
||||
AvgKeypointsNormalized = MapKeypointsFromDto(dto.AvgKeypointsNormalized),
|
||||
PerImageMetadata = dto.PerImageMetadata?.Select(x => new ImageMetadata
|
||||
{
|
||||
FaceAspectRatio = x.FaceAspectRatio,
|
||||
EyeDistanceNormalized = x.EyeDistanceNormalized,
|
||||
EyeToFaceRatio = x.EyeToFaceRatio,
|
||||
DetectionConfidence = x.DetectionConfidence,
|
||||
KeypointsNormalized = MapKeypointsFromDto(x.KeypointsNormalized)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
private EmployeeFaceEmbeddingKeypoints MapKeypointsFromDto(EmployeeFaceEmbeddingKeypointsDto dto)
|
||||
{
|
||||
if (dto == null) return null;
|
||||
|
||||
return new EmployeeFaceEmbeddingKeypoints
|
||||
{
|
||||
LeftEye = dto.LeftEye,
|
||||
RightEye = dto.RightEye,
|
||||
Nose = dto.Nose,
|
||||
MouthLeft = dto.MouthLeft,
|
||||
MouthRight = dto.MouthRight
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -106,8 +106,11 @@ public class FinancialStatmentApplication : IFinancialStatmentApplication
|
||||
debtor = command.DeptorString.MoneyToDouble();
|
||||
|
||||
}
|
||||
|
||||
var tDateGr = command.TdateFa.ToGeorgianDateTime();
|
||||
|
||||
if (!command.TdateFa.TryToGeorgianDateTime(out var tDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده صحیح نمی باشد");
|
||||
}
|
||||
if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == command.ContractingPartyId))
|
||||
{
|
||||
var financialStatment = _financialStatmentRepository.GetDetailsByContractingPartyId(command.ContractingPartyId);
|
||||
|
||||
132
CompanyManagment.Application/Helpers/ApkHelper.cs
Normal file
132
CompanyManagment.Application/Helpers/ApkHelper.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace CompanyManagment.Application.Helpers
|
||||
{
|
||||
public class ApkInfo
|
||||
{
|
||||
public string VersionName { get; set; } = string.Empty;
|
||||
public string VersionCode { get; set; } = string.Empty;
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
public string ApplicationLabel { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public static class ApkHelper
|
||||
{
|
||||
public static ApkInfo ReadApkInfo(Stream apkStream)
|
||||
{
|
||||
var apkInfo = new ApkInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using var archive = new ZipArchive(apkStream, ZipArchiveMode.Read, true);
|
||||
var manifestEntry = archive.GetEntry("AndroidManifest.xml");
|
||||
|
||||
if (manifestEntry == null)
|
||||
{
|
||||
throw new InvalidOperationException("AndroidManifest.xml not found in APK file");
|
||||
}
|
||||
|
||||
using var manifestStream = manifestEntry.Open();
|
||||
using var memoryStream = new MemoryStream();
|
||||
manifestStream.CopyTo(memoryStream);
|
||||
var manifestBytes = memoryStream.ToArray();
|
||||
|
||||
// Parse the binary AndroidManifest.xml
|
||||
apkInfo = ParseBinaryManifest(manifestBytes);
|
||||
|
||||
// Validate that we found at least version information
|
||||
if (string.IsNullOrEmpty(apkInfo.VersionCode) && string.IsNullOrEmpty(apkInfo.VersionName))
|
||||
{
|
||||
throw new InvalidOperationException("Could not extract version information from APK");
|
||||
}
|
||||
|
||||
return apkInfo;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException($"Error reading APK file: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static ApkInfo ParseBinaryManifest(byte[] manifestBytes)
|
||||
{
|
||||
var apkInfo = new ApkInfo();
|
||||
|
||||
try
|
||||
{
|
||||
// Convert bytes to string for regex parsing
|
||||
var text = System.Text.Encoding.UTF8.GetString(manifestBytes);
|
||||
|
||||
// Extract package name
|
||||
var packageMatch = Regex.Match(text, @"package[^a-zA-Z]+([a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)+)", RegexOptions.IgnoreCase);
|
||||
if (packageMatch.Success)
|
||||
{
|
||||
apkInfo.PackageName = packageMatch.Groups[1].Value;
|
||||
}
|
||||
|
||||
// Extract version code - look for numeric values that could be version codes
|
||||
var versionCodeMatch = Regex.Match(text, @"versionCode[^\d]*(\d+)", RegexOptions.IgnoreCase);
|
||||
if (versionCodeMatch.Success)
|
||||
{
|
||||
apkInfo.VersionCode = versionCodeMatch.Groups[1].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback: try to find reasonable numeric values
|
||||
var numbers = Regex.Matches(text, @"\b(\d{1,8})\b");
|
||||
foreach (Match numMatch in numbers)
|
||||
{
|
||||
if (int.TryParse(numMatch.Groups[1].Value, out int num) && num > 0 && num < 99999999)
|
||||
{
|
||||
apkInfo.VersionCode = num.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extract version name
|
||||
var versionNameMatch = Regex.Match(text, @"versionName[^\d]*(\d+(?:\.\d+)*(?:\.\d+)*)", RegexOptions.IgnoreCase);
|
||||
if (versionNameMatch.Success)
|
||||
{
|
||||
apkInfo.VersionName = versionNameMatch.Groups[1].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback: look for version-like patterns
|
||||
var versionMatch = Regex.Match(text, @"\b(\d+\.\d+(?:\.\d+)*)\b");
|
||||
if (versionMatch.Success)
|
||||
{
|
||||
apkInfo.VersionName = versionMatch.Groups[1].Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Set defaults if nothing found
|
||||
if (string.IsNullOrEmpty(apkInfo.VersionCode))
|
||||
apkInfo.VersionCode = "1";
|
||||
|
||||
if (string.IsNullOrEmpty(apkInfo.VersionName))
|
||||
apkInfo.VersionName = "1.0";
|
||||
|
||||
if (string.IsNullOrEmpty(apkInfo.PackageName))
|
||||
apkInfo.PackageName = "unknown.package";
|
||||
|
||||
return apkInfo;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Return default values if parsing fails
|
||||
return new ApkInfo
|
||||
{
|
||||
VersionCode = "1",
|
||||
VersionName = "1.0",
|
||||
PackageName = "unknown.package"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,8 +1140,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
@@ -1203,7 +1203,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
|
||||
var code = new Random().Next(1000, 9999).ToString();
|
||||
institutionContract.SetVerifyCode(code);
|
||||
|
||||
var contractingPartyFullName = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.FName + " " + contractingParty.LName
|
||||
: contractingParty.CeoFName + " " + contractingParty.CeoLName;
|
||||
|
||||
institutionContract.SetVerifyCode(code,contractingPartyFullName ,contractingParty.Phone);
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
try
|
||||
@@ -1340,11 +1345,53 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return await _institutionContractRepository.GetAmendmentWorkshops(institutionContractId);
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
return await _institutionContractRepository.InsertAmendmentTempWorkshops(request);
|
||||
}
|
||||
|
||||
public Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
return _institutionContractRepository.RemoveAmendmentWorkshops(workshopTempId);
|
||||
}
|
||||
|
||||
public Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
return _institutionContractRepository.GetAmendmentPaymentDetails(request);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> ResendVerifyLink(long institutionContractId)
|
||||
{
|
||||
var institutionContract = _institutionContractRepository.Get(institutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
{
|
||||
throw new NotFoundException("رکورد مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
if (institutionContract.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
{
|
||||
throw new BadRequestException("این قرارداد مالی در وضعیت مناسبی برای ارسال مجدد لینک تایید نمی باشد");
|
||||
}
|
||||
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
|
||||
{
|
||||
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
|
||||
}
|
||||
|
||||
public Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id)
|
||||
{
|
||||
return _institutionContractRepository.GetContractWorkshopsDetails(id);
|
||||
}
|
||||
|
||||
|
||||
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
|
||||
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
|
||||
@@ -1440,7 +1487,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return operation.Succcedded(personalContractingParty);
|
||||
}
|
||||
|
||||
private List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
public static List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
string loanStartDate, bool getRounded)
|
||||
{
|
||||
int day = Convert.ToInt32(loanStartDate.Substring(8, 2));
|
||||
|
||||
@@ -1707,7 +1707,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
return result;
|
||||
}
|
||||
|
||||
private double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
|
||||
public double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
|
||||
{
|
||||
|
||||
double? result = 0;
|
||||
@@ -1858,7 +1858,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <returns></returns>
|
||||
private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
|
||||
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
|
||||
{
|
||||
//ToDo
|
||||
//افزودن شرط مشمول مزایای
|
||||
@@ -1869,6 +1869,11 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
|
||||
if (isManager && !includeStatus)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء سیدعسکر موسوی زاده - فروشگاه ولی عصر
|
||||
if (employeeId == 1496)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء
|
||||
if (employeeId == 42783)
|
||||
return 53082855;
|
||||
@@ -1893,7 +1898,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
|
||||
|
||||
|
||||
private double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
|
||||
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
|
||||
{
|
||||
double dailyWage = yearlysalaryItemValue;
|
||||
InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
|
||||
|
||||
@@ -30,13 +30,14 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
|
||||
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
IContractApplication contractApplication, IWorkingHoursApplication workingHoursApplication,
|
||||
IWorkingHoursItemsApplication workingHoursItemsApplication, IEmployeeRepository employeeRepository,
|
||||
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
|
||||
IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_contractRepository = contractRepository;
|
||||
@@ -51,7 +52,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public OperationResult Create(CreateLeftWork command)
|
||||
{
|
||||
|
||||
// var Contracts = _contractRepository.Search(new ContractSearchModel()
|
||||
// {
|
||||
// EmployeeId = command.EmployeeId,
|
||||
@@ -70,7 +70,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
var start = command.StartWorkDate.ToGeorgianDateTime();
|
||||
|
||||
|
||||
|
||||
//if (_leftWorkRepository.Exists(x =>
|
||||
// x.StartWorkDate > start && x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
|
||||
// return operation.Failed("تاریخ وارد شده کوچکتر از سابقه شروع به کار قبلی است");
|
||||
@@ -112,16 +111,17 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
|
||||
|
||||
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
|
||||
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
|
||||
var workshopName = workshop.WorkshopFullName;
|
||||
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
|
||||
var workshopName = workshop.WorkshopFullName;
|
||||
var leftWork = new LeftWork(left, start, command.WorkshopId,
|
||||
command.EmployeeId, employeeFullName, workshopName, command.JobId, command.IncludeStatus,
|
||||
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,workshop.ComputeOptions,workshop.BonusesOptions);
|
||||
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, workshop.ComputeOptions,
|
||||
workshop.BonusesOptions);
|
||||
_leftWorkRepository.Create(leftWork);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
|
||||
|
||||
return operation.Succcedded();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
//public OperationResult Create(CreateLeftWork command)
|
||||
@@ -193,8 +193,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
command.EmployeeId, command.JobId, command.IncludeStatus, command.AddBonusesPay, command.AddYearsPay,
|
||||
command.AddLeavePay);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
return operation.Succcedded();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
public EditLeftWork GetDetails(long id)
|
||||
@@ -214,11 +214,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
|
||||
return _leftWorkRepository.SearchCreateContract(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
@@ -228,7 +226,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public string GetBeforeDate(string date)
|
||||
{
|
||||
|
||||
var persianBefore = "";
|
||||
var year = Convert.ToInt32(date.Substring(0, 4));
|
||||
var month = Convert.ToInt32(date.Substring(5, 2));
|
||||
@@ -255,10 +252,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void LeftWorkExtension(long contractId, string CStart, string CEnd)
|
||||
{
|
||||
|
||||
var step1 = _contractApplication.GetDetails(contractId);
|
||||
var step2 = _workingHoursApplication.GetByContractId(contractId);
|
||||
var step3 = _workingHoursItemsApplication.GetWorkingHoursItems();
|
||||
@@ -380,13 +375,11 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
ContarctStart = CStart,
|
||||
ContractEnd = CEnd,
|
||||
GetWorkDateHide = step1.GetWorkDate,
|
||||
|
||||
};
|
||||
var step5 = _contractApplication.MandatoryHours(computing);
|
||||
string workingDays = string.Empty;
|
||||
if (step5.NumberOfWorkingDays == "0")
|
||||
{
|
||||
|
||||
workingDays = step5.ComplexNumberOfWorkingDays;
|
||||
}
|
||||
else
|
||||
@@ -477,8 +470,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
OverTimeWorkM = step5.OverTimeWorkM == "0" ? "" : step5.OverTimeWorkM,
|
||||
OverNightWorkH = step5.OverNightWorkH == "0" ? "" : step5.OverNightWorkH,
|
||||
OverNightWorkM = step5.OverNightWorkM == "0" ? "" : step5.OverNightWorkM,
|
||||
|
||||
|
||||
};
|
||||
var resss = _contractApplication.Create(createNew);
|
||||
}
|
||||
@@ -529,7 +520,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
item.LeftWorkDate = string.IsNullOrWhiteSpace(item.LeftWorkDate) ? "1500/01/01" : item.LeftWorkDate;
|
||||
var left = item.LeftWorkDate.ToGeorgianDateTime();
|
||||
var start = item.StartWorkDate.ToGeorgianDateTime();
|
||||
if (_leftWorkRepository.Exists(x => x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id!=item.Id))
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("وارد کردن تاریخ پایان کار اجباری است ");
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate == start && x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
@@ -540,17 +533,23 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("شروع به کار قبلی این شخص ترک کار ندارد ");
|
||||
if (_leftWorkRepository.Exists(x => x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start &&
|
||||
x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
|
||||
}
|
||||
}
|
||||
|
||||
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
if (informationLeftwork != null && operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId);
|
||||
return operation;
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
if (informationLeftwork != null && operation.IsSuccedded)
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId,
|
||||
informationLeftwork.WorkshopId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
|
||||
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId,
|
||||
List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
@@ -560,7 +559,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
{
|
||||
foreach (var item2 in item.LeftWorkViewModels)
|
||||
{
|
||||
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate) ? "1500/01/01" : item2.LeftWorkDate;
|
||||
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate)
|
||||
? "1500/01/01"
|
||||
: item2.LeftWorkDate;
|
||||
var left = item2.LeftWorkDate.ToGeorgianDateTime();
|
||||
var start = item2.StartWorkDate.ToGeorgianDateTime();
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
@@ -586,14 +587,16 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
}
|
||||
|
||||
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups);
|
||||
if (operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
|
||||
return operation;
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId,
|
||||
commandPersonnelCode, leftWorkGroups);
|
||||
if (operation.IsSuccedded)
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type)
|
||||
{
|
||||
return _leftWorkRepository.CheckDeleteLeftWork( workshopId, employeeId, date.ToGeorgianDateTime(),type);
|
||||
return _leftWorkRepository.CheckDeleteLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
|
||||
}
|
||||
|
||||
public OperationResult CheckEditLeftWork(long workshopId, long employeeId, string date, int type)
|
||||
@@ -607,21 +610,23 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
|
||||
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId })
|
||||
.GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
|
||||
@@ -632,17 +637,90 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
x.WorkshopId,
|
||||
x.EmployeeId,
|
||||
y.LeftWorkDateGr,
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z =>
|
||||
z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
});
|
||||
|
||||
//shaping up the list to send as parameter to repository
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if(newRollCallRecords.Count > 0)
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x =>
|
||||
new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if (newRollCallRecords.Count > 0)
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
|
||||
|
||||
foreach (var rollCallEmployeeViewModel in rollCallsEmployee)
|
||||
{
|
||||
var maxLeftWork = leftWorks.FirstOrDefault(x => x.WorkshopId == rollCallEmployeeViewModel.WorkshopId);
|
||||
if (maxLeftWork == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var employeeStatus = _rollCallEmployeeRepository.GetBy(rollCallEmployeeViewModel.EmployeeId,
|
||||
rollCallEmployeeViewModel.WorkshopId);
|
||||
var rollCallEmployeeStatusList = employeeStatus.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
|
||||
{ EmployeeId = employeeId, WorkshopId = workshopId })
|
||||
.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.WorkshopId,
|
||||
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = x.StartWorkDateGr
|
||||
}).ToList();
|
||||
|
||||
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
|
||||
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
|
||||
|
||||
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
// {
|
||||
// x.WorkshopId,
|
||||
// x.EmployeeId,
|
||||
// y.LeftWorkDateGr,
|
||||
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
// });
|
||||
|
||||
|
||||
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
|
||||
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
|
||||
&& rollCallEmployeeStatus.EndDate.Date >
|
||||
maxLeftWork.LeftWorkDateGr);
|
||||
|
||||
if (status != null)
|
||||
{
|
||||
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = maxLeftWork.LeftWorkDateGr,
|
||||
RollCallStatusId = status.id
|
||||
};
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
|
||||
}
|
||||
|
||||
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -27,26 +27,30 @@ namespace CompanyManagment.Application;
|
||||
|
||||
public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
{
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IJobRepository _jobRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
private readonly IContractRepository _contractRepository;
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IJobRepository _jobRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
private readonly IContractRepository _contractRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
|
||||
|
||||
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository, ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository, IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository, IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_jobRepository = jobRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_contractRepository = contractRepository;
|
||||
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository,
|
||||
ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository,
|
||||
IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository,
|
||||
IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
|
||||
IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_jobRepository = jobRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_contractRepository = contractRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
}
|
||||
@@ -59,15 +63,16 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
{
|
||||
#region Validation
|
||||
|
||||
if (_leftWorkTempRepository.Exists(x=>x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
|
||||
if (_leftWorkTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
|
||||
{
|
||||
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
|
||||
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
|
||||
}
|
||||
|
||||
if (command.LeftWorkTime.TryToGeorgianDateTime(out var leftWorkDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (command.LastDayStanding.TryToGeorgianDateTime(out var lastDayStandingDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
@@ -101,7 +106,6 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if (leftWork.StartWorkDate >= leftWorkDateGr)
|
||||
//{
|
||||
// return op.Failed("ترک کار نمیتواند کوچک تر یا مساوی شروع به کار باشد");
|
||||
@@ -121,10 +125,10 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
// return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای قرارداد میباشد");
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr, lastDayStandingDateGr,
|
||||
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr,
|
||||
lastDayStandingDateGr,
|
||||
command.WorkshopId, employeeId, leftWork.JobId);
|
||||
|
||||
await _leftWorkTempRepository.CreateAsync(leftWorkTemp);
|
||||
@@ -135,61 +139,63 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
}
|
||||
|
||||
public Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId, long workshopId)
|
||||
{
|
||||
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
|
||||
}
|
||||
{
|
||||
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (_leftWorkRepository.Exists(x => x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId && x.LeftWorkDate >= startDateGr))
|
||||
{
|
||||
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
|
||||
}
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId &&
|
||||
x.LeftWorkDate >= startDateGr))
|
||||
{
|
||||
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
|
||||
}
|
||||
|
||||
|
||||
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
|
||||
{
|
||||
return op.Failed("سمت وارد شده نامعتبر است");
|
||||
}
|
||||
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
|
||||
{
|
||||
return op.Failed("سمت وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var defaultTime = new DateTime(2121, 03, 21);
|
||||
var defaultTime = new DateTime(2121, 03, 21);
|
||||
|
||||
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
|
||||
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
|
||||
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
|
||||
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
|
||||
|
||||
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
|
||||
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
|
||||
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
|
||||
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
|
||||
|
||||
await _leftWorkRepository.CreateAsync(newLeftWork);
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
|
||||
await _leftWorkRepository.CreateAsync(newLeftWork);
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
|
||||
|
||||
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
|
||||
if (rollCallStatus != null)
|
||||
{
|
||||
var startWork = newLeftWork.StartWorkDate;
|
||||
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
|
||||
if (rollCallStatus != null)
|
||||
{
|
||||
var startWork = newLeftWork.StartWorkDate;
|
||||
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
|
||||
}
|
||||
|
||||
}
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptLeftWork(AcceptLeftWorkTemp command)
|
||||
{
|
||||
@@ -237,9 +243,12 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
x.WorkshopId == leftWorkTemp.WorkshopId &&
|
||||
x.ContractStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
|
||||
{
|
||||
return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
return op.Failed(
|
||||
"این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
}
|
||||
|
||||
var transaction = await _rollCallEmployeeStatusRepository.BeginTransactionAsync();
|
||||
|
||||
leftWork.Edit(leftWorkDateGr, leftWork.StartWorkDate, leftWork.WorkshopId, leftWork.EmployeeId, leftWork.JobId,
|
||||
leftWork.IncludeStatus, leftWork.AddBonusesPay, leftWork.AddYearsPay, leftWork.AddLeavePay);
|
||||
|
||||
@@ -247,8 +256,9 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId);
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId, leftWork.WorkshopId);
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -259,45 +269,59 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
|
||||
public List<LeftWorkTempViewModel> GetLeftWorksByWorkshopId(long workshopId)
|
||||
{
|
||||
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
|
||||
|
||||
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
|
||||
{ EmployeeId = employeeId, WorkshopId = workshopId })
|
||||
.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
WorkshopId = x.WorkshopId,
|
||||
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = x.StartWorkDateGr
|
||||
}).ToList();
|
||||
|
||||
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
|
||||
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
|
||||
.Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId)).ToList();
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
|
||||
|
||||
var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
{
|
||||
x.WorkshopId,
|
||||
x.EmployeeId,
|
||||
y.LeftWorkDateGr,
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
});
|
||||
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
// {
|
||||
// x.WorkshopId,
|
||||
// x.EmployeeId,
|
||||
// y.LeftWorkDateGr,
|
||||
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
// });
|
||||
|
||||
//shaping up the list to send as parameter to repository
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
|
||||
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
|
||||
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
|
||||
&& rollCallEmployeeStatus.EndDate.Date >
|
||||
maxLeftWork.LeftWorkDateGr);
|
||||
|
||||
if (status != null)
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if (newRollCallRecords.Count > 0)
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
|
||||
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = maxLeftWork.LeftWorkDateGr,
|
||||
RollCallStatusId = status.id
|
||||
};
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
|
||||
}
|
||||
|
||||
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
command.ContractingPartyId,
|
||||
command.Amount,
|
||||
contractingPartyName,
|
||||
command.CallBackUrl);
|
||||
command.CallBackUrl,command.Gateway);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
@@ -87,7 +87,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName)
|
||||
public OperationResult SetSuccess(long paymentTransactionId,string cardNumber, string bankName, string rrn, string digitalReceipt)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
{
|
||||
return op.Failed("تراکنش مورد نظر یافت نشد");
|
||||
}
|
||||
paymentTransaction.SetPaid(cardNumber, bankName);
|
||||
paymentTransaction.SetPaid(cardNumber, bankName,rrn, digitalReceipt);
|
||||
_paymentTransactionRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
|
||||
@@ -29,67 +29,67 @@ public class ReportApplication : IReportApplication
|
||||
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
#region Print
|
||||
|
||||
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -674,7 +674,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
result.MonthlyValueAddedTaxStr= tenPercent.ToMoney();
|
||||
var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
|
||||
result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation(duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -230,6 +230,8 @@ public class CompanyContext : DbContext
|
||||
|
||||
#endregion
|
||||
|
||||
public DbSet<CheckoutWarningMessage> CheckoutWarningMessages { get; set; }
|
||||
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
||||
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.QualityTools.Testing.Fakes" Version="16.11.230815" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.5.0" />
|
||||
<PackageReference Include="Parbad.Gateway.Sepehr" Version="1.7.0" />
|
||||
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Hosting.Builder;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
@@ -19,10 +18,15 @@ public class AndroidApkVersionMapping:IEntityTypeConfiguration<AndroidApkVersion
|
||||
v => v.ToString(),
|
||||
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(5);
|
||||
|
||||
builder.Property(x => x.Title).HasMaxLength(50);
|
||||
builder.Property(x => x.ApkType).HasConversion(
|
||||
v => v.ToString(),
|
||||
v => (ApkType)Enum.Parse(typeof(ApkType), v)).HasMaxLength(20);
|
||||
|
||||
builder.Property(x => x.Title).HasMaxLength(200);
|
||||
builder.Property(x => x.VersionCode).HasMaxLength(20);
|
||||
builder.Property(x => x.VersionName).HasMaxLength(35);
|
||||
builder.Property(x => x.Path).HasMaxLength(255);
|
||||
builder.Property(x => x.IsForce);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -50,12 +50,18 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
|
||||
builder.Property(x => x.TotalDayOfLeaveCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
|
||||
|
||||
|
||||
builder.Property(x => x.EmployeeMandatoryHours).HasTimeSpanConversion();
|
||||
builder.HasOne(x => x.Workshop)
|
||||
.WithMany(x => x.Checkouts)
|
||||
.HasForeignKey(x => x.WorkshopId);
|
||||
|
||||
builder.HasMany(x => x.CheckoutWarningMessageList)
|
||||
.WithOne(x => x.Checkout)
|
||||
.HasForeignKey(x => x.CheckoutId);
|
||||
|
||||
|
||||
builder.OwnsMany(x => x.LoanInstallments, installments =>
|
||||
{
|
||||
installments.Property(x => x.AmountForMonth).HasMaxLength(25);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using _0_Framework.Application.Enums;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class CheckoutWarningMessageMapping : IEntityTypeConfiguration<CheckoutWarningMessage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CheckoutWarningMessage> builder)
|
||||
{
|
||||
builder.ToTable("CheckoutWarningMessage");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.WarningMessage).HasMaxLength(150);
|
||||
|
||||
builder.Property(x => x.TypeOfCheckoutWarning).HasConversion(
|
||||
v => v.ToString(),
|
||||
v => (TypeOfCheckoutWarning)Enum.Parse(typeof(TypeOfCheckoutWarning), v)).HasMaxLength(30);
|
||||
|
||||
builder.HasOne(x => x.Checkout)
|
||||
.WithMany(x => x.CheckoutWarningMessageList)
|
||||
.HasForeignKey(x => x.CheckoutId);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.VerifyCode).HasMaxLength(10);
|
||||
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
|
||||
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
|
||||
|
||||
builder.HasOne(x => x.InstitutionContract)
|
||||
.WithMany(x => x.Amendments)
|
||||
|
||||
@@ -30,6 +30,8 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
|
||||
|
||||
builder.Property(x => x.VerifyCode).HasMaxLength(20);
|
||||
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
|
||||
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
|
||||
|
||||
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);
|
||||
|
||||
|
||||
@@ -15,8 +15,12 @@ public class PaymentTransactionMapping:IEntityTypeConfiguration<PaymentTransacti
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.BankName).HasMaxLength(50);
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.Gateway).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.ContractingPartyName).HasMaxLength(255);
|
||||
builder.Property(x => x.CallBackUrl).HasMaxLength(500);
|
||||
builder.Property(x => x.Rrn).HasMaxLength(50);
|
||||
builder.Property(x => x.DigitalReceipt).HasMaxLength(50);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddVerifierdetailsininstituioncontractandamendment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "VerifyCodeCreation",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContracts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContracts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContractAmendments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContractAmendments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifyCodeCreation",
|
||||
table: "InstitutionContractAmendments");
|
||||
}
|
||||
}
|
||||
}
|
||||
11070
CompanyManagment.EFCore/Migrations/20251027125514_hasInsuranceShareTheSameAsList_checkoutTable.Designer.cs
generated
Normal file
11070
CompanyManagment.EFCore/Migrations/20251027125514_hasInsuranceShareTheSameAsList_checkoutTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class hasInsuranceShareTheSameAsList_checkoutTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasInsuranceShareTheSameAsList",
|
||||
table: "Checkouts",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasInsuranceShareTheSameAsList",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
11116
CompanyManagment.EFCore/Migrations/20251028121828_CheckoutWarningMessage.Designer.cs
generated
Normal file
11116
CompanyManagment.EFCore/Migrations/20251028121828_CheckoutWarningMessage.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CheckoutWarningMessage : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsUpdateNeeded",
|
||||
table: "Checkouts",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CheckoutWarningMessage",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WarningMessage = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: true),
|
||||
CheckoutId = table.Column<long>(type: "bigint", nullable: false),
|
||||
TypeOfCheckoutWarning = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CheckoutWarningMessage", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CheckoutWarningMessage_Checkouts_CheckoutId",
|
||||
column: x => x.CheckoutId,
|
||||
principalTable: "Checkouts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CheckoutWarningMessage_CheckoutId",
|
||||
table: "CheckoutWarningMessage",
|
||||
column: "CheckoutId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CheckoutWarningMessage");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsUpdateNeeded",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
11121
CompanyManagment.EFCore/Migrations/20251112143907_addGateways in transaction .Designer.cs
generated
Normal file
11121
CompanyManagment.EFCore/Migrations/20251112143907_addGateways in transaction .Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addGatewaysintransaction : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Gateway",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(35)",
|
||||
maxLength: 35,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Gateway",
|
||||
table: "PaymentTransactions");
|
||||
}
|
||||
}
|
||||
}
|
||||
11129
CompanyManagment.EFCore/Migrations/20251112151518_add rrn and digital receipt.Designer.cs
generated
Normal file
11129
CompanyManagment.EFCore/Migrations/20251112151518_add rrn and digital receipt.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addrrnanddigitalreceipt : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DigitalReceipt",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Rrn",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DigitalReceipt",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Rrn",
|
||||
table: "PaymentTransactions");
|
||||
}
|
||||
}
|
||||
}
|
||||
11134
CompanyManagment.EFCore/Migrations/20251115161128_AddApkTypeToAndroidApkVersion.Designer.cs
generated
Normal file
11134
CompanyManagment.EFCore/Migrations/20251115161128_AddApkTypeToAndroidApkVersion.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddApkTypeToAndroidApkVersion : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ApkType",
|
||||
table: "AndroidApkVersions",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApkType",
|
||||
table: "AndroidApkVersions");
|
||||
}
|
||||
}
|
||||
}
|
||||
11137
CompanyManagment.EFCore/Migrations/20251116081057_AddIsForceFieldToAndroidApkVersions.Designer.cs
generated
Normal file
11137
CompanyManagment.EFCore/Migrations/20251116081057_AddIsForceFieldToAndroidApkVersions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddIsForceFieldToAndroidApkVersions : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsForce",
|
||||
table: "AndroidApkVersions",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsForce",
|
||||
table: "AndroidApkVersions");
|
||||
}
|
||||
}
|
||||
}
|
||||
11137
CompanyManagment.EFCore/Migrations/20251116194223_add title max length in android apk.Designer.cs
generated
Normal file
11137
CompanyManagment.EFCore/Migrations/20251116194223_add title max length in android apk.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addtitlemaxlengthinandroidapk : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "AndroidApkVersions",
|
||||
type: "nvarchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(50)",
|
||||
oldMaxLength: 50,
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
table: "AndroidApkVersions",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("ApkType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -69,13 +74,16 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(5)
|
||||
.HasColumnType("nvarchar(5)");
|
||||
|
||||
b.Property<bool>("IsForce")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<string>("VersionCode")
|
||||
.HasMaxLength(20)
|
||||
@@ -415,6 +423,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<bool>("HasAmountConflict")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasInsuranceShareTheSameAsList")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasRollCall")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -431,6 +442,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<bool>("IsUpdateNeeded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LeaveCheckout")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -543,6 +557,33 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("Checkouts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<long>("CheckoutId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("TypeOfCheckoutWarning")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("WarningMessage")
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("nvarchar(150)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("CheckoutId");
|
||||
|
||||
b.ToTable("CheckoutWarningMessage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3205,6 +3246,14 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(122)
|
||||
.HasColumnType("nvarchar(122)");
|
||||
|
||||
b.Property<string>("VerifierFullName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("VerifierPhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
@@ -3247,10 +3296,21 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("VerificationCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("VerifierFullName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("VerifierPhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("VerifyCodeCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
@@ -4938,6 +4998,19 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("DigitalReceipt")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Gateway")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<string>("Rrn")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
@@ -7192,6 +7265,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Workshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.CheckoutAgg.Checkout", "Checkout")
|
||||
.WithMany("CheckoutWarningMessageList")
|
||||
.HasForeignKey("CheckoutId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Checkout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee")
|
||||
@@ -10711,6 +10795,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("PetitionsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b =>
|
||||
{
|
||||
b.Navigation("CheckoutWarningMessageList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b =>
|
||||
{
|
||||
b.Navigation("ContractingPartyBankAccounts");
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -15,13 +16,21 @@ public class AndroidApkVersionRepository:RepositoryBase<long, AndroidApkVersion>
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public IQueryable<AndroidApkVersion> GetActives()
|
||||
public IQueryable<AndroidApkVersion> GetActives(ApkType apkType)
|
||||
{
|
||||
return _companyContext.AndroidApkVersions.Where(x => x.IsActive == IsActive.True);
|
||||
return _companyContext.AndroidApkVersions.Where(x => x.IsActive == IsActive.True && x.ApkType == apkType);
|
||||
}
|
||||
|
||||
public async Task<string> GetLatestActiveVersionPath()
|
||||
public async Task<string> GetLatestActiveVersionPath(ApkType apkType)
|
||||
{
|
||||
return (await _companyContext.AndroidApkVersions.OrderByDescending(x=>x.CreationDate).FirstOrDefaultAsync(x => x.IsActive == IsActive.True)).Path;
|
||||
return (await _companyContext.AndroidApkVersions.OrderByDescending(x=>x.CreationDate).FirstOrDefaultAsync(x => x.IsActive == IsActive.True && x.ApkType == apkType)).Path;
|
||||
}
|
||||
|
||||
public AndroidApkVersion GetLatestActive(ApkType apkType)
|
||||
{
|
||||
return _companyContext.AndroidApkVersions
|
||||
.Where(x => x.IsActive == IsActive.True && x.ApkType == apkType)
|
||||
.OrderByDescending(x => x.CreationDate)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
@@ -524,6 +524,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
entity.SetLoanInstallment(command.LoanInstallments, command.InstallmentDeduction);
|
||||
entity.SetCheckoutRollCall(command.CheckoutRollCall);
|
||||
entity.SetEmployeeMandatoryHours(command.EmployeeMandatoryHours);
|
||||
if(command.HasInsuranceShareTheSameAsList)
|
||||
entity.SetInsuranceShare();
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
@@ -1689,7 +1691,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
return new List<CheckoutViewModel>();
|
||||
}
|
||||
#endregion
|
||||
var query = _context.CheckoutSet
|
||||
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
||||
.AsSplitQuery().Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
@@ -1724,7 +1726,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
HasAmountConflict = x.HasAmountConflict
|
||||
HasAmountConflict = x.HasAmountConflict,
|
||||
IsUpdateNeeded = x.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
if (searchModel.EmployeeId > 0)
|
||||
@@ -1992,7 +2001,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
// );
|
||||
|
||||
var checkouts =
|
||||
_context.CheckoutSet.Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
_context.CheckoutSet.Include(w=>w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
.Join(_context.Workshops.AsSplitQuery(),
|
||||
ch => ch.WorkshopId,
|
||||
workshop => workshop.id,
|
||||
@@ -2261,7 +2270,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm=> new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
|
||||
@@ -2299,7 +2315,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).OrderByDescending(x => x.Id)
|
||||
.GroupBy(x => x.Id)
|
||||
@@ -2365,7 +2388,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
|
||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||
@@ -2398,7 +2428,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id)
|
||||
.Select(x => x.First()).ToList()
|
||||
|
||||
@@ -19,39 +19,41 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext, IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
public class CustomizeWorkshopGroupSettingsRepository(
|
||||
CompanyContext companyContext,
|
||||
IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopGroupSettings>(companyContext),
|
||||
ICustomizeWorkshopGroupSettingsRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository = _rollCallEmployeeRepository;
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id)
|
||||
{
|
||||
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopSettings)
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x=>x.CustomizeWorkshopSettings)
|
||||
.Include(x=> x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopSettings)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long customizeWorkshopSettingId)
|
||||
{
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
|
||||
if (workshopSettings == null)
|
||||
return new();
|
||||
|
||||
var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().Include(x=>x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x=>x.EmployeeId).ToList();
|
||||
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
var workshopId = workshopSettings.WorkshopId;
|
||||
var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
@@ -81,79 +83,81 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
|
||||
var dateNow = DateTime.Now.Date;
|
||||
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x=> new EmployeeViewModel()
|
||||
{
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x => new EmployeeViewModel()
|
||||
{
|
||||
EmployeeFullName = x.rollCallEmployee.EmployeeFullName,
|
||||
Id = x.rollCallEmployee.EmployeeId
|
||||
});
|
||||
});
|
||||
|
||||
return employees.ToList();
|
||||
return employees.ToList();
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
|
||||
|
||||
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true"&&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true" &&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWithEmployees(long groupId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupId);
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -169,23 +173,26 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -201,38 +208,52 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
var employees = entity.CustomizeWorkshopEmployeeSettingsCollection;
|
||||
if (employees.Count == 0)
|
||||
return [];
|
||||
|
||||
var workshopId = employees.FirstOrDefault()?.WorkshopId??0;
|
||||
|
||||
if (workshopId == 0)
|
||||
return [];
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId);
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
|
||||
.Select(x => new { x.id, x.FullName }).ToList();
|
||||
|
||||
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
employeeIds.Contains(x.EmployeeId)).ToList();
|
||||
|
||||
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
@@ -243,82 +264,86 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
Salary = x.Salary,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts
|
||||
.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
LeavePermittedDays = x.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts
|
||||
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
|
||||
|
||||
.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
|
||||
});
|
||||
return joinedList.ToList();
|
||||
return joinedList.OrderBy(x=>x.HasLeft).ToList();
|
||||
}
|
||||
|
||||
public EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
|
||||
return new EditCustomizeWorkshopGroupSettings()
|
||||
{
|
||||
//FridayWork = entity.FridayWork,
|
||||
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value, LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value, EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.BonusesPay.Value, BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.ShiftPay.Value, ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay =new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
@@ -332,23 +357,27 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
IsShiftChanged = entity.IsShiftChange,
|
||||
ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x=> new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x =>
|
||||
new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(long workshopSettingsId)
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(
|
||||
long workshopSettingsId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
}
|
||||
|
||||
public void Remove(long groupId)
|
||||
@@ -360,7 +389,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
_companyContext.SaveChanges();
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId)
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId,
|
||||
long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AccountManagement.Application.Contracts.SubAccount;
|
||||
using ZstdSharp.Unsafe;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -266,14 +267,26 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
public async Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel)
|
||||
{
|
||||
var contractingParty = await _context.PersonalContractingParties
|
||||
.FirstOrDefaultAsync(x=>x.id == contractingPartyId);
|
||||
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
|
||||
var financialStatement = await _context.FinancialStatments
|
||||
.Include(x=>x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x=>x.ContractingPartyId == contractingPartyId);
|
||||
|
||||
|
||||
if (financialStatement == null)
|
||||
{
|
||||
throw new NotFoundException("وضعیت مالی مورد نظر یافت نشد");
|
||||
financialStatement = new FinancialStatment(contractingPartyId,contractingParty.FName+" "+contractingParty.LName);
|
||||
|
||||
await _context.AddAsync(financialStatement);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool searched = false;
|
||||
#region Search
|
||||
|
||||
@@ -383,7 +396,8 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
};
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
|
||||
list.Reverse();
|
||||
|
||||
var res = new FinancialStatmentDetailsByContractingPartyViewModel()
|
||||
{
|
||||
@@ -392,7 +406,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
TotalCredit = financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor),
|
||||
ContractingPartyName = financialStatement.ContractingPartyName,
|
||||
List = list.OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
List = list,
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class FineRepository : RepositoryBase<long, Fine>, IFineRepository
|
||||
}
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
var list = query.ToList().Select(x => new FineViewModel()
|
||||
var list = query.OrderByDescending(x=>x.FineDate).ToList().Select(x => new FineViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
@@ -16,6 +17,7 @@ using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using Company.Domain.FinancialTransactionAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
using Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
@@ -23,9 +25,11 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -42,9 +46,20 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
private readonly IEmployerRepository _employerRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IMongoCollection<InstitutionContractExtensionTemp> _institutionExtensionTemp;
|
||||
private readonly IMongoCollection<InstitutionContractAmendmentTemp> _institutionAmendmentTemp;
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
private readonly ISmsService _smsService;
|
||||
|
||||
private readonly InstitutionContratVerificationParty _firstParty = new()
|
||||
{
|
||||
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
|
||||
PhoneNumber = "09111485044",
|
||||
CeoName = "سید حسن مصباح",
|
||||
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
|
||||
NationalCodeOrNationalId = "14009970584",
|
||||
LegalType = LegalType.Legal
|
||||
};
|
||||
|
||||
public InstitutionContractRepository(CompanyContext context, IEmployerRepository employerRepository,
|
||||
IWorkshopRepository workshopRepository, IMongoDatabase database,
|
||||
IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context)
|
||||
@@ -56,6 +71,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
_smsService = smsService;
|
||||
_institutionExtensionTemp =
|
||||
database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtensionTemp");
|
||||
_institutionAmendmentTemp =
|
||||
database.GetCollection<InstitutionContractAmendmentTemp>("InstitutionContractAmendmentTemp");
|
||||
}
|
||||
|
||||
public EditInstitutionContract GetDetails(long id)
|
||||
@@ -1240,7 +1257,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalCount = await joinedQuery.CountAsync(),
|
||||
List = list.Select(x =>
|
||||
{
|
||||
Console.WriteLine(x.contractingParty.id);
|
||||
var workshops = x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).DistinctBy(w => w.id).ToList();
|
||||
|
||||
@@ -1267,7 +1283,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetails = currentStateWorkshops?.Select(w =>
|
||||
{
|
||||
Workshop workshopSelected = null;
|
||||
Console.WriteLine(w.WorkshopId);
|
||||
if (w.WorkshopId != null && workshops.Select(ww => ww.id).Contains(w.WorkshopId.Value))
|
||||
{
|
||||
workshopSelected = workshops.First(ww => ww.id == w.WorkshopId.Value);
|
||||
@@ -1276,7 +1291,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return new InstitutionContractListWorkshop()
|
||||
{
|
||||
EmployeeCount = w.PersonnelCount,
|
||||
Price = w.Price.ToMoney(),
|
||||
WorkshopName = workshopSelected?.WorkshopName ?? w.WorkshopName,
|
||||
|
||||
WorkshopServices = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = w.Services.Contract,
|
||||
@@ -1285,10 +1302,15 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Insurance = w.Services.Insurance,
|
||||
InsuranceInPerson = w.Services.InsuranceInPerson,
|
||||
RollCall = w.Services.RollCall,
|
||||
RollCallInPerson = w.Services.RollCallInPerson
|
||||
RollCallInPerson = w.Services.RollCallInPerson,
|
||||
|
||||
}
|
||||
};
|
||||
}).ToList() ?? [];
|
||||
|
||||
var employeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.WorkshopId))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1303,14 +1325,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Id = x.contract.id,
|
||||
ContractNo = x.contract.ContractNo,
|
||||
ArchiveNo = archiveCode.ToString(),
|
||||
EmployeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.id))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now),
|
||||
EmployeesCount = employeesCount,
|
||||
EmployerNames = employers.Select(e => e.FullName).ToList(),
|
||||
ListStatus = status,
|
||||
IsExpired = x.contract.ContractEndGr <= endThisMontGr,
|
||||
ContractingPartyId = x.contractingParty.id,
|
||||
Workshops = workshopDetails
|
||||
Workshops = workshopDetails,
|
||||
IsInPersonContract = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
.Any(y=>y.Services.ContractInPerson)??true,
|
||||
IsOldContract = x.contract.WorkshopGroup?.CurrentWorkshops == null
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Count == 0
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Any(y => y.Price == 0)
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -1789,15 +1814,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
|
||||
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
},
|
||||
FirstParty = new InstitutionContratVerificationParty()
|
||||
{
|
||||
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
|
||||
PhoneNumber = "09111111111",
|
||||
CeoName = "سید حسن مصباح",
|
||||
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
|
||||
NationalCodeOrNationalId = "1111111111",
|
||||
LegalType = LegalType.Legal
|
||||
}
|
||||
FirstParty =_firstParty
|
||||
};
|
||||
|
||||
return res;
|
||||
@@ -2239,7 +2256,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
extensionNo, workshopsCount, employeeCount,
|
||||
previousInstitutionContract.Description,
|
||||
"NotOfficial", "JobRelation", hasValueAddedTax,
|
||||
payment.Tax.MoneyToDouble(),[],
|
||||
payment.Tax.MoneyToDouble(), [],
|
||||
request.LawId);
|
||||
|
||||
await CreateAsync(entity);
|
||||
@@ -2249,26 +2266,25 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetail = new InstitutionContractWorkshopInitial(
|
||||
workshop.WorkshopName, workshop.RollCall, workshop.RollCallInPerson,
|
||||
workshop.CustomizeCheckout, workshop.ContractAndCheckout,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.InsuranceInPerson, workshop.CountPerson, workshop.Price);
|
||||
|
||||
|
||||
workshopDetail.SetWorkshopGroup(entity.WorkshopGroup);
|
||||
|
||||
|
||||
if (workshop.WorkshopId != 0)
|
||||
{
|
||||
workshopDetail.SetWorkshopId(workshop.WorkshopId);
|
||||
}
|
||||
// Set parent reference
|
||||
|
||||
|
||||
// Add to the parent's collection
|
||||
entity.WorkshopGroup.InitialWorkshops.Add(workshopDetail);
|
||||
}
|
||||
|
||||
// Save the changes again
|
||||
await SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FinancialStatment financialStatement;
|
||||
if (_context.FinancialStatments.Any(x => x.ContractingPartyId == contractingParty.id))
|
||||
{
|
||||
@@ -2329,8 +2345,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -2346,46 +2362,251 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
|
||||
var workshops = institutionContract.WorkshopGroup.CurrentWorkshops.Select(x => new WorkshopTempViewModel()
|
||||
|
||||
if (institutionContract.WorkshopGroup.CurrentWorkshops.Any(x => x.Price == 0))
|
||||
{
|
||||
Id = x.id,
|
||||
ContractAndCheckout = x.Services.Contract,
|
||||
ContractAndCheckoutInPerson = x.Services.ContractInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
CountPerson = x.PersonnelCount,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopServicesAmountStr = x.Price.ToMoney(),
|
||||
WorkshopServicesAmount = x.Price,
|
||||
WorkshopId = x.WorkshopId ?? 0,
|
||||
RollCallInPerson = x.Services.RollCallInPerson,
|
||||
throw new BadRequestException(
|
||||
"این قرارداد قابل ارتقا به صورت ظاهری نیست لطفا به صورت دیتابیسی اقدام به ویرایش کنید");
|
||||
}
|
||||
|
||||
}).ToList();
|
||||
var workshops = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new InstitutionContractAmendmentTempPrevWorkshop(x.WorkshopName,x.PersonnelCount,
|
||||
x.Services.Contract,x.Services.ContractInPerson,x.Services.Insurance,
|
||||
x.Services.InsuranceInPerson,x.Services.RollCall,x.Services.RollCallInPerson,
|
||||
x.Services.CustomizeCheckout,x.Price,
|
||||
x.WorkshopId??0,x.id)).ToList();
|
||||
|
||||
|
||||
|
||||
var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId);
|
||||
|
||||
await _institutionAmendmentTemp.InsertOneAsync(temp);
|
||||
|
||||
var prevWorkshops = workshops.Select(x =>
|
||||
new InstitutionContractAmendmentTempWorkshopViewModel()
|
||||
{
|
||||
WorkshopName = x.WorkshopName,
|
||||
CountPerson = x.CountPerson,
|
||||
ContractAndCheckout = x.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = x.ContractAndCheckoutInPerson,
|
||||
Insurance = x.Insurance,
|
||||
InsuranceInPerson = x.InsuranceInPerson,
|
||||
RollCall = x.RollCall,
|
||||
RollCallInPerson = x.RollCallInPerson,
|
||||
CustomizeCheckout = x.CustomizeCheckout,
|
||||
PriceStr = x.Price.ToMoney(),
|
||||
Price = x.Price,
|
||||
WorkshopId = x.WorkshopId,
|
||||
WorkshopTempId = x.Id,
|
||||
CurrentWorkshopId = x.CurrentWorkshopId,
|
||||
TempId =temp.Id
|
||||
})
|
||||
.ToList();
|
||||
var res = new InstitutionContractAmendmentWorkshopsResponse()
|
||||
{
|
||||
Workshops = workshops
|
||||
Workshops = prevWorkshops,
|
||||
TempId = temp.Id
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request)
|
||||
public async Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(
|
||||
InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
var institutionContract =await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == request.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مالی یافت نشد");
|
||||
var institutionContractAmendmentTemp = await _institutionAmendmentTemp
|
||||
.Find(x=>x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (institutionContractAmendmentTemp == null)
|
||||
throw new NotFoundException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var amendmentStart = DateTime.Now;
|
||||
var amendmentEnd = institutionContract.ContractEndGr;
|
||||
//TODO : محاسبه مبلغ بر اساس کارگاه های انتخاب شده
|
||||
var res = new InsitutionContractAmendmentPaymentResponse();
|
||||
return res;
|
||||
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractAmendmentTemp.InstitutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var amendmentEnd = institutionContract.ContractEndGr;
|
||||
|
||||
var haContractInPerson = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Any(x => x.Services.ContractInPerson);
|
||||
if (!haContractInPerson)
|
||||
{
|
||||
if (institutionContractAmendmentTemp.NewWorkshops.Any(x => x.ContractAndCheckoutInPerson))
|
||||
{
|
||||
throw new BadRequestException("برای قرارداد آنلاین نمیتوان سرویس حضوری انتخاب کرد");
|
||||
}
|
||||
}
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
|
||||
int startYear = pc.GetYear(amendmentStart);
|
||||
int startMonth = pc.GetMonth(amendmentStart);
|
||||
int startDay = pc.GetDayOfMonth(amendmentStart);
|
||||
|
||||
int endYear = pc.GetYear(amendmentEnd);
|
||||
int endMonth = pc.GetMonth(amendmentEnd);
|
||||
int endDay = pc.GetDayOfMonth(amendmentEnd);
|
||||
|
||||
// اختلاف خام ماهها
|
||||
int monthDiff = (endYear - startYear) * 12 + (endMonth - startMonth);
|
||||
|
||||
// اگر حتی چند روز از ماه بعدی هم گذشته بود → رند به بالا
|
||||
if (endDay > startDay)
|
||||
monthDiff++;
|
||||
|
||||
var sumOneMonth = institutionContractAmendmentTemp.NewWorkshops.Sum(x => x.PriceDifference);
|
||||
|
||||
var baseAmount = monthDiff * sumOneMonth;
|
||||
var tax = baseAmount*0.10;
|
||||
var totalPayment = tax+baseAmount;
|
||||
|
||||
|
||||
var res = new InsitutionContractAmendmentPaymentResponse()
|
||||
{
|
||||
ContractStart = amendmentStart.ToFarsi(),
|
||||
ContractEnd = amendmentEnd.ToFarsi(),
|
||||
OneMonthAmount = sumOneMonth.ToMoney(),
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
};
|
||||
|
||||
res.OneTime = new InstitutionContractPaymentOneTimeViewModel()
|
||||
{
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
};
|
||||
|
||||
if (haContractInPerson)
|
||||
{
|
||||
var installment = InstitutionMonthlyInstallmentCaculation(monthDiff,totalPayment, amendmentStart.ToFarsi());
|
||||
|
||||
var firstPrevInstallment = installment.First();
|
||||
var lastPrevInstallment = installment.Last();
|
||||
|
||||
var firstInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = firstPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = firstPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = amendmentStart.ToFarsi()
|
||||
};
|
||||
|
||||
var lastInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = lastPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = lastPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = lastPrevInstallment.InstalmentDate
|
||||
};
|
||||
|
||||
installment.Remove(firstPrevInstallment);
|
||||
installment.Remove(lastPrevInstallment);
|
||||
|
||||
installment.Insert(0, firstInstallment);
|
||||
installment.Add(lastInstallment);
|
||||
|
||||
res.Monthly = new InstitutionContractPaymentMonthlyViewModel()
|
||||
{
|
||||
Installments = installment,
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(
|
||||
InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
var amendmentTemp =await _institutionAmendmentTemp
|
||||
.Find(x=> x.Id == request.TempId).FirstOrDefaultAsync();
|
||||
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var workshopTemp = amendmentTemp.NewWorkshops
|
||||
.FirstOrDefault(x => x.Id == request.WorkshopTempId);
|
||||
|
||||
var planForWorkshop = new WorkshopTempViewModel()
|
||||
{
|
||||
WorkshopName = request.WorkshopName,
|
||||
CountPerson = request.CountPerson,
|
||||
ContractAndCheckout = request.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = request.ContractAndCheckoutInPerson,
|
||||
Insurance = request.Insurance,
|
||||
InsuranceInPerson = request.InsuranceInPerson,
|
||||
RollCall = request.RollCall,
|
||||
RollCallInPerson = request.RollCallInPerson,
|
||||
CustomizeCheckout = request.CustomizeCheckout
|
||||
};
|
||||
var price = _planPercentageRepository.GetInstitutionPlanForWorkshop(planForWorkshop)
|
||||
.OnlineAndInPersonSumAmountDouble;
|
||||
|
||||
if (workshopTemp == null)
|
||||
{
|
||||
var newWorkshopTemp = new InstitutionContractAmendmentTempNewWorkshop(request.WorkshopName,
|
||||
request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall, request.RollCallInPerson,
|
||||
request.CustomizeCheckout, price,
|
||||
request.WorkshopId,0,price);
|
||||
|
||||
workshopTemp = newWorkshopTemp;
|
||||
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(newWorkshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
var differencePrice = price - workshopTemp.Price;
|
||||
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall,
|
||||
request.CustomizeCheckout, price,differencePrice);
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
|
||||
return new InsertAmendmentTempWorkshopResponse()
|
||||
{
|
||||
WorkshopTempId = workshopTemp.Id,
|
||||
Amount = workshopTemp.PriceDifference.ToMoney()
|
||||
};
|
||||
}
|
||||
|
||||
public async Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
var amendmentTemp = await _institutionAmendmentTemp.Find(x => x.NewWorkshops.Any(w => w.Id == workshopTempId))
|
||||
.FirstOrDefaultAsync();
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
var workshopTemp = amendmentTemp.NewWorkshops.FirstOrDefault(x => x.Id == workshopTempId);
|
||||
if (workshopTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
if (workshopTemp.CurrentWorkshopId!=0)
|
||||
throw new BadRequestException("شما نمی توانید این کارگاه را حذف کنید زیرا در قرارداد اصلی وجود دارد");
|
||||
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
|
||||
}
|
||||
public async Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,
|
||||
string selected)
|
||||
@@ -2405,10 +2626,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Id = x.id,
|
||||
Text = x.WorkshopFullName
|
||||
});
|
||||
var employers = _context.Employers.Select(x => new InstitutionContractSelectListViewModel()
|
||||
//کارفرما ها به غیر از آن هایی که به طرف حساب ---- وصل هستند
|
||||
var employers = _context.Employers.Where(x=>x.ContractingPartyId != 30428)
|
||||
.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.FName + " " + x.LName
|
||||
Text = x.FullName
|
||||
});
|
||||
var representatives = _context.RepresentativeSet.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
@@ -2441,6 +2664,168 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids)
|
||||
{
|
||||
var query =_context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.InitialWorkshops)
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.Where(x=>ids.Contains(x.id));
|
||||
|
||||
var contractingPartyIds = query.Select(x => x.ContractingPartyId).ToList();
|
||||
var contractingParties = await _context.PersonalContractingParties
|
||||
.Where(x => contractingPartyIds.Contains(x.id))
|
||||
.ToListAsync();
|
||||
|
||||
var list = query.ToList();
|
||||
|
||||
if (list.Count == 0)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var res = new List<InstitutionContractPrintViewModel>();
|
||||
foreach (var institution in list)
|
||||
{
|
||||
var contractingParty = contractingParties.FirstOrDefault(x => x.id == institution.ContractingPartyId);
|
||||
|
||||
if (contractingParty == null)
|
||||
{
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
}
|
||||
|
||||
var law = await _context.Laws
|
||||
.FirstOrDefaultAsync(x => x.id == institution.LawId);
|
||||
|
||||
|
||||
var secondParty = new InstitutionContratVerificationParty()
|
||||
{
|
||||
Address = contractingParty.Address,
|
||||
PhoneNumber = contractingParty.Phone,
|
||||
CeoName = contractingParty.IsLegal == "حقیقی"
|
||||
? $"{contractingParty.FName} {contractingParty.LName}"
|
||||
: $"{contractingParty.CeoFName} {contractingParty.CeoLName}",
|
||||
CompanyNameOrFullName = contractingParty.IsLegal == "حقیقی"
|
||||
? $"{contractingParty.FName} {contractingParty.LName}"
|
||||
: contractingParty.LName,
|
||||
NationalCodeOrNationalId =
|
||||
contractingParty.IsLegal == "حقیقی" ? contractingParty.Nationalcode : contractingParty.NationalId,
|
||||
LegalType = contractingParty.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
};
|
||||
|
||||
var lawViewModel = new LawViewModel()
|
||||
{
|
||||
Id = law.id,
|
||||
CreatedAt = law.CreationDate,
|
||||
HeadTitle = law.HeadTitle,
|
||||
IsActive = law.IsActive,
|
||||
Items = law.Items.Select(x => new LawItemViewModel()
|
||||
{
|
||||
Details = x.Details,
|
||||
Header = x.Header
|
||||
}).ToList(),
|
||||
Notifications = law.Notifications,
|
||||
Title = law.Title,
|
||||
Type = law.Type,
|
||||
Version = law.Version
|
||||
};
|
||||
|
||||
var item = new InstitutionContractPrintViewModel()
|
||||
{
|
||||
ContractStart = institution.ContractStartFa,
|
||||
ContractEnd = institution.ContractEndFa,
|
||||
ContractNo = institution.ContractNo,
|
||||
CreationDate = institution.CreationDate.ToFarsi(),
|
||||
FirstParty = _firstParty,
|
||||
SecondParty = secondParty,
|
||||
LawViewModel = lawViewModel,
|
||||
Obligation = institution.Obligation.ToMoney(),
|
||||
PaymentPrice = institution.TotalAmount.ToMoney(),
|
||||
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
|
||||
TaxPrice = institution.ValueAddedTax.ToMoney(),
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
|
||||
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
|
||||
Workshops = institution.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
|
||||
{
|
||||
Name = x.WorkshopName,
|
||||
PersonnelCount = x.PersonnelCount,
|
||||
Services = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = x.Services.Contract,
|
||||
ContractInPerson = x.Services.ContractInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
RollCallInPerson = x.Services.RollCallInPerson
|
||||
},
|
||||
Price = x.Price.ToMoney()
|
||||
}).ToList()
|
||||
};
|
||||
res.Add(item);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id)
|
||||
{
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.InitialWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == id);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var workshops = institutionContract.WorkshopGroup.InitialWorkshops
|
||||
.Select(x =>
|
||||
{
|
||||
var plan = _planPercentageRepository.GetInstitutionPlanForWorkshop(new WorkshopTempViewModel()
|
||||
{
|
||||
CountPerson = x.PersonnelCount,
|
||||
ContractAndCheckout = x.Services.Contract,
|
||||
ContractAndCheckoutInPerson = x.Services.ContractInPerson,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
RollCallInPerson = x.Services.RollCallInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
});
|
||||
|
||||
return new InstitutionContractListWorkshop()
|
||||
{
|
||||
EmployeeCount = x.PersonnelCount,
|
||||
Price = x.Price.ToMoney(),
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopServices = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = x.Services.Contract,
|
||||
ContractPrice =plan.ContractAndCheckout ,
|
||||
ContractInPerson = x.Services.ContractInPerson,
|
||||
ContractInPersonPrice = plan.ContractAndCheckoutInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
CustomizeCheckoutPrice = plan.CustomizeCheckout,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsurancePrice =plan.Insurance ,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
InsuranceInPersonPrice = plan.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
RollCallPrice =plan.RollCall ,
|
||||
RollCallInPerson = x.Services.RollCallInPerson,
|
||||
RollCallInPersonPrice = "0",
|
||||
}
|
||||
};
|
||||
}).ToList();
|
||||
return new GetInstitutionContractWorkshopsDetails()
|
||||
{
|
||||
Workshops = workshops
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
|
||||
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,
|
||||
@@ -2464,7 +2849,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
// حالت پرداخت اقساطی
|
||||
var monthlyTax = baseAmount * 0.10;
|
||||
var monthlyTotal = baseAmount + monthlyTax;
|
||||
var installments = InstitutionMonthlyInstallmentCaculation(duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
var installments = InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
|
||||
res.Monthly = new()
|
||||
{
|
||||
@@ -2546,7 +2931,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(InstitutionContractDuration duration,
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(int duration,
|
||||
double monthlyTotalPaymentDouble,
|
||||
string installmentstart)
|
||||
{
|
||||
@@ -2554,7 +2939,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var installmentList = new List<MonthlyInstallment>();
|
||||
|
||||
|
||||
int instalmentCount = (int)duration;
|
||||
int instalmentCount = duration;
|
||||
var instalmentAmount = monthlyTotalPaymentDouble / instalmentCount;
|
||||
int currentInstallmentStartDay = int.Parse(installmentstart.Substring(8, 2));
|
||||
bool endOfMonth = currentInstallmentStartDay == 31;
|
||||
@@ -2614,6 +2999,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CustomViewModels
|
||||
|
||||
|
||||
@@ -7,11 +7,14 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.EmployeeChildrenAgg;
|
||||
using Company.Domain.EmployeeInsurancListDataAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.InsuranceListAgg;
|
||||
using Company.Domain.InsuranceWorkshopAgg;
|
||||
using Company.Domain.InsuranceYearlySalaryAgg;
|
||||
@@ -132,6 +135,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
var id = insuranceListObj.id;
|
||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
|
||||
var checkouts = _context.CheckoutSet.Where(x =>
|
||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||
x.IsActiveString == "true");
|
||||
foreach (var item in command.EmployeeInsurancListDataList)
|
||||
{
|
||||
if (item.EmployeeInsurancListDataId == 0)
|
||||
@@ -158,6 +166,29 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears,
|
||||
item.MarriedAllowance, item.OverTimePay, item.FamilyAllowance);
|
||||
}
|
||||
|
||||
|
||||
if (checkouts.Any())
|
||||
{
|
||||
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
|
||||
if (checkout != null)
|
||||
{
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_employeeInsurancListDataRepository.SaveChanges();
|
||||
@@ -698,6 +729,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
var id = insuranceListObj.id;
|
||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
|
||||
var checkouts = _context.CheckoutSet.Where(x =>
|
||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||
x.IsActiveString == "true");
|
||||
foreach (var item in command.EmployeeInsurancListDataList)
|
||||
{
|
||||
var employeeInsurancListData = new EmployeeInsurancListData(id,
|
||||
@@ -711,6 +747,28 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears, item.MarriedAllowance,
|
||||
item.OverTimePay, item.FamilyAllowance);
|
||||
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
|
||||
if (checkouts.Any())
|
||||
{
|
||||
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
|
||||
if (checkout != null)
|
||||
{
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_employeeInsurancListDataRepository.SaveChanges();
|
||||
@@ -1411,6 +1469,27 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId)
|
||||
{
|
||||
var res = _context.InsuranceListSet
|
||||
.Where(x => x.StartDate <= startDate && x.EndDate >= startDate &&
|
||||
x.WorkshopId == workshopId)
|
||||
.Join(_context.EmployeeInsurancListDataSet,
|
||||
insuranceList => insuranceList.id,
|
||||
employeeInsurancListData => employeeInsurancListData.InsuranceListId,
|
||||
(insuranceList, employeeInsurancListData) => new EmployeeInsurancListDataViewModel
|
||||
{
|
||||
InsuranceListId = insuranceList.id,
|
||||
EmployeeId = employeeInsurancListData.EmployeeId,
|
||||
WorkingDays = employeeInsurancListData.WorkingDays,
|
||||
BenefitsIncludedNonContinuous = employeeInsurancListData.BenefitsIncludedNonContinuous,
|
||||
InsuranceShare = employeeInsurancListData.InsuranceShare,
|
||||
});
|
||||
|
||||
return res.ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceDataForEdit(long insuranceListId,
|
||||
DateTime startDate, DateTime endDate)
|
||||
{
|
||||
@@ -1724,9 +1803,86 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
.Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorkInsurances.Any(l => l.StartWorkDate <= firstDayOfMonth &&
|
||||
(l.LeftWorkDate == null || l.LeftWorkDate >= firstDayOfMonth)));
|
||||
|
||||
|
||||
var query = notCreatedWorkshop.Select(result=>new InsuranceListViewModel
|
||||
{
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
WorkShopId = result.id,
|
||||
WorkShopCode = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.InsuranceCode
|
||||
: result.InsuranceCode,
|
||||
WorkShopName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.WorkshopName
|
||||
: result.WorkshopFullName,
|
||||
TypeOfInsuranceSend = result.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
result.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
result.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = result.FixedSalary,
|
||||
StrFixedSalary = result.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.EmployerName
|
||||
: result.WorkshopFullName,
|
||||
Branch = "",
|
||||
City = "",
|
||||
ArchiveCode = result.ArchiveCode,
|
||||
});
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
||||
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||
|
||||
var workshopList = await notCreatedWorkshop.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.id);
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
||||
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year)
|
||||
.ThenByDescending(x => x.Month).ThenByDescending(x => x.EmployerName);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
|
||||
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
|
||||
|
||||
query = query.Where(x => x.WorkShopName.Contains(workshopName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
|
||||
query = query.Where(x => x.EmployerName.Contains(employerName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployerName))
|
||||
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.FixedSalary != null)
|
||||
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
|
||||
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
|
||||
query = query.Where(x => x.City == searchModel.City);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Branch))
|
||||
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
|
||||
|
||||
|
||||
var workshopList = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.WorkShopId);
|
||||
|
||||
var employers =await _context.WorkshopEmployers
|
||||
.Where(x=>workshopIds.Contains(x.WorkshopId))
|
||||
@@ -1735,20 +1891,16 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
|
||||
var res = workshopList.Select(x =>
|
||||
{
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.id)?.Employer;
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.WorkShopId)?.Employer;
|
||||
|
||||
return new InsuranceListViewModel
|
||||
{
|
||||
WorkShopId = x.id,
|
||||
WorkShopCode = x.InsuranceCode,
|
||||
WorkShopName = x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.WorkshopName
|
||||
: x.WorkshopFullName,
|
||||
WorkShopId = x.WorkShopId,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
EmployerName = employer != null
|
||||
? employer.FullName
|
||||
: (x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.EmployerName
|
||||
: x.WorkshopFullName),
|
||||
: (x.EmployerName),
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
|
||||
@@ -97,7 +97,7 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate);
|
||||
}
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
var list = query.ToList().Select(x => new LoanViewModel()
|
||||
var list = query.OrderByDescending(x=>x.StartInstallmentPayment).ToList().Select(x => new LoanViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ using _0_Framework.InfraStructure;
|
||||
using Company.Domain.RewardAgg;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharpCompress.Compressors.Xz;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -119,12 +120,12 @@ public class RewardRepository : RepositoryBase<long, Reward>, IRewardRepository
|
||||
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
var list = query.ToList().Select(x => new RewardViewModel
|
||||
var list = query.ToList().OrderByDescending(x=>x.GrantDate).Select(x => new RewardViewModel
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
Description = x.Description ?? "",
|
||||
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
|
||||
EmployeeId = x.EmployeeId,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
|
||||
@@ -478,7 +478,8 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
|
||||
public RollCallEmployee GetBy(long employeeId, long workshopId)
|
||||
{
|
||||
return _context.RollCallEmployees.Include(x => x.EmployeesStatus).FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
return _context.RollCallEmployees.Include(x => x.EmployeesStatus)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1517,7 +1517,9 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
StartDate = y.StartDate.Value.ToString("HH:mm"),
|
||||
EndDate = y.EndDate!.Value.ToString("HH:mm"),
|
||||
StartDateGr = y.StartDate.Value,
|
||||
EndDateGr = y.EndDate.Value
|
||||
EndDateGr = y.EndDate.Value,
|
||||
EntryTimeDifferences = CalculateEntryTimeDifferences( y.EarlyEntryDuration, y.LateEntryDuration),
|
||||
ExitTimeDifferences = CalculateExitTimeDifferences(y.EarlyExitDuration, y.LateExitDuration)
|
||||
}),
|
||||
TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date == y.ShiftDate.Date)
|
||||
.Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)),
|
||||
|
||||
@@ -1,30 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace _0_Framework.Application.Sms;
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
public SmsService(IConfiguration configuration)
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_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)
|
||||
@@ -54,12 +85,7 @@ public class SmsService : ISmsService
|
||||
}
|
||||
public bool VerifySend(string number, string message)
|
||||
{
|
||||
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var verificationSendResult = smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
@@ -88,11 +114,7 @@ public class SmsService : ISmsService
|
||||
|
||||
public bool LoginSend(string number, string message)
|
||||
{
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var verificationSendResult = smsIr.VerifySendAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
var verificationSendResult = VerifySendSmsAsync(number, 635330, new VerifySendParameter[] { new VerifySendParameter("LOGINCODE", message) });
|
||||
Thread.Sleep(2000);
|
||||
if (verificationSendResult.IsCompletedSuccessfully)
|
||||
{
|
||||
@@ -117,11 +139,8 @@ public class SmsService : ISmsService
|
||||
|
||||
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
|
||||
{
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new SentSmsViewModel();
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
var sendResult = await VerifySendSmsAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
@@ -146,9 +165,8 @@ public class SmsService : ISmsService
|
||||
var checkLength = fullName.Length;
|
||||
if (checkLength > 25)
|
||||
fullName = fullName.Substring(0, 24);
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
var sendResult = smsIr.VerifySendAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
var sendResult = VerifySendSmsAsync(number, 725814, new VerifySendParameter[] { new VerifySendParameter("FULLNAME", fullName), new VerifySendParameter("USERNAME", userName), new VerifySendParameter("PASSWORD", userName) });
|
||||
|
||||
|
||||
Console.WriteLine(userName + " - " + sendResult.Result.Status);
|
||||
@@ -204,8 +222,7 @@ public class SmsService : ISmsService
|
||||
int pageSize = 100; // max: 100
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||
|
||||
|
||||
|
||||
MessageReportResult[] messages = response.Data;
|
||||
foreach (var message in messages)
|
||||
{
|
||||
@@ -331,26 +348,57 @@ public class SmsService : ISmsService
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
|
||||
|
||||
public async Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 527519, new VerifySendParameter[]
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ایجاد قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
|
||||
public async Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
var secondPart = guidStr.Substring(15);
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 527519, new VerifySendParameter[]
|
||||
{
|
||||
new("FULLNAME", fullName),
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه ارتقا قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
{
|
||||
var verificationSendResult =await VerifySendSmsAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
@@ -220,11 +220,17 @@ 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;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using _0_Framework.Infrastructure;
|
||||
using _0_Framework.InfraStructure;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
|
||||
@@ -479,6 +485,10 @@ public class PersonalBootstrapper
|
||||
|
||||
services
|
||||
.AddTransient<IInstitutionContractExtenstionTempRepository, InstitutionContractExtenstionTempRepository>();
|
||||
|
||||
services.AddTransient<IEmployeeFaceEmbeddingRepository, EmployeeFaceEmbeddingRepository>();
|
||||
services.AddTransient<IEmployeeFaceEmbeddingApplication, EmployeeFaceEmbeddingApplication>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
@@ -604,6 +614,10 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<IInsuranceApplication, InsuranceApplication>();
|
||||
services.AddTransient<IInsuranceRepository, InsuranceRepository>();
|
||||
|
||||
// Face Embedding Services
|
||||
services.AddTransient<IFaceEmbeddingService, FaceEmbeddingService>();
|
||||
services.AddTransient<IFaceEmbeddingNotificationService, NullFaceEmbeddingNotificationService>();
|
||||
|
||||
services.AddDbContext<CompanyContext>(x => x.UseSqlServer(connectionString));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user