Compare commits

..

9 Commits

Author SHA1 Message Date
4b39994de6 feat: add API endpoint for printing multiple contracts 2025-12-20 15:50:34 +03:30
0dd2dc7c43 add workshopCode on client contract print 2025-12-20 15:21:34 +03:30
20c00893b6 feat: add API endpoint for printing contract details and enhance contract print logic 2025-12-20 14:23:23 +03:30
b0d174a575 feat: implement contract printing methods and view models 2025-12-20 13:04:30 +03:30
0fbd5c9d3e Add print methods and ContractPrintViewModel class
Updated the `IContractApplication` interface:
- Added `PrintOneAsync(long id)` and `PrintAllAsync(List<long> ids)` methods.
- Corrected formatting of `DeleteAllContarcts(List<long> ids)`.
- Grouped changes under the `NewChangeByHeydari` region.

Introduced the `ContractPrintViewModel` class (currently empty).

Implemented `PrintOneAsync` and `PrintAllAsync` in `ContractApplication` with `NotImplementedException`.

These changes prepare the codebase for contract printing functionality.
2025-11-11 19:29:51 +03:30
8436f70aa0 Refactor and enhance contract handling logic
- Added `DailyWage`, `AvgWorkingHour`, and `FamilyAllowance` properties to `GetContractListForClientResponse`.
- Refactored `WorkingHoursWeekly` conversion logic by introducing a reusable `WeeklyHourConvertor` method in `ContractRepository`.
- Updated query result mapping to include new properties and utilize `WeeklyHourConvertor` for `AvgWorkingHour`.
- Improved code readability and maintainability by centralizing repetitive logic.
2025-11-11 19:26:45 +03:30
9cf8447a83 feat: add API for retrieving paginated contract list for client with filtering options 2025-11-03 17:49:51 +03:30
e124a4d5d9 feat: implement method to retrieve paginated contract list for client with filtering options 2025-11-03 17:43:50 +03:30
7b9e7881c6 feat: add commented-out method for retrieving contract list for client 2025-11-03 14:45:41 +03:30
215 changed files with 5570 additions and 598773 deletions

View File

@@ -1,22 +0,0 @@
namespace _0_Framework.Application.Enums;
/// <summary>
/// وضعیت تایید قرادا مالی
/// </summary>
public enum InstitutionContractVerificationStatus
{
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -1,36 +0,0 @@
namespace _0_Framework.Application.Enums;
public enum TypeOfSmsSetting
{
/// <summary>
/// پیامک
/// یادآور بدهی ماهیانه قرارداد مالی
/// </summary>
InstitutionContractDebtReminder,
/// <summary>
/// پیامک
/// صورت حساب ماهانه قرارداد مالی
/// </summary>
MonthlyInstitutionContract,
/// <summary>
/// پیامک
/// اعلام مسدودی طرف حساب
/// </summary>
BlockContractingParty,
/// <summary>
/// پیامک
/// هشدار اول
/// </summary>
Warning,
/// <summary>
///پیامک اقدام قضائی
/// </summary>
LegalAction,
}

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
amount = command.Amount,
callback = command.CallBackUrl,
card_number = command.CardNumber,
invoice_id = command.TransactionId,
invoice_id = command.InvoiceId,
mobile = command.Mobile,
email = command.Email??"",
description = command.Description,
@@ -73,7 +73,7 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
amount = command.Amount,
callback = command.CallBackUrl,
card_number = command.Amount,
invoice_id = command.TransactionId,
invoice_id = command.InvoiceId,
mobile = command.Mobile,
email = command.Email,
description = command.Email,

View File

@@ -29,11 +29,9 @@ public class PaymentGatewayResponse
public int? ErrorCode { get; set; }
[JsonPropertyName("transid")]
public string Token { get; set; }
public string TransactionId { get; set; }
public bool IsSuccess { get; set; }
public string Message { get; set; }
public bool IsSuccess => Status == "success";
}
public class WalletAmountResponse
@@ -49,19 +47,16 @@ public class WalletAmountResponse
public class CreatePaymentGatewayRequest
{
public double Amount { get; set; }
public string TransactionId { get; set; }
public string CallBackUrl { get; set; }
public string InvoiceId { get; set; }
public string CardNumber { get; set; }
public string Mobile { get; set; }
public string Email { get; set; }
public string Description { get; set; }
public long FinancialInvoiceId { get; set; }
public IDictionary<string, object> ExtraData { get; set; }
}
public class VerifyPaymentGateWayRequest
{
public string DigitalReceipt { get; set; }
public string TransactionId { get; set; }
public string TransactionId { get; set; }
public double Amount { get; set; }
}

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
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)
{
command.ExtraData ??= new Dictionary<string, object>();
command.ExtraData.Add("financialInvoiceId", command.FinancialInvoiceId);
var extraData = JsonConvert.SerializeObject(command.ExtraData);
var res = await _httpClient.PostAsJsonAsync("GetToken", new
{
TerminalID = TerminalId,
Amount = command.Amount,
InvoiceID = command.TransactionId,
callbackURL = command.CallBackUrl,
payload = extraData
}, cancellationToken: cancellationToken);
// خواندن محتوای پاسخ
var content = await res.Content.ReadAsStringAsync(cancellationToken);
// تبدیل پاسخ JSON به آبجکت دات‌نت
var json = System.Text.Json.JsonDocument.Parse(content);
// گرفتن مقدار AccessToken
var accessToken = json.RootElement.GetProperty("Accesstoken").ToString();
var status = json.RootElement.GetProperty("Status").ToString();
return new PaymentGatewayResponse
{
Status = status,
IsSuccess = status == "0",
Token = accessToken
};
}
public string GetStartPayUrl(string token)=>
$"https://sepehr.shaparak.ir/Payment/Pay?token={token}&terminalId={TerminalId}";
public async Task<PaymentGatewayResponse> Verify(VerifyPaymentGateWayRequest command, CancellationToken cancellationToken = default)
{
var res = await _httpClient.PostAsJsonAsync("Advice", new
{
digitalreceipt = command.DigitalReceipt,
Tid = TerminalId,
}, cancellationToken: cancellationToken);
// خواندن محتوای پاسخ
var content = await res.Content.ReadAsStringAsync(cancellationToken);
// تبدیل پاسخ JSON به آبجکت دات‌نت
var json = System.Text.Json.JsonDocument.Parse(content);
var message = json.RootElement.GetProperty("Message").GetString();
var status = json.RootElement.GetProperty("Status").GetString();
return new PaymentGatewayResponse
{
Status = status,
IsSuccess = status.ToLower() == "ok",
Message = message
};
}
public Task<PaymentGatewayResponse> CreateSandBox(CreatePaymentGatewayRequest command, CancellationToken cancellationToken = default)
{
throw new System.NotImplementedException();
}
public string GetStartPaySandBoxUrl(string transactionId)
{
throw new System.NotImplementedException();
}
public Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
}

View File

@@ -27,65 +27,11 @@ public interface ISmsService
Task<double> GetCreditAmount();
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId);
SmsResult TaskReminderSms(string number, string taskCount);
#endregion
#region InstitutionContractSMS
/// <summary>
/// پیامک اهانه جدید
/// </summary>
/// <param name="number"></param>
/// <param name="tamplateId"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="code1"></param>
/// <param name="code2"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBillNew(string number, int tamplateId, string fullname, string amount, string code1,
string code2);
/// <summary>
/// پیامک ماهانه قدیم
/// </summary>
/// <param name="number"></param>
/// <param name="tamplateId"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="id"></param>
/// <param name="aprove"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id, string aprove);
/// <summary>
/// پیامک مسدودی طرف حساب
/// </summary>
/// <param name="number"></param>
/// <param name="fullname"></param>
/// <param name="amount"></param>
/// <param name="accountType"></param>
/// <param name="id"></param>
/// <param name="aprove"></param>
/// <returns></returns>
Task<(byte status, string message, int messaeId, bool isSucceded)> BlockMessage(string number, string fullname, string amount, string accountType, string id, string aprove);
#endregion
#region AlarmMessage
/// <summary>
/// ارسال پیامک های خطا یا اعمال ارسال
/// </summary>
/// <param name="number"></param>
/// <param name="message"></param>
/// <returns></returns>
Task<bool> Alarm(string number, string message);
#endregion
}

View File

@@ -1,32 +0,0 @@
namespace _0_Framework.Application.Sms;
public class SmsResult
{
public SmsResult()
{
IsSuccedded = false;
}
public bool IsSuccedded { get; set; }
public string Message { get; set; }
public byte StatusCode { get; set; }
public int MessageId { get; set; }
public SmsResult Succedded(byte statusCode, string message, int messageId)
{
IsSuccedded = true;
Message = message;
StatusCode = statusCode;
MessageId = messageId;
return this;
}
public SmsResult Failed(byte statusCode, string message, int messageId)
{
IsSuccedded = false;
Message = message;
StatusCode = statusCode;
MessageId = messageId;
return this;
}
}

View File

@@ -1,9 +0,0 @@
namespace _0_Framework.Application.Enums
{
public class CheckoutDynamicDeductionItem
{
public string Name { get; set; }
public int Count { get; set; }
public string Amount { get; set; }
}
}

View File

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

View File

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

View File

@@ -1,624 +0,0 @@
# راهنمای اتصال اپلیکیشن 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 | خروج از گروه کارگاه |

View File

@@ -66,11 +66,4 @@ public interface IAccountApplication
public bool CheckExistClientAccount(string userName);
List<AccountViewModel> GetAdminAccountsNew();
void CameraLogin(CameraLoginRequest request);
}
public class CameraLoginRequest
{
public string UserName { get; set; }
public string Password { get; set; }
}

View File

@@ -18,7 +18,6 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using Company.Domain.WorkshopAgg;
using System.Security.Claims;
using _0_Framework.Exceptions;
using AccountManagement.Domain.PositionAgg;
using AccountManagement.Domain.SubAccountAgg;
using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg;
@@ -804,29 +803,4 @@ public class AccountApplication : IAccountApplication
{
return _accountRepository.GetAdminAccountsNew();
}
public void CameraLogin(CameraLoginRequest request)
{
var cameraAccount = _cameraAccountRepository.GetBy(request.UserName);
if (cameraAccount == null)
{
throw new BadRequestException(ApplicationMessages.WrongUserPass);
}
(bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(cameraAccount.Password, request.Password);
if (!result.Verified)
throw new BadRequestException(ApplicationMessages.WrongUserPass);
var mobile = string.IsNullOrWhiteSpace(cameraAccount.Mobile) ? " " : cameraAccount.Mobile;
var authViewModel = new CameraAuthViewModel(cameraAccount.id, cameraAccount.WorkshopId,
cameraAccount.Username, mobile, cameraAccount.WorkshopName, cameraAccount.AccountId,
cameraAccount.IsActiveSting);
if (cameraAccount.IsActiveSting != "true")
throw new BadRequestException(ApplicationMessages.WrongUserPass);
_authHelper.CameraSignIn(authViewModel);
}
}

View File

@@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>BackgroundInstitutionContract.Task</AssemblyName>
<RootNamespace>BackgroundInstitutionContract.Task</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
<ProjectReference Include="..\..\PersonalContractingParty.Config\PersonalContractingParty.Config.csproj" />
<ProjectReference Include="..\..\Query.Bootstrapper\Query.Bootstrapper.csproj" />
<ProjectReference Include="..\..\WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,32 +0,0 @@
using _0_Framework.Application;
namespace BackgroundInstitutionContract.Task
{
public class FileUploader : IFileUploader
{
private readonly IWebHostEnvironment _webHostEnvironment;
public FileUploader(IWebHostEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
}
public string Upload(IFormFile file, string path)
{
if (file == null) return "";
var directoryPath = $"{_webHostEnvironment.WebRootPath}\\ProductPictures\\{path}";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
var fileName = $"{DateTime.Now.ToFileName()}-{file.FileName}";
var filePath = $"{directoryPath}\\{fileName}";
var output = System.IO.File.Create(filePath);
file.CopyTo(output);
return $"{path}/{fileName}";
}
}
}

View File

@@ -1,149 +0,0 @@
using _0_Framework.Application;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.InstitutionContractAgg;
using Hangfire;
namespace BackgroundInstitutionContract.Task.Jobs;
public class JobSchedulerRegistrator
{
private readonly IBackgroundJobClient _backgroundJobClient;
private readonly SmsReminder _smsReminder;
private readonly IInstitutionContractRepository _institutionContractRepository;
private static DateTime? _lastRunCreateTransaction;
private static DateTime? _lastRunSendMonthlySms;
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
_institutionContractRepository = institutionContractRepository;
}
public void Register()
{
RecurringJob.AddOrUpdate(
"InstitutionContract.CreateFinancialTransaction",
() => CreateFinancialTransaction(),
"*/30 * * * *" // هر 30 دقیقه یکبار چک کن
);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendMonthlySms",
() => SendFirstDayOfMonthSms(),
"*/20 * * * *" // هر 30 دقیقه یکبار چک کن
);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendReminderSms",
() => SendReminderSms(),
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
RecurringJob.AddOrUpdate(
"InstitutionContract.SendBlockSms",
() => SendBlockSms(),
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
);
}
/// <summary>
/// ایجاد سند بدهی ماهیانه برای قراداد مالی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
public async System.Threading.Tasks.Task CreateFinancialTransaction()
{
var now =DateTime.Now;
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
if (now.Date == endOfMonthGr.Date && now.Hour >= 2 && now.Hour < 4 &&
now.Date != _lastRunCreateTransaction?.Date)
{
var month = endOfMonth.Substring(5, 2);
var year = endOfMonth.Substring(0, 4);
var monthName = month.ToFarsiMonthByNumber();
var description = $"{monthName} {year}";
var endnew = ($"{endOfMonth.Substring(0, 8)}01").FindeEndOfMonth();
var endNewGr = endnew.ToGeorgianDateTime();
var endNewFa = endNewGr.ToFarsi();
try
{
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
_lastRunCreateTransaction = now;
Console.WriteLine("CreateTransAction executed");
}
catch (Exception e)
{
//_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
}
}
}
/// <summary>
/// ارسال پیامک صورت حساب ماهانه
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 600)]
public async System.Threading.Tasks.Task SendFirstDayOfMonthSms()
{
//var now = new DateTime(2025,11,21, 10,30,0);
var now = DateTime.Now;
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
if (now.Date == endOfMonthGr.Date && now.Hour >= 10 && now.Hour < 11 &&
now.Date != _lastRunSendMonthlySms?.Date)
{
try
{
await _institutionContractRepository.SendMonthlySms(now);
_lastRunSendMonthlySms = now;
Console.WriteLine("Send Monthly sms executed");
}
catch (Exception e)
{
//_smsService.Alarm("09114221321", "خطا-ایجاد سند مالی");
}
}
}
/// <summary>
/// ارسال پیامک یاد آور بدهی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
public async System.Threading.Tasks.Task SendReminderSms()
{
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
}
/// <summary>
/// ارسال پیامک مسدودی
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 100)]
public async System.Threading.Tasks.Task SendBlockSms()
{
await _institutionContractRepository.SendBlockSmsForBackgroundTask();
}
}

View File

@@ -1,116 +0,0 @@
using _0_Framework.Application.Sms;
using AccountManagement.Application.Contracts.Account;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace BackgroundInstitutionContract.Task.Jobs;
public class SmsReminder
{
private readonly AccountContext _accountContext;
private readonly ISmsService _smsService;
private readonly ISmsResultRepository _smsResultRepository;
public SmsReminder(ISmsService smsService, AccountContext accountContext, ISmsResultRepository smsResultRepository)
{
_smsService = smsService;
_accountContext = accountContext;
_smsResultRepository = smsResultRepository;
}
public void Execute()
{
//var accounts = _accountContext.Accounts.Where(x => x.PositionId > 0 && x.IsActiveString == "true").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
//Thread.Sleep(300);
//var accounts = new List<AccountViewModel>() { new AccountViewModel() { Mobile = "09114221321", Id = 2 } };
var accounts= _accountContext.Accounts.Where(x => x.Username.ToLower()=="mahan").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
var smsVM = accounts.Select(x => new AccountSmsTaskViewModel()
{
Mobile = x.Mobile,
AccountId = x.Id,
FullName = x.Fullname,
TaskCount = GetLateTasksCount(x.Id)
}).Where(x => x.TaskCount > 0 && !string.IsNullOrEmpty(x.Mobile) && x.Mobile.Length == 11).ToList();
Thread.Sleep(300);
foreach (var viewmodel in smsVM)
{
var smsResult = _smsService.TaskReminderSms(viewmodel.Mobile, $"{viewmodel.TaskCount}");
Thread.Sleep(1000);
var createSmsResult = new SmsResult(smsResult.MessageId, smsResult.Message, "یادآور وظایف",
viewmodel.FullName, viewmodel.Mobile, viewmodel.AccountId, viewmodel.AccountId);
_smsResultRepository.Create(createSmsResult);
_smsResultRepository.SaveChanges();
Thread.Sleep(1000);
}
}
private int GetLateTasksCount(long accountId)
{
var positionValue = _accountContext.Accounts
.Where(x => x.id == accountId)
.Include(p => p.Position)
.Select(x => x.Position.PositionValue)
.FirstOrDefault();
if (positionValue == 0)
return 0;
DateTime now = DateTime.Now;
int overdueTasksCount;
if (positionValue == 1)
{
overdueTasksCount = _accountContext.Assigns.Include(x => x.Task).Where(x => x.AssignedId == accountId &&
x.AssignerId == accountId && x.Task.Assigns.Count == 1 &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId && a.AssignerId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId && a.AssignerId == accountId)
// .EndTaskDate.Date <= DateTime.Now.Date) && x.Assigns.Count == 1);
}
else
{
overdueTasksCount = _accountContext.Assigns
.Include(x => x.Task)
.Where(x => x.AssignedId == accountId &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
}
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId).EndTaskDate.Date <= DateTime.Now.Date));
var overdueRequestsCount = _accountContext.Assigns.Include(x => x.Task)
.Where(x => (x.IsCanceledRequest
|| x.IsDoneRequest || x.TimeRequest) && !x.IsCancel && !x.IsDone &&
x.Task.IsActiveString == "true" &&
x.Task.SenderId == accountId).GroupBy(x => x.TaskId).Select(x => x.First()).Count();
return overdueTasksCount + overdueRequestsCount;
}
}
public class AccountSmsTaskViewModel
{
public int TaskCount { get; set; }
public long AccountId { get; set; }
public string Mobile { get; set; }
public string FullName { get; set; }
}

View File

@@ -1,25 +0,0 @@
using BackgroundInstitutionContract.Task.Jobs;
namespace BackgroundInstitutionContract.Task;
public class JobsBootstrapper
{
public static void Configure(IServiceCollection services)
{
var currentNamespace = typeof(JobSchedulerRegistrator).Namespace; // همون namespace کلاس
var assembly = typeof(JobSchedulerRegistrator).Assembly;
var jobTypes = assembly.GetTypes()
.Where(t =>
t is { IsClass: true, IsAbstract: false, Namespace: not null } &&
t.Namespace.StartsWith(currentNamespace, StringComparison.Ordinal))
.ToList();
foreach (var jobType in jobTypes)
{
services.AddTransient(jobType);
}
}
}

View File

@@ -1,63 +0,0 @@
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.InfraStructure.Mongo;
using AccountManagement.Configuration;
using BackgroundInstitutionContract.Task;
using BackgroundInstitutionContract.Task.Jobs;
using CompanyManagment.App.Contracts.Hubs;
using CompanyManagment.EFCore.Services;
using Hangfire;
using Microsoft.AspNetCore.Identity;
using MongoDB.Driver;
using PersonalContractingParty.Config;
using Query.Bootstrapper;
using WorkFlow.Infrastructure.Config;
var builder = WebApplication.CreateBuilder(args);
var hangfireConnectionString = builder.Configuration.GetConnectionString("HangfireDb");
builder.Services.AddHangfire(x => x.UseSqlServerStorage(hangfireConnectionString));
builder.Services.AddHangfireServer();
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
builder.Services.AddSingleton<IPasswordHasher, PasswordHasher>();
builder.Services.AddTransient<IAuthHelper, AuthHelper>();
builder.Services.AddTransient<ISmsService, SmsService>();
builder.Services.AddTransient<IUidService, UidService>();
builder.Services.AddTransient<IFileUploader, FileUploader>();
builder.Services.Configure<AppSettingConfiguration>(builder.Configuration);
#region MongoDb
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
var mongoDbSettings = mongoConnectionSection.Get<MongoDbConfig>();
var mongoClient = new MongoClient(mongoDbSettings.ConnectionString);
var mongoDatabase = mongoClient.GetDatabase(mongoDbSettings.DatabaseName);
builder.Services.AddSingleton<IMongoDatabase>(mongoDatabase);
#endregion
PersonalBootstrapper.Configure(builder.Services, connectionString);
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
QueryBootstrapper.Configure(builder.Services);
JobsBootstrapper.Configure(builder.Services);
builder.Services.AddHttpClient();
builder.Services.AddHttpContextAccessor();
builder.Services.AddSignalR();
var app = builder.Build();
app.MapHub<SendSmsHub>("/sendSmsHub");
app.MapHangfireDashboard();
app.MapGet("/", () => "Hello World!");
using (var scope = app.Services.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetRequiredService<JobSchedulerRegistrator>();
jobScheduler.Register();
}
app.Run();

View File

@@ -1,38 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56492",
"sslPort": 44378
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7223;http://localhost:5217",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -1,47 +0,0 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
//تست
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
//dad-mehr
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;",
//mahan Docker
//"MesbahDb": "Data Source=localhost,5069;Initial Catalog=mesbah_db;User ID=sa;Password=YourPassword123;TrustServerCertificate=True;",
//"HangfireDb": "Data Source=.;Initial Catalog=hangfire_db;Integrated Security=True;TrustServerCertificate=true;",
"HangfireDb": "Data Source=185.208.175.186;Initial Catalog=hangfire_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",
"SecretKey": "6Lfhp_AnAAAAANjDDY6DPrbbUQS7k6ZCRmrVP5Lb"
},
"SmsSecrets": {
"ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa",
"SecretKey": "dadmehr"
},
"Domain": ".gozareshgir.ir",
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
}
}

View File

@@ -1,28 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
//local
//"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
"MesbahDb": "Data Source=185.208.175.186;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//dad-mehr
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
//"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;",
"TestDb": "Data Source=185.208.175.186;Initial Catalog=TestDb;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//"MesbahDb": "Data Source=.\\MSSQLSERVER2019;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=mesbah_db;Password=sa142857$@;"
//"HangfireDb": "Data Source=.;Initial Catalog=hangfire_db;Integrated Security=True;TrustServerCertificate=true;",
"HangfireDb": "Data Source=185.208.175.186;Initial Catalog=hangfire_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;"
},
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
}
}

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\..\AccountManagement.Configuration\AccountManagement.Configuration.csproj" />
<ProjectReference Include="..\..\PersonalContractingParty.Config\PersonalContractingParty.Config.csproj" />
<ProjectReference Include="..\..\Query.Bootstrapper\Query.Bootstrapper.csproj" />
<ProjectReference Include="..\..\WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,32 +0,0 @@
using _0_Framework.Application;
namespace BackgroundJobs.Task
{
public class FileUploader : IFileUploader
{
private readonly IWebHostEnvironment _webHostEnvironment;
public FileUploader(IWebHostEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
}
public string Upload(IFormFile file, string path)
{
if (file == null) return "";
var directoryPath = $"{_webHostEnvironment.WebRootPath}\\ProductPictures\\{path}";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
var fileName = $"{DateTime.Now.ToFileName()}-{file.FileName}";
var filePath = $"{directoryPath}\\{fileName}";
var output = System.IO.File.Create(filePath);
file.CopyTo(output);
return $"{path}/{fileName}";
}
}
}

View File

@@ -1,62 +0,0 @@
using Hangfire;
namespace BackgroundJobs.Task.Jobs;
public class JobSchedulerRegistrator
{
private readonly IBackgroundJobClient _backgroundJobClient;
private readonly SmsReminder _smsReminder;
private static DateTime? _lastRunDateMorning;
private static DateTime? _lastRunDateEvening;
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient)
{
_smsReminder = smsReminder;
_backgroundJobClient = backgroundJobClient;
}
public void Register()
{
RecurringJob.AddOrUpdate(
"Task.SmsReminderChecker",
() => SmsReminderCheckAndSchedule(),
"*/5 * * * *" // هر 5 دقیقه یکبار چک کن
);
}
public void SmsReminderCheckAndSchedule()
{
var now = DateTime.Now;
var startMorning = new TimeSpan(9, 0, 0);
var endMorning = new TimeSpan(9, 40, 0);
var startEvening = new TimeSpan(15, 30, 0);
var endEvening = new TimeSpan(15, 40, 0);
// صبح
if (now.DayOfWeek != DayOfWeek.Friday &&
now.TimeOfDay >= startMorning &&
now.TimeOfDay < endMorning)
{
if (_lastRunDateMorning?.Date != now.Date)
{
_backgroundJobClient.Enqueue(() => _smsReminder.Execute());
_lastRunDateMorning = now;
}
}
// عصر - پنجشنبه و جمعه تعطیل است
if (now.DayOfWeek != DayOfWeek.Friday &&
now.DayOfWeek != DayOfWeek.Thursday &&
now.TimeOfDay >= startEvening &&
now.TimeOfDay < endEvening)
{
if (_lastRunDateEvening?.Date != now.Date)
{
_backgroundJobClient.Enqueue(() => _smsReminder.Execute());
_lastRunDateEvening = now;
}
}
}
}

View File

@@ -1,116 +0,0 @@
using _0_Framework.Application.Sms;
using AccountManagement.Application.Contracts.Account;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace BackgroundJobs.Task.Jobs;
public class SmsReminder
{
private readonly AccountContext _accountContext;
private readonly ISmsService _smsService;
private readonly ISmsResultRepository _smsResultRepository;
public SmsReminder(ISmsService smsService, AccountContext accountContext, ISmsResultRepository smsResultRepository)
{
_smsService = smsService;
_accountContext = accountContext;
_smsResultRepository = smsResultRepository;
}
public void Execute()
{
//var accounts = _accountContext.Accounts.Where(x => x.PositionId > 0 && x.IsActiveString == "true").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
//Thread.Sleep(300);
//var accounts = new List<AccountViewModel>() { new AccountViewModel() { Mobile = "09114221321", Id = 2 } };
var accounts= _accountContext.Accounts.Where(x => x.Username.ToLower()=="mahan").Select(x => new AccountViewModel() { Id = x.id, Mobile = x.Mobile, Fullname = x.Fullname }).ToList();
var smsVM = accounts.Select(x => new AccountSmsTaskViewModel()
{
Mobile = x.Mobile,
AccountId = x.Id,
FullName = x.Fullname,
TaskCount = GetLateTasksCount(x.Id)
}).Where(x => x.TaskCount > 0 && !string.IsNullOrEmpty(x.Mobile) && x.Mobile.Length == 11).ToList();
Thread.Sleep(300);
foreach (var viewmodel in smsVM)
{
var smsResult = _smsService.TaskReminderSms(viewmodel.Mobile, $"{viewmodel.TaskCount}");
Thread.Sleep(1000);
var createSmsResult = new SmsResult(smsResult.MessageId, smsResult.Message, "یادآور وظایف",
viewmodel.FullName, viewmodel.Mobile, viewmodel.AccountId, viewmodel.AccountId);
_smsResultRepository.Create(createSmsResult);
_smsResultRepository.SaveChanges();
Thread.Sleep(1000);
}
}
private int GetLateTasksCount(long accountId)
{
var positionValue = _accountContext.Accounts
.Where(x => x.id == accountId)
.Include(p => p.Position)
.Select(x => x.Position.PositionValue)
.FirstOrDefault();
if (positionValue == 0)
return 0;
DateTime now = DateTime.Now;
int overdueTasksCount;
if (positionValue == 1)
{
overdueTasksCount = _accountContext.Assigns.Include(x => x.Task).Where(x => x.AssignedId == accountId &&
x.AssignerId == accountId && x.Task.Assigns.Count == 1 &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId && a.AssignerId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId && a.AssignerId == accountId)
// .EndTaskDate.Date <= DateTime.Now.Date) && x.Assigns.Count == 1);
}
else
{
overdueTasksCount = _accountContext.Assigns
.Include(x => x.Task)
.Where(x => x.AssignedId == accountId &&
!x.IsCancel && !x.IsCanceledRequest &&
!x.IsDone && !x.TimeRequest && !x.IsDoneRequest && x.EndTaskDate.Date <= DateTime.Now.Date && x.Task.IsActiveString == "true")
.GroupBy(x => x.TaskId).Select(x => x.First()).Count();
}
//overdueTasksCount = _accountContext.Tasks.Include(x =>
// x.Assigns).Count(x => !x.Assigns.Any(a => a.IsCancel) && !x.Assigns.Any(a => a.IsCanceledRequest) &&
// !x.Assigns.Any(a => a.IsDone) && !x.Assigns.Any(a => a.IsDoneRequest) &&
// !x.Assigns.Any(a => a.TimeRequest)
// && x.Assigns.Any(a => a.AssignedId == accountId) &&
// (x.Assigns.First(a => a.AssignedId == accountId).EndTaskDate.Date <= DateTime.Now.Date));
var overdueRequestsCount = _accountContext.Assigns.Include(x => x.Task)
.Where(x => (x.IsCanceledRequest
|| x.IsDoneRequest || x.TimeRequest) && !x.IsCancel && !x.IsDone &&
x.Task.IsActiveString == "true" &&
x.Task.SenderId == accountId).GroupBy(x => x.TaskId).Select(x => x.First()).Count();
return overdueTasksCount + overdueRequestsCount;
}
}
public class AccountSmsTaskViewModel
{
public int TaskCount { get; set; }
public long AccountId { get; set; }
public string Mobile { get; set; }
public string FullName { get; set; }
}

View File

@@ -1,24 +0,0 @@
using BackgroundJobs.Task.Jobs;
namespace BackgroundJobs.Task;
public class JobsBootstrapper
{
public static void Configure(IServiceCollection services)
{
var currentNamespace = typeof(JobSchedulerRegistrator).Namespace; // همون namespace کلاس
var assembly = typeof(JobSchedulerRegistrator).Assembly;
var jobTypes = assembly.GetTypes()
.Where(t =>
t is { IsClass: true, IsAbstract: false, Namespace: not null } &&
t.Namespace.StartsWith(currentNamespace, StringComparison.Ordinal))
.ToList();
foreach (var jobType in jobTypes)
{
services.AddTransient(jobType);
}
}
}

View File

@@ -1,59 +0,0 @@
using _0_Framework.Application;
using _0_Framework.Application.Sms;
using _0_Framework.Application.UID;
using _0_Framework.InfraStructure.Mongo;
using AccountManagement.Configuration;
using BackgroundJobs.Task;
using BackgroundJobs.Task.Jobs;
using CompanyManagment.EFCore.Services;
using Hangfire;
using Microsoft.AspNetCore.Identity;
using MongoDB.Driver;
using PersonalContractingParty.Config;
using Query.Bootstrapper;
using WorkFlow.Infrastructure.Config;
var builder = WebApplication.CreateBuilder(args);
var hangfireConnectionString = builder.Configuration.GetConnectionString("HangfireDb");
builder.Services.AddHangfire(x => x.UseSqlServerStorage(hangfireConnectionString));
builder.Services.AddHangfireServer();
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
builder.Services.AddSingleton<IPasswordHasher, PasswordHasher>();
builder.Services.AddTransient<IAuthHelper, AuthHelper>();
builder.Services.AddTransient<ISmsService, SmsService>();
builder.Services.AddTransient<IUidService, UidService>();
builder.Services.AddTransient<IFileUploader, FileUploader>();
builder.Services.Configure<AppSettingConfiguration>(builder.Configuration);
#region MongoDb
var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
var mongoDbSettings = mongoConnectionSection.Get<MongoDbConfig>();
var mongoClient = new MongoClient(mongoDbSettings.ConnectionString);
var mongoDatabase = mongoClient.GetDatabase(mongoDbSettings.DatabaseName);
builder.Services.AddSingleton<IMongoDatabase>(mongoDatabase);
#endregion
PersonalBootstrapper.Configure(builder.Services, connectionString);
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
QueryBootstrapper.Configure(builder.Services);
JobsBootstrapper.Configure(builder.Services);
builder.Services.AddHttpClient();
builder.Services.AddHttpContextAccessor();
var app = builder.Build();
app.MapHangfireDashboard();
app.MapGet("/", () => "Hello World!");
using (var scope = app.Services.CreateScope())
{
var jobScheduler = scope.ServiceProvider.GetRequiredService<JobSchedulerRegistrator>();
jobScheduler.Register();
}
app.Run();

View File

@@ -1,38 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56492",
"sslPort": 44378
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7222;http://localhost:5216",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -1,46 +0,0 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
//تست
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
//dad-mehr
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;",
//mahan Docker
//"MesbahDb": "Data Source=localhost,5069;Initial Catalog=mesbah_db;User ID=sa;Password=YourPassword123;TrustServerCertificate=True;",
"HangfireDb": "Data Source=.;Initial Catalog=hangfire_db;Integrated Security=True;TrustServerCertificate=true;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",
"SecretKey": "6Lfhp_AnAAAAANjDDY6DPrbbUQS7k6ZCRmrVP5Lb"
},
"SmsSecrets": {
"ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa",
"SecretKey": "dadmehr"
},
"Domain": ".gozareshgir.ir",
"MongoDb": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "Gozareshgir"
}
}

View File

@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -1,7 +1,6 @@
using System;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.AndroidApkVersion;
namespace Company.Domain.AndroidApkVersionAgg;
@@ -9,17 +8,14 @@ public class AndroidApkVersion:EntityBase
{
private AndroidApkVersion () { }
public AndroidApkVersion( string versionName,string versionCode, IsActive isActive, string path, ApkType apkType, bool isForce = false)
public AndroidApkVersion( string versionName,string versionCode, IsActive isActive, string path)
{
VersionName = versionName;
VersionCode = versionCode;
IsActive = isActive;
Path = path;
ApkType = apkType;
IsForce = isForce;
var appName = apkType == ApkType.WebView ? "Gozareshgir-WebView" : "Gozareshgir-FaceDetection";
Title = $"{appName}-{versionName}-{CreationDate:g}";
Title = $"Gozareshgir-{versionName}-{CreationDate:g}";
}
public string Title { get; private set; }
@@ -27,9 +23,6 @@ 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()
{
@@ -40,4 +33,4 @@ public class AndroidApkVersion:EntityBase
{
IsActive = IsActive.False;
}
}
}

View File

@@ -1,14 +1,12 @@
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(ApkType apkType);
AndroidApkVersion GetLatestActive(ApkType apkType);
IQueryable<AndroidApkVersion> GetActives();
void Remove(AndroidApkVersion entity);
System.Threading.Tasks.Task<string> GetLatestActiveVersionPath(ApkType apkType);
System.Threading.Tasks.Task<string> GetLatestActiveVersionPath();
}

View File

@@ -75,5 +75,5 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
Task<GetLegalContractingPartyDetailsViewModel> GetLegalDetails(long id);
Task<PersonalContractingParty> GetByNationalCode(string nationalCode);
Task<PersonalContractingParty> GetByNationalId(string registerId);
Task<PersonalContractingParty> GetByRegisterId(string registerId);
}

View File

@@ -48,6 +48,10 @@ public interface IContractRepository : IRepository<long, Contract>
bool Remove(long id);
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel);
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
#endregion
#region NewChangeByHeydari
@@ -63,4 +67,8 @@ public interface IContractRepository : IRepository<long, Contract>
ContractViweModel GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
List<ContractViweModel> GetByWorkshopIdInDates(long workshopId, DateTime contractStart, DateTime contractEnd);
#endregion
}
}

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -34,8 +33,7 @@ public class CustomizeCheckout : EntityBase
ICollection<CustomizeCheckoutSalaryAid> customizeCheckoutSalaryAids,
ICollection<CustomizeCheckoutReward> customizeCheckoutRewards, TimeSpan lateToWorkValue, double settingSalary,
double dailyWage, WorkshopShiftStatus shiftStatus, IrregularShift irregularShift,
ICollection<CustomizeRotatingShift> customizeRotatingShifts, ICollection<CustomizeCheckoutRegularShift> employeeSettingsShifts,
ICollection<CheckoutDynamicDeductionItem> checkoutDynamicDeductions)
ICollection<CustomizeRotatingShift> customizeRotatingShifts, ICollection<CustomizeCheckoutRegularShift> employeeSettingsShifts)
{
YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0, 4));
MonthInt = Convert.ToInt32(contractStart.ToFarsi().Substring(5, 2));
@@ -85,7 +83,6 @@ public class CustomizeCheckout : EntityBase
IrregularShift = irregularShift;
CustomizeRotatingShifts = customizeRotatingShifts;
RegularShifts = employeeSettingsShifts;
CheckoutDynamicDeductions = checkoutDynamicDeductions;
}
@@ -289,7 +286,6 @@ public class CustomizeCheckout : EntityBase
public ICollection<CustomizeCheckoutLoanInstallments> CustomizeCheckoutLoanInstallments { get; set; }
public ICollection<CustomizeCheckoutSalaryAid> CustomizeCheckoutSalaryAids { get; set; }
public ICollection<CustomizeCheckoutReward> CustomizeCheckoutRewards { get; set; }
public ICollection<CheckoutDynamicDeductionItem> CheckoutDynamicDeductions { get; private set; }
public IrregularShift IrregularShift { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }

View File

@@ -9,7 +9,6 @@ using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using System.Linq;
using _0_Framework.Application.Enums;
namespace Company.Domain.CustomizeCheckoutTempAgg;
@@ -22,8 +21,7 @@ public class CustomizeCheckoutTemp : EntityBase
{
LateToWorkValue = lateToWorkValue;
}
public CustomizeCheckoutTemp(
DateTime contractStart, DateTime contractEnd, long employeeId, string employeeFName,
public CustomizeCheckoutTemp(DateTime contractStart, DateTime contractEnd, long employeeId, string employeeFName,
string employeeLName, DateTime employeeDateOfBirth,
string employeeNationalCode, string workshopFullName, long workshopId, long? contractId,
double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay,
@@ -39,8 +37,7 @@ public class CustomizeCheckoutTemp : EntityBase
ICollection<CustomizeCheckoutTempSalaryAid> customizeCheckoutSalaryAids,
ICollection<CustomizeCheckoutTempReward> customizeCheckoutRewards,
TimeSpan lateToWorkValue, double settingSalary, double dailyWage, WorkshopShiftStatus shiftStatus, IrregularShift irregularShift,
ICollection<CustomizeRotatingShift> customizeRotatingShifts, ICollection<CustomizeCheckoutRegularShift> employeeSettingsShifts,
ICollection<CheckoutDynamicDeductionItem> checkoutDynamicDeductions)
ICollection<CustomizeRotatingShift> customizeRotatingShifts, ICollection<CustomizeCheckoutRegularShift> employeeSettingsShifts)
{
YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0, 4));
MonthInt = Convert.ToInt32(contractStart.ToFarsi().Substring(5, 2));
@@ -90,7 +87,6 @@ public class CustomizeCheckoutTemp : EntityBase
IrregularShift = irregularShift;
CustomizeRotatingShifts = customizeRotatingShifts;
RegularShifts = employeeSettingsShifts;
CheckoutDynamicDeductions = checkoutDynamicDeductions;
}
#region Getters
@@ -127,7 +123,6 @@ public class CustomizeCheckoutTemp : EntityBase
public IrregularShift IrregularShift { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public ICollection<CustomizeCheckoutRegularShift> RegularShifts { get; set; }
public ICollection<CheckoutDynamicDeductionItem> CheckoutDynamicDeductions { get; private set; }
#endregion
@@ -394,4 +389,4 @@ public class CustomizeCheckoutTemp : EntityBase
{
HasAmountConflict = hasConflict;
}
}
}

View File

@@ -1,189 +0,0 @@
using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
public class EmployeeFaceEmbedding
{
public EmployeeFaceEmbedding()
{
EmbeddingHistory = new List<EmbeddingHistoryItem>();
MetadataHistory = new List<MetadataHistoryItem>();
}
public EmployeeFaceEmbedding(string employeeFullName, long employeeId, long workshopId,
List<double> embeddings, EmployeeFaceEmbeddingMetadata metadata)
{
Id = Guid.NewGuid().ToString();
EmployeeFullName = employeeFullName;
EmployeeId = employeeId;
WorkshopId = workshopId;
Embeddings = embeddings;
Metadata = metadata;
EmbeddingHistory = new List<EmbeddingHistoryItem>();
MetadataHistory = new List<MetadataHistoryItem>();
CreatedAt = DateTime.UtcNow;
UpdatedAt = DateTime.UtcNow;
}
[BsonId]
[BsonRepresentation(BsonType.String)]
public string Id { get; set; }
[BsonElement("employeeFullName")]
public string EmployeeFullName { get; set; }
[BsonElement("employeeId")]
public long EmployeeId { get; set; }
[BsonElement("workshopId")]
public long WorkshopId { get; set; }
[BsonElement("embeddings")]
public List<double> Embeddings { get; set; }
[BsonElement("metadata")]
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
[BsonElement("embeddingHistory")]
public List<EmbeddingHistoryItem> EmbeddingHistory { get; set; }
[BsonElement("metadataHistory")]
public List<MetadataHistoryItem> MetadataHistory { get; set; }
[BsonElement("createdAt")]
public DateTime CreatedAt { get; set; }
[BsonElement("updatedAt")]
public DateTime UpdatedAt { get; set; }
public void UpdateEmbedding(List<double> newEmbedding, double confidence, double refinementPercentage)
{
if (Embeddings != null)
{
EmbeddingHistory.Add(new EmbeddingHistoryItem
{
Embedding = new List<double>(Embeddings),
Timestamp = DateTime.UtcNow,
Confidence = confidence,
RefinementPercentage = refinementPercentage
});
}
Embeddings = newEmbedding;
UpdatedAt = DateTime.UtcNow;
}
public void UpdateMetadata(EmployeeFaceEmbeddingMetadata newMetadata, double confidence, double refinementPercentage)
{
if (Metadata != null)
{
MetadataHistory.Add(new MetadataHistoryItem
{
Metadata = Metadata,
Timestamp = DateTime.UtcNow,
Confidence = confidence,
RefinementPercentage = refinementPercentage
});
}
Metadata = newMetadata;
UpdatedAt = DateTime.UtcNow;
}
public void UpdateEmployeeInfo(string employeeFullName, long workshopId)
{
EmployeeFullName = employeeFullName;
WorkshopId = workshopId;
UpdatedAt = DateTime.UtcNow;
}
}
public class EmployeeFaceEmbeddingMetadata
{
[BsonElement("avg_eye_distance_normalized")]
public double AvgEyeDistanceNormalized { get; set; }
[BsonElement("avg_eye_to_face_ratio")]
public double AvgEyeToFaceRatio { get; set; }
[BsonElement("avg_face_aspect_ratio")]
public double AvgFaceAspectRatio { get; set; }
[BsonElement("avg_detection_confidence")]
public double AvgDetectionConfidence { get; set; }
[BsonElement("avg_keypoints_normalized")]
public EmployeeFaceEmbeddingKeypoints AvgKeypointsNormalized { get; set; }
[BsonElement("per_image_metadata")]
public List<ImageMetadata> PerImageMetadata { get; set; }
}
public class EmployeeFaceEmbeddingKeypoints
{
[BsonElement("left_eye")]
public double[] LeftEye { get; set; }
[BsonElement("right_eye")]
public double[] RightEye { get; set; }
[BsonElement("nose")]
public double[] Nose { get; set; }
[BsonElement("mouth_left")]
public double[] MouthLeft { get; set; }
[BsonElement("mouth_right")]
public double[] MouthRight { get; set; }
}
public class ImageMetadata
{
[BsonElement("face_aspect_ratio")]
public double FaceAspectRatio { get; set; }
[BsonElement("eye_distance_normalized")]
public double EyeDistanceNormalized { get; set; }
[BsonElement("eye_to_face_ratio")]
public double EyeToFaceRatio { get; set; }
[BsonElement("detection_confidence")]
public double DetectionConfidence { get; set; }
[BsonElement("keypoints_normalized")]
public EmployeeFaceEmbeddingKeypoints KeypointsNormalized { get; set; }
}
public class EmbeddingHistoryItem
{
[BsonElement("embedding")]
public List<double> Embedding { get; set; }
[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
[BsonElement("confidence")]
public double Confidence { get; set; }
[BsonElement("refinementPercentage")]
public double RefinementPercentage { get; set; }
}
public class MetadataHistoryItem
{
[BsonElement("metadata")]
public EmployeeFaceEmbeddingMetadata Metadata { get; set; }
[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
[BsonElement("confidence")]
public double Confidence { get; set; }
[BsonElement("refinementPercentage")]
public double RefinementPercentage { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.EmployeeFaceEmbeddingAgg;
public interface IEmployeeFaceEmbeddingRepository
{
Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding);
Task<EmployeeFaceEmbedding> GetByIdAsync(string id);
Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId);
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId);
Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds);
Task DeleteAsync(string id);
}

View File

@@ -1,108 +0,0 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
using Company.Domain.PaymentTransactionAgg;
using CompanyManagment.App.Contracts.FinancialInvoice;
namespace Company.Domain.FinancialInvoiceAgg;
public class FinancialInvoice : EntityBase
{
public string InvoiceNumber { get; private set; }
public string Description { get; set; }
public FinancialInvoiceStatus Status { get; private set; }
public DateTime? PaidAt { get; private set; }
public double Amount { get; private set; }
public Guid PublicId { get; private set; }
public bool IsActive { get; set; }
public List<PaymentTransaction> PaymentTransactions { get; private set; }
public long ContractingPartyId { get; private set; }
public List<FinancialInvoiceItem> Items { get; private set; }
public FinancialInvoice(double amount, long contractingPartyId, string description)
{
InvoiceNumber = GenerateInvoiceNumber();
Status = FinancialInvoiceStatus.Unpaid;
Amount = amount;
PublicId = Guid.NewGuid();
ContractingPartyId = contractingPartyId;
Description = description;
IsActive = true;
Items = [];
PaymentTransactions = [];
}
public void AddItem(FinancialInvoiceItem item)
{
Items ??= [];
Items.Add(item);
}
public void SetItems(List<FinancialInvoiceItem> items)
{
Items = items;
}
public void SetPaid(DateTime paidAt)
{
Status = FinancialInvoiceStatus.Paid;
PaidAt = paidAt;
}
public void SetUnpaid()
{
Status = FinancialInvoiceStatus.Unpaid;
PaidAt = null;
}
public void SetCancelled()
{
Status = FinancialInvoiceStatus.Cancelled;
PaidAt = null;
}
public void SetRefunded()
{
Status = FinancialInvoiceStatus.Refunded;
PaidAt = null;
}
public void DeActivate()
{
IsActive = false;
}
public void SetInvoiceNumber(string invoiceNumber)
{
InvoiceNumber = invoiceNumber;
}
private string GenerateInvoiceNumber()
{
var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
var random = new Random().Next(1000, 9999);
return $"GZ_{timestamp}{random}";
}
}
public class FinancialInvoiceItem : EntityBase
{
public string Description { get; private set; }
public double Amount { get; private set; }
public FinancialInvoiceItemType Type { get; set; }
public long EntityId { get; set; }
public FinancialInvoice FinancialInvoice { get; set; }
public long FinancialInvoiceId { get; set; }
public FinancialInvoiceItem(string description, double amount,
long financialInvoiceId, FinancialInvoiceItemType type, long entityId)
{
Description = description;
Amount = amount;
FinancialInvoiceId = financialInvoiceId;
Type = type;
EntityId = entityId;
}
}

View File

@@ -1,13 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.FinancialInvoice;
namespace Company.Domain.FinancialInvoiceAgg;
public interface IFinancialInvoiceRepository : IRepository<long, FinancialInvoice>
{
EditFinancialInvoice GetDetails(long id);
List<FinancialInvoiceViewModel> Search(FinancialInvoiceSearchModel searchModel);
Task<FinancialInvoice> GetUnPaidByEntityId(long entityId, FinancialInvoiceItemType financialInvoiceItemType);
}

View File

@@ -5,7 +5,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Domain;
using Company.Domain.FinancialInvoiceAgg;
using Company.Domain.FinancialTransactionAgg;
namespace Company.Domain.FinancialStatmentAgg;

View File

@@ -22,8 +22,6 @@ public interface IFinancialStatmentRepository : IRepository<long, FinancialStatm
Task<OperationResult<ClientFinancialStatementViewModel>> GetDetailsByPublicId(string publicId);
Task<GetFinancialStatementBalanceAmount> GetBalanceAmount(long id);
Task<double> GetClientDebtAmount(long accountId);
Task<double> GetClientDebtAmountByContractingPartyId(long contractingPartyId);
Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel);
Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel);
Task<FinancialStatment> GetByContractingPartyId(long contractingPartyId);
}

View File

@@ -26,35 +26,6 @@ public class FinancialTransaction : EntityBase
}
/// <summary>
/// ایجاد از طرف بک گراند سرویس
/// </summary>
/// <param name="financialStatementId"></param>
/// <param name="tdateGr"></param>
/// <param name="tdateFa"></param>
/// <param name="description"></param>
/// <param name="typeOfTransaction"></param>
/// <param name="descriptionOption"></param>
/// <param name="deptor"></param>
/// <param name="creditor"></param>
/// <param name="balance"></param>
/// <param name="sentSms"></param>
public FinancialTransaction(long financialStatementId, DateTime tdateGr, string tdateFa, string description,
string typeOfTransaction, string descriptionOption, double deptor, double creditor, double balance,
bool sentSms)
{
FinancialStatementId = financialStatementId;
TdateGr = tdateGr;
TdateFa = tdateFa;
Description = description;
TypeOfTransaction = typeOfTransaction;
DescriptionOption = descriptionOption;
Deptor = deptor;
Creditor = creditor;
Balance = balance;
SentSms = sentSms;
}
public long FinancialStatementId { get; private set; }
public DateTime TdateGr { get; private set; }
public string TdateFa { get; private set; }

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop;
@@ -45,7 +44,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
/// <param name="endOfMonthGr"></param>
/// <param name="endOfMonth"></param>
/// <param name="description"></param>
Task RollCallServiceCreateTransaction();
void RollcallServiceCreateTransaction();
Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(InstitutionContractListSearchModel searchModel);
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
@@ -78,71 +77,4 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
#region ReminderSMS
/// <summary>
/// دریافت لیست - ارسال پیامک
/// فراخوانی از سمت بک گراند سرویس
/// </summary>
/// <returns></returns>
Task<bool> SendReminderSmsForBackgroundTask();
/// <summary>
/// ارسال پیامک صورت حساب ماهانه
/// </summary>
/// <param name="now"></param>
/// <returns></returns>
Task SendMonthlySms(DateTime now);
/// <summary>
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
/// </summary>
/// <returns></returns>
Task SendBlockSmsForBackgroundTask();
/// <summary>
/// دریافت لیست واجد شرایط بلاک
/// جهت ارسال پیامک مسدودی
/// </summary>
/// <param name="checkDate"></param>
/// <returns></returns>
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
/// <summary>
/// ارسال پیامک مسدودی
/// </summary>
/// <param name="smsListData"></param>
/// <param name="typeOfSms"></param>
/// <param name="sendMessStart"></param>
/// <param name="sendMessEnd"></param>
/// <returns></returns>
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
string sendMessStart, string sendMessEnd);
/// <summary>
///دریافت لیست بدهکارن
/// جهت ارسال پیامک
/// </summary>
/// <returns></returns>
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک های یاد آور بدهی
/// </summary>
/// <returns></returns>
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
#endregion
#region CreateMontlyTransaction
/// <summary>
/// ایجاد سند مالی برای قرارداد ها
/// </summary>
/// <returns></returns>
Task CreateTransactionForInstitutionContracts(DateTime endOfMonthGr, string endOfMonthFa, string description);
#endregion
}

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Security.Cryptography;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using Company.Domain.InstitutionContractContactInfoAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
@@ -372,3 +371,20 @@ public enum InstitutionContractAmendmentChangeType
WorkshopCreated
}
public enum InstitutionContractVerificationStatus
{
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -1,6 +1,5 @@
using System;
using _0_Framework.Domain;
using Company.Domain.FinancialInvoiceAgg;
using CompanyManagment.App.Contracts.PaymentTransaction;
namespace Company.Domain.PaymentTransactionAgg;
@@ -10,25 +9,22 @@ namespace Company.Domain.PaymentTransactionAgg;
/// </summary>
public class PaymentTransaction:EntityBase
{
/// <summary>
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
/// </summary>
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
/// <param name="amount">مبلغ تراکنش</param>
/// <param name="contractingPartyName"></param>
/// <param name="callBackUrl"></param>
/// <param name="gateway"></param>
public PaymentTransaction(long contractingPartyId,
/// <summary>
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
/// </summary>
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
/// <param name="amount">مبلغ تراکنش</param>
/// <param name="contractingPartyName"></param>
/// <param name="callBackUrl"></param>
public PaymentTransaction(long contractingPartyId,
double amount,
string contractingPartyName,string callBackUrl,
PaymentTransactionGateWay gateway)
string contractingPartyName,string callBackUrl)
{
ContractingPartyId = contractingPartyId;
Status = PaymentTransactionStatus.Pending;
Amount = amount;
ContractingPartyName = contractingPartyName;
CallBackUrl = callBackUrl;
Gateway = gateway;
}
/// <summary>
@@ -72,23 +68,13 @@ public class PaymentTransaction:EntityBase
public string TransactionId { get; private set; }
public string CallBackUrl { get; private set; }
public PaymentTransactionGateWay Gateway { get; private set; }
public string Rrn { get; private set; }
public string DigitalReceipt { get; private set; }
public FinancialInvoice FinancialInvoice { get; set; }
public long? FinancialInvoiceId { get; set; }
public void SetPaid(string cardNumber,string bankName,string rrn,string digitalReceipt)
public void SetPaid(string cardNumber,string bankName)
{
Status = PaymentTransactionStatus.Success;
TransactionDate = DateTime.Now;
CardNumber = cardNumber;
BankName = bankName;
Rrn = rrn;
DigitalReceipt = digitalReceipt;
}
public void SetFailed()
{
@@ -99,5 +85,4 @@ public class PaymentTransaction:EntityBase
{
TransactionId = transactionId;
}
}
}

View File

@@ -11,23 +11,21 @@ namespace Company.Domain.ReportAgg
{
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
AllReport GetAllActiveWorkshops(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);

View File

@@ -1,30 +0,0 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using System.Threading.Tasks;
namespace Company.Domain.SmsResultAgg;
public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
{
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveItem(long id);
}

View File

@@ -1,72 +0,0 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using System;
namespace Company.Domain.SmsResultAgg;
public class SmsSetting : EntityBaseWithoutCreationDate
{
/// <summary>
/// ایجاد تنظیمات پیامک
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
public SmsSetting(TypeOfSmsSetting typeOfSmsSetting, int dayOfMonth, TimeSpan timeOfDay)
{
TypeOfSmsSetting = typeOfSmsSetting;
DayOfMonth = dayOfMonth;
TimeOfDay = timeOfDay;
IsActive = true;
}
/// <summary>
/// نوع پیامک
/// </summary>
public TypeOfSmsSetting TypeOfSmsSetting { get; set; }
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// ساعت
/// </summary>
public TimeSpan TimeOfDay { get; set; }
/// <summary>
/// فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
public void Edit(int dayOfMonth, TimeSpan timeOfDay)
{
DayOfMonth = dayOfMonth;
TimeOfDay = timeOfDay;
}
/// <summary>
/// فعال نمودن
/// </summary>
public void Active()
{
IsActive = true;
}
/// <summary>
/// غیر فعال نمودن
/// </summary>
public void DeActive()
{
IsActive = false;
}
}

View File

@@ -1,47 +0,0 @@
using System.Drawing;
using CompanyManagment.App.Contracts.Workshop;
using OfficeOpenXml;
using OfficeOpenXml.Style;
namespace CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
public class WorkshopRollCallExcelExporter
{
public static byte[] Export(List<WorkshopRollCallExcelViewModel> workshops)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (var package = new ExcelPackage())
{
var ws = package.Workbook.Worksheets.Add("Workshops");
// Header
ws.Cells[1, 1].Value = "نام کارگاه";
ws.Cells[1, 2].Value = "فعال/غیرفعال";
ws.Cells[1, 3].Value = "تعداد پرسنل";
ws.Cells[1, 4].Value = "نام کارفرما";
ws.Row(1).Style.Font.Bold = true;
ws.Row(1).Style.Fill.PatternType = ExcelFillStyle.Solid;
ws.Row(1).Style.Fill.BackgroundColor.SetColor(Color.LightGray);
int row = 2;
foreach (var w in workshops)
{
ws.Cells[row, 1].Value = w.WorkshopName;
ws.Cells[row, 2].Value = w.IsActive ? "فعال" : "غیرفعال";
ws.Cells[row, 3].Value = w.PersonnelCount;
ws.Cells[row, 4].Value = w.EmployerName;
if (!w.IsActive)
{
using (var range = ws.Cells[row, 1, row, 4])
{
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.LightGray);
}
}
row++;
}
ws.Cells[ws.Dimension.Address].AutoFitColumns();
return package.GetAsByteArray();
}
}
}

View File

@@ -1,11 +0,0 @@
namespace CompanyManagement.Infrastructure.Excel.WorkshopsRollCall
{
public class WorkshopRollCallExcelViewModel
{
public string WorkshopName { get; set; }
public bool IsActive { get; set; }
public int PersonnelCount { get; set; }
public string EmployerName { get; set; }
}
}

View File

@@ -1,60 +0,0 @@
using Company.Domain.EmployeeFaceEmbeddingAgg;
using MongoDB.Driver;
namespace CompanyManagement.Infrastructure.Mongo.EmployeeFaceEmbeddingRepo;
public class EmployeeFaceEmbeddingRepository : IEmployeeFaceEmbeddingRepository
{
private readonly IMongoCollection<EmployeeFaceEmbedding> _employeeFaceEmbeddings;
public EmployeeFaceEmbeddingRepository(IMongoDatabase database)
{
_employeeFaceEmbeddings = database.GetCollection<EmployeeFaceEmbedding>("EmployeeFaces");
}
public async Task CreateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
{
await _employeeFaceEmbeddings.InsertOneAsync(employeeFaceEmbedding);
}
public async Task UpdateAsync(EmployeeFaceEmbedding employeeFaceEmbedding)
{
await _employeeFaceEmbeddings.ReplaceOneAsync(
x => x.Id == employeeFaceEmbedding.Id,
employeeFaceEmbedding);
}
public async Task<EmployeeFaceEmbedding> GetByIdAsync(string id)
{
return await _employeeFaceEmbeddings
.Find(x => x.Id == id)
.FirstOrDefaultAsync();
}
public async Task<EmployeeFaceEmbedding> GetByEmployeeIdAsync(long employeeId)
{
return await _employeeFaceEmbeddings
.Find(x => x.EmployeeId == employeeId)
.FirstOrDefaultAsync();
}
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdAsync(long workshopId)
{
return await _employeeFaceEmbeddings
.Find(x => x.WorkshopId == workshopId)
.ToListAsync();
}
public async Task<List<EmployeeFaceEmbedding>> GetByWorkshopIdsAsync(List<long> workshopIds)
{
return await _employeeFaceEmbeddings
.Find(x => workshopIds.First()==x.WorkshopId)
.ToListAsync();
}
public async Task DeleteAsync(string id)
{
await _employeeFaceEmbeddings.DeleteOneAsync(x => x.Id == id);
}
}

View File

@@ -1,8 +0,0 @@
namespace CompanyManagment.App.Contracts.AndroidApkVersion;
public enum ApkType
{
WebView,
FaceDetection
}

View File

@@ -4,15 +4,12 @@ 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, 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);
Task<OperationResult> CreateAndActive(IFormFile file);
Task<OperationResult> CreateAndDeActive(IFormFile file);
Task<string> GetLatestActiveVersionPath();
OperationResult Remove(long id);
bool HasAndroidApkToDownload(ApkType apkType);
bool HasAndroidApkToDownload();
}

View File

@@ -0,0 +1,12 @@
namespace CompanyManagment.App.Contracts.Contract;
public enum ContractListOrderType
{
ByContractCreationDate,
BySignedContract,
ByUnSignedContract,
ByPersonnelCode,
ByPersonnelCodeDescending,
ByContractStartDate,
ByContractStartDateDescending
}

View File

@@ -0,0 +1,13 @@
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Contract;
public class GetContractListForClientRequest: PaginationRequest
{
public int Year { get; set; }
public int Month { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public long EmployeeId { get; set; }
public ContractListOrderType? OrderType { get; set; }
}

View File

@@ -0,0 +1,15 @@
namespace CompanyManagment.App.Contracts.Contract;
public class GetContractListForClientResponse
{
public long Id { get; set; }
public string PersonnelCode { get; set; }
public string ContractNo { get; set; }
public string EmployeeFullName { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public bool IsSigned { get; set; }
public string DailyWage { get; set; }
public string AvgWorkingHour { get; set; }
public string FamilyAllowance { get; set; }
}

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Workshop;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
@@ -45,16 +47,101 @@ public interface IContractApplication
#region Client
OperationResult Remove(long id);
[Obsolete("این متد منسوخ شده است. لطفاً از متد GetContractListForClient استفاده کنید.")]
List<ContractViweModel> SearchForClient(ContractSearchModel searchModel);
#endregion
/// <summary>
/// لیست قراردادها برای کلاینت
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<PagedResult<GetContractListForClientResponse>>
GetContractListForClient(GetContractListForClientRequest searchModel);
Task<ContractPrintViewModel> PrintOneAsync(long id);
Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids);
#region NewChangeByHeydari
#endregion
OperationResult DeleteAllContarcts(List<long> ids);
#region NewChangeByHeydari
OperationResult DeleteAllContarcts(List<long> ids);
OperationResult DeleteContarcts(long id);
List<long> CheckHasCheckout(List<long> ids);
List<long> CheckHasSignature(List<long> ids);
List<ContractViweModel> SearchForMainContract(ContractSearchModel searchModel);
#endregion
}
public class ContractPrintViewModel
{
public string ContractNo { get; set; }
public ContractPrintEmployerViewModel Employer { get; set; }
public ContractPrintEmployeeViewModel Employee { get; set; }
public ContractPrintTypeOfContractViewModel TypeOfContract { get; set; }
public ContractPrintFeesViewModel Fees { get; set; }
public string ConditionAndDetials { get; set; }
}
public class ContractPrintFeesViewModel
{
public string DailyWage { get; set; }
public string FamilyAllowance { get; set; }
public string ConsumableItems { get; set; }
public string HousingAllowance { get; set; }
}
public class ContractPrintTypeOfContractViewModel
{
public string ContractType { get; set; }
public string JobName { get; set; }
public string SetContractDate { get; set; }
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }
public string WorkingHoursWeekly { get; set; }
public List<string> WorkshopAddress { get; set; }
}
public class ContractPrintEmployeeViewModel
{
public string FullName { get; set; }
public string NationalCode { get; set; }
public string IdNumber { get; set; }
public string DateOfBirth { get; set; }
public string FatherName { get; set; }
public string LevelOfEducation { get; set; }
public string Address { get; set; }
}
public class ContractPrintEmployerViewModel
{
public LegalType LegalType { get; set; }
public ContractPrintRealEmployerViewModel RealEmployer { get; set; }
public ContractPrintLegalEmployerViewModel LegalEmployer { get; set; }
public string WorkshopName { get; set; }
public string Address { get; set; }
public string WorkshopCode { get; set; }
}
public class ContractPrintLegalEmployerViewModel
{
public string CompanyName { get; set; }
public string NationalId { get; set; }
public string RegisterId { get; set; }
}
public class ContractPrintRealEmployerViewModel
{
public string FullName { get; set; }
public string NationalCode { get; set; }
public string IdNumber { get; set; }
}

View File

@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -20,6 +18,8 @@ namespace CompanyManagment.App.Contracts.CustomizeCheckout;
public class CustomizeCheckoutMandatoryViewModel
{
/// <summary>
/// حقوق ماهانه
/// </summary>
@@ -159,7 +159,7 @@ public class CustomizeCheckoutMandatoryViewModel
/// </summary>
public double TotalDeductionsDouble => FineAbsenceDeduction + InsuranceDeduction + LateToWorkDeduction +
EarlyExitDeduction + SalaryAidDeduction + InstallmentDeduction +
FineDeduction + TaxDeduction+ DynamicDeductions.Sum(x=>x.Amount.MoneyToDouble());
FineDeduction + TaxDeduction;
/// <summary>
/// مجموع مطالبات
@@ -207,8 +207,6 @@ public class CustomizeCheckoutMandatoryViewModel
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; } = [];
public ICollection<CustomizeSifts> EmployeeSettingsShifts { get; set; } = [];
public List<CheckoutDynamicDeductionItem> DynamicDeductions { get; set; } = new();
}

View File

@@ -4,7 +4,6 @@ using System;
using System.Collections.Generic;
using System.Runtime;
using System.Security.AccessControl;
using _0_Framework.Application.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -13,115 +12,113 @@ using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.Reward;
using CompanyManagment.App.Contracts.SalaryAid;
namespace CompanyManagment.App.Contracts.CustomizeCheckout;
public class CustomizeCheckoutViewModel
namespace CompanyManagment.App.Contracts.CustomizeCheckout
{
public long Id { get; set; }
public DateTime CreationDate { get; set; }
public string Month { get; set; }
public string Year { get; set; }
public int PrintCounter { get; set; }
public class CustomizeCheckoutViewModel
{
public long Id { get; set; }
public DateTime CreationDate { get; set; }
public string Month { get; set; }
public string Year { get; set; }
public int PrintCounter { get; set; }
public long EmployeeId { get; set; }
public string EmployeeFName { get; set; }
public string EmployeeLName { get; set; }
public string EmployeeFullName => $"{EmployeeFName} {EmployeeLName}";
public string FatherName { get; set; }
public string NationalCode { get; set; }
public string DateOfBirth { get; set; }
public long PersonnelCode { get; set; }
public string PersonnelCodeString => PersonnelCode.ToString();
public long EmployeeId { get; set; }
public string EmployeeFName { get; set; }
public string EmployeeLName { get; set; }
public string EmployeeFullName => $"{EmployeeFName} {EmployeeLName}";
public string FatherName { get; set; }
public string NationalCode { get; set; }
public string DateOfBirth { get; set; }
public long PersonnelCode { get; set; }
public string PersonnelCodeString => PersonnelCode.ToString();
public string WorkshopName { get; set; }
public long WorkshopId { get; set; }
public string WorkshopName { get; set; }
public long WorkshopId { get; set; }
public long EmployerId { get; set; }
public string EmployerName { get; set; }
public List<EmployerViewModel> EmployerList { get; set; }
public long EmployerId { get; set; }
public string EmployerName { get; set; }
public List<EmployerViewModel> EmployerList { get; set; }
public long ContractId { get; set; }
public string ContractNo { get; set; }
public DateTime ContractStartGr { get; set; }
public DateTime ContractEndGr { get; set; }
public string ContractStartFa { get; set; }
public string ContractEndFa { get; set; }
//[JsonIgnore]
//public string LastDayOfWork => LeftWorkDateGr.AddDays(-1).ToFarsi();
//[JsonIgnore]
//public string LeftWorkDateFa => LeftWorkDateGr.ToFarsi();
public DateTime LeftWorkDateGr { get; set; }
public long ContractId { get; set; }
public string ContractNo { get; set; }
public DateTime ContractStartGr { get; set; }
public DateTime ContractEndGr { get; set; }
public string ContractStartFa { get; set; }
public string ContractEndFa { get; set; }
//[JsonIgnore]
//public string LastDayOfWork => LeftWorkDateGr.AddDays(-1).ToFarsi();
//[JsonIgnore]
//public string LeftWorkDateFa => LeftWorkDateGr.ToFarsi();
public DateTime LeftWorkDateGr { get; set; }
public string SumOfWorkingDays { get; set; }
public string SumOfWorkingDays { get; set; }
public string MonthlySalary { get; set; }
public string BaseYearsPay { get; set; }
public string MonthlySalary { get; set; }
public string BaseYearsPay { get; set; }
public string MarriedAllowance { get; set; }
public string OvertimePay { get; set; }
public string NightworkPay { get; set; }
public string FridayPay { get; set; }
public string MissionPay { get; set; }
public string ShiftPay { get; set; }
public string FamilyAllowance { get; set; }
public string BonusesPay { get; set; }
public string LeavePay { get; set; }
public string RewardPay { get; set; }
public string MarriedAllowance { get; set; }
public string OvertimePay { get; set; }
public string NightworkPay { get; set; }
public string FridayPay { get; set; }
public string MissionPay { get; set; }
public string ShiftPay { get; set; }
public string FamilyAllowance { get; set; }
public string BonusesPay { get; set; }
public string LeavePay { get; set; }
public string RewardPay { get; set; }
public bool IsBirthday { get; set; } = true;
public string FineDeduction { get; set; }
public string InsuranceDeduction { get; set; }
public string TaxDeducation { get; set; }
public string InstallmentDeduction { get; set; }
public string SalaryAidDeduction { get; set; }
public string AbsenceDeduction { get; set; }
public string EarlyExitDeduction { get; set; }
public string LateToWorkDeduction { get; set; }
public bool IsBirthday { get; set; } = true;
public string FineDeduction { get; set; }
public string InsuranceDeduction { get; set; }
public string TaxDeducation { get; set; }
public string InstallmentDeduction { get; set; }
public string SalaryAidDeduction { get; set; }
public string AbsenceDeduction { get; set; }
public string EarlyExitDeduction { get; set; }
public string LateToWorkDeduction { get; set; }
public string TotalClaims { get; set; }
public string TotalDeductions { get; set; }
public string TotalPayment { get; set; }
public string TotalClaims { get; set; }
public string TotalDeductions { get; set; }
public string TotalPayment { get; set; }
public List<FineViewModel> FineViewModelList { get; set; }
public List<RewardViewModel> RewardViewModels { get; set; }
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; }
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
public bool TotalPaymentHide { get; set; }
public PersonnelCheckoutDailyRollCallViewModel MonthlyRollCall { get; set; }
public double TotalPaymentD { get; set; }
public List<FineViewModel> FineViewModelList { get; set; }
public List<RewardViewModel> RewardViewModels { get; set; }
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; }
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
public bool TotalPaymentHide { get; set; }
public PersonnelCheckoutDailyRollCallViewModel MonthlyRollCall { get; set; }
public double TotalPaymentD { get; set; }
public string TotalLateToWorkDeduction { get; set; }
public string TotalLateToWorkDeduction { get; set; }
public string LateToWorkValue { get; set; }
public string LateToWorkValue { get; set; }
public string SettingSalary { get; set; }
public string DailyWage { get; set; }
public WorkshopShiftStatus ShiftStatus { get; set; }
public string SettingSalary { get; set; }
public string DailyWage { get; set; }
public WorkshopShiftStatus ShiftStatus { get; set; }
public string EmployeePicture { get; set; }
public string EmployeePicture { get; set; }
public IrregularShift IrregularShift { get; set; }
public List<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public List<CustomizeSifts> RegularShift { get; set; }
public IrregularShift IrregularShift { get; set; }
public List<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public List<CustomizeSifts> RegularShift { get; set; }
public bool HasAmountConflict { get; set; }
public bool HasAmountConflict { get; set; }
// New: up to three dynamic deduction items (name, count, amount)
public List<CheckoutDynamicDeductionItem> CheckoutDynamicDeductions { get; set; } = new List<CheckoutDynamicDeductionItem>();
//public bool HasLeft { get; set; }
//public string IsBlockCantracingParty { get; set; }
//public string IsActiveString { get; set; }
//public long WorkingHoursId { get; set; }
//public string ArchiveCode { get; set; }
//public string ConsumableItems { get; set; }
//public string HousingAllowance { get; set; }
//public string YearsPay { get; set; }
//public bool HasLeft { get; set; }
//public string IsBlockCantracingParty { get; set; }
//public string IsActiveString { get; set; }
//public long WorkingHoursId { get; set; }
//public string ArchiveCode { get; set; }
//public string ConsumableItems { get; set; }
//public string HousingAllowance { get; set; }
//public string YearsPay { get; set; }
}
}

View File

@@ -25,5 +25,4 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
public int LeavePermittedDays { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
public List<DayOfWeek> WeeklyOffDays { get; set; }
public bool HasLeft { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
public class EmployeeFaceEmbeddingDto
{
public string Id { get; set; }
public string EmployeeFullName { get; set; }
public long EmployeeId { get; set; }
public long WorkshopId { get; set; }
public List<double> Embeddings { get; set; }
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
}

View File

@@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
public class EmployeeFaceEmbeddingMetadataDto
{
public double AvgEyeDistanceNormalized { get; set; }
public double AvgEyeToFaceRatio { get; set; }
public double AvgFaceAspectRatio { get; set; }
public double AvgDetectionConfidence { get; set; }
public EmployeeFaceEmbeddingKeypointsDto AvgKeypointsNormalized { get; set; }
public List<ImageMetadataDto> PerImageMetadata { get; set; }
}
public class EmployeeFaceEmbeddingKeypointsDto
{
public double[] LeftEye { get; set; }
public double[] RightEye { get; set; }
public double[] Nose { get; set; }
public double[] MouthLeft { get; set; }
public double[] MouthRight { get; set; }
}
public class ImageMetadataDto
{
public double FaceAspectRatio { get; set; }
public double EyeDistanceNormalized { get; set; }
public double EyeToFaceRatio { get; set; }
public double DetectionConfidence { get; set; }
public EmployeeFaceEmbeddingKeypointsDto KeypointsNormalized { get; set; }
}
public class EmbeddingHistoryItemDto
{
public List<double> Embedding { get; set; }
public DateTime Timestamp { get; set; }
public double Confidence { get; set; }
public double RefinementPercentage { get; set; }
}
public class MetadataHistoryItemDto
{
public EmployeeFaceEmbeddingMetadataDto Metadata { get; set; }
public DateTime Timestamp { get; set; }
public double Confidence { get; set; }
public double RefinementPercentage { get; set; }
}

View File

@@ -1,43 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
/// <summary>
/// سرویس مدیریت Embedding چهره کارکنان
/// این سرویس فقط برای دریافت و ارسال داده است و هیچ command-driven نیست
/// </summary>
public interface IEmployeeFaceEmbeddingApplication
{
/// <summary>
/// دریافت embedding بر اساس شناسه
/// </summary>
Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id);
/// <summary>
/// دریافت embedding بر اساس شناسه کارمند
/// </summary>
Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId);
/// <summary>
/// دریافت لیست embeddings بر اساس شناسه کارگاه
/// </summary>
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId);
/// <summary>
/// دریافت لیست embeddings بر اساس لیست شناسه کارگاه‌ها
/// </summary>
Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds);
/// <summary>
/// ذخیره یا به‌روزرسانی embedding
/// اگر Id وجود داشته باشد، به‌روزرسانی می‌شود، در غیر این صورت ایجاد می‌شود
/// </summary>
Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto);
/// <summary>
/// حذف embedding
/// </summary>
Task DeleteAsync(string id);
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public class CreateFinancialInvoice
{
public double Amount { get; set; }
public long ContractingPartyId { get; set; }
public string Description { get; set; }
public List<CreateFinancialInvoiceItem>? Items { get; set; }
}
public class CreateFinancialInvoiceItem
{
public string Description { get; set; }
public double Amount { get; set; }
public FinancialInvoiceItemType Type { get; set; }
public long EntityId { get; set; }
}

View File

@@ -1,23 +0,0 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public class EditFinancialInvoice
{
public long Id { get; set; }
public string InvoiceNumber { get; set; }
public string Description { get; set; }
public double Amount { get; set; }
public FinancialInvoiceStatus Status { get; set; }
public List<EditFinancialInvoiceItem>? Items { get; set; }
}
public class EditFinancialInvoiceItem
{
public long Id { get; set; }
public string Description { get; set; }
public double Amount { get; set; }
public FinancialInvoiceItemType Type { get; set; }
public long EntityId { get; set; }
}

View File

@@ -1,25 +0,0 @@
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public enum FinancialInvoiceItemType
{
/// <summary>
/// قسط قرارداد خرید از موسسه
/// </summary>
BuyInstitutionContractInstallment,
/// <summary>
/// خرید قرارداد از موسسه
/// </summary>
BuyInstitutionContract,
/// <summary>
///قسط ارتقا قرارداد موسسه
/// </summary>
AmendmentInstitutionContractInstallment,
/// <summary>
/// ارتقا قرارداد موسسه
/// </summary>
AmendmentInstitutionContract,
/// <summary>
/// بدهی قبلی
/// </summary>
PreviousDebt,
}

View File

@@ -1,12 +0,0 @@
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public class FinancialInvoiceSearchModel
{
public string? Description { get; set; }
public FinancialInvoiceStatus? Status { get; set; }
public long? ContractingPartyId { get; set; }
public string? FromDate { get; set; }
public string? ToDate { get; set; }
public double? MinAmount { get; set; }
public double? MaxAmount { get; set; }
}

View File

@@ -1,21 +0,0 @@
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public enum FinancialInvoiceStatus
{
/// <summary>
/// پرداخت نشده
/// </summary>
Unpaid = 0,
/// <summary>
/// پرداخت شده کامل
/// </summary>
Paid = 1,
/// <summary>
/// فاکتور لغو شده
/// </summary>
Cancelled = 4,
/// <summary>
/// // بازپرداخت شده (در صورت برگشت وجه)
/// </summary>
Refunded = 5,
}

View File

@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public class FinancialInvoiceViewModel
{
public long Id { get; set; }
public string InvoiceNumber { get; set; }
public string Description { get; set; }
public string Status { get; set; }
public string PaidAt { get; set; }
public double Amount { get; set; }
public Guid PublicId { get; set; }
public long ContractingPartyId { get; set; }
public string ContractingPartyName { get; set; }
public string CreationDate { get; set; }
public int ItemsCount { get; set; }
}

View File

@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.FinancialInvoice;
public interface IFinancialInvoiceApplication
{
OperationResult Create(CreateFinancialInvoice command);
OperationResult Edit(EditFinancialInvoice command);
OperationResult SetPaid(long id, DateTime paidAt);
OperationResult SetUnpaid(long id);
OperationResult SetCancelled(long id);
OperationResult SetRefunded(long id);
EditFinancialInvoice GetDetails(long id);
List<FinancialInvoiceViewModel> Search(FinancialInvoiceSearchModel searchModel);
}

View File

@@ -9,7 +9,6 @@ public class FinancialStatmentViewModel
public long Id { get; set; }
public long ContractingPartyId { get; set; }
public string ContractingPartyName { get; set; }
public string PublicId { get; set; }
public List<FinancialTransactionViewModel> FinancialTransactionViewModels { get; set; }

View File

@@ -10,7 +10,6 @@ public class FinancialTransactionViewModel
public string TdateFa { get; set; }
public string Description { get; set; }
public string TypeOfTransaction { get; set; }
public string DescriptionOption { get; set; }
public double Deptor { get; set; }
public string DeptorString { get; set; }
public double Creditor { get; set; }
@@ -21,7 +20,4 @@ public class FinancialTransactionViewModel
public string MessageText { get; set; }
public string SentSmsDateFa { get; set; }
public int Counter { get; set; }
}

View File

@@ -1,20 +0,0 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
namespace CompanyManagment.App.Contracts.Hubs;
public class SendSmsHub : Hub
{
public async Task send(long id)
{
await Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName(id));
}
public static string GetGroupName(long id)
{
return $"group-sms-{id}";
}
}

View File

@@ -213,7 +213,7 @@ public interface IInstitutionContractApplication
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
Task<OperationResult<OtpResultViewModel>> SendVerifyOtp(Guid id);
Task<OperationResult<string>> VerifyOtpAndMakeGateway(Guid publicId, string code, string callbackUrl);
Task<OperationResult> VerifyOtp(Guid publicId, string code);
Task<InstitutionContractWorkshopDetailViewModel> GetWorkshopInitialDetails(long workshopDetailsId);
#region Extension
@@ -251,8 +251,6 @@ public interface IInstitutionContractApplication
/// <param name="id"></param>
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<OperationResult> SetPendingWorkflow(long entityId);
}
public class InstitutionContractPrintViewModel

View File

@@ -27,13 +27,7 @@ public class InstitutionContractInstallmentViewModel
/// مبلغ قسط
/// </summary>
public string Amount { get; set; }
/// <summary>
/// مبلغ قسط
/// Double
/// </summary>
public double AmountDouble { get; set; }
/// <summary>
/// عدد قسط فارسی
/// </summary>

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.Workshop;
@@ -26,7 +25,6 @@ public class InstitutionContractViewModel
public DateTime ContractEndGr { get; set; }
public string ContractEndFa { get; set; }
public string ContractAmount { get; set; }
public double ContractAmountDouble { get; set; }
public string DailyCompenseation { get; set; }
public string Obligation { get; set; }
@@ -72,9 +70,4 @@ public class InstitutionContractViewModel
public int LeftWorkEmployeeCount { get; set; }
public int InsuranceLeftWorkEmployeeCount { get; set; }
public string IsExpier { get; set; }
public bool IsInstallment { get; set; }
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
public List<InstitutionContractInstallmentViewModel> InstallmentList { get; set; }
}

View File

@@ -1,97 +0,0 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// لیست پیامکهای بدهکاران قرارداد ملی
/// </summary>
public class SmsListData
{
/// <summary>
/// شماره تماس طرف حساب
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// تمپلیت آی دی
/// </summary>
public int TemplateId { get; set; }
/// <summary>
/// نام طرف حساب
/// </summary>
public string PartyName { get; set; }
/// <summary>
/// مبلغ بدهی
/// </summary>
public string Amount { get; set; }
/// <summary>
/// آی دی طرف حساب
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// آی دی صورت حساب مالی
/// </summary>
public string AproveId { get; set; }
/// <summary>
/// نوع متد ارسال پیامک
/// </summary>
public string TypeOfSmsMethod { get; set; }
/// <summary>
/// پابلیک آی دی بخش یک
/// </summary>
public string Code1 { get; set; }
/// <summary>
/// پابلیک آی دی بخش دو
/// </summary>
public string Code2 { get; set; }
/// <summary>
/// ای دی قراداد مالی
/// </summary>
public long InstitutionContractId { get; set; }
}
/// <summary>
/// لیست پیامک های بلاک
/// </summary>
public class BlockSmsListData
{
/// <summary>
/// شماره تماس طرف حساب
/// </summary>
public string PhoneNumber { get; set; }
/// <summary>
/// نام طرف حساب
/// </summary>
public string PartyName { get; set; }
/// <summary>
/// مبلغ بدهی
/// </summary>
public string Amount { get; set; }
/// <summary>
/// آی دی طرف حساب
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// نوع حساب - رسمی یا غیر رسمی
/// </summary>
public string AccountType { get; set; }
/// <summary>
/// ای دی قراداد مالی
/// </summary>
public long InstitutionContractId { get; set; }
/// <summary>
/// آی دی صورت حساب مالی
/// </summary>
public string AproveId { get; set; }
}

View File

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

View File

@@ -49,7 +49,7 @@ public interface IPaymentTransactionApplication
/// <param name="cardNumber"></param>
/// <param name="bankName"></param>
/// <returns></returns>
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName, string rrn, string digitalReceipt);
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
Task<OperationResult> SetTransactionId(long id, string transactionId);
}

View File

@@ -27,8 +27,6 @@ namespace CompanyManagment.App.Contracts.Report
public int ContractSignNotDone { get; set; }
public int ContractSignDone { get; set; }
public int ContractSignToBe { get; set; }
//تصفیه
public int AllCheckout { get; set; }
public int CheckoutNotDone { get; set; }
@@ -36,8 +34,6 @@ namespace CompanyManagment.App.Contracts.Report
public int CheckoutSignNotDone { get; set; }
public int CheckoutSignDone { get; set; }
public int CheckoutSignToBe { get; set; }
}

View File

@@ -10,23 +10,21 @@ namespace CompanyManagment.App.Contracts.Report
{
Task<AllReport> GetAllActiveWorkshops(string year, string month);
Task<AllReport> GetAllReports(string year, string month);
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
List<long> workshopList);
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
List<long> workshopList);
}
}

View File

@@ -1,62 +0,0 @@
using _0_Framework.Application.Enums;
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
namespace CompanyManagment.App.Contracts.SmsResult;
/// <summary>
/// مدل ایجاد تنظیمات پیامک
/// </summary>
public class CreateSmsSetting
{
/// <summary>
/// نوع پیامک
/// </summary>
public TypeOfSmsSetting TypeOfSmsSetting { get; set; }
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// ساعت
/// </summary>
public TimeSpan TimeOfDay { get; set; }
}
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
public class EditSmsSetting : CreateSmsSetting
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// نمایش ساعت و دقیقه
/// </summary>
public string TimeOfDayDisplay { get; set; }
}
/// <summary>
/// ویو مدل تنظیمات پیامک
/// </summary>
public class SmsSettingViewModel
{
/// <summary>
/// لیست تنظیمات پیامک
/// </summary>
public List<EditSmsSetting> EditSmsSettings { get; set; }
}

View File

@@ -1,78 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContract;
namespace CompanyManagment.App.Contracts.SmsResult;
public interface ISmsSettingApplication
{
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay, TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ویرایش پیامک خودکار
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditSmsSetting> GetSmsSettingToEdit(long id);
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<OperationResult> EditeSmsSetting(EditSmsSetting command);
/// <summary>
/// حذف از دیتابیس
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveSetting(long id);
/// <summary>
/// دریافت لیست بدهکاران
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// دریافت لیست کسانی که باید بلاک شوند
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک یاد آور آنی
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> InstantSendReminderSms(List<SmsListData> command);
/// <summary>
/// ارسال پیامک مسدودس
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
}

View File

@@ -1,11 +1,13 @@
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;
@@ -22,7 +24,7 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
_taskRepository = taskRepository;
}
public async Task<OperationResult> CreateAndActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false)
public async Task<OperationResult> CreateAndActive(IFormFile file)
{
OperationResult op = new OperationResult();
@@ -34,26 +36,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 activeApks = _androidApkVersionRepository.GetActives(apkType);
var activeApks = _androidApkVersionRepository.GetActives();
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", folderName);
"Apk", "Android", "GozreshgirWebView");
Directory.CreateDirectory(path);
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{versionName}{Path.GetExtension(file.FileName)}";
//var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}{Path.GetExtension(file.FileName)}";
string filepath = Path.Combine(path, uniqueFileName);
@@ -62,13 +60,13 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
await file.CopyToAsync(stream);
}
var entity = new AndroidApkVersion(versionName, versionCode, IsActive.True, filepath,apkType,isForce);
var entity = new AndroidApkVersion("0", "0", IsActive.True, filepath);
_androidApkVersionRepository.Create(entity);
_androidApkVersionRepository.SaveChanges();
return op.Succcedded();
}
public async Task<OperationResult> CreateAndDeActive(IFormFile file, ApkType apkType, string versionName, string versionCode, bool isForce = false)
public async Task<OperationResult> CreateAndDeActive(IFormFile file)
{
OperationResult op = new OperationResult();
@@ -80,22 +78,18 @@ 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", folderName);
"Apk", "Android", "GozreshgirWebView");
Directory.CreateDirectory(path);
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{versionName}{Path.GetExtension(file.FileName)}";
var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{apk.VersionName}{Path.GetExtension(file.FileName)}";
string filepath = Path.Combine(path, uniqueFileName);
@@ -104,15 +98,14 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
await file.CopyToAsync(stream);
}
var entity = new AndroidApkVersion(versionName, versionCode, IsActive.False, filepath,apkType);
_androidApkVersionRepository.Create(entity);
var entity = new AndroidApkVersion(apk.VersionName, apk.VersionCode, IsActive.False, filepath);
_androidApkVersionRepository.SaveChanges();
return op.Succcedded();
}
public async Task<string> GetLatestActiveVersionPath(ApkType apkType)
public async Task<string> GetLatestActiveVersionPath()
{
return await _androidApkVersionRepository.GetLatestActiveVersionPath(apkType);
return await _androidApkVersionRepository.GetLatestActiveVersionPath();
}
public OperationResult Remove(long id)
@@ -134,22 +127,8 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
return op.Succcedded();
}
public bool HasAndroidApkToDownload(ApkType apkType)
public bool HasAndroidApkToDownload()
{
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"));
return _androidApkVersionRepository.Exists(x => x.IsActive == IsActive.True);
}
}

View File

@@ -5,8 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AndroidXml" Version="1.1.24" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="ApkReader" Version="2.0.1.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -2712,7 +2712,9 @@ public class ContractApplication : IContractApplication
var emp = workshopEmpList.Where(x => x.WorkshopId == res.WorkshopIds)
.Select(x => x.EmployerId).ToList();
res.Employers = _employerRepository.GetEmployers(emp);
var workshopSelect = _workshopApplication.GetDetails(res.WorkshopIds);
var workshop = new WorkshopViewModel()
{
@@ -3107,6 +3109,21 @@ public class ContractApplication : IContractApplication
return _contractRepository.SearchForClient(searchModel);
}
public async Task<PagedResult<GetContractListForClientResponse>> GetContractListForClient(GetContractListForClientRequest searchModel)
{
return await _contractRepository.GetContractListForClient(searchModel);
}
public async Task<ContractPrintViewModel> PrintOneAsync(long id)
{
return (await _contractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public async Task<List<ContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
return await _contractRepository.PrintAllAsync(ids);
}
#endregion
#region NewChangeByHeydari

View File

@@ -123,7 +123,7 @@ namespace CompanyManagment.Application
result.LateToWorkDeduction, result.EarlyExitDeduction, result.RewardPay, result.SalaryAidDeduction, result.InstallmentDeduction, result.FineDeduction,
result.TaxDeduction, result.SumOfWorkingDays, result.TotalClaimsStr, result.TotalDeductionsStr, result.TotalPayment, contract?.ContractNo ?? "-",
fines, loanInstallments, salaryAids, rewards, result.LateToWorkValue, result.SettingSalary, result.DailyWage, result.ShiftStatus, result.IrregularShift, result.CustomizeRotatingShifts,
regularShift,result.DynamicDeductions);
regularShift);
_customizeCheckoutRepository.Create(entity);
@@ -187,7 +187,7 @@ namespace CompanyManagment.Application
computations.LateToWorkDeduction, computations.EarlyExitDeduction, computations.RewardPay, computations.SalaryAidDeduction, computations.InstallmentDeduction, computations.FineDeduction,
computations.TaxDeduction, computations.SumOfWorkingDays, computations.TotalClaimsStr, computations.TotalDeductionsStr, computations.TotalPayment, contract?.ContractNo ?? "-",
fines, loanInstallments, salaryAids, rewards, computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus, computations.IrregularShift,
computations.CustomizeRotatingShifts, regularShift,computations.DynamicDeductions);
computations.CustomizeRotatingShifts, regularShift);
_customizeCheckoutRepository.Create(entity);
_customizeCheckoutRepository.RemoveEmployeeCustomizeCheckoutInDates(command.WorkshopId, employeeId, command.ContractStart, command.ContractEnd);

View File

@@ -98,7 +98,7 @@ namespace CompanyManagment.Application
result.LateToWorkDeduction, result.EarlyExitDeduction, result.RewardPay, result.SalaryAidDeduction, result.InstallmentDeduction, result.FineDeduction,
result.TaxDeduction, result.SumOfWorkingDays, result.TotalClaimsStr, result.TotalDeductionsStr, result.TotalPayment, contract?.ContractNo ?? "-",
fines, loanInstallments, salaryAids, rewards, result.LateToWorkValue, result.SettingSalary, result.DailyWage, result.ShiftStatus, result.IrregularShift, result.CustomizeRotatingShifts,
regularShift,result.DynamicDeductions);
regularShift);
_customizeCheckoutTempRepository.Create(entity);
@@ -146,8 +146,7 @@ namespace CompanyManagment.Application
var regularShift = computations.EmployeeSettingsShifts.Select(x =>
new CustomizeCheckoutRegularShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var entity = new CustomizeCheckoutTemp(command.ContractStart, command.ContractEnd, employeeId, employee.FName, employee.LName, employee.DateOfBirth, employee.NationalCode,
workshop.WorkshopFullName, command.WorkshopId, contract?.Id,
computations.MonthlySalary, computations.FridayPay, computations.OverTimePay, computations.BaseYearsPay,
@@ -156,7 +155,7 @@ namespace CompanyManagment.Application
computations.LateToWorkDeduction, computations.EarlyExitDeduction, computations.RewardPay, computations.SalaryAidDeduction, computations.InstallmentDeduction, computations.FineDeduction,
computations.TaxDeduction, computations.SumOfWorkingDays, computations.TotalClaimsStr, computations.TotalDeductionsStr, computations.TotalPayment, contract?.ContractNo ?? "-",
fines, loanInstallments, salaryAids, rewards, computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus, computations.IrregularShift,
computations.CustomizeRotatingShifts, regularShift,computations.DynamicDeductions);
computations.CustomizeRotatingShifts, regularShift);
_customizeCheckoutTempRepository.Create(entity);
_customizeCheckoutTempRepository.RemoveEmployeeTemporaryCheckoutInDates(command.WorkshopId, employeeId, command.ContractStart, command.ContractEnd);
}

View File

@@ -31,7 +31,6 @@ 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;
@@ -62,31 +61,29 @@ 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, 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 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 OperationResult Create(CreateEmployee command)
public OperationResult Create(CreateEmployee command)
{
var opration = new OperationResult();
if (_EmployeeRepository.Exists(x =>
@@ -1125,12 +1122,6 @@ 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);
}
}

View File

@@ -1,170 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Company.Domain.EmployeeFaceEmbeddingAgg;
using CompanyManagment.App.Contracts.EmployeeFaceEmbedding;
namespace CompanyManagment.Application;
public class EmployeeFaceEmbeddingApplication : IEmployeeFaceEmbeddingApplication
{
private readonly IEmployeeFaceEmbeddingRepository _repository;
public EmployeeFaceEmbeddingApplication(IEmployeeFaceEmbeddingRepository repository)
{
_repository = repository;
}
public async Task<EmployeeFaceEmbeddingDto> GetByIdAsync(string id)
{
var entity = await _repository.GetByIdAsync(id);
return entity == null ? null : MapToDto(entity);
}
public async Task<EmployeeFaceEmbeddingDto> GetByEmployeeIdAsync(long employeeId)
{
var entity = await _repository.GetByEmployeeIdAsync(employeeId);
return entity == null ? null : MapToDto(entity);
}
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdAsync(long workshopId)
{
var entities = await _repository.GetByWorkshopIdAsync(workshopId);
return entities.Select(MapToDto).ToList();
}
public async Task<List<EmployeeFaceEmbeddingDto>> GetByWorkshopIdsAsync(List<long> workshopIds)
{
var entities = await _repository.GetByWorkshopIdsAsync(workshopIds);
return entities.Select(MapToDto).ToList();
}
public async Task<string> SaveAsync(EmployeeFaceEmbeddingDto dto)
{
if (string.IsNullOrWhiteSpace(dto.Id))
{
// ایجاد جدید
var metadata = MapMetadataFromDto(dto.Metadata);
var entity = new EmployeeFaceEmbedding(
dto.EmployeeFullName,
dto.EmployeeId,
dto.WorkshopId,
dto.Embeddings,
metadata
);
await _repository.CreateAsync(entity);
return entity.Id;
}
else
{
// به‌روزرسانی
var entity = await _repository.GetByIdAsync(dto.Id);
if (entity == null)
throw new Exception($"EmployeeFaceEmbedding با شناسه {dto.Id} یافت نشد");
entity.UpdateEmployeeInfo(dto.EmployeeFullName, dto.WorkshopId);
entity.UpdateEmbedding(dto.Embeddings, 0, 0);
entity.UpdateMetadata(MapMetadataFromDto(dto.Metadata), 0, 0);
await _repository.UpdateAsync(entity);
return entity.Id;
}
}
public async Task DeleteAsync(string id)
{
await _repository.DeleteAsync(id);
}
#region Mapping Methods
private EmployeeFaceEmbeddingDto MapToDto(EmployeeFaceEmbedding entity)
{
return new EmployeeFaceEmbeddingDto
{
Id = entity.Id,
EmployeeFullName = entity.EmployeeFullName,
EmployeeId = entity.EmployeeId,
WorkshopId = entity.WorkshopId,
Embeddings = entity.Embeddings,
Metadata = MapMetadataToDto(entity.Metadata)
};
}
private EmployeeFaceEmbeddingMetadataDto MapMetadataToDto(EmployeeFaceEmbeddingMetadata metadata)
{
if (metadata == null) return null;
return new EmployeeFaceEmbeddingMetadataDto
{
AvgEyeDistanceNormalized = metadata.AvgEyeDistanceNormalized,
AvgEyeToFaceRatio = metadata.AvgEyeToFaceRatio,
AvgFaceAspectRatio = metadata.AvgFaceAspectRatio,
AvgDetectionConfidence = metadata.AvgDetectionConfidence,
AvgKeypointsNormalized = MapKeypointsToDto(metadata.AvgKeypointsNormalized),
PerImageMetadata = metadata.PerImageMetadata?.Select(x => new ImageMetadataDto
{
FaceAspectRatio = x.FaceAspectRatio,
EyeDistanceNormalized = x.EyeDistanceNormalized,
EyeToFaceRatio = x.EyeToFaceRatio,
DetectionConfidence = x.DetectionConfidence,
KeypointsNormalized = MapKeypointsToDto(x.KeypointsNormalized)
}).ToList()
};
}
private EmployeeFaceEmbeddingKeypointsDto MapKeypointsToDto(EmployeeFaceEmbeddingKeypoints keypoints)
{
if (keypoints == null) return null;
return new EmployeeFaceEmbeddingKeypointsDto
{
LeftEye = keypoints.LeftEye,
RightEye = keypoints.RightEye,
Nose = keypoints.Nose,
MouthLeft = keypoints.MouthLeft,
MouthRight = keypoints.MouthRight
};
}
private EmployeeFaceEmbeddingMetadata MapMetadataFromDto(EmployeeFaceEmbeddingMetadataDto dto)
{
if (dto == null) return null;
return new EmployeeFaceEmbeddingMetadata
{
AvgEyeDistanceNormalized = dto.AvgEyeDistanceNormalized,
AvgEyeToFaceRatio = dto.AvgEyeToFaceRatio,
AvgFaceAspectRatio = dto.AvgFaceAspectRatio,
AvgDetectionConfidence = dto.AvgDetectionConfidence,
AvgKeypointsNormalized = MapKeypointsFromDto(dto.AvgKeypointsNormalized),
PerImageMetadata = dto.PerImageMetadata?.Select(x => new ImageMetadata
{
FaceAspectRatio = x.FaceAspectRatio,
EyeDistanceNormalized = x.EyeDistanceNormalized,
EyeToFaceRatio = x.EyeToFaceRatio,
DetectionConfidence = x.DetectionConfidence,
KeypointsNormalized = MapKeypointsFromDto(x.KeypointsNormalized)
}).ToList()
};
}
private EmployeeFaceEmbeddingKeypoints MapKeypointsFromDto(EmployeeFaceEmbeddingKeypointsDto dto)
{
if (dto == null) return null;
return new EmployeeFaceEmbeddingKeypoints
{
LeftEye = dto.LeftEye,
RightEye = dto.RightEye,
Nose = dto.Nose,
MouthLeft = dto.MouthLeft,
MouthRight = dto.MouthRight
};
}
#endregion
}

View File

@@ -1,214 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.FinancialInvoiceAgg;
using CompanyManagment.App.Contracts.FinancialInvoice;
using CompanyManagment.EFCore;
namespace CompanyManagment.Application;
public class FinancialInvoiceApplication : RepositoryBase<long, FinancialInvoice>, IFinancialInvoiceApplication
{
private readonly IFinancialInvoiceRepository _financialInvoiceRepository;
private readonly CompanyContext _context;
public FinancialInvoiceApplication(IFinancialInvoiceRepository financialInvoiceRepository, CompanyContext context) : base(context)
{
_financialInvoiceRepository = financialInvoiceRepository;
_context = context;
}
public OperationResult Create(CreateFinancialInvoice command)
{
var operation = new OperationResult();
if (command.Amount <= 0)
return operation.Failed("مبلغ فاکتور باید بزرگتر از صفر باشد");
if (command.ContractingPartyId <= 0)
return operation.Failed("طرف قرارداد نامعتبر است");
if (string.IsNullOrWhiteSpace(command.Description))
return operation.Failed("توضیحات فاکتور الزامی است");
var financialInvoice = new FinancialInvoice(command.Amount, command.ContractingPartyId, command.Description);
if (command.Items != null && command.Items.Any())
{
foreach (var item in command.Items)
{
if (string.IsNullOrWhiteSpace(item.Description))
return operation.Failed("توضیحات آیتم الزامی است");
if (item.Amount <= 0)
return operation.Failed("مبلغ آیتم باید بزرگتر از صفر باشد");
var invoiceItem = new FinancialInvoiceItem(item.Description, item.Amount,
financialInvoice.id, item.Type, item.EntityId);
financialInvoice.AddItem(invoiceItem);
}
}
_financialInvoiceRepository.Create(financialInvoice);
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult Edit(EditFinancialInvoice command)
{
var operation = new OperationResult();
var financialInvoice = _financialInvoiceRepository.Get(command.Id);
if (financialInvoice == null)
return operation.Failed("فاکتور مورد نظر یافت نشد");
if (financialInvoice.Status == FinancialInvoiceStatus.Paid)
return operation.Failed("امکان ویرایش فاکتور پرداخت شده وجود ندارد");
if (string.IsNullOrWhiteSpace(command.Description))
return operation.Failed("توضیحات فاکتور الزامی است");
// Update description
financialInvoice.Description = command.Description;
// Update items if provided
if (command.Items != null)
{
// Clear existing items
if (financialInvoice.Items != null)
{
financialInvoice.Items.Clear();
}
else
{
financialInvoice.SetItems([]);
}
// Add updated items
foreach (var item in command.Items)
{
if (string.IsNullOrWhiteSpace(item.Description))
return operation.Failed("توضیحات آیتم الزامی است");
if (item.Amount <= 0)
return operation.Failed("مبلغ آیتم باید بزرگتر از صفر باشد");
var invoiceItem = new FinancialInvoiceItem(item.Description, item.Amount,
financialInvoice.id, item.Type, item.EntityId);
financialInvoice.AddItem(invoiceItem);
}
}
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult SetPaid(long id, DateTime paidAt)
{
var operation = new OperationResult();
var financialInvoice = _financialInvoiceRepository.Get(id);
if (financialInvoice == null)
return operation.Failed("فاکتور مورد نظر یافت نشد");
if (financialInvoice.Status == FinancialInvoiceStatus.Paid)
return operation.Failed("فاکتور قبلاً پرداخت شده است");
if (financialInvoice.Status == FinancialInvoiceStatus.Cancelled)
return operation.Failed("امکان پرداخت فاکتور لغو شده وجود ندارد");
financialInvoice.SetPaid(paidAt);
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult SetUnpaid(long id)
{
var operation = new OperationResult();
var financialInvoice = _financialInvoiceRepository.Get(id);
if (financialInvoice == null)
return operation.Failed("فاکتور مورد نظر یافت نشد");
financialInvoice.SetUnpaid();
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult SetCancelled(long id)
{
var operation = new OperationResult();
var financialInvoice = _financialInvoiceRepository.Get(id);
if (financialInvoice == null)
return operation.Failed("فاکتور مورد نظر یافت نشد");
if (financialInvoice.Status == FinancialInvoiceStatus.Paid)
return operation.Failed("امکان لغو فاکتور پرداخت شده وجود ندارد");
financialInvoice.SetCancelled();
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public OperationResult SetRefunded(long id)
{
var operation = new OperationResult();
var financialInvoice = _financialInvoiceRepository.Get(id);
if (financialInvoice == null)
return operation.Failed("فاکتور مورد نظر یافت نشد");
if (financialInvoice.Status != FinancialInvoiceStatus.Paid)
return operation.Failed("فقط فاکتورهای پرداخت شده قابل بازپرداخت هستند");
financialInvoice.SetRefunded();
_financialInvoiceRepository.SaveChanges();
return operation.Succcedded();
}
public EditFinancialInvoice GetDetails(long id)
{
return _financialInvoiceRepository.GetDetails(id);
}
public List<FinancialInvoiceViewModel> Search(FinancialInvoiceSearchModel searchModel)
{
return _financialInvoiceRepository.Search(searchModel);
}
//public OperationResult Remove(long id)
//{
// var operation = new OperationResult();
// try
// {
// var financialInvoice = _financialInvoiceRepository.Get(id);
// if (financialInvoice == null)
// return operation.Failed("فاکتور مورد نظر یافت نشد");
// if (financialInvoice.Status == FinancialInvoiceStatus.Paid)
// return operation.Failed("امکان حذف فاکتور پرداخت شده وجود ندارد");
// // Remove the entity using the context directly since Remove method might not be available
// _context.FinancialInvoiceSet.Remove(financialInvoice);
// _financialInvoiceRepository.SaveChanges();
// return operation.Succcedded();
// }
// catch (Exception ex)
// {
// return operation.Failed("خطا در حذف فاکتور");
// }
//}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -1,165 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.SmsResult;
namespace CompanyManagment.Application;
public class SmsSettingApplication : ISmsSettingApplication
{
private readonly ISmsSettingsRepository _smsSettingsRepository;
private readonly IInstitutionContractRepository _institutionContractRepository;
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
{
_smsSettingsRepository = smsSettingsRepository;
_institutionContractRepository = institutionContractRepository;
}
public async Task<SmsSettingViewModel> GetSmsSettingsByType(TypeOfSmsSetting typeOfSmsSetting)
{
return await _smsSettingsRepository.GetSmsSettingsByType(typeOfSmsSetting);
}
/// <summary>
/// ایجاد تنظیمات پیامک یادآور
/// </summary>
/// <param name="dayOfMonth"></param>
/// <param name="timeOfDay"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<OperationResult> CreateSmsSetting(int dayOfMonth, string timeOfDay,
TypeOfSmsSetting typeOfSmsSetting)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(timeOfDay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(timeOfDay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (dayOfMonth < 1 || dayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == dayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == typeOfSmsSetting))
return op.Failed("رکورد ایجاد شده تکراری است");
var create = new SmsSetting(typeOfSmsSetting, dayOfMonth, timeSpan);
await _smsSettingsRepository.CreateAsync(create);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<EditSmsSetting> GetSmsSettingToEdit(long id)
{
return await _smsSettingsRepository.GetSmsSettingToEdit(id);
}
public async Task<OperationResult> EditeSmsSetting(EditSmsSetting command)
{
var op = new OperationResult();
var timeSpan = new TimeSpan();
if (string.IsNullOrWhiteSpace(command.TimeOfDayDisplay))
return op.Failed("ساعت وارد نشده است");
try
{
timeSpan = TimeSpan.ParseExact(command.TimeOfDayDisplay, @"hh\:mm", null);
}
catch (Exception e)
{
return op.Failed("فرمت ساعت اشتباه است");
}
if (command.DayOfMonth < 1 || command.DayOfMonth > 31)
{
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
}
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == command.DayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == command.TypeOfSmsSetting && x.id != command.Id))
return op.Failed("رکورد ایجاد شده تکراری است");
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task RemoveSetting(long id)
{
await _smsSettingsRepository.RemoveItem(id);
}
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
}
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
return await _institutionContractRepository.GetBlockListData(DateTime.Now);
}
public async Task<OperationResult> InstantSendReminderSms(List<SmsListData> command)
{
var op = new OperationResult();
string typeOfSms = "یادآور بدهی ماهانه";
string sendMessStart = "شروع یادآور آنی";
string sendMessEnd = "پایان یادآور آنی";
if (command.Any())
{
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
return op.Succcedded();
}
else
{
return op.Failed("موردی انتخاب نشده است");
}
}
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
{
var op = new OperationResult();
string typeOfSms = "اعلام مسدودی طرف حساب";
string sendMessStart = "شروع مسدودی آنی";
string sendMessEnd = "پایان مسدودی آنی ";
if (command.Any())
{
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
sendMessEnd);
return op.Succcedded();
}
else
{
return op.Failed("موردی انتخاب نشده است");
}
}
}

Some files were not shown because too many files have changed in this diff Show More