Compare commits

..

3 Commits

199 changed files with 2751 additions and 159415 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

@@ -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

@@ -49,13 +49,12 @@ 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; }
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading;
@@ -17,18 +16,18 @@ public class SepehrPaymentGateway:IPaymentGateway
{
_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,
InvoiceID = command.InvoiceId,
callbackURL = command.CallBackUrl,
payload = extraData
}, cancellationToken: cancellationToken);

View File

@@ -32,60 +32,6 @@ public interface ISmsService
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

@@ -32,7 +32,7 @@ public static class StaticWorkshopAccounts
/// 392 - عمار حسن دوست
/// 20 - سمیرا الهی نیا
/// </summary>
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20, 476];
public static List<long> StaticAccountIds = [2, 3, 380, 381, 392, 20];
/// <summary>
/// این تاریخ در جدول اکانت لفت ورک به این معنیست

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

@@ -27,3 +27,4 @@ public class NullFaceEmbeddingNotificationService : IFaceEmbeddingNotificationSe
return Task.CompletedTask;
}
}

View File

@@ -1,4 +1,4 @@
using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.AccountAgg;
using AccountMangement.Infrastructure.EFCore.Mappings;
using Microsoft.EntityFrameworkCore;
using System;
@@ -26,6 +26,7 @@ using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg;
using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg;
using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg;
using AccountManagement.Domain.SubAccountRoleAgg;
using AccountMangement.Infrastructure.EFCore.Seed;
using AccountManagement.Domain.TaskScheduleAgg;
namespace AccountMangement.Infrastructure.EFCore
@@ -59,10 +60,9 @@ namespace AccountMangement.Infrastructure.EFCore
public DbSet<TaskSchedule> TaskSchedules { get; set; }
#endregion
#region Pooya
public DbSet<SubAccount> SubAccounts { get; set; }
public DbSet<SubAccountRole> SubAccountRoles { get; set; }

View File

@@ -18,8 +18,4 @@
<ProjectReference Include="..\Company.Domain\Company.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Mappings\BugReportMapping.cs" />
</ItemGroup>
</Project>

View File

@@ -1,175 +0,0 @@
# سیستم گزارش خرابی (Bug Report System)
## نمای کلی
این سیستم برای جمع‌آوری، ذخیره و مدیریت گزارش‌های خرابی از تطبیق موبایلی طراحی شده است.
## ساختار فایل‌ها
### Domain Layer
- `AccountManagement.Domain/BugReportAgg/`
- `BugReport.cs` - موجودیت اصلی
- `BugReportLog.cs` - لاگ‌های گزارش
- `BugReportScreenshot.cs` - تصاویر ضمیمه شده
### Application Contracts
- `AccountManagement.Application.Contracts/BugReport/`
- `IBugReportApplication.cs` - اینترفیس سرویس
- `CreateBugReportCommand.cs` - درخواست ایجاد
- `EditBugReportCommand.cs` - درخواست ویرایش
- `BugReportViewModel.cs` - نمایش لیست
- `BugReportDetailViewModel.cs` - نمایش جزئیات
- `IBugReportRepository.cs` - اینترفیس Repository
### Application Service
- `AccountManagement.Application/BugReportApplication.cs` - پیاده‌سازی سرویس
### Infrastructure
- `AccountMangement.Infrastructure.EFCore/`
- `Mappings/BugReportMapping.cs`
- `Mappings/BugReportLogMapping.cs`
- `Mappings/BugReportScreenshotMapping.cs`
- `Repository/BugReportRepository.cs`
### API Controller
- `ServiceHost/Controllers/BugReportController.cs`
### Admin Pages
- `ServiceHost/Areas/AdminNew/Pages/BugReport/`
- `BugReportPageModel.cs` - base model
- `Index.cshtml.cs / Index.cshtml` - لیست گزارش‌ها
- `Details.cshtml.cs / Details.cshtml` - جزئیات کامل
- `Edit.cshtml.cs / Edit.cshtml` - ویرایش وضعیت/اولویت
- `Delete.cshtml.cs / Delete.cshtml` - حذف
## روش استفاده
### 1. ثبت گزارش از موبایل
```csharp
POST /api/bugreport/submit
{
"title": "برنامه هنگام ورود خراب می‌شود",
"description": "هنگام وارد کردن نام کاربری، برنامه کرش می‌کند",
"userEmail": "user@example.com",
"deviceModel": "Samsung Galaxy S21",
"osVersion": "Android 12",
"platform": "Android",
"manufacturer": "Samsung",
"deviceId": "device-unique-id",
"screenResolution": "1440x3200",
"memoryInMB": 8000,
"storageInMB": 256000,
"batteryLevel": 75,
"isCharging": false,
"networkType": "4G",
"appVersion": "1.0.0",
"buildNumber": "100",
"packageName": "com.example.app",
"installTime": "2024-01-01T10:00:00Z",
"lastUpdateTime": "2024-12-01T14:30:00Z",
"flavor": "production",
"type": 1, // Crash = 1
"priority": 2, // High = 2
"stackTrace": "...",
"logs": ["log1", "log2"],
"screenshots": ["base64-encoded-image-1"]
}
```
### 2. دسترسی به Admin Panel
```
https://yourdomain.com/AdminNew/BugReport
```
**صفحات موجود:**
- **Index** - لیست تمام گزارش‌ها با فیلترها
- **Details** - نمایش جزئیات کامل شامل:
- معلومات کاربر و گزارش
- معلومات دستگاه
- معلومات برنامه
- لاگ‌ها
- تصاویر
- Stack Trace
- **Edit** - تغییر وضعیت و اولویت
- **Delete** - حذف گزارش
### 3. درخواست‌های API
#### دریافت لیست
```
GET /api/bugreport/list?type=1&priority=2&status=1&searchTerm=crash&pageNumber=1&pageSize=10
```
#### دریافت جزئیات
```
GET /api/bugreport/{id}
```
#### ویرایش
```
PUT /api/bugreport/{id}
{
"id": 1,
"priority": 2,
"status": 3
}
```
#### حذف
```
DELETE /api/bugreport/{id}
```
## انواع (Enums)
### BugReportType
- `1` - Crash (کرش)
- `2` - UI (مشکل رابط)
- `3` - Performance (عملکرد)
- `4` - Feature (فیچر)
- `5` - Network (شبکه)
- `6` - Camera (دوربین)
- `7` - FaceRecognition (تشخیص چهره)
- `8` - Database (دیتابیس)
- `9` - Login (ورود)
- `10` - Other (سایر)
### BugPriority
- `1` - Critical (بحرانی)
- `2` - High (بالا)
- `3` - Medium (متوسط)
- `4` - Low (پایین)
### BugReportStatus
- `1` - Open (باز)
- `2` - InProgress (در حال بررسی)
- `3` - Fixed (رفع شده)
- `4` - Closed (بسته شده)
- `5` - Reopened (مجدداً باز)
## Migration
برای اعمال تغییرات دیتابیس:
```powershell
Add-Migration AddBugReportTables
Update-Database
```
## نکات مهم
1. **تصاویر**: تصاویر به صورت Base64 encoded ذخیره می‌شوند
2. **لاگ‌ها**: تمام لاگ‌ها به صورت جدا ذخیره می‌شوند
3. **وضعیت پیش‌فرض**: وقتی گزارش ثبت می‌شود، وضعیت آن "Open" است
4. **تاریخ**: تاریخ ایجاد و بروزرسانی خودکار ثبت می‌شود
## Security
- API endpoints از `authentication` محافظت می‌شوند
- Admin pages تنها برای کاربرانی با دسترسی AdminArea قابل دسترس هستند
- حذف و ویرایش نیاز به تأیید دارد

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,314 +0,0 @@
# خلاصه تغییرات سیستم گزارش خرابی
## 📝 فایل‌های اضافه شده (23 فایل)
### 1⃣ Domain Layer (3 فایل)
```
✓ AccountManagement.Domain/BugReportAgg/
├── BugReport.cs
├── BugReportLog.cs
└── BugReportScreenshot.cs
```
### 2⃣ Application Contracts (6 فایل)
```
✓ AccountManagement.Application.Contracts/BugReport/
├── IBugReportRepository.cs
├── IBugReportApplication.cs
├── CreateBugReportCommand.cs
├── EditBugReportCommand.cs
├── BugReportViewModel.cs
└── BugReportDetailViewModel.cs
```
### 3⃣ Application Service (1 فایل)
```
✓ AccountManagement.Application/
└── BugReportApplication.cs
```
### 4⃣ Infrastructure EFCore (4 فایل)
```
✓ AccountMangement.Infrastructure.EFCore/
├── Mappings/
│ ├── BugReportMapping.cs
│ ├── BugReportLogMapping.cs
│ └── BugReportScreenshotMapping.cs
└── Repository/
└── BugReportRepository.cs
```
### 5⃣ API Controller (1 فایل)
```
✓ ServiceHost/Controllers/
└── BugReportController.cs
```
### 6⃣ Admin Pages (8 فایل)
```
✓ ServiceHost/Areas/AdminNew/Pages/BugReport/
├── BugReportPageModel.cs
├── Index.cshtml.cs
├── Index.cshtml
├── Details.cshtml.cs
├── Details.cshtml
├── Edit.cshtml.cs
├── Edit.cshtml
├── Delete.cshtml.cs
└── Delete.cshtml
```
### 7⃣ Documentation (2 فایل)
```
✓ BUG_REPORT_SYSTEM.md
✓ FLUTTER_BUG_REPORT_EXAMPLE.dart
```
---
## ✏️ فایل‌های اصلاح شده (2 فایل)
### 1. AccountManagement.Configuration/AccountManagementBootstrapper.cs
**تغییر:** اضافه کردن using برای BugReport
```csharp
using AccountManagement.Application.Contracts.BugReport;
```
**تغییر:** رجیستریشن سرویس‌ها
```csharp
services.AddTransient<IBugReportApplication, BugReportApplication>();
services.AddTransient<IBugReportRepository, BugReportRepository>();
```
### 2. AccountMangement.Infrastructure.EFCore/AccountContext.cs
**تغییر:** اضافه کردن using
```csharp
using AccountManagement.Domain.BugReportAgg;
```
**تغییر:** اضافه کردن DbSets
```csharp
#region BugReport
public DbSet<BugReport> BugReports { get; set; }
public DbSet<BugReportLog> BugReportLogs { get; set; }
public DbSet<BugReportScreenshot> BugReportScreenshots { get; set; }
#endregion
```
---
## 🔧 موارد مورد نیاز قبل از استفاده
### 1. Database Migration
```powershell
# در Package Manager Console
cd AccountMangement.Infrastructure.EFCore
Add-Migration AddBugReportSystem
Update-Database
```
### 2. الگوی Enum برای Flutter
```dart
enum BugReportType {
crash, // 1
ui, // 2
performance, // 3
feature, // 4
network, // 5
camera, // 6
faceRecognition, // 7
database, // 8
login, // 9
other, // 10
}
enum BugPriority {
critical, // 1
high, // 2
medium, // 3
low, // 4
}
```
---
## 🚀 نقاط ورود
### API Endpoints
```
POST /api/bugreport/submit - ثبت گزارش جدید
GET /api/bugreport/list - دریافت لیست
GET /api/bugreport/{id} - دریافت جزئیات
PUT /api/bugreport/{id} - ویرایش وضعیت/اولویت
DELETE /api/bugreport/{id} - حذف گزارش
```
### Admin Pages
```
/AdminNew/BugReport - لیست گزارش‌ها
/AdminNew/BugReport/Details/{id} - جزئیات کامل
/AdminNew/BugReport/Edit/{id} - ویرایش
/AdminNew/BugReport/Delete/{id} - حذف
```
---
## 📊 Database Schema
### BugReports جدول
```sql
- id (bigint, PK)
- Title (nvarchar(200))
- Description (ntext)
- UserEmail (nvarchar(150))
- AccountId (bigint, nullable)
- DeviceModel (nvarchar(100))
- OsVersion (nvarchar(50))
- Platform (nvarchar(50))
- Manufacturer (nvarchar(100))
- DeviceId (nvarchar(200))
- ScreenResolution (nvarchar(50))
- MemoryInMB (int)
- StorageInMB (int)
- BatteryLevel (int)
- IsCharging (bit)
- NetworkType (nvarchar(50))
- AppVersion (nvarchar(50))
- BuildNumber (nvarchar(50))
- PackageName (nvarchar(150))
- InstallTime (datetime2)
- LastUpdateTime (datetime2)
- Flavor (nvarchar(50))
- Type (int)
- Priority (int)
- Status (int)
- StackTrace (ntext, nullable)
- CreationDate (datetime2)
- UpdateDate (datetime2, nullable)
```
### BugReportLogs جدول
```sql
- id (bigint, PK)
- BugReportId (bigint, FK)
- Message (ntext)
- Timestamp (datetime2)
```
### BugReportScreenshots جدول
```sql
- id (bigint, PK)
- BugReportId (bigint, FK)
- Base64Data (ntext)
- FileName (nvarchar(255))
- UploadDate (datetime2)
```
---
## ✨ مثال درخواست API
```json
POST /api/bugreport/submit
Content-Type: application/json
{
"title": "برنامه هنگام ورود خراب می‌شود",
"description": "هنگام فشار دادن دکمه ورود، برنامه کرش می‌کند",
"userEmail": "user@example.com",
"accountId": 123,
"deviceModel": "Samsung Galaxy S21",
"osVersion": "Android 12",
"platform": "Android",
"manufacturer": "Samsung",
"deviceId": "device-12345",
"screenResolution": "1440x3200",
"memoryInMB": 8000,
"storageInMB": 256000,
"batteryLevel": 75,
"isCharging": false,
"networkType": "4G",
"appVersion": "1.0.0",
"buildNumber": "100",
"packageName": "com.example.app",
"installTime": "2024-01-01T10:00:00Z",
"lastUpdateTime": "2024-12-07T14:30:00Z",
"flavor": "production",
"type": 1,
"priority": 2,
"stackTrace": "...",
"logs": ["log line 1", "log line 2"],
"screenshots": ["base64-string"]
}
```
---
## 🔐 Security Features
- ✅ Authorization برای Admin Pages (AdminAreaPermission required)
- ✅ API Authentication
- ✅ XSS Protection (Html.Raw محدود)
- ✅ CSRF Protection (ASP.NET Core default)
- ✅ Input Validation
- ✅ Safe Delete with Confirmation
---
## 📚 Documentation Files
1. **BUG_REPORT_SYSTEM.md** - راهنمای کامل سیستم
2. **FLUTTER_BUG_REPORT_EXAMPLE.dart** - مثال پیاده‌سازی Flutter
3. **CHANGELOG.md** (این فایل) - خلاصه تغییرات
---
## ✅ Checklist پیاده‌سازی
- [x] Domain Models
- [x] Database Mappings
- [x] Repository Pattern
- [x] Application Services
- [x] API Endpoints
- [x] Admin UI Pages
- [x] Dependency Injection
- [x] Error Handling
- [x] Documentation
- [x] Flutter Example
- [ ] Database Migration (باید دستی اجرا شود)
- [ ] Testing
---
## 🎯 مراحل بعدی
1. **اجرای Migration:**
```powershell
Add-Migration AddBugReportSystem
Update-Database
```
2. **تست API:**
- استفاده از Postman/Thunder Client
- تست تمام endpoints
3. **تست Admin Panel:**
- دسترسی به /AdminNew/BugReport
- تست فیلترها و جستجو
- تست ویرایش و حذف
4. **Integration Flutter:**
- کپی کردن `FLUTTER_BUG_REPORT_EXAMPLE.dart`
- سازگار کردن با پروژه Flutter
- تست ثبت گزارش‌ها
---
## 📞 پشتیبانی
برای هر سوال یا مشکل:
1. بررسی کنید `BUG_REPORT_SYSTEM.md`
2. بررسی کنید logs و error messages
3. مطمئن شوید Migration اجرا شده است

View File

@@ -1,190 +0,0 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
using MongoDB.Bson.Serialization.Attributes;
namespace Company.Domain.CameraBugReportAgg;
/// <summary>
/// مدل دامنه برای گزارش خرابی دوربین
/// </summary>
public class CameraBugReport
{
[BsonId]
[BsonRepresentation(MongoDB.Bson.BsonType.String)]
public Guid Id { get; set; }
public CameraBugReport()
{
Id = Guid.NewGuid();
CreationDate = DateTime.Now;
Status = CameraBugReportStatus.Open;
Screenshots = new List<CameraBugReportScreenshot>();
Logs = new List<CameraBugReportLog>();
}
public CameraBugReport(
string title,
string description,
string userEmail,
string deviceModel,
string osVersion,
string manufacturer,
string buildNumber,
string appVersion,
string screenResolution,
bool isCharging,
int batteryLevel,
int storageInMB,
int memoryInMB,
string networkType,
string platform,
string deviceId,
string packageName,
DateTime installTime,
DateTime lastUpdateTime,
string flavor,
CameraBugReportType type,
CameraBugPriority priority,
long? accountId = null,
string stackTrace = null) : this()
{
Priority = priority;
Type = type;
Flavor = flavor;
LastUpdateTime = lastUpdateTime;
InstallTime = installTime;
PackageName = packageName;
BuildNumber = buildNumber;
AppVersion = appVersion;
NetworkType = networkType;
IsCharging = isCharging;
BatteryLevel = batteryLevel;
StorageInMB = storageInMB;
MemoryInMB = memoryInMB;
ScreenResolution = screenResolution;
DeviceId = deviceId;
Manufacturer = manufacturer;
Platform = platform;
OsVersion = osVersion;
DeviceModel = deviceModel;
AccountId = accountId;
UserEmail = userEmail;
Description = description;
Title = title;
StackTrace = stackTrace;
}
[BsonElement("screenshots")]
public List<CameraBugReportScreenshot> Screenshots { get; private set; }
[BsonElement("logs")]
public List<CameraBugReportLog> Logs { get; private set; }
[BsonElement("updateDate")]
public DateTime? UpdateDate { get; private set; }
[BsonElement("creationDate")]
public DateTime CreationDate { get; private set; }
[BsonElement("stackTrace")]
public string StackTrace { get; private set; }
[BsonElement("status")]
public CameraBugReportStatus Status { get; private set; }
[BsonElement("priority")]
public CameraBugPriority Priority { get; private set; }
[BsonElement("type")]
public CameraBugReportType Type { get; private set; }
[BsonElement("flavor")]
public string Flavor { get; private set; }
[BsonElement("lastUpdateTime")]
public DateTime LastUpdateTime { get; private set; }
[BsonElement("installTime")]
public DateTime InstallTime { get; private set; }
[BsonElement("packageName")]
public string PackageName { get; private set; }
[BsonElement("buildNumber")]
public string BuildNumber { get; private set; }
[BsonElement("appVersion")]
public string AppVersion { get; private set; }
[BsonElement("networkType")]
public string NetworkType { get; private set; }
[BsonElement("isCharging")]
public bool IsCharging { get; private set; }
[BsonElement("batteryLevel")]
public int BatteryLevel { get; private set; }
[BsonElement("storageInMB")]
public int StorageInMB { get; private set; }
[BsonElement("memoryInMB")]
public int MemoryInMB { get; private set; }
[BsonElement("screenResolution")]
public string ScreenResolution { get; private set; }
[BsonElement("deviceId")]
public string DeviceId { get; private set; }
[BsonElement("manufacturer")]
public string Manufacturer { get; private set; }
[BsonElement("platform")]
public string Platform { get; private set; }
[BsonElement("osVersion")]
public string OsVersion { get; private set; }
[BsonElement("deviceModel")]
public string DeviceModel { get; private set; }
[BsonElement("accountId")]
public long? AccountId { get; private set; }
[BsonElement("userEmail")]
public string UserEmail { get; private set; }
[BsonElement("description")]
public string Description { get; private set; }
[BsonElement("title")]
public string Title { get; private set; }
public void ChangeStatus(CameraBugReportStatus newStatus)
{
UpdateDate = DateTime.Now;
Status = newStatus;
}
public void ChangePriority(CameraBugPriority newPriority)
{
Priority = newPriority;
UpdateDate = DateTime.Now;
}
public void AddScreenshot(string base64Data, string fileName)
{
Screenshots.Add(new CameraBugReportScreenshot
{ Base64Data = base64Data, FileName = fileName, UploadDate = DateTime.Now });
}
public void AddLog(string logMessage)
{
Logs.Add(new CameraBugReportLog { Message = logMessage, Timestamp = DateTime.Now });
}
}

View File

@@ -1,20 +0,0 @@
using System;
using _0_Framework.Domain;
using MongoDB.Bson.Serialization.Attributes;
namespace Company.Domain.CameraBugReportAgg
{
/// <summary>
/// لاگ‌های گزارش خرابی دوربین
/// </summary>
public class CameraBugReportLog : EntityBase
{
// FK و navigation property حذف شد برای MongoDB
[BsonElement("message")]
public string Message { get; set; }
[BsonElement("timestamp")]
public DateTime Timestamp { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using System;
using _0_Framework.Domain;
using MongoDB.Bson.Serialization.Attributes;
namespace Company.Domain.CameraBugReportAgg
{
/// <summary>
/// عکس‌های ضمیمه شده به گزارش خرابی دوربین (Base64 encoded)
/// </summary>
public class CameraBugReportScreenshot : EntityBase
{
// FK و navigation property حذف شد برای MongoDB
[BsonElement("base64Data")]
public string Base64Data { get; set; }
[BsonElement("fileName")]
public string FileName { get; set; }
[BsonElement("uploadDate")]
public DateTime UploadDate { get; set; }
}
}

View File

@@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.InfraStructure;
namespace Company.Domain.CameraBugReportAgg;
/// <summary>
/// رابط انبار گزارش خرابی دوربین برای MongoDB
/// </summary>
public interface ICameraBugReportRepository
{
// Async methods for MongoDB operations
Task CreateAsync(CameraBugReport bugReport);
Task UpdateAsync(CameraBugReport bugReport);
Task<CameraBugReport> GetByIdAsync(Guid id);
Task<List<CameraBugReport>> GetAllAsync();
Task<List<CameraBugReport>> GetAllAsync(int skip, int take);
Task DeleteAsync(Guid id);
Task<bool> IsExistAsync(Guid id);
Task<List<CameraBugReport>> FilterAsync(
CameraBugReportType? type = null,
CameraBugPriority? priority = null,
CameraBugReportStatus? status = null,
string searchTerm = null,
int skip = 0,
int take = 10);
Task<int> CountAsync(
CameraBugReportType? type = null,
CameraBugPriority? priority = null,
CameraBugReportStatus? status = null,
string searchTerm = null);
}

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

@@ -251,35 +251,6 @@ public class PersonalContractingParty : EntityBase
this.IsAuthenticated = true;
Phone = phone;
}
public void UnAuthenticateRealEdit(string fName, string lName, string fatherName,string idNumber,
string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender,string phone)
{
this.FName = fName;
this.LName = lName;
this.FatherName = fatherName;
this.IdNumberSeri = idNumberSeri;
this.IdNumberSerial = idNumberSerial;
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : null;
this.IdNumber = idNumber;
this.Gender = gender;
Phone = phone;
}
public void UnAuthenticateLegalEdit(string fName, string lName, string fatherName, string idNumber,
string idNumberSeri,
string idNumberSerial, string dateOfBirth, Gender gender, string phone)
{
CeoFName = fName;
CeoLName = lName;
this.FatherName = fatherName;
this.IdNumberSeri = idNumberSeri;
this.IdNumberSerial = idNumberSerial;
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : null;
this.IdNumber = idNumber;
this.Gender = gender;
Phone = phone;
}
public void RegisterComplete(string fatherName, string idNumberSeri, string idNumberSerial, DateTime dateOfBirth, Gender gender)
{
@@ -290,13 +261,4 @@ public class PersonalContractingParty : EntityBase
this.Gender = gender;
this.IsAuthenticated = true;
}
public void EditLegalPartyFromInstitution(string legalPosition, string companyName,
string registerId,string nationalId)
{
LegalPosition = legalPosition;
LName = companyName;
RegisterId = registerId;
NationalId = nationalId;
}
}

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

@@ -37,7 +37,7 @@ namespace Company.Domain.EmployeeDocumentsAgg
{
WorkshopId = workshopId;
EmployeeId = employeeId;
Gender = gender??string.Empty;
Gender = gender;
}
private EmployeeDocuments()

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);
@@ -56,9 +55,6 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
void UpdateStatusIfNeeded(long institutionContractId);
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
Task<InstitutionContract> GetByPublicIdAsync(Guid id);
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request);
InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request);
#region Extension
@@ -66,13 +62,9 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request);
Task<InstitutionContractDiscountResponse> SetDiscountForExtension(
InstitutionContractSetDiscountForExtensionRequest request);
Task<InstitutionContractDiscountResponse> ResetDiscountForExtension(InstitutionContractResetDiscountForExtensionRequest request);
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
#endregion
#endregion
#region Upgrade(Amendment)
@@ -85,73 +77,5 @@ 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
Task<long> GetIdByInstallmentId(long installmentId);
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
}

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;
@@ -19,8 +18,7 @@ public class InstitutionContract : EntityBase
string contractEndFa, double contractAmount, double dailyCompenseation, double obligation,
double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description,
string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax,
List<InstitutionContractWorkshopInitial> workshopDetails, long lawId,
int discountPercentage, double discountAmount)
List<InstitutionContractWorkshopInitial> workshopDetails, long lawId)
{
ContractNo = contractNo;
RepresentativeId = representativeId;
@@ -58,12 +56,8 @@ public class InstitutionContract : EntityBase
WorkshopGroup = new InstitutionContractWorkshopGroup(id, workshopDetails);
PublicId = Guid.NewGuid();
LawId = lawId;
DiscountPercentage = discountPercentage;
DiscountAmount = discountAmount;
}
public long LawId { get; private set; }
public string ContractNo { get; private set; }
@@ -133,10 +127,6 @@ public class InstitutionContract : EntityBase
public DateTime VerifyCodeCreation { get; private set; }
public string VerifierFullName { get; private set; }
public string VerifierPhoneNumber { get; private set; }
public double DiscountAmount { get; private set; }
public int DiscountPercentage { get; private set; }
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
@@ -381,3 +371,20 @@ public enum InstitutionContractAmendmentChangeType
WorkshopCreated
}
public enum InstitutionContractVerificationStatus
{
/// <summary>
/// در انتظار تایید
/// </summary>
PendingForVerify = 0,
/// <summary>
/// در انتظار کارپوشه
/// </summary>
PendingWorkflow = 1,
/// <summary>
/// تایید شده
/// </summary>
Verified = 2
}

View File

@@ -65,7 +65,6 @@ public class InstitutionContractExtensionTemp
MonthlyPayment = monthly;
OneTimePayment = oneTime;
}
}

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,15 +9,14 @@ 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)
@@ -76,9 +74,6 @@ public class PaymentTransaction:EntityBase
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)
{

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,176 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Company.Domain.CameraBugReportAgg;
using MongoDB.Bson;
using MongoDB.Driver;
namespace CompanyManagement.Infrastructure.Mongo.CameraBugReportRepo;
/// <summary>
/// پیاده‌سازی انبار گزارش خرابی دوربین برای MongoDB
/// </summary>
public class CameraBugReportRepository : ICameraBugReportRepository
{
private readonly IMongoCollection<CameraBugReport> _cameraBugReports;
public CameraBugReportRepository(IMongoDatabase database)
{
_cameraBugReports = database.GetCollection<CameraBugReport>("CameraBugReports");
}
public async Task CreateAsync(CameraBugReport bugReport)
{
await _cameraBugReports.InsertOneAsync(bugReport);
}
public async Task UpdateAsync(CameraBugReport bugReport)
{
await _cameraBugReports.ReplaceOneAsync(
x => x.Id == bugReport.Id,
bugReport);
}
public async Task<CameraBugReport> GetByIdAsync(Guid id)
{
return await _cameraBugReports
.Find(x => x.Id == id)
.FirstOrDefaultAsync();
}
public async Task<List<CameraBugReport>> GetAllAsync()
{
return await _cameraBugReports
.Find(_ => true)
.ToListAsync();
}
public async Task<List<CameraBugReport>> GetAllAsync(int skip, int take)
{
return await _cameraBugReports
.Find(_ => true)
.Skip(skip)
.Limit(take)
.SortByDescending(x => x.CreationDate)
.ToListAsync();
}
public async Task DeleteAsync(Guid id)
{
await _cameraBugReports.DeleteOneAsync(x => x.Id == id);
}
public async Task<bool> IsExistAsync(Guid id)
{
var result = await _cameraBugReports
.Find(x => x.Id == id)
.FirstOrDefaultAsync();
return result != null;
}
public async Task<List<CameraBugReport>> FilterAsync(
CameraBugReportType? type = null,
CameraBugPriority? priority = null,
CameraBugReportStatus? status = null,
string searchTerm = null,
int skip = 0,
int take = 10)
{
var filterDefinition = BuildFilterDefinition(type, priority, status, searchTerm);
return await _cameraBugReports
.Find(filterDefinition)
.Skip(skip)
.Limit(take)
.SortByDescending(x => x.CreationDate)
.ToListAsync();
}
public async Task<int> CountAsync(
CameraBugReportType? type = null,
CameraBugPriority? priority = null,
CameraBugReportStatus? status = null,
string searchTerm = null)
{
var filterDefinition = BuildFilterDefinition(type, priority, status, searchTerm);
var count = await _cameraBugReports.CountDocumentsAsync(filterDefinition);
return (int)count;
}
private FilterDefinition<CameraBugReport> BuildFilterDefinition(
CameraBugReportType? type = null,
CameraBugPriority? priority = null,
CameraBugReportStatus? status = null,
string searchTerm = null)
{
var filters = new List<FilterDefinition<CameraBugReport>>();
if (type.HasValue)
filters.Add(Builders<CameraBugReport>.Filter.Eq(x => x.Type, type.Value));
if (priority.HasValue)
filters.Add(Builders<CameraBugReport>.Filter.Eq(x => x.Priority, priority.Value));
if (status.HasValue)
filters.Add(Builders<CameraBugReport>.Filter.Eq(x => x.Status, status.Value));
if (!string.IsNullOrEmpty(searchTerm))
{
var searchFilter = Builders<CameraBugReport>.Filter.Or(
Builders<CameraBugReport>.Filter.Regex(x => x.Title, new BsonRegularExpression(searchTerm, "i")),
Builders<CameraBugReport>.Filter.Regex(x => x.Description, new BsonRegularExpression(searchTerm, "i")),
Builders<CameraBugReport>.Filter.Regex(x => x.UserEmail, new BsonRegularExpression(searchTerm, "i"))
);
filters.Add(searchFilter);
}
if (filters.Count == 0)
return Builders<CameraBugReport>.Filter.Empty;
return Builders<CameraBugReport>.Filter.And(filters);
}
// Sync methods from IRepository interface (not used in MongoDB flow but required for interface implementation)
public CameraBugReport Get(long id)
{
throw new NotImplementedException("استفاده از GetByIdAsync برای MongoDB");
}
public List<CameraBugReport> Get()
{
throw new NotImplementedException("استفاده از GetAllAsync برای MongoDB");
}
public void Create(CameraBugReport entity)
{
throw new NotImplementedException("استفاده از CreateAsync برای MongoDB");
}
public bool ExistsIgnoreQueryFilter(System.Linq.Expressions.Expression<Func<CameraBugReport, bool>> expression)
{
throw new NotImplementedException("استفاده از IsExistAsync برای MongoDB");
}
public bool Exists(System.Linq.Expressions.Expression<Func<CameraBugReport, bool>> expression)
{
throw new NotImplementedException("استفاده از FilterAsync برای MongoDB");
}
public void SaveChanges()
{
throw new NotImplementedException("MongoDB نیازی به SaveChanges ندارد");
}
public async Task SaveChangesAsync()
{
// MongoDB خودکار ذخیره می‌کند، بنابراین این متد خالی است
await Task.CompletedTask;
}
public Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> BeginTransactionAsync()
{
throw new NotImplementedException("MongoDB اعاملات را بصورت متفاوت مدیریت می‌کند");
}
}

View File

@@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CameraBugReport
{
public class CameraBugReportDetailViewModel
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string UserEmail { get; set; }
public long? AccountId { get; set; }
public string DeviceModel { get; set; }
public string OsVersion { get; set; }
public string Platform { get; set; }
public string Manufacturer { get; set; }
public string DeviceId { get; set; }
public string ScreenResolution { get; set; }
public int MemoryInMB { get; set; }
public int StorageInMB { get; set; }
public int BatteryLevel { get; set; }
public bool IsCharging { get; set; }
public string NetworkType { get; set; }
public string AppVersion { get; set; }
public string BuildNumber { get; set; }
public string PackageName { get; set; }
public DateTime InstallTime { get; set; }
public DateTime LastUpdateTime { get; set; }
public string Flavor { get; set; }
public CameraBugReportType Type { get; set; }
public CameraBugPriority Priority { get; set; }
public CameraBugReportStatus Status { get; set; }
public string StackTrace { get; set; }
public DateTime CreationDate { get; set; }
public DateTime? UpdateDate { get; set; }
public List<string> Logs { get; set; }
public List<CameraBugReportScreenshotViewModel> Screenshots { get; set; }
}
public class CameraBugReportScreenshotViewModel
{
public string FileName { get; set; }
public DateTime UploadDate { get; set; }
public string Base64Data { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using System;
namespace CompanyManagment.App.Contracts.CameraBugReport
{
public class CameraBugReportViewModel
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string UserEmail { get; set; }
public long? AccountId { get; set; }
public string DeviceModel { get; set; }
public string AppVersion { get; set; }
public CameraBugReportType Type { get; set; }
public CameraBugPriority Priority { get; set; }
public CameraBugReportStatus Status { get; set; }
public DateTime CreationDate { get; set; }
public DateTime? UpdateDate { get; set; }
public int LogsCount { get; set; }
public int ScreenshotsCount { get; set; }
}
}

View File

@@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CameraBugReport
{
public class CreateCameraBugReportCommand
{
public string Title { get; set; }
public string Description { get; set; }
public string UserEmail { get; set; }
public long? AccountId { get; set; }
public string DeviceModel { get; set; }
public string OsVersion { get; set; }
public string Platform { get; set; }
public string Manufacturer { get; set; }
public string DeviceId { get; set; }
public string ScreenResolution { get; set; }
public int MemoryInMB { get; set; }
public int StorageInMB { get; set; }
public int BatteryLevel { get; set; }
public bool IsCharging { get; set; }
public string NetworkType { get; set; }
public string AppVersion { get; set; }
public string BuildNumber { get; set; }
public string PackageName { get; set; }
public DateTime InstallTime { get; set; }
public DateTime LastUpdateTime { get; set; }
public string Flavor { get; set; }
public CameraBugReportType Type { get; set; }
public CameraBugPriority Priority { get; set; }
public string StackTrace { get; set; }
public List<string> Logs { get; set; }
public List<string> Screenshots { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System;
namespace CompanyManagment.App.Contracts.CameraBugReport
{
public class EditCameraBugReportCommand
{
public Guid Id { get; set; }
public CameraBugPriority Priority { get; set; }
public CameraBugReportStatus Status { get; set; }
}
}

View File

@@ -1,73 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.CameraBugReport
{
public interface ICameraBugReportApplication
{
Task<OperationResult> CreateAsync(CreateCameraBugReportCommand command);
Task<OperationResult> EditAsync(EditCameraBugReportCommand command);
Task<OperationResult> DeleteAsync(Guid id);
Task<List<CameraBugReportViewModel>> GetAllAsync(CameraBugReportSearchModel searchModel);
Task<CameraBugReportDetailViewModel> GetDetailsAsync(Guid id);
Task<bool> IsExistAsync(Guid id);
// Keep sync methods for backward compatibility but they delegate to async
OperationResult Create(CreateCameraBugReportCommand command);
OperationResult Edit(EditCameraBugReportCommand command);
OperationResult Delete(Guid id);
List<CameraBugReportViewModel> GetAll(CameraBugReportSearchModel searchModel);
CameraBugReportDetailViewModel GetDetails(Guid id);
bool IsExist(Guid id);
}
public class CameraBugReportSearchModel
{
public CameraBugReportType? Type { get; set; }
public CameraBugPriority? Priority { get; set; }
public CameraBugReportStatus? Status { get; set; }
public string SearchTerm { get; set; }
public int PageNumber { get; set; } = 1;
public int PageSize { get; set; } = 10;
}
}
/// </summary>
/// وضعیت گزارش خرابی دوربین
/// <summary>
public enum CameraBugReportStatus
{
Reopened = 5, // مجدداً باز شده
Closed = 4, // بسته شده
Fixed = 3, // رفع شده
InProgress = 2, // در حال بررسی
Open = 1, // باز
}
/// </summary>
/// اولویت گزارش خرابی دوربین
/// <summary>
public enum CameraBugPriority
{
Low = 4, // پایین
Medium = 3, // متوسط
High = 2, // بالا
Critical = 1, // بحرانی
}
/// </summary>
/// انواع گزارش خرابی دوربین
/// <summary>
public enum CameraBugReportType
{
Other = 8, // سایر
CrashOnCapture = 7, // کرش هنگام عکس‌برداری
LightingIssue = 6, // مشکل روشنایی
FocusIssue = 5, // مشکل فوکوس
PerformanceIssue = 4, // مشکل عملکردی
FaceRecognitionFailed = 3, // شناسایی چهره ناموفق
BlurryImage = 2, // تصویر مبهم
CameraNotWorking = 1, // دوربین کار نمی‌کند
}

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

@@ -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

@@ -87,7 +87,7 @@ public class CreateInstitutionContractRequest
/// <summary>
/// مبلغ کل قرارداد
/// </summary>
public double PaymentAmount { get; set; }
public double TotalAmount { get; set; }
/// <summary>
/// آیا قرارداد اقساطی است؟
@@ -102,10 +102,6 @@ public class CreateInstitutionContractRequest
public double OneMonthAmount { get; set; }
public long LawId { get; set; }
public int DiscountPercentage { get; set; }
public double DiscountAmount { get; set; }
}
/// <summary>
/// مدت زمان قرارداد نهاد

View File

@@ -1,4 +1,7 @@
using System.Collections.Generic;
using System.Security.AccessControl;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Server.HttpSys;
namespace CompanyManagment.App.Contracts.InstitutionContract;
@@ -97,6 +100,7 @@ public class InstitutionContractListWorkshop
{
public string WorkshopName { get; set; }
public int EmployeeCount { get; set; }
public string Price { get; set; }
public WorkshopServicesViewModel WorkshopServices { get; set; }
}
@@ -104,22 +108,31 @@ public class WorkshopServicesViewModel
{
public bool Insurance { get; set; }
public string InsuranceLabel => "ارسال لیست بیمه";
public string InsurancePrice { get; set; }
public bool InsuranceInPerson { get; set; }
public string InsuranceInPersonLabel => "خدمات مستقیم";
public string InsuranceInPersonPrice { get; set; }
public bool Contract { get; set; }
public string ContractLabel => "قرارداد و تصفیه حساب";
public string ContractPrice { get; set; }
public bool ContractInPerson { get; set; }
public string ContractInPersonLabel => "خدمات مستقیم";
public string ContractInPersonPrice { get; set; }
public bool RollCall { get; set; }
public string RollCallLabel => "ساعت حضور و غیاب";
public string RollCallPrice { get; set; }
public bool RollCallInPerson { get; set; }
public string RollCallInPersonLabel => "خدمات مستقیم";
public string RollCallInPersonPrice { get; set; }
public bool CustomizeCheckout { get; set; }
public string CustomizeCheckoutLabel => "فیش غیر رسمی";
public string CustomizeCheckoutPrice { get; set; }
}

View File

@@ -213,11 +213,9 @@ 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);
InstitutionContractDiscountResponse CalculateDiscount(InstitutionContractSetDiscountRequest request);
InstitutionContractDiscountResponse ResetDiscountCreate(InstitutionContractResetDiscountForCreateRequest request);
#region Extension
Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId);
@@ -230,12 +228,6 @@ public interface IInstitutionContractApplication
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(
InstitutionContractExtensionPaymentRequest request);
Task<InstitutionContractDiscountResponse> SetDiscountForExtension(
InstitutionContractSetDiscountForExtensionRequest request);
Task<InstitutionContractDiscountResponse> ResetDiscountForExtension(
InstitutionContractResetDiscountForExtensionRequest request);
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,string selected);
@@ -260,77 +252,15 @@ public interface IInstitutionContractApplication
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<OperationResult> SetPendingWorkflow(long entityId);
Task<long> GetIdByInstallmentId(long installmentId);
Task<GetInstitutionContractWorkshopsDetails> GetContractWorkshopsDetails(long id);
}
public class InstitutionContractDiscountResponse
public class GetInstitutionContractWorkshopsDetails
{
public InstitutionContractDiscountOneTimeViewModel OneTime { get; set; }
public InstitutionContractDiscountMonthlyViewModel Monthly { get; set; }
public List<InstitutionContractListWorkshop> Workshops { get; set; }
}
public class InstitutionContractDiscountMonthlyViewModel:InstitutionContractDiscountOneTimeViewModel
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractDiscountOneTimeViewModel
{
/// <summary>
/// مجموع مبالغ
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
public string DiscountedAmount { get; set; }
public int DiscountPercetage { get; set; }
public string Obligation { get; set; }
public string OneMonthAmount { get; set; }
}
public class InstitutionContractResetDiscountForCreateRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
}
public class InstitutionContractSetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractResetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractSetDiscountRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractPrintViewModel
{

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
namespace CompanyManagment.App.Contracts.InstitutionContract;
@@ -12,15 +11,4 @@ public class InstitutionContractExtensionWorkshopsRequest
public string Province { get; set; }
public string Address { get; set; }
public List<EditContactInfo> ContactInfos { get; set; }
/// <summary>
/// اطلاعات شخص حقیقی
/// </summary>
public CreateInstitutionContractRealPartyRequest RealParty { get; set; }
/// <summary>
/// اطلاعات شخص حقوقی
/// </summary>
public CreateInstitutionContractLegalPartyRequest LegalParty { get; set; }
public LegalType LegalType { get; set; }
}

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

@@ -17,9 +17,6 @@ public class InstitutionContractPaymentOneTimeViewModel
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
public string DiscountedAmount { get; set; }
public int DiscountPercetage { get; set; }
}
public class InstitutionContractPaymentMonthlyViewModel:InstitutionContractPaymentOneTimeViewModel
{

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

@@ -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,292 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.CameraBugReport;
using Company.Domain.CameraBugReportAgg;
namespace CompanyManagment.Application
{
public class CameraBugReportApplication : ICameraBugReportApplication
{
private readonly ICameraBugReportRepository _repository;
public CameraBugReportApplication(ICameraBugReportRepository repository)
{
_repository = repository;
}
// ============ Async Methods (MongoDB) ============
public async Task<OperationResult> CreateAsync(CreateCameraBugReportCommand command)
{
var op = new OperationResult();
try
{
var bugReport = new CameraBugReport(
command.Title,
command.Description,
command.UserEmail,
command.DeviceModel,
command.OsVersion,
command.Manufacturer,
command.BuildNumber,
command.AppVersion,
command.ScreenResolution,
command.IsCharging,
command.BatteryLevel,
command.StorageInMB,
command.MemoryInMB,
command.NetworkType,
command.Platform,
command.DeviceId,
command.PackageName,
command.InstallTime,
command.LastUpdateTime,
command.Flavor,
command.Type,
command.Priority,
command.AccountId,
command.StackTrace
);
// اضافه کردن لاگ‌ها
if (command.Logs != null && command.Logs.Any())
{
foreach (var log in command.Logs)
{
bugReport.AddLog(log);
}
}
// اضافه کردن تصاویر
if (command.Screenshots != null && command.Screenshots.Any())
{
foreach (var screenshot in command.Screenshots)
{
bugReport.AddScreenshot(screenshot, $"screenshot_{Guid.NewGuid()}.jpg");
}
}
await _repository.CreateAsync(bugReport);
return op.Succcedded();
}
catch (Exception ex)
{
return op.Failed($"خطا در ثبت گزارش خرابی: {ex.Message}");
}
}
public async Task<OperationResult> EditAsync(EditCameraBugReportCommand command)
{
var op = new OperationResult();
try
{
var bugReport = await _repository.GetByIdAsync(command.Id);
if (bugReport == null)
return op.Failed("گزارش خرابی یافت نشد.");
bugReport.ChangePriority(command.Priority);
bugReport.ChangeStatus(command.Status);
await _repository.UpdateAsync(bugReport);
return op.Succcedded();
}
catch (Exception ex)
{
return op.Failed($"خطا در ویرایش گزارش خرابی: {ex.Message}");
}
}
public async Task<OperationResult> DeleteAsync(Guid id)
{
var op = new OperationResult();
try
{
var exists = await _repository.IsExistAsync(id);
if (!exists)
return op.Failed("گزارش خرابی یافت نشد.");
await _repository.DeleteAsync(id);
return op.Succcedded();
}
catch (Exception ex)
{
return op.Failed($"خطا در حذف گزارش خرابی: {ex.Message}");
}
}
public async Task<List<CameraBugReportViewModel>> GetAllAsync(CameraBugReportSearchModel searchModel)
{
try
{
var skip = (searchModel.PageNumber - 1) * searchModel.PageSize;
var bugReports = await _repository.FilterAsync(
searchModel.Type,
searchModel.Priority,
searchModel.Status,
searchModel.SearchTerm,
skip,
searchModel.PageSize
);
return bugReports.Select(x => new CameraBugReportViewModel
{
Id = x.Id,
Title = x.Title,
Description = x.Description,
UserEmail = x.UserEmail,
AccountId = x.AccountId,
DeviceModel = x.DeviceModel,
AppVersion = x.AppVersion,
Type = x.Type,
Priority = x.Priority,
Status = x.Status,
CreationDate = x.CreationDate,
UpdateDate = x.UpdateDate,
LogsCount = x.Logs?.Count ?? 0,
ScreenshotsCount = x.Screenshots?.Count ?? 0
}).ToList();
}
catch (Exception ex)
{
throw new Exception($"خطا در دریافت لیست گزارش‌ها: {ex.Message}", ex);
}
}
public async Task<CameraBugReportDetailViewModel> GetDetailsAsync(Guid id)
{
try
{
var bugReport = await _repository.GetByIdAsync(id);
if (bugReport == null)
return null;
return new CameraBugReportDetailViewModel
{
Id = bugReport.Id,
Title = bugReport.Title,
Description = bugReport.Description,
UserEmail = bugReport.UserEmail,
AccountId = bugReport.AccountId,
DeviceModel = bugReport.DeviceModel,
OsVersion = bugReport.OsVersion,
Platform = bugReport.Platform,
Manufacturer = bugReport.Manufacturer,
DeviceId = bugReport.DeviceId,
ScreenResolution = bugReport.ScreenResolution,
MemoryInMB = bugReport.MemoryInMB,
StorageInMB = bugReport.StorageInMB,
BatteryLevel = bugReport.BatteryLevel,
IsCharging = bugReport.IsCharging,
NetworkType = bugReport.NetworkType,
AppVersion = bugReport.AppVersion,
BuildNumber = bugReport.BuildNumber,
PackageName = bugReport.PackageName,
InstallTime = bugReport.InstallTime,
LastUpdateTime = bugReport.LastUpdateTime,
Flavor = bugReport.Flavor,
Type = bugReport.Type,
Priority = bugReport.Priority,
Status = bugReport.Status,
StackTrace = bugReport.StackTrace,
CreationDate = bugReport.CreationDate,
UpdateDate = bugReport.UpdateDate,
Logs = bugReport.Logs?.Select(x => x.Message).ToList() ?? new List<string>(),
Screenshots = bugReport.Screenshots?.Select(x => new CameraBugReportScreenshotViewModel
{
FileName = x.FileName,
UploadDate = x.UploadDate,
Base64Data = x.Base64Data
}).ToList() ?? new List<CameraBugReportScreenshotViewModel>()
};
}
catch (Exception ex)
{
throw new Exception($"خطا در دریافت جزئیات گزارش: {ex.Message}", ex);
}
}
public async Task<bool> IsExistAsync(Guid id)
{
return await _repository.IsExistAsync(id);
}
// ============ Sync Methods (Backward Compatibility) ============
public OperationResult Create(CreateCameraBugReportCommand command)
{
try
{
return CreateAsync(command).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
return new OperationResult().Failed($"خطا: {ex.Message}");
}
}
public OperationResult Edit(EditCameraBugReportCommand command)
{
try
{
return EditAsync(command).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
return new OperationResult().Failed($"خطا: {ex.Message}");
}
}
public OperationResult Delete(Guid id)
{
try
{
return DeleteAsync(id).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
return new OperationResult().Failed($"خطا: {ex.Message}");
}
}
public List<CameraBugReportViewModel> GetAll(CameraBugReportSearchModel searchModel)
{
try
{
return GetAllAsync(searchModel).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
throw new Exception($"خطا: {ex.Message}", ex);
}
}
public CameraBugReportDetailViewModel GetDetails(Guid id)
{
try
{
return GetDetailsAsync(id).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
throw new Exception($"خطا: {ex.Message}", ex);
}
}
public bool IsExist(Guid id)
{
try
{
return IsExistAsync(id).ConfigureAwait(false).GetAwaiter().GetResult();
}
catch (Exception ex)
{
throw new Exception($"خطا: {ex.Message}", ex);
}
}
}
}

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

@@ -1585,12 +1585,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (employee.IsAuthorized == false)
{
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (apiResult == null)
{
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
}
if (apiResult.ResponseContext.Status.Code is 14 or 3)
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
@@ -1649,13 +1644,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
};
return op.Succcedded(data);
}
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (apiResult == null)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
}
if (apiResult.ResponseContext.Status.Code is 14 or 3)
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });

View File

@@ -1485,12 +1485,12 @@ public class EmployerApplication : IEmployerApplication
return opration.Failed("نام شرکت وارد شده تکراری است");
}
// if (_EmployerRepository.Exists(x =>
// x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
// x.RegisterId != null))
// {
// return opration.Failed(" شماره ثبت وارد شده تکراری است");
// }
if (_EmployerRepository.Exists(x =>
x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
x.RegisterId != null))
{
return opration.Failed(" شماره ثبت وارد شده تکراری است");
}
if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
{

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

@@ -290,34 +290,8 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
if (rollCallsEmployee != null)
{
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
// {
// x.WorkshopId,
@@ -327,6 +301,27 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
// });
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
&& rollCallEmployeeStatus.EndDate.Date >
maxLeftWork.LeftWorkDateGr);
if (status != null)
{
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
{
LeaveDate = maxLeftWork.LeftWorkDateGr,
RollCallStatusId = status.id
};
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
}
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
if (rollCallEmployeeStatusList.Any())
{
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
_rollCallEmployeeStatusRepository.SaveChanges();
}
}
}

View File

@@ -446,7 +446,7 @@ public class RollCallApplication : IRollCallApplication
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
}
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
@@ -486,8 +486,7 @@ public class RollCallApplication : IRollCallApplication
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date
&& x.EndDate.Value.Date <= y.EndDateGr.Date)))
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
@@ -631,7 +630,7 @@ public class RollCallApplication : IRollCallApplication
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
}
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
@@ -663,7 +662,7 @@ public class RollCallApplication : IRollCallApplication
&& (y.StartDate.Value.Date <= x.ContractEndGr.Date))))
return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است");
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate.Value.Date >= y.StartDateGr.Date && x.EndDate.Value.Date <= y.EndDateGr.Date)))
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
var currentDayRollCall = employeeRollCalls.FirstOrDefault(x => x.EndDate == null);

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("موردی انتخاب نشده است");
}
}
}

View File

@@ -119,29 +119,27 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
//دریافت اطلاعات احراز هویت
var apiResponsParty = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
return op.Failed("خطا در سرویس احراز هویت");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
if (apiResponsParty == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiResponsParty.ResponseContext.Status.Code is 14 or 3)
if (apiResponsParty.ResponseContext.Status.Code ==14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiResponsParty.ResponseContext.Status.Code != 0)
return op.Failed($"{apiResponsParty.ResponseContext.Status.Message}");
idNumberParty = apiResponsParty.IdentificationInformation.ShenasnamehNumber == "0"
idNumberParty = apiResponsParty.IdentificationInformation.ShenasnamehNumber == "0"
? apiResponsParty.IdentificationInformation.NationalId
: apiResponsParty.IdentificationInformation.ShenasnamehNumber;
//چک کردن مطابقت شماره همراه و کد ملی
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
if (isMachMobilAndNationalCode == null)
throw new InternalServerException("خطا در سرویس تطابق کد ملی و شماره همراه");
if (!isMachMobilAndNationalCode.IsMatched)
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
contractingParty.Authentication(apiResponsParty.BasicInformation.FirstName, apiResponsParty.BasicInformation.LastName,
apiResponsParty.BasicInformation.FatherName,idNumberParty,apiResponsParty.IdentificationInformation.ShenasnameSeri,
apiResponsParty.IdentificationInformation.ShenasnameSerial,dateOfBirth,apiResponsParty.BasicInformation.GenderEnum,
@@ -149,11 +147,12 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
await _contractingPartyTempRepository.SaveChangesAsync();
}
if (contractingParty.Phone != mobile)
return op.Failed("شما قبلا با شماره همراه دیگری احراز هویت شده اید");
result.Id = contractingParty.id;
result.FName = contractingParty.FName;
result.LName = contractingParty.LName;
@@ -207,14 +206,9 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
if (apiRespons == null)
throw new InternalServerException("خطا در سرویس احراز هویت");
if (apiRespons.ResponseContext.Status.Code is 14 or 3)
if (apiRespons.ResponseContext.Status.Code == 14)
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
if (apiRespons.ResponseContext.Status.Code == 2)
{
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
}
if (apiRespons.ResponseContext.Status.Code != 0)
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
@@ -240,8 +234,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
result.IdNumberSerial = createTemp.IdNumberSerial;
result.IdNumber = idNumber;
result.NationalCode = createTemp.NationalCode;
result.Phone = createTemp.Phone;
result.IdNumberSeri = createTemp.IdNumberSeri;
return op.Succcedded(result);

View File

@@ -45,7 +45,6 @@ using Company.Domain.FileEmployerAgg;
using Company.Domain.FileState;
using Company.Domain.FileTiming;
using Company.Domain.FileTitle;
using Company.Domain.FinancialInvoiceAgg;
using Company.Domain.FinancialStatmentAgg;
using Company.Domain.FinancialTransactionAgg;
using Company.Domain.FineAgg;
@@ -118,7 +117,6 @@ using Company.Domain.WorkshopSubAccountAgg;
using Company.Domain.YearlySalaryAgg;
using Company.Domain.YearlySalaryItemsAgg;
using Company.Domain.YearlysSalaryTitleAgg;
using Company.Domain.CameraBugReportAgg;
using CompanyManagment.EFCore.Mapping;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
@@ -164,12 +162,6 @@ public class CompanyContext : DbContext
//-------Main-Project----------------------------
#region SmsSettings
public DbSet<SmsSetting> SmsSettings { get; set; }
#endregion
#region Mahan
//-----------------------------RollCallWorkshopSettings-----------------------------
@@ -212,13 +204,12 @@ public class CompanyContext : DbContext
public DbSet<AuthorizedBankDetails> AuthorizedBankDetails { get; set; }
public DbSet<FinancialInvoice> FinancialInvoices { get; set; }
#endregion
#endregion
#region Pooya
#region Pooya
public DbSet<EmployeeDocumentItem> EmployeeDocumentItems { get; set; }
public DbSet<EmployeeDocumentItem> EmployeeDocumentItems { get; set; }
public DbSet<EmployeeDocuments> EmployeeDocuments { get; set; }
public DbSet<WorkshopSubAccount> WorkshopSubAccounts { get; set; }
@@ -324,11 +315,6 @@ public class CompanyContext : DbContext
public DbSet<Employer> Employers { get; set; }
#region BugReport
public DbSet<CameraBugReport> CameraBugReports { get; set; }
public DbSet<CameraBugReportLog> CameraBugReportLogs { get; set; }
public DbSet<CameraBugReportScreenshot> CameraBugReportScreenshots { get; set; }
#endregion
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
{

View File

@@ -131,12 +131,5 @@ public class CustomizeCheckoutMapping : IEntityTypeConfiguration<CustomizeChecko
// .HasForeignKey(x => x.EmployeeId);
#endregion
builder.OwnsMany(x => x.CheckoutDynamicDeductions, dynamicDeduction =>
{
dynamicDeduction.Property(x => x.Name).HasMaxLength(100);
dynamicDeduction.Property(x => x.Count);
dynamicDeduction.Property(x => x.Amount).HasMaxLength(30);
});
}
}

View File

@@ -129,12 +129,5 @@ public class CustomizeCheckoutTempMapping : IEntityTypeConfiguration<CustomizeCh
// .HasForeignKey(x => x.EmployeeId);
#endregion
builder.OwnsMany(x => x.CheckoutDynamicDeductions, dynamicDeduction =>
{
dynamicDeduction.Property(x => x.Name).HasMaxLength(100);
dynamicDeduction.Property(x => x.Count);
dynamicDeduction.Property(x => x.Amount).HasMaxLength(30);
});
}
}

View File

@@ -1,17 +0,0 @@
using Company.Domain.FinancialInvoiceAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class FinancialInvoiceItemMapping : IEntityTypeConfiguration<FinancialInvoiceItem>
{
public void Configure(EntityTypeBuilder<FinancialInvoiceItem> builder)
{
builder.Property(x=>x.Description).HasMaxLength(800);
builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
builder.HasOne(x => x.FinancialInvoice).WithMany(x => x.Items)
.HasForeignKey(x => x.FinancialInvoiceId);
}
}

View File

@@ -1,25 +0,0 @@
using Company.Domain.FinancialInvoiceAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class FinancialInvoiceMapping:IEntityTypeConfiguration<FinancialInvoice>
{
public void Configure(EntityTypeBuilder<FinancialInvoice> builder)
{
builder.HasKey(x => x.id);
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(20);
builder.Property(x => x.PaidAt).IsRequired(false);
builder.Property(x => x.Description).HasMaxLength(800);
builder.Property(x => x.InvoiceNumber).HasMaxLength(22);
builder.HasMany(x => x.Items).WithOne(x => x.FinancialInvoice)
.HasForeignKey(x => x.FinancialInvoiceId).IsRequired().OnDelete(DeleteBehavior.Cascade);
builder.HasMany(x => x.PaymentTransactions).WithOne(x => x.FinancialInvoice)
.HasForeignKey(x => x.FinancialInvoiceId).IsRequired(false).OnDelete(DeleteBehavior.NoAction);
}
}

View File

@@ -14,7 +14,7 @@ public class FinancialTransactionMapping : IEntityTypeConfiguration<FinancialTra
builder.Property(x => x.TdateFa);
builder.Property(x => x.TdateFa).HasMaxLength(10);
builder.Property(x => x.TypeOfTransaction).HasMaxLength(10);
builder.Property(x => x.DescriptionOption).HasMaxLength(100);
builder.Property(x => x.DescriptionOption).HasMaxLength(50);
builder.Property(x => x.Description).HasMaxLength(600);
builder.Property(x => x.Deptor);
builder.Property(x => x.Creditor);

View File

@@ -11,7 +11,7 @@ public class InstitutinContractContactInfoMapping : IEntityTypeConfiguration<Ins
builder.ToTable("InstitutinContractContactInfo");
builder.HasKey(x => x.id);
builder.Property(x => x.FnameLname).HasMaxLength(150);
builder.Property(x => x.FnameLname).HasMaxLength(50);
builder.Property(x => x.PhoneNumber).HasMaxLength(20);
builder.Property(x => x.PhoneType).HasMaxLength(20);
builder.Property(x => x.Position).HasMaxLength(50);

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