Compare commits

...

63 Commits

Author SHA1 Message Date
3f55446f82 Merge branch 'Feature/loan/client-api' 2026-02-06 18:29:45 +03:30
3b4f880d54 Merge branch 'Feature/roll-call/client-api' 2026-02-05 15:11:09 +03:30
fb239e3159 Merge branch 'Feature/salary-aid/client-api' 2026-02-05 15:02:32 +03:30
c844867cab add OnPostCreateFromExcelData method to SalaryAidController for bulk salary aid creation from Excel data 2026-02-05 15:00:56 +03:30
779514f5c0 refactor ValidateExcel method in SalaryAidController to use ValidateExcelRequest model 2026-02-05 14:18:18 +03:30
bc491eec18 add EditDetails endpoint to SalaryAidController for salary aid detail retrieval 2026-02-05 13:55:02 +03:30
67910d2fa5 add EditDetails method to SalaryAidController for retrieving salary aid details 2026-02-05 12:50:53 +03:30
9475c786d3 add endpoint to remove employee roll calls by date 2026-02-05 11:58:52 +03:30
db32b1e6ea set WorkshopId in search model for salary aid list retrieval 2026-02-05 11:50:23 +03:30
79a9d72b86 rename SalaryAidViewModels property to Items in grouped view models 2026-02-05 11:32:16 +03:30
dddc4b143a add edit functionality for employee roll call details 2026-02-05 11:29:41 +03:30
a8cb226d20 change list key for salary aid 2026-02-05 11:05:54 +03:30
ffe8fa67e2 refactor salary aid controller to update Excel validation endpoint 2026-02-05 10:33:09 +03:30
a0d2023a6c add Excel validation for salary aid import and update pagination in salary aid list 2026-02-05 10:32:08 +03:30
c2fdc217b9 refactor SetTimeProjectCommandHandler to validate total time after applying changes 2026-02-05 10:14:13 +03:30
db0047d3d3 set time get details 2026-02-03 17:54:32 +03:30
fa4c39904a chnage loan list to new type 2026-02-03 13:44:47 +03:30
gozareshgir
a14a78309e Merge branch 'Feature/SmsRepoetApi' 2026-02-02 19:46:54 +03:30
gozareshgir
4ccade4c7a change sms url 2026-02-02 19:45:51 +03:30
085d138bc5 Merge branch 'Feature/SmsRepoetApi' 2026-02-02 19:19:32 +03:30
3dace574ff refactor date parsing method in RollCallCaseHistoryController 2026-02-02 19:08:25 +03:30
bf2a102a55 add Excel export functionality for roll call case history 2026-02-02 19:07:11 +03:30
88744bd4cf add endpoint to download case history as Excel file 2026-02-02 17:54:33 +03:30
5942075dd6 refactor roll call case history controller and add total working hours endpoint 2026-02-02 17:31:37 +03:30
61015ae5c1 Merge remote-tracking branch 'origin/master' 2026-02-02 16:54:32 +03:30
57a5000124 refactor GetProjectsListQueryHandler to improve task and phase status aggregation logic 2026-02-02 16:52:53 +03:30
7cbb9eef69 add validation and management for additional time entries in SetTimeProjectCommand 2026-02-02 16:07:43 +03:30
gozareshgir
7a065e9d16 Checkout Except EmployeeId = 7175 2026-02-02 13:57:15 +03:30
0e7787dd56 add page size for search model 2026-02-01 18:14:28 +03:30
gozareshgir
e2bab8c1ce HasRollCall Method Changeed 2026-02-01 13:20:22 +03:30
gozareshgir
b088d3089d merge from smsReportApi 2026-01-29 15:29:19 +03:30
gozareshgir
45b4690066 Test singnalR instandSms 2026-01-29 15:26:04 +03:30
179de86840 update SMS report links in menu to use absolute URLs 2026-01-27 21:10:18 +03:30
e0d10510e0 update RemoveSmsSetting method to return OperationResult 2026-01-27 20:20:54 +03:30
a55492b16a add CancelSendVerificationSms flag to InstitutionContractExtensionCompleteRequest and update SMS sending logic 2026-01-27 17:43:05 +03:30
9596c8f8b6 refactor FileUploadService to simplify category folder naming 2026-01-27 16:24:34 +03:30
5c3c9739d1 fix regex and validation for rollcall history case details 2026-01-19 15:30:28 +03:30
355ec72140 comment excel data 2026-01-18 14:17:23 +03:30
b22aa86aea add create - edit - remove salary aid api controller 2026-01-15 10:35:43 +03:30
f0feac9601 add salary aid controller 2026-01-14 19:27:23 +03:30
90fa0ac8f8 change excel download api controller 2026-01-14 10:20:58 +03:30
eb8352e8fc add rollcall download excel controller. 2026-01-14 09:37:55 +03:30
4c7599b568 add print to rollcall case history 2026-01-13 18:50:18 +03:30
d179c90c48 change paginated to list 2026-01-13 18:31:10 +03:30
gozareshgir
2fc124bf6d Get Sms Details 2026-01-13 17:35:29 +03:30
gozareshgir
1d88ca0fbb changes 2026-01-13 17:05:07 +03:30
gozareshgir
e2911dfc2a addnew dto 2026-01-13 17:00:59 +03:30
gozareshgir
cfb96d1277 Chenge Post Methods to fromBody 2026-01-13 16:42:50 +03:30
gozareshgir
b5c5be2cb6 change smsResult grouping 2026-01-13 16:26:04 +03:30
8850328fd4 add GetEditDetails controller method 2026-01-13 16:08:13 +03:30
gozareshgir
f5c8888137 IsDev mode chak for instant sms 2026-01-13 15:33:08 +03:30
gozareshgir
4d7923936e InstantSms Send Completed 2026-01-13 15:16:33 +03:30
915f16c7c0 add rollcall case history upsert 2026-01-13 14:03:10 +03:30
gozareshgir
532065e3a8 Merge branch 'master' into Feature/SmsRepoetApi 2026-01-13 11:20:57 +03:30
gozareshgir
f7bfa37a77 SmsSettings List , create, edit, delete 2026-01-13 11:17:25 +03:30
87c3cebb60 set workshopId to readonly 2026-01-13 09:38:44 +03:30
0d72392701 complete rollcall history details 2026-01-12 10:48:19 +03:30
8f6007835c complete rollcallCase history details by employee 2026-01-11 17:25:56 +03:30
05d860795e add rollcall title case history query 2026-01-11 15:12:08 +03:30
607c0780b6 Merge branch 'master' into Feature/loan/client-api 2026-01-10 11:50:52 +03:30
ef49302f8a feat: add workshop ID handling in LoanController for loan search filtering 2026-01-08 12:03:54 +03:30
4ab9f60932 feat: add methods for creating, calculating installments, and removing loans in LoanController 2026-01-01 14:41:13 +03:30
9cfae54db3 feat: add LoanController for managing loan applications and details 2026-01-01 13:13:04 +03:30
56 changed files with 2418 additions and 737 deletions

View File

@@ -45,6 +45,11 @@ public enum TypeOfSmsSetting
/// </summary>
SendInstitutionContractConfirmationCode,
/// <summary>
/// لینک تاییدیه ایجاد قرارداد مالی
/// </summary>
SendInstitutionContractConfirmationLink,
/// <summary>
/// یادآور وظایف
/// </summary>

View File

@@ -7,7 +7,7 @@ namespace _0_Framework.Application;
public class PagedResult<T> where T : class
{
public int TotalCount { get; set; }
public List<T> List { get; set; }
public List<T> List { get; set; } = [];
}
public class PagedResult<T,TMeta>:PagedResult<T> where T : class
{

View File

@@ -30,5 +30,22 @@ public class ApiReportDto
public string DeliveryState { get; set; }
public string DeliveryUnixTime { get; set; }
public string DeliveryColor { get; set; }
public string FullName { get; set; }
}
public class SmsDetailsDto
{
public string MessageText { get; set; }
public long Mobile { get; set; }
public string SendUnixTime { get; set; }
public string DeliveryState { get; set; }
public string DeliveryUnixTime { get; set; }
public string DeliveryColor { get; set; }
public string FullName { get; set; }
}

View File

@@ -16,15 +16,21 @@ public interface ISmsService
/// <param name="code"></param>
/// <returns></returns>
Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code);
bool SendAccountsInfo(string number,string fullName, string userName);
bool SendAccountsInfo(string number, string fullName, string userName);
Task<ApiResultViewModel> GetByMessageId(int messId);
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
#region ForApi
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
#endregion
/// <summary>
/// دریافت جزئیات پیامک
/// </summary>
/// <param name="messId"></param>
/// <param name="fullName"></param>
/// <returns></returns>
Task<SmsDetailsDto> GetSmsDetailsByMessageId(int messId, string fullName);
#endregion
string DeliveryStatus(byte? dv);
string DeliveryColorStatus(byte? dv);
@@ -33,9 +39,9 @@ public interface ISmsService
#region Mahan
Task<double> GetCreditAmount();
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms = null);
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
long contractingPartyId, long institutionContractId);
@@ -68,7 +74,7 @@ public interface ISmsService
/// <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>
/// پیامک مسدودی طرف حساب
/// قراردادهای قدیم

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -91,5 +92,9 @@ namespace Company.Domain.RollCallAgg
Task<List<RollCall>> GetRollCallsUntilNowWithWorkshopIdEmployeeIds(long workshopId, List<long> employeeIds,
DateTime fromDate);
#endregion
Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,RollCallCaseHistorySearchModel searchModel);
Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId,
string titleId, RollCallCaseHistorySearchModel searchModel);
}
}

View File

@@ -1,4 +1,5 @@
using _0_Framework.Domain;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System.Collections.Generic;
@@ -22,8 +23,9 @@ public interface ISmsResultRepository : IRepository<long, SmsResult>
/// </summary>
/// <param name="searchModel"></param>
/// <param name="date"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
#endregion
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);

View File

@@ -1,6 +1,7 @@
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.SmsResult;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.SmsResultAgg;
@@ -27,4 +28,25 @@ public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
/// <param name="id"></param>
/// <returns></returns>
Task RemoveItem(long id);
#region ForApi
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// Api
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
#endregion
}

View File

@@ -1,6 +1,12 @@
using _0_Framework.Excel;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.RollCall;
using OfficeOpenXml;
using OfficeOpenXml.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace CompanyManagement.Infrastructure.Excel.RollCall;
@@ -308,6 +314,111 @@ public class RollCallExcelGenerator : ExcelGenerator
return package.GetAsByteArray();
}
public static byte[] CaseHistoryExcelForEmployee(List<RollCallCaseHistoryDetail> data, string titleId)
{
if (!Regex.IsMatch(titleId, @"^\d{4}_\d{2}$"))
throw new ArgumentException("Invalid titleId format.", nameof(titleId));
var splitDate = titleId.Split("_");
var year = Convert.ToInt32(splitDate.First());
var month = Convert.ToInt32(splitDate.Last());
var startDateFa = $"{year:D4}/{month:D2}/01";
var startDate = startDateFa.ToGeorgianDateTime();
var endDateFa = startDateFa.FindeEndOfMonth();
var endDate = endDateFa.ToGeorgianDateTime();
var dateRange = (int)(endDate.Date - startDate.Date).TotalDays + 1;
var dates = Enumerable.Range(0, dateRange).Select(x => startDate.AddDays(x)).ToList();
var safeData = data ?? new List<RollCallCaseHistoryDetail>();
var first = safeData.FirstOrDefault();
var totalWorkingTime = new TimeSpan(safeData.Sum(x => x.TotalWorkingTime.Ticks));
var viewModel = new CaseHistoryRollCallExcelForEmployeeViewModel
{
EmployeeId = first?.EmployeeId ?? 0,
DateGr = startDate,
PersonnelCode = first?.PersonnelCode,
EmployeeFullName = first?.EmployeeFullName,
PersianMonthName = month.ToFarsiMonthByIntNumber(),
PersianYear = year.ToString(),
TotalWorkingHoursFa = totalWorkingTime.ToFarsiHoursAndMinutes("-"),
TotalWorkingTimeSpan = $"{(int)totalWorkingTime.TotalHours}:{totalWorkingTime.Minutes:00}",
RollCalls = dates.Select((date, index) =>
{
var item = index < safeData.Count ? safeData[index] : null;
var records = item?.Records ?? new List<RollCallCaseHistoryDetailRecord>();
return new RollCallItemForEmployeeExcelViewModel
{
DateGr = date,
DateFa = date.ToFarsi(),
DayOfWeekFa = date.DayOfWeek.DayOfWeeKToPersian(),
PersonnelCode = item?.PersonnelCode,
EmployeeFullName = item?.EmployeeFullName,
IsAbsent = item?.Status == RollCallRecordStatus.Absent,
HasLeave = item?.Status == RollCallRecordStatus.Leaved,
IsHoliday = false,
TotalWorkingHours = (item?.TotalWorkingTime ?? TimeSpan.Zero).ToFarsiHoursAndMinutes("-"),
StartsItems = JoinRecords(records, r => r.StartTime),
EndsItems = JoinRecords(records, r => r.EndTime),
EnterTimeDifferences = JoinRecords(records, r => FormatSignedTimeSpan(r.EntryTimeDifference)),
ExitTimeDifferences = JoinRecords(records, r => FormatSignedTimeSpan(r.ExitTimeDifference))
};
}).ToList()
};
return CaseHistoryExcelForEmployee(viewModel);
}
public static byte[] CaseHistoryExcelForOneDay(List<RollCallCaseHistoryDetail> data, string titleId)
{
if (!Regex.IsMatch(titleId, @"^\d{4}/\d{2}/\d{2}$"))
throw new ArgumentException("Invalid titleId format.", nameof(titleId));
var dateGr = titleId.ToGeorgianDateTime();
var safeData = data ?? new List<RollCallCaseHistoryDetail>();
var viewModel = new CaseHistoryRollCallForOneDayViewModel
{
DateFa = titleId,
DateGr = dateGr,
DayOfWeekFa = dateGr.DayOfWeek.DayOfWeeKToPersian(),
RollCalls = safeData.Select(item =>
{
var records = item.Records ?? new List<RollCallCaseHistoryDetailRecord>();
return new RollCallItemForOneDayExcelViewModel
{
EmployeeFullName = item.EmployeeFullName,
PersonnelCode = item.PersonnelCode,
StartsItems = JoinRecords(records, r => r.StartTime),
EndsItems = JoinRecords(records, r => r.EndTime),
TotalWorkingHours = item.TotalWorkingTime.ToFarsiHoursAndMinutes("-")
};
}).ToList()
};
return CaseHistoryExcelForOneDay(viewModel);
}
private static string JoinRecords(IEnumerable<RollCallCaseHistoryDetailRecord> records, Func<RollCallCaseHistoryDetailRecord, string> selector)
{
var safeRecords = records ?? Enumerable.Empty<RollCallCaseHistoryDetailRecord>();
var values = safeRecords.Select(selector).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
return values.Count == 0 ? string.Empty : string.Join(Environment.NewLine, values);
}
private static string FormatSignedTimeSpan(TimeSpan value)
{
if (value == TimeSpan.Zero)
return "-";
var abs = value.Duration();
var sign = value.Ticks < 0 ? "-" : "+";
return $"{(int)abs.TotalHours}:{abs.Minutes:00}{sign}";
}
private string CalculateExitMinuteDifference(TimeSpan early, TimeSpan late)
{
if (early == TimeSpan.Zero && late == TimeSpan.Zero)

View File

@@ -7,6 +7,7 @@ public class InstitutionContractExtensionCompleteRequest
public Guid TemporaryId { get; set; }
public bool IsInstallment { get; set; }
public long LawId { get; set; }
public bool CancelSendVerificationSms { get; set; }
}
public class InstitutionContractCreationCompleteRequest

View File

@@ -1,4 +1,6 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
/// <summary>
/// لیست پیامکهای بدهکاران قرارداد ملی
@@ -113,10 +115,30 @@ public class BlockSmsListData
/// <summary>
/// لیست قراداد های آبی
/// جهت ارسال هشدار یا اقدام قضائی
///پیامک آنی یادآور
/// </summary>
public class BlueWarningSmsData
public class InstantReminderSendSms
{
/// <summary>
/// نام طرف حساب
/// </summary>
public string FullName { get; set; }
/// <summary>
/// مبلغ بدهی
/// </summary>
public string Amount { get; set; }
public List<InstantReminderSmsList> InstantReminderSmsList { get; set; }
}
public class InstantReminderSmsList
{
/// <summary>
/// شماره تماس طرف حساب
/// </summary>
public string PhoneNumber { get; set; }
}

View File

@@ -21,6 +21,6 @@ public class LoanGroupedViewModel
{
public List<LoanGroupedByDateViewModel> GroupedByDate { get; set; }
public List<LoanGroupedByEmployeeViewModel>GroupedByEmployee { get; set; }
public List<LoanViewModel> LoanListViewModel { get; set; }
public PagedResult<LoanViewModel> LoanListViewModel { get; set; }
}

View File

@@ -16,5 +16,6 @@ public class LoanSearchViewModel
public string EndDate { get; set; }
public int PageIndex { get; set; }
public int PageSize { get; set; } = 30;
public bool ShowAsGrouped { get; set; }
}

View File

@@ -4,6 +4,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.RollCall
{
@@ -125,7 +127,62 @@ namespace CompanyManagment.App.Contracts.RollCall
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,RollCallCaseHistorySearchModel searchModel);
Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel);
Task<RollCallCaseHistoryExcelDto> DownloadCaseHistoryExcel(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel);
}
public class RollCallCaseHistoryExcelDto
{
public byte[] Bytes { get; set; }
public string FileName { get; set; }
public string MimeType { get; set; }
}
public class RollCallCaseHistoryDetail
{
public string EmployeeFullName { get; set; }
public string PersonnelCode { get; set; }
public TimeSpan TotalWorkingTime { get; set; }
public List<RollCallCaseHistoryDetailRecord> Records { get; set; }
public RollCallRecordStatus Status { get; set; }
public long EmployeeId { get; set; }
}
public enum RollCallRecordStatus
{
Worked = 0,
Absent = 1,
Leaved = 2
}
public class RollCallCaseHistoryDetailRecord
{
public TimeSpan EntryTimeDifference { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public TimeSpan ExitTimeDifference { get; set; }
}
public class RollCallCaseHistorySearchModel:PaginationRequest
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public string OneDayDate { get; set; }
public long? EmployeeId { get; set; }
}
public class RollCallCaseHistoryTitleDto
{
public string Id { get; set; }
public string Title { get; set; }
}
public class ReCalculateRollCallValues
{
public long EmployeeId { get; set; }

View File

@@ -8,7 +8,6 @@ public class CreateSalaryAidViewModel
public long WorkshopId { get; set; }
public string Amount { get; set; }
public string SalaryDateTime { get; set; }
public string CalculationDateTime { get; set; }
public string NationalCode { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }

View File

@@ -8,7 +8,7 @@ public class SalaryAidGroupedByDateViewModel
public string YearFa { get; set; }
public int Month { get; set; }
public int Year { get; set; }
public List<SalaryAidGroupedByDateViewModelItems> SalaryAidViewModels { get; set; }
public List<SalaryAidGroupedByDateViewModelItems> Items { get; set; }
public string TotalAmount { get; set; }
}

View File

@@ -6,7 +6,7 @@ public class SalaryAidGroupedByEmployeeViewModel
{
public string EmployeeName { get; set; }
public long EmployeeId { get; set; }
public List<SalaryAidGroupedByEmployeeViewModelItems> SalaryAidViewModels { get; set; }
public List<SalaryAidGroupedByEmployeeViewModelItems> Items { get; set; }
public string TotalAmount { get; set; }
}

View File

@@ -3,15 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.SalaryAid;
public class SalaryAidSearchViewModel
public class SalaryAidSearchViewModel:PaginationRequest
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public long EmployeeId { get; set; }
public long WorkshopId { get; set; }
public int PageIndex { get; set; }
public bool ShowAsGrouped { get; set; }
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Security.Cryptography;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.SalaryAid;
@@ -7,7 +8,7 @@ public class SalaryAidsGroupedViewModel
{
public List<SalaryAidGroupedByEmployeeViewModel> GroupedByEmployee { get; set; }
public List<SalaryAidGroupedByDateViewModel> GroupedByDate { get; set; }
public List<SalaryAidViewModel> SalaryAidListViewModels { get; set; }
public PagedResult<SalaryAidViewModel> List { get; set; }
}

View File

@@ -60,3 +60,43 @@ public class SmsSettingViewModel
/// </summary>
public List<EditSmsSetting> EditSmsSettings { get; set; }
}
/// <summary>
/// لیست تنظیمات پیامک خودکار
/// </summary>
public class SmsSettingDto
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// نمایش ساعت و دقیقه
/// </summary>
public string TimeOfDayDisplay { get; set; }
}
public class CreateSmsSettingDto
{
/// <summary>
/// عدد روز از ماه
/// </summary>
public int DayOfMonth { get; set; }
/// <summary>
/// نمایش ساعت و دقیقه
/// </summary>
public string TimeOfDayDisplay { get; set; }
}

View File

@@ -9,6 +9,11 @@ public class SmsReportDto
/// </summary>
public string SentDate { get; set; }
/// <summary>
/// نوع پیامک
/// </summary>
public string TypeOfSms { get; set; }
}

View File

@@ -1,4 +1,5 @@
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using System;
using System.Collections.Generic;
@@ -24,8 +25,9 @@ public interface ISmsResultApplication
/// </summary>
/// <param name="searchModel"></param>
/// <param name="date"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
#endregion

View File

@@ -75,4 +75,45 @@ public interface ISmsSettingApplication
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
#region ForApi
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// Api
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditSmsSetting(SmsSettingDto command);
/// <summary>
/// دریافت لیست ارسال آنی
/// </summary>
/// <returns></returns>
Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting);
/// <summary>
/// ارسال پیامک آنی
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <param name="phoneNumbers"></param>
/// <returns></returns>
Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers);
#endregion
}

View File

@@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\0_Framework\0_Framework.csproj" />
<ProjectReference Include="..\Company.Domain\Company.Domain.csproj" />
<ProjectReference Include="..\CompanyManagement.Infrastructure.Excel\CompanyManagement.Infrastructure.Excel.csproj" />
<ProjectReference Include="..\CompanyManagment.App.Contracts\CompanyManagment.App.Contracts.csproj" />
<ProjectReference Include="..\CompanyManagment.EFCore\CompanyManagment.EFCore.csproj" />
</ItemGroup>

View File

@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Exceptions;
using Company.Domain.CheckoutAgg;
using Company.Domain.CustomizeCheckoutAgg;
using Company.Domain.CustomizeCheckoutTempAgg;
@@ -16,6 +18,8 @@ using Company.Domain.LeaveAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.RollCallAgg.DomainService;
using Company.Domain.RollCallEmployeeAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagement.Infrastructure.Excel.RollCall;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.RollCall;
@@ -34,8 +38,9 @@ public class RollCallApplication : IRollCallApplication
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository;
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
private readonly IWorkshopRepository _workshopRepository;
public RollCallApplication(IRollCallRepository rollCallRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository, IRollCallDomainService rollCallDomainService, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
public RollCallApplication(IRollCallRepository rollCallRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, ILeaveRepository leaveRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICheckoutRepository checkoutRepository, IRollCallDomainService rollCallDomainService, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IWorkshopRepository workshopRepository)
{
_rollCallRepository = rollCallRepository;
_rollCallEmployeeRepository = rollCallEmployeeRepository;
@@ -47,7 +52,8 @@ public class RollCallApplication : IRollCallApplication
_customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
}
_workshopRepository = workshopRepository;
}
public OperationResult Create(CreateRollCall command)
{
@@ -862,4 +868,58 @@ public class RollCallApplication : IRollCallApplication
}
}
public async Task<PagedResult<RollCallCaseHistoryTitleDto>> GetCaseHistoryTitles(long workshopId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallRepository.GetCaseHistoryTitles(workshopId,searchModel);
}
public async Task<List<RollCallCaseHistoryDetail>> GetCaseHistoryDetails(long workshopId,
string titleId, RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallRepository.GetCaseHistoryDetails(workshopId, titleId, searchModel);
}
public async Task<RollCallCaseHistoryExcelDto> DownloadCaseHistoryExcel(long workshopId, string titleId,
RollCallCaseHistorySearchModel searchModel)
{
var data = await _rollCallRepository
.GetCaseHistoryDetails(workshopId, titleId, searchModel);
string nameSecondPart = "";
byte[] excelBytes;
if (Regex.IsMatch(titleId, @"^\d{4}_\d{2}$"))
{
var splitDate = titleId.Split("_");
var year = Convert.ToInt32(splitDate.First());
var month = Convert.ToInt32(splitDate.Last());
var monthName = Convert.ToInt32(month).ToFarsiMonthByIntNumber();
nameSecondPart = $"{year}/{monthName}";
excelBytes = RollCallExcelGenerator.CaseHistoryExcelForEmployee(data, titleId);
}
else if (Regex.IsMatch(titleId, @"^\d{4}/\d{2}/\d{2}$"))
{
var oneDayDate = titleId.ToGeorgianDateTime();
nameSecondPart = $" {oneDayDate.DayOfWeek.DayOfWeeKToPersian()}،{titleId}";
excelBytes = RollCallExcelGenerator.CaseHistoryExcelForOneDay(data, titleId);
}
else
{
throw new BadRequestException("شناسه سر تیتر وارد شده نامعتبر است");
}
var workshopFullName = _workshopRepository.Get(workshopId)?.WorkshopFullName ?? "بدون کارگاه";
var fileName = $"{workshopFullName} - {nameSecondPart}.xlsx";
var res = new RollCallCaseHistoryExcelDto()
{
Bytes = excelBytes,
MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
FileName = fileName
};
return res;
}
}

View File

@@ -433,7 +433,7 @@ public class SalaryAidApplication : ISalaryAidApplication
var checkouts = _checkoutRepository.GetByWorkshopIdEmployeeIdInDate(
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
checkouts?.SetAmountConflict(true);
checkouts?.SetAmountConflict(true);
}
}

View File

@@ -1,20 +1,26 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.Sms;
using Company.Domain.SmsResultAgg;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using CompanyManagment.EFCore.Services;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
namespace CompanyManagment.Application;
public class SmsResultApplication : ISmsResultApplication
{
private readonly ISmsResultRepository _smsResultRepository;
private readonly ISmsService _smsService;
public SmsResultApplication(ISmsResultRepository smsResultRepository)
public SmsResultApplication(ISmsResultRepository smsResultRepository, ISmsService smsService)
{
_smsResultRepository = smsResultRepository;
_smsService = smsService;
}
@@ -25,9 +31,9 @@ public class SmsResultApplication : ISmsResultApplication
return await _smsResultRepository.GetSmsReportList(searchModel);
}
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
}
#endregion
@@ -67,4 +73,6 @@ public class SmsResultApplication : ISmsResultApplication
}).ToList();
return result;
}
}

View File

@@ -9,6 +9,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
namespace CompanyManagment.Application;
@@ -17,12 +19,15 @@ public class SmsSettingApplication : ISmsSettingApplication
private readonly ISmsSettingsRepository _smsSettingsRepository;
private readonly IInstitutionContractRepository _institutionContractRepository;
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
private readonly IHostEnvironment _hostEnvironment;
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository, IHostEnvironment hostEnvironment)
{
_smsSettingsRepository = smsSettingsRepository;
_institutionContractRepository = institutionContractRepository;
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
_hostEnvironment = hostEnvironment;
}
@@ -131,6 +136,12 @@ public class SmsSettingApplication : ISmsSettingApplication
public async Task<OperationResult> InstantSendReminderSms(List<SmsListData> command)
{
var op = new OperationResult();
if (_hostEnvironment.IsDevelopment())
{
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
}
string typeOfSms = "یادآور بدهی ماهانه";
string sendMessStart = "شروع یادآور آنی";
string sendMessEnd = "پایان یادآور آنی";
@@ -151,6 +162,13 @@ public class SmsSettingApplication : ISmsSettingApplication
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
{
var op = new OperationResult();
if (_hostEnvironment.IsDevelopment())
{
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
}
string typeOfSms = "اعلام مسدودی طرف حساب";
string sendMessStart = "شروع مسدودی آنی";
string sendMessEnd = "پایان مسدودی آنی ";
@@ -165,4 +183,166 @@ public class SmsSettingApplication : ISmsSettingApplication
return op.Failed("موردی انتخاب نشده است");
}
}
#region ForApi
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// Api
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
{
return await _smsSettingsRepository.GetSmsSettingList(typeOfSmsSetting);
}
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
{
return await _smsSettingsRepository.GetSmsSettingDataToEdit(id);
}
public async Task<OperationResult> EditSmsSetting(SmsSettingDto command)
{
var op = new OperationResult();
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
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 == editSmsSetting.TypeOfSmsSetting && x.id != command.Id))
return op.Failed("رکورد ایجاد شده تکراری است");
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
await _smsSettingsRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting)
{
var result = new List<InstantReminderSendSms>();
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
{
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
if (data.Any())
{
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
{
FullName = m.Key,
Amount = m.Select(c => c.Amount).First(),
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
{
PhoneNumber = c.PhoneNumber,
}).ToList()
}).ToList();
}
}
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
{
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
if (data.Any())
{
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
{
FullName = m.Key,
Amount = m.Select(c => c.Amount).First(),
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
{
PhoneNumber = c.PhoneNumber,
}).ToList()
}).ToList();
}
}
return result;
}
public async Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers)
{
var op = new OperationResult();
if (_hostEnvironment.IsDevelopment())
{
var str = "";
foreach (var item in phoneNumbers)
{
str += $" {item}, ";
}
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد " + " لیست ارسال شما " + str);
}
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
{
if (phoneNumbers.Any())
{
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
if (data.Any())
{
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
var res = await InstantSendReminderSms(sendItems);
return res;
}
return op.Succcedded();
}
return op.Failed("موردی انتخاب نشده است");
}
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
{
if (phoneNumbers.Any())
{
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
if (data.Any())
{
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
var res = await InstantSendBlockSms(sendItems);
return res;
}
return op.Succcedded();
}
return op.Failed("موردی انتخاب نشده است");
}
return op.Failed("خطای انتخاب نوع ارسال");
}
#endregion
}

View File

@@ -713,10 +713,15 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
var itemsQuery = _companyContext.EmployeeDocumentItems
.Where(x => x.DocumentStatus != DocumentStatus.Unsubmitted)
.Include(x => x.EmployeeDocuments)
.ThenInclude(x => x.Workshop).ThenInclude(x => x.WorkshopEmployers).ThenInclude(x => x.Employer)
.GroupBy(x => x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
.ThenInclude(x => x.Workshop)
.ThenInclude(x => x.WorkshopEmployers)
.ThenInclude(x => x.Employer)
.GroupBy(x => x.WorkshopId)
.Select(x => new WorkshopWithEmployeeDocumentsViewModel()
{
SubmittedItemsCount = x.Count(y => y.DocumentStatus == DocumentStatus.SubmittedByAdmin || y.DocumentStatus == DocumentStatus.SubmittedByClient),
SubmittedItemsCount = x
.Count(y => y.DocumentStatus == DocumentStatus.SubmittedByAdmin
|| y.DocumentStatus == DocumentStatus.SubmittedByClient),
WorkshopId = x.Key,
WorkshopFullName = x.First().EmployeeDocuments.Workshop.WorkshopName,
EmployerName = x.First().EmployeeDocuments.Workshop.WorkshopEmployers.First().Employer.FullName

View File

@@ -2269,7 +2269,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
extenstionTemp
);
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value)??[];
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value) ??
[];
var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList();
@@ -2317,7 +2318,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
WorkshopId = workshop?.id ?? 0,
RollCallInPerson = service.RollCallInPerson
};
}).ToList()??[];
}).ToList() ?? [];
var notIncludeWorskhopsLeftWork = await _context.LeftWorkList
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
x.LeftWorkDate >= DateTime.Now)
@@ -2959,8 +2960,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
if (!request.CancelSendVerificationSms)
{
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
}
await SaveChangesAsync();
@@ -3363,10 +3367,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierFullName,
VerifierPhoneNumber =
VerifierPhoneNumber =
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierPhoneNumber,
? null
: institution.VerifierPhoneNumber,
VerifyCode = institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifyCode,
@@ -4366,8 +4370,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
bool tempCreated = false;
if (creationTemp == null)
{
creationTemp = new InstitutionContractCreationTemp();
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
creationTemp = new InstitutionContractCreationTemp();
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
}
List<WorkshopTempViewModel> workshopDetails = [];
@@ -5109,9 +5113,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
if (!request.CancelSendVerificationSms)
{
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
}
await SaveChangesAsync();
await transaction.CommitAsync();

View File

@@ -2109,11 +2109,24 @@ public class InstitutionContractSmsServiceRepository : RepositoryBase<long, Inst
int successProcess = 1;
int countList = smsListData.Count;
#region Test
//for (int i = 0; i < 100; i++)
//{
// var percent = (successProcess / (double)countList) * 100;
// await _hubContext.Clients.Group(SendSmsHub.GetGroupName(7))
// .SendAsync("showStatus", (int)percent);
// Thread.Sleep(1000);
// successProcess += 1;
//}
#endregion
foreach (var item in smsListData)
{
try
{
if (item.TypeOfSmsMethod == "MonthlyBill")
{
var res = await _smsService.MonthlyBill(item.PhoneNumber, item.TemplateId, item.PartyName,

View File

@@ -171,22 +171,29 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate);
}
result.LoanListViewModel = query.OrderByDescending(x => x.StartInstallmentPayment).Skip(searchModel.PageIndex)
.Take(30).ToList()
.Select(x => new LoanViewModel()
{
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
Amount = x.Amount.ToMoney(),
AmountPerMonth = x.AmountPerMonth.ToMoney(),
StartDateTime = x.StartInstallmentPayment.ToFarsi(),
Count = x.Count,
Id = x.id,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
YearFa = pc.GetYear(x.StartInstallmentPayment).ToString(),
result.LoanListViewModel = new PagedResult<LoanViewModel>()
{
TotalCount = query.Count(),
List = query.OrderByDescending(x => x.StartInstallmentPayment)
.ApplyPagination(searchModel.PageIndex, searchModel.PageSize)
.Take(30).ToList()
.Select(x => new LoanViewModel()
{
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode
.ToString(),
Amount = x.Amount.ToMoney(),
AmountPerMonth = x.AmountPerMonth.ToMoney(),
StartDateTime = x.StartInstallmentPayment.ToFarsi(),
Count = x.Count,
Id = x.id,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
YearFa = pc.GetYear(x.StartInstallmentPayment).ToString(),
}).ToList()
};
}).ToList();
return result;
}

View File

@@ -82,25 +82,45 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId);
//اگر سرویس حضور غیاب نداشت
if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date))
return false;
//var rollCallEmployee = GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
//if (rollCallEmployee == null)
// return false;
var rollCallEmployee = _context.RollCallEmployees
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
.Include(x => x.EmployeesStatus);
if (!rollCallEmployee.Any())
var rollCallEmployee = _context.RollCallEmployees.Include(xs => xs.EmployeesStatus)
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
//اگر تنظیمات حضور غیاب نداشت
if (rollCallEmployee == null)
return false;
//اگر استاتوس نداشت
if (!rollCallEmployee.EmployeesStatus.Any())
return false;
var a = rollCallEmployee.Any(x => x.EmployeesStatus.Any(s =>
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date) ||
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date)));
//var result = _employeeRollCallStatusRepository.w(x => x.RollCallEmployeeId == rollCallEmployee.Id &&
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date >= contractEnd.Date) ||
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date > contractStart.Date));
return a;
var leftWork =
_context.LeftWorkList.FirstOrDefault(x =>
x.StartWorkDate <= contractEnd.Date && x.LeftWorkDate > contractStart);
if (leftWork == null)
return false;
var status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date));
//اگر استاتوس کامل پوشش داد
if (status != null)
return true;
status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date &&
s.EndDate.Date < contractEnd.Date));
//اگر قبل از پایان فیس استاتوس قطع شده ولی ترک کار داره
if (status != null && leftWork.HasLeft)
return true;
return false;
}
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
{

File diff suppressed because it is too large Load Diff

View File

@@ -146,7 +146,7 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
{
YearFa = x.Key.YearFa,
MonthFa = x.Key.MonthFa,
SalaryAidViewModels = x.Select(s => new SalaryAidGroupedByDateViewModelItems()
Items = x.Select(s => new SalaryAidGroupedByDateViewModelItems()
{
Amount = s.Amount,
EmployeeName = s.EmployeeFullName,
@@ -175,7 +175,7 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
EmployeeId = x.Key,
TotalAmount = x.Sum(s => s.Amount).ToMoney(),
EmployeeName = employees.FirstOrDefault(e => e.id == x.Key).FullName,
SalaryAidViewModels = x.Select(s => new SalaryAidGroupedByEmployeeViewModelItems()
Items = x.Select(s => new SalaryAidGroupedByEmployeeViewModelItems()
{
Amount = s.Amount.ToMoney(),
Id = s.id,
@@ -197,23 +197,28 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
query = query.Where(x => x.SalaryAidDateTime >= startDate && x.SalaryAidDateTime <= endDate);
}
result.SalaryAidListViewModels = query.OrderByDescending(x => x.SalaryAidDateTime).Skip(searchModel.PageIndex).Take(30).ToList().Select(
x => new SalaryAidViewModel()
{
Amount = x.Amount.ToMoney(),
CreationDate = x.CreationDate.ToFarsi(),
Id = x.id,
EmployeeId = x.EmployeeId,
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
SalaryAidDateTimeGe = x.SalaryAidDateTime,
WorkshopId = x.WorkshopId,
YearFa = x.SalaryAidDateTime.ToFarsi().Substring(0, 4),
MonthFa = x.SalaryAidDateTime.ToFarsi().Substring(5, 2),
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(),
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
AmountDouble = x.Amount,
}).ToList();
result.List = new PagedResult<SalaryAidViewModel>()
{
TotalCount = query.Count(),
List = query.OrderByDescending(x => x.SalaryAidDateTime).ApplyPagination(searchModel.PageIndex,searchModel.PageSize).ToList()
.Select(x => new SalaryAidViewModel()
{
Amount = x.Amount.ToMoney(),
CreationDate = x.CreationDate.ToFarsi(),
Id = x.id,
EmployeeId = x.EmployeeId,
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
SalaryAidDateTimeGe = x.SalaryAidDateTime,
WorkshopId = x.WorkshopId,
YearFa = x.SalaryAidDateTime.ToFarsi().Substring(0, 4),
MonthFa = x.SalaryAidDateTime.ToFarsi().Substring(5, 2),
PersonnelCode = personnelCodes.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode
.ToString(),
EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName,
AmountDouble = x.Amount,
}).ToList()
};
return result;
}

View File

@@ -77,6 +77,9 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
typeOfSms = "کد تاییدیه قرارداد مالی";
break;
case TypeOfSmsSetting.SendInstitutionContractConfirmationLink:
typeOfSms = "لینک تاییدیه ایجاد قرارداد مالی";
break;
case TypeOfSmsSetting.TaskReminder:
typeOfSms = "یادآور وظایف";
break;
@@ -147,7 +150,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
// مرحله 2: گروه‌بندی و انتخاب آخرین رکورد هر روز روی Client
var grouped = rawQuery
.GroupBy(x => x.DateOnly)
.GroupBy(x => (x.DateOnly, x.TypeOfSms))
.Select(g => g.OrderByDescending(x => x.CreationDate).First())
.OrderByDescending(x => x.CreationDate)
.ToList();
@@ -155,15 +158,16 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
// مرحله 3: تبدیل به DTO و ToFarsi
var result = grouped.Select(x => new SmsReportDto
{
SentDate = x.CreationDate.ToFarsi()
SentDate = x.CreationDate.ToFarsi(),
TypeOfSms = x.TypeOfSms
}).ToList();
return result;
}
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
if(string.IsNullOrWhiteSpace(date))
if(string.IsNullOrWhiteSpace(date) || string.IsNullOrWhiteSpace(typeOfSmsSetting))
return new List<SmsReportListDto>();
if (date.TryToGeorgianDateTime(out var searchDate) == false)
@@ -198,41 +202,12 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
query = query.Where(x => x.Mobile.Contains(searchModel.Mobile)).ToList();
}
if (searchModel.TypeOfSms != TypeOfSmsSetting.All && searchModel.TypeOfSms != TypeOfSmsSetting.Warning)
{
var typeOfSms = "All";
switch (searchModel.TypeOfSms)
{
case TypeOfSmsSetting.InstitutionContractDebtReminder:
typeOfSms = "یادآور بدهی ماهانه";
break;
case TypeOfSmsSetting.MonthlyInstitutionContract:
typeOfSms = "صورت حساب ماهانه";
break;
case TypeOfSmsSetting.BlockContractingParty:
typeOfSms = "اعلام مسدودی طرف حساب";
break;
case TypeOfSmsSetting.LegalAction:
typeOfSms = "اقدام قضایی";
break;
case TypeOfSmsSetting.InstitutionContractConfirm:
typeOfSms = "یادآور تایید قرارداد مالی";
break;
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
typeOfSms = "کد تاییدیه قرارداد مالی";
break;
case TypeOfSmsSetting.TaskReminder:
typeOfSms = "یادآور وظایف";
break;
}
query = query.Where(x => x.TypeOfSms == typeOfSms).ToList();
}
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
if (typeOfSmsSetting.Contains("هشدار"))
{
query = query.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
}
query = query.Where(x => x.TypeOfSms == typeOfSmsSetting).ToList();
if (searchModel.SendStatus != SendStatus.All)
{

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application.Enums;
using _0_Framework.InfraStructure;
@@ -68,4 +69,48 @@ public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSetti
_context.SmsSettings.Remove(removeItem);
await _context.SaveChangesAsync();
}
#region ForApi
/// <summary>
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
/// Api
/// </summary>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
{
var data = await _context.SmsSettings
.Where(x => x.TypeOfSmsSetting == typeOfSmsSetting)
.OrderBy(x => x.DayOfMonth).ThenBy(x => x.TimeOfDay)
.Select(x =>
new SmsSettingDto()
{
Id = x.id,
DayOfMonth = x.DayOfMonth,
TimeOfDayDisplay = x.TimeOfDay.ToString(@"hh\:mm")
}).ToListAsync();
return data;
}
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
{
var edit = new SmsSettingDto();
var getItem = await _context.SmsSettings.FirstOrDefaultAsync(x => x.id == id);
if (getItem != null)
{
edit.Id = getItem.id;
edit.TimeOfDayDisplay = getItem.TimeOfDay.ToString(@"hh\:mm");
edit.DayOfMonth = getItem.DayOfMonth;
}
return edit;
}
#endregion
}

View File

@@ -2859,7 +2859,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
var contactCanToleaveList = new List<ContractsCanToLeave>();
var allContractsBetween = _context.Contracts.AsSplitQuery().Include(x => x.WorkingHoursList)
.Where(x => x.WorkshopIds == workshopId && x.EmployeeId == employeeId &&
x.ContractEnd >= startDate && x.ContarctStart <= endDate).ToList();
x.ContractEnd >= startDate && x.ContarctStart <= endDate).OrderBy(x=>x.ContarctStart).ToList();
var isWorkshopStaticCheckout = _context.Workshops.FirstOrDefault(x => x.id == workshopId)!.IsStaticCheckout;
int mandatoryDays = 0;
double allCanToLeave = 0;

View File

@@ -205,6 +205,26 @@ public class SmsService : ISmsService
};
return appendData;
}
public async Task<SmsDetailsDto> GetSmsDetailsByMessageId(int messId, string fullName)
{
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var response = await smsIr.GetReportAsync(messId);
MessageReportResult messages = response.Data;
var appendData = new SmsDetailsDto()
{
Mobile = messages.Mobile,
MessageText = messages.MessageText,
SendUnixTime = UnixTimeStampToDateTime(messages.SendDateTime),
DeliveryState = DeliveryStatus(messages.DeliveryState),
DeliveryUnixTime = UnixTimeStampToDateTime(messages.DeliveryDateTime),
DeliveryColor = DeliveryColorStatus(messages.DeliveryState),
FullName = fullName
};
return appendData;
}
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
{

View File

@@ -12,6 +12,7 @@ public record SetTimeProjectCommand(
public class SetTimeSectionTime
{
public Guid? Id { get; set; }
public string Description { get; set; }
public int Hours { get; set; }
public int Minutes { get; set; }

View File

@@ -349,6 +349,15 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
return OperationResult.Success();
}
private void ValidateTotalTimeNotLessThanSpent(TimeSpan newTotalTime, TimeSpan currentTotalSpent)
{
if (newTotalTime < currentTotalSpent)
{
throw new BadRequestException(
$"تایم کل سکشن نمی‌تواند کمتر از زمان مصرف شده ({currentTotalSpent.TotalHours:F2} ساعت) باشد");
}
}
private void SetSectionTime(TaskSection section, SetTimeProjectSkillItem sectionItem, long? addedByUserId)
{
var initData = sectionItem.InitData;
@@ -363,18 +372,62 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
// تنظیم زمان اولیه
section.UpdateInitialEstimatedHours(initialTime, initData.Description);
section.ClearAdditionalTimes();
// افزودن زمان‌های اضافی
bool hasAdditionalTime = false;
foreach (var additionalTime in sectionItem.AdditionalTime)
// مدیریت هوشمند زمان‌های اضافی
var existingAdditionalTimes = section.AdditionalTimes.ToList();
var incomingAdditionalTimes = sectionItem.AdditionalTime ?? [];
bool hasRealChange = false;
// حذف آیتم‌هایی که دیگر در لیست نیستند
foreach (var existingTime in existingAdditionalTimes)
{
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes));
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Description, addedByUserId);
hasAdditionalTime = true;
var stillExists = incomingAdditionalTimes.Any(x => x.Id == existingTime.Id);
if (!stillExists)
{
section.RemoveAdditionalTime(existingTime.Id);
hasRealChange = true;
}
}
// ویرایش یا اضافه کردن آیتم‌های جدید
foreach (var additionalTime in incomingAdditionalTimes)
{
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours)
.Add(TimeSpan.FromMinutes(additionalTime.Minutes));
if (additionalTimeSpan <= TimeSpan.Zero)
continue;
var existingAdditionalTime = existingAdditionalTimes.FirstOrDefault(x => x.Id == additionalTime.Id);
if (existingAdditionalTime != null)
{
// اگر آیتم با این ID وجود دارد، بررسی کن اگر تغییر کرده باشد
if (existingAdditionalTime.HasChanged(additionalTimeSpan, additionalTime.Description))
{
// ویرایش بدون حذف و ایجاد دوباره
existingAdditionalTime.Update(additionalTimeSpan, additionalTime.Description);
hasRealChange = true;
}
}
else
{
// اگر ID نداشت یا ID جدید بود، اضافه کن
if (additionalTime.Id == null || additionalTime.Id == Guid.Empty)
{
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Description, addedByUserId);
hasRealChange = true;
}
}
}
// تغییر status به Incomplete فقط اگر زمان اضافی اضافه شده باشد و در وضعیتی غیر از ReadyToStart باشد
if (hasAdditionalTime && section.Status != TaskSectionStatus.ReadyToStart)
// اعتبارسنجی بعد از اعمال تمام تغییرات
var currentTotalSpent = section.GetTotalTimeSpent();
var newTotalTime = section.FinalEstimatedHours;
ValidateTotalTimeNotLessThanSpent(newTotalTime, currentTotalSpent);
// تغییر status به Incomplete فقط اگر تغییری واقعی اعمال شده باشد و در وضعیتی غیر از ReadyToStart باشد
if (hasRealChange && section.Status != TaskSectionStatus.ReadyToStart)
{
// اگر سکشن درحال انجام است، باید متوقف شود قبل از تغییر status
if (section.Status == TaskSectionStatus.InProgress)

View File

@@ -228,28 +228,30 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
// For projects: gather all phases, then tasks, then sections
var phases = await _context.ProjectPhases
.Where(ph => projectIds.Contains(ph.ProjectId))
.Select(ph => ph.Id)
.Select(ph => new { ph.Id, ph.ProjectId })
.ToListAsync(cancellationToken);
var phaseIds = phases.Select(ph => ph.Id).ToList();
var tasks = await _context.ProjectTasks
.Where(t => phases.Contains(t.PhaseId))
.Select(t => t.Id)
.Where(t => phaseIds.Contains(t.PhaseId))
.Select(t => new { t.Id, t.PhaseId })
.ToListAsync(cancellationToken);
var taskIds = tasks.Select(t => t.Id).ToList();
var sections = await _context.TaskSections
.Include(s => s.Skill)
.Where(s => tasks.Contains(s.TaskId))
.Where(s => taskIds.Contains(s.TaskId))
.ToListAsync(cancellationToken);
// Convert to tuple list for AggregatePhaseStatuses
var tasksList = tasks.Select(t => (t.Id, t.PhaseId)).ToList();
foreach (var item in items)
{
var relatedPhases = phases; // used for filtering tasks by project
var relatedTasks = await _context.ProjectTasks
.Where(t => t.PhaseId != Guid.Empty && relatedPhases.Contains(t.PhaseId))
.Select(t => t.Id)
.ToListAsync(cancellationToken);
var itemSections = sections.Where(s => relatedTasks.Contains(s.TaskId));
item.Backend = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Backend"));
item.Front = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Frontend"));
item.Design = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "UI/UX Design"));
var projectPhaseIds = phases.Where(ph => ph.ProjectId == item.Id).Select(ph => ph.Id).ToList();
// برای هر Skill، وضعیت‌های تمام Phases را تجمیع کنیم
item.Backend = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "Backend");
item.Front = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "Frontend");
item.Design = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "UI/UX Design");
}
}
@@ -259,24 +261,22 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
// For phases: gather tasks, then sections
var tasks = await _context.ProjectTasks
.Where(t => phaseIds.Contains(t.PhaseId))
.Select(t => t.Id)
.Select(t => new { t.Id, t.PhaseId })
.ToListAsync(cancellationToken);
var taskIds = tasks.Select(t => t.Id).ToList();
var sections = await _context.TaskSections
.Include(s => s.Skill)
.Where(s => tasks.Contains(s.TaskId))
.Where(s => taskIds.Contains(s.TaskId))
.ToListAsync(cancellationToken);
foreach (var item in items)
{
// Filter tasks for this phase
var phaseTaskIds = await _context.ProjectTasks
.Where(t => t.PhaseId == item.Id)
.Select(t => t.Id)
.ToListAsync(cancellationToken);
var phaseTaskIds = tasks.Where(t => t.PhaseId == item.Id).Select(t => t.Id).ToList();
var itemSections = sections.Where(s => phaseTaskIds.Contains(s.TaskId));
item.Backend = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Backend"));
item.Front = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Frontend"));
item.Design = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "UI/UX Design"));
item.Backend = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "Backend"));
item.Front = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "Frontend"));
item.Design = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "UI/UX Design"));
}
}
@@ -380,4 +380,57 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
// تعیین تکلیف نشده: نه user دارد نه time
return AssignmentStatus.Unassigned;
}
}
private static AssignmentStatus AggregatePhaseStatuses(
List<Guid> phaseIds,
List<(Guid Id, Guid PhaseId)> tasks,
List<TaskSection> sections,
string skillName)
{
var phaseStatuses = new List<AssignmentStatus>();
foreach (var phaseId in phaseIds)
{
var phaseTaskIds = tasks.Where(t => t.PhaseId == phaseId).Select(t => t.Id).ToList();
var phaseSections = sections.Where(s => phaseTaskIds.Contains(s.TaskId) && s.Skill?.Name == skillName);
var phaseStatus = AggregateAssignmentStatus(phaseSections);
phaseStatuses.Add(phaseStatus);
}
// الآن تجمیع وضعیت‌های Phases
if (!phaseStatuses.Any())
return AssignmentStatus.Unassigned;
// اگر هر یکی Unassigned باشد → Unassigned
if (phaseStatuses.Any(s => s == AssignmentStatus.Unassigned))
return AssignmentStatus.Unassigned;
// اگر Unassigned نیست و هر یکی UserOnly باشد → UserOnly
if (phaseStatuses.Any(s => s == AssignmentStatus.UserOnly))
return AssignmentStatus.UserOnly;
// فقط اگر همه Assigned باشند → Assigned
return AssignmentStatus.Assigned;
}
private static AssignmentStatus AggregateAssignmentStatus(IEnumerable<TaskSection> sections)
{
var sectionList = sections.ToList();
if (!sectionList.Any())
return AssignmentStatus.Unassigned;
var statuses = sectionList.Select(GetAssignmentStatus).ToList();
// اگر هر یکی Unassigned باشد → Unassigned (بدترین وضعیت)
if (statuses.Any(s => s == AssignmentStatus.Unassigned))
return AssignmentStatus.Unassigned;
// اگر Unassigned نیست و هر یکی UserOnly باشد → UserOnly (وضعیت متوسط)
if (statuses.Any(s => s == AssignmentStatus.UserOnly))
return AssignmentStatus.UserOnly;
// فقط اگر همه Assigned باشند → Assigned (بهترین وضعیت)
return AssignmentStatus.Assigned;
}
}

View File

@@ -26,6 +26,7 @@ public record ProjectSetTimeResponseSkill
public class ProjectSetTimeResponseSectionAdditionalTime
{
public Guid Id { get; set; }
public int Hours { get; init; }
public int Minutes { get; init; }
public string Description { get; init; }

View File

@@ -70,6 +70,7 @@ public class ProjectSetTimeDetailsQueryHandler
AdditionalTimes = section?.AdditionalTimes
.Select(x => new ProjectSetTimeResponseSectionAdditionalTime
{
Id = x.Id,
Description = x.Reason ?? "",
Hours = (int)x.Hours.TotalHours,
Minutes = x.Hours.Minutes,

View File

@@ -26,4 +26,15 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
{
Reason = reason;
}
public void Update(TimeSpan hours, string? reason = null)
{
Hours = hours;
Reason = reason;
}
public bool HasChanged(TimeSpan newHours, string? newReason)
{
return Hours != newHours || Reason != newReason;
}
}

View File

@@ -95,7 +95,7 @@ public class FileUploadService : IFileUploadService
await _fileRepository.SaveChangesAsync();
// آپلود فایل به استوریج
var categoryFolder = GetCategoryFolderName(category);
var categoryFolder = category.ToString();
var uploadResult = await _fileStorageService.UploadAsync(
fileStream,
uploadedFile.UniqueFileName,
@@ -227,21 +227,5 @@ public class FileUploadService : IFileUploadService
return FileType.Document;
}
/// <summary>
/// دریافت نام پوشه بر اساس دسته‌بندی
/// </summary>
private string GetCategoryFolderName(FileCategory category)
{
return category switch
{
FileCategory.TaskChatMessage => "TaskChatMessage",
FileCategory.TaskAttachment => "TaskAttachment",
FileCategory.ProjectDocument => "ProjectDocument",
FileCategory.UserProfilePhoto => "UserProfilePhoto",
FileCategory.Report => "Report",
_ => "Other"
};
}
}

View File

@@ -1,4 +1,7 @@
using _0_Framework.Application.Sms;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.Sms;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.SmsResult;
using CompanyManagment.App.Contracts.SmsResult.Dto;
using Microsoft.AspNetCore.Mvc;
@@ -9,12 +12,14 @@ namespace ServiceHost.Areas.Admin.Controllers;
public class SmsReportController : AdminBaseController
{
private readonly ISmsResultApplication _smsResultApplication;
private readonly ISmsSettingApplication _smsSettingApplication;
private readonly ISmsService _smsService;
public SmsReportController(ISmsResultApplication smsResultApplication, ISmsService smsService)
public SmsReportController(ISmsResultApplication smsResultApplication, ISmsService smsService, ISmsSettingApplication smsSettingApplication)
{
_smsResultApplication = smsResultApplication;
_smsService = smsService;
_smsSettingApplication = smsSettingApplication;
}
/// <summary>
@@ -35,11 +40,25 @@ public class SmsReportController : AdminBaseController
/// </summary>
/// <param name="searchModel"></param>
/// <param name="date"></param>
/// <param name="typeOfSmsSetting"></param>
/// <returns></returns>
[HttpGet("GetExpandedList")]
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
{
var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date);
var result =await _smsResultApplication.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
return result;
}
/// <summary>
/// دریافت جزئیات پیامک
/// </summary>
/// <param name="messId"></param>
/// <param name="fullName"></param>
/// <returns></returns>
[HttpGet("GetSmsDetails")]
public async Task<SmsDetailsDto> GetSmsDetails(int messId, string fullName)
{
var result =await _smsService.GetSmsDetailsByMessageId(messId, fullName);
return result;
}
@@ -56,4 +75,207 @@ public class SmsReportController : AdminBaseController
return result;
}
//تنظیمات پیامک خودکار
#region SmsSettings
/// <summary>
/// لیست تنظیمات پیامک - یادآور
/// </summary>
/// <returns></returns>
[HttpGet("ReminderSmsSettingList")]
public async Task<List<SmsSettingDto>> ReminderSmsSettingList()
{
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.InstitutionContractDebtReminder);
return result;
}
/// <summary>
/// لیست تنظیمات پیامک - مسدودی
/// </summary>
/// <returns></returns>
[HttpGet("BlockSmsSettingList")]
public async Task<List<SmsSettingDto>> BlockSmsSettingList()
{
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.BlockContractingParty);
return result;
}
/// <summary>
/// لیست تنظیمات پیامک - هشدار قضایی
/// </summary>
/// <returns></returns>
[HttpGet("WarningSmsSettingList")]
public async Task<List<SmsSettingDto>> WarningSmsSettingList()
{
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.Warning);
return result;
}
/// <summary>
/// لیست تنظیمات پیامک - اقدام قضایی
/// </summary>
/// <returns></returns>
[HttpGet("LegalActionSmsSettingList")]
public async Task<List<SmsSettingDto>> LegalActionSmsSettingList()
{
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.LegalAction);
return result;
}
/// <summary>
/// لیست تنظیمات پیامک - تایید قراداد مالی
/// </summary>
/// <returns></returns>
[HttpGet("ContractConfirmSmsSettingList")]
public async Task<List<SmsSettingDto>> ContractConfirmSmsSettingList()
{
var result = await _smsSettingApplication.GetSmsSettingList(TypeOfSmsSetting.InstitutionContractConfirm);
return result;
}
//=====================Create=========================
/// <summary>
/// ایجاد پیامک یادآور
/// </summary>
/// <returns></returns>
[HttpPost("CreateReminderSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateReminderSmsSetting([FromBody] CreateSmsSettingDto command)
{
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.InstitutionContractDebtReminder);
return result;
}
/// <summary>
/// ایجاد پیامک مسدودی
/// </summary>
/// <returns></returns>
[HttpPost("CreateBlockSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateBlockSmsSetting([FromBody] CreateSmsSettingDto command)
{
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.BlockContractingParty);
return result;
}
/// <summary>
/// ایجاد پیامک هشدار قضایی
/// </summary>
/// <returns></returns>
[HttpPost("CreateWarningSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateWarningSmsSetting([FromBody] CreateSmsSettingDto command)
{
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.Warning);
return result;
}
/// <summary>
/// ایجاد پیامک اقدام قضایی
/// </summary>
/// <returns></returns>
[HttpPost("CreateLegalActionSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateLegalActionSmsSetting([FromBody] CreateSmsSettingDto command)
{
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.LegalAction);
return result;
}
/// <summary>
/// ایجاد پیامک تایید قرارداد مالی
/// </summary>
/// <returns></returns>
[HttpPost("CreateContractConfirmSmsSetting")]
public async Task<ActionResult<OperationResult>> CreateContractConfirmSmsSetting([FromBody] CreateSmsSettingDto command)
{
var result = await _smsSettingApplication.CreateSmsSetting(command.DayOfMonth, command.TimeOfDayDisplay, TypeOfSmsSetting.InstitutionContractConfirm);
return result;
}
//=====================Edit=========================
/// <summary>
/// دریافت اطلاعات ویرایش تنظیمات پیامک
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("GetEditData")]
public async Task<SmsSettingDto> GetEditData(long id)
{
return await _smsSettingApplication.GetSmsSettingDataToEdit(id);
}
/// <summary>
/// ویرایش تنظیمات پیامک
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPut("EditSmsSetting")]
public async Task<ActionResult<OperationResult>> EditSmsSetting([FromBody] SmsSettingDto command)
{
var result =await _smsSettingApplication.EditSmsSetting(command);
return result;
}
//=====================Remove=========================
/// <summary>
/// حذف تنظیمات پیامک
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpDelete]
public async Task<ActionResult<OperationResult>> RemoveSmsSetting(long id)
{
await _smsSettingApplication.RemoveSetting(id);
return Ok(new OperationResult().Succcedded());
}
/// <summary>
/// دریافت لیست ارسال آنی یادآور
/// </summary>
/// <returns></returns>
[HttpGet("GetInstantReminderSmsListData")]
public async Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData()
{
var result =await _smsSettingApplication.GetInstantReminderSmsListData(TypeOfSmsSetting.InstitutionContractDebtReminder);
return result;
}
/// <summary>
/// دریافت لیست ارسال آنی مسدودی
/// </summary>
/// <returns></returns>
[HttpGet("GetInstantBlockSmsListData")]
public async Task<List<InstantReminderSendSms>> GetInstantBlockSmsListData()
{
var result = await _smsSettingApplication.GetInstantReminderSmsListData(TypeOfSmsSetting.BlockContractingParty);
return result;
}
/// <summary>
/// ارسال پیامک آنی یادآور
/// </summary>
/// <param name="phoneNumbers"></param>
/// <returns></returns>
[HttpPost("InstantReminderSmsSend")]
public async Task<ActionResult<OperationResult>> InstantReminderSmsSend([FromBody] List<string> phoneNumbers)
{
var result = await _smsSettingApplication.InstantSmsSendApi(TypeOfSmsSetting.InstitutionContractDebtReminder, phoneNumbers);
return result;
}
/// <summary>
/// ارسال پیامک آنی مسدودی
/// </summary>
/// <param name="phoneNumbers"></param>
/// <returns></returns>
[HttpPost("InstantBlockSmsSend")]
public async Task<ActionResult<OperationResult>> InstantBlockSmsSend([FromBody] List<string> phoneNumbers)
{
var result = await _smsSettingApplication.InstantSmsSendApi(TypeOfSmsSetting.BlockContractingParty, phoneNumbers);
return result;
}
#endregion
}

View File

@@ -796,12 +796,17 @@ public class IndexModel : PageModel
var firstContract = _contractApplication.GetDetails(ContractsId[0]);
var workshop = _workshopApplication.GetDetails(firstContract.WorkshopIds);
//int i = 0;
foreach (var item in ContractsId)
{
var contract = _contractApplication.GetDetails(item);
//=============== استثنا علی خادم دهقان - میز اداری پویا========
if (workshop.Id == 482 && contract.EmployeeId == 7175)
workshop.IsOldContract = false;
//==============================================================
//var workingHours = _workingHoursApplication.GetByContractId(contract.Id);
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(contract.Id);
var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth,

View File

@@ -190,7 +190,7 @@
بانک ها </a>
</li>
<li permission="314">
<a class="clik3" asp-page="/Company/SmsResult/Index">
<a class="clik3" href="https://admin@(AppSetting.Value.Domain)/automatic-sms-reporting">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
</svg>

View File

@@ -253,7 +253,7 @@
بانک ها </a>
</li>
<li permission="314">
<a class="clik3" asp-area="Admin" asp-page="/Company/SmsResult/Index">
<a class="clik3" href="https://admin@(AppSetting.Value.Domain)/automatic-sms-reporting">
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
<circle cx="6.5" cy="6.5" r="6.5" fill="white" />
</svg>

View File

@@ -0,0 +1,59 @@
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.Loan;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers;
public class LoanController: ClientBaseController
{
private readonly ILoanApplication _loanApplication;
private readonly long _workshopId;
public LoanController(ILoanApplication loanApplication, IAuthHelper authHelper)
{
_loanApplication = loanApplication;
_workshopId= authHelper.GetWorkshopId();
}
[HttpGet]
public ActionResult<LoanGroupedViewModel> GetList(LoanSearchViewModel searchModel)
{
searchModel.WorkshopId = _workshopId;
var loans = _loanApplication.GetSearchListAsGrouped(searchModel);
return loans;
}
[HttpGet("{id}")]
public async Task<ActionResult<LoanDetailsViewModel>> GetDetails(long id)
{
var loan = await _loanApplication.GetDetails(id);
return loan;
}
[HttpPost]
public ActionResult<OperationResult> Create([FromBody] CreateLoanViewModel command)
{
var result = _loanApplication.Create(command);
return result;
}
[HttpGet("create/installments")]
public ActionResult<List<LoanInstallmentViewModel>> CalculateLoanInstallment(string amount,
int installmentCount, string loanStartDate, bool getRounded)
{
var installments =
_loanApplication.CalculateLoanInstallment(amount, installmentCount, loanStartDate, getRounded);
return installments;
}
[HttpDelete("{id}")]
public ActionResult<OperationResult> Remove(long id)
{
var result = _loanApplication.Remove(id);
return result;
}
}

View File

@@ -0,0 +1,200 @@
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.RollCall;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers.RollCall;
public class RollCallCaseHistoryController : ClientBaseController
{
private readonly IRollCallApplication _rollCallApplication;
private readonly long _workshopId;
private readonly IWorkshopApplication _workshopApplication;
private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication;
public RollCallCaseHistoryController(IRollCallApplication rollCallApplication,
IAuthHelper authHelper, IWorkshopApplication workshopApplication,
IRollCallEmployeeApplication rollCallEmployeeApplication)
{
_rollCallApplication = rollCallApplication;
_workshopApplication = workshopApplication;
_rollCallEmployeeApplication = rollCallEmployeeApplication;
_workshopId = authHelper.GetWorkshopId();
}
[HttpGet]
public async Task<ActionResult<PagedResult<RollCallCaseHistoryTitleDto>>> GetTitles(
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryTitles(_workshopId, searchModel);
}
[HttpGet("details")]
public async Task<ActionResult<List<RollCallCaseHistoryDetail>>> GetDetails(string titleId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
}
/// <summary>
/// ایجاد و ویرایش
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost]
public ActionResult<OperationResult> Upsert(CreateOrEditEmployeeRollCall command)
{
command.WorkshopId = _workshopId;
return _rollCallApplication.ManualEdit(command);
}
[HttpGet("print")]
public async Task<ActionResult<List<RollCallCaseHistoryDetail>>> GetPrintDetails(string titleId,
RollCallCaseHistorySearchModel searchModel)
{
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
}
[HttpGet("total-working")]
public ActionResult<OperationResult<string>> OnGetTotalWorking(
string startDate,
string startTime,
string endDate,
string endTime)
{
var op = new OperationResult<string>();
const string emptyValue = "-";
if (!TryParseDateTime(startDate, startTime, out var start) ||
!TryParseDateTime(endDate, endTime, out var end))
{
return op.Succcedded(emptyValue);
}
if (start >= end)
{
return op.Succcedded(emptyValue);
}
var duration = (end - start).ToFarsiHoursAndMinutes(emptyValue);
return op.Succcedded(duration);
}
[HttpGet("excel")]
public async Task<IActionResult> GetDownload(string titleId, RollCallCaseHistorySearchModel searchModel)
{
var res =await _rollCallApplication.DownloadCaseHistoryExcel(_workshopId, titleId, searchModel);
return File(res.Bytes,
res.MimeType,
res.FileName);
}
[HttpGet("edit")]
public ActionResult<EditRollCallDetailsResult> GetEditDetails(string date, long employeeId)
{
var result = _rollCallApplication.GetWorkshopEmployeeRollCallsForDate(_workshopId, employeeId, date);
//var dates = _rollCallApplication.GetEditableDatesForManualEdit(date.ToGeorgianDateTime());
var name = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, _workshopId);
var total = new TimeSpan(result.Sum(x =>
(x.EndDate!.Value.Ticks - x.StartDate!.Value.Ticks)));
var res = new EditRollCallDetailsResult()
{
EmployeeFullName = name.EmployeeFullName,
EmployeeId = employeeId,
DateFa = date,
//EditableDates = dates,
Records = result.Select(x=>new EmployeeRollCallRecord()
{
Date = x.DateGr,
EndDate = x.EndDateFa,
EndTime = x.EndTimeString,
RollCallId = x.Id,
StartDate = x.StartDateFa,
StartTime = x.StartTimeString
}).ToList(),
TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
};
return res;
}
[HttpPost("edit")]
public ActionResult<OperationResult> Edit(CreateOrEditEmployeeRollCall command)
{
command.WorkshopId = _workshopId;
var result = _rollCallApplication.ManualEdit(command);
return result;
}
[HttpDelete("delete")]
public IActionResult OnPostRemoveEmployeeRollCallsInDate(RemoveEmployeeRollCallRequest request)
{
var result = _rollCallApplication.RemoveEmployeeRollCallsInDate(_workshopId, request.EmployeeId, request.Date);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message,
});
}
// [HttpGet("edit")]
// public ActionResult<> GetEditDetails(string date,long employeeId)
// {
// var result = _rollCallApplication.GetWorkshopEmployeeRollCallsForDate(_workshopId, employeeId, date);
// //var dates = _rollCallApplication.GetEditableDatesForManualEdit(date.ToGeorgianDateTime());
// var name = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, _workshopId);
//
// var total = new TimeSpan(result.Sum(x =>
// (x.EndDate!.Value.Ticks - x.StartDate!.Value.Ticks)));
//
// var command = new EmployeeRollCallsViewModel()
// {
// EmployeeFullName = name.EmployeeFullName,
// EmployeeId = employeeId,
// DateFa = date,
// //EditableDates = dates,
// RollCalls = result,
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
// };
// }
private static bool TryParseDateTime(string date, string time, out DateTime result)
{
result = default;
try
{
var dateTime = date.ToGeorgianDateTime();
var timeOnly = TimeOnly.Parse(time);
result = dateTime.AddTicks(timeOnly.Ticks);
return true;
}
catch
{
return false;
}
}
}
public class EditRollCallDetailsResult
{
public string EmployeeFullName { get; set; }
public long EmployeeId { get; set; }
public string DateFa { get; set; }
public string TotalRollCallsDuration { get; set; }
public List<EmployeeRollCallRecord> Records { get; set; }
}
public class RemoveEmployeeRollCallRequest
{
public long EmployeeId { get; set; }
public string Date { get; set; }
}

View File

@@ -0,0 +1,138 @@
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.SalaryAid;
using CompanyManagment.App.Contracts.SalaryAid;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Build.Evaluation;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers;
public class SalaryAidController:ClientBaseController
{
private readonly ISalaryAidApplication _salaryAidApplication;
private readonly long _workshopId;
private readonly SalaryAidImportExcel _salaryAidImportExcel;
public SalaryAidController(ISalaryAidApplication salaryAidApplication,IAuthHelper authHelper, SalaryAidImportExcel salaryAidImportExcel)
{
_salaryAidApplication = salaryAidApplication;
_salaryAidImportExcel = salaryAidImportExcel;
_workshopId = authHelper.GetWorkshopId();
}
[HttpGet]
public ActionResult<SalaryAidsGroupedViewModel> GetList([FromQuery]SalaryAidSearchViewModel searchModel)
{
searchModel.WorkshopId = _workshopId;
var result = _salaryAidApplication.GetSearchListAsGrouped(searchModel);
return Ok(result);
}
[HttpPost]
public ActionResult<OperationResult> Create([FromBody]CreateSalaryAidRequest request)
{
var command = new CreateSalaryAidViewModel()
{
Amount = request.Amount.ToMoney(),
CalculationMonth = request.CalculationMonth,
CalculationYear = request.CalculationYear,
EmployeeIds = request.EmployeeIds,
WorkshopId = _workshopId,
SalaryDateTime = request.SalaryDateTime,
};
var result = _salaryAidApplication.Create(command);
return result;
}
[HttpPut]
public ActionResult<OperationResult> Edit([FromBody]EditSalaryAidRequest request)
{
var command = new EditSalaryAidViewModel()
{
Id = request.Id,
Amount = request.Amount.ToMoney(),
CalculationMonth = request.CalculationMonth,
CalculationYear = request.CalculationYear,
SalaryDateTime = request.SalaryDateTime,
WorkshopId = _workshopId,
};
var result = _salaryAidApplication.Edit(command);
return result;
}
[HttpGet("{id}")]
public ActionResult<EditSalaryAidRequest> EditDetails(long id)
{
var data = _salaryAidApplication.GetDetails(id);
var res = new EditSalaryAidRequest()
{
Id = data.Id,
Amount = data.Amount.MoneyToDouble(),
CalculationMonth = data.CalculationMonth,
CalculationYear = data.CalculationYear,
SalaryDateTime = data.SalaryDateTime,
};
return res;
}
[HttpDelete("{id:long}")]
public ActionResult<OperationResult> Delete(long id)
{
var result = _salaryAidApplication.Remove(id);
return result;
}
[HttpPost("validate-excel")]
public ActionResult<ExcelValidation<SalaryAidImportData>> ValidateExcel([FromForm]ValidateExcelRequest request)
{
var validation = _salaryAidImportExcel.ReadAndValidateExcel(request.Excel, _workshopId);
return validation;
}
[HttpPost("create-from-excel")]
public async Task<ActionResult<OperationResult>> OnPostCreateFromExcelData(List<SalaryAidImportData> data)
{
var commands = data.Select(x => new CreateSalaryAidViewModel()
{
WorkshopId = x.WorkshopId,
Amount = x.Amount.ToMoney(),
EmployeeIds = [x.EmployeeId],
SalaryDateTime = x.SalaryAidDateTime,
NationalCode = x.NationalCode,
CalculationMonth = x.calculationMonth,
CalculationYear = x.calculationYear
}).ToList();
OperationResult result = await _salaryAidApplication.CreateRangeAsync(commands);
return new JsonResult(new
{
result.IsSuccedded,
result.Message
});
}
}
public class ValidateExcelRequest
{
public IFormFile Excel { get; set; }
}
public class EditSalaryAidRequest
{
public long Id { get; set; }
public long EmployeeId { get; set; }
public double Amount { get; set; }
public string SalaryDateTime { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }
}
public class CreateSalaryAidRequest
{
public List<long> EmployeeIds { get; set; }
public double Amount { get; set; }
public string SalaryDateTime { get; set; }
public int CalculationMonth { get; set; }
public int CalculationYear { get; set; }
}

View File

@@ -250,9 +250,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
var span = end - start;
var hours = (int)span.TotalHours;
var minutes = span.Minutes;
if (hours > 0 && minutes > 0)
{
return new JsonResult(new

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.BaseControllers;
[Authorize(Policy = "AdminArea")]

View File

@@ -42,6 +42,15 @@ public class GeneralController : GeneralBaseController
currentDate
});
}
[HttpGet("persian-day-of-week")]
public ActionResult<OperationResult<string>> OnGetDayOfWeek(string dateFa)
{
var op = new OperationResult<string>();
if (!dateFa.TryToGeorgianDateTime(out DateTime date))
return op.Failed("تاریخ وارد شده نامعتبر است");
return op.Succcedded(date.DayOfWeek.DayOfWeeKToPersian());
}
// [HttpGet("pm-permissions")]
// public IActionResult GetPMPermissions()
@@ -96,44 +105,8 @@ public class GeneralController : GeneralBaseController
var statusCode = isSuccess ? "1" : "0";
return $"{baseUrl}/callback?Status={statusCode}&transactionId={transactionId}";
}
}
public class TokenReq
{
public long Amount { get; set; }
public string CallbackUrl { get; set; }
[Display(Name = "شماره فاکتور")]
[MaxLength(100)]
[Required]
[Key]
// be ezaye har pazirande bayad yekta bashad
public string invoiceID { get; set; }
[Required] public long terminalID { get; set; }
/*
* JSON Bashad
* etelaate takmili site harchi
* nabayad char khas dashte bashe (*'"xp_%!+- ...)
*/
public string Payload { get; set; } = "";
public string email { get; set; }
}
public class TokenResp
{
// if 0 = success
public int Status { get; set; }
public string AccessToken { get; set; }
}
public class PayRequest
{
[Required] [MaxLength(3000)] public string token { get; set; }
[Required] public long terminalID { get; set; }
public string nationalCode { get; set; }
}
public class SepehrGatewayPayResponse
@@ -169,10 +142,4 @@ public class SepehrGatewayPayResponse
public string issuerbank { get; set; }
[Display(Name = " شماره کارت ")] public string cardnumber { get; set; }
}
public class AdviceReq
{
[Display(Name = " رسید دیجیتال ")] public string digitalreceipt { get; set; }
public long Tid { get; set; }
}

View File

@@ -19,7 +19,7 @@
"sqlDebugging": true,
"dotnetRunMessages": "true",
"nativeDebugging": true,
"applicationUrl": "https://localhost:5004;http://localhost:5003;",
"applicationUrl": "https://localhost:5004;http://localhost:5003;https://192.168.0.117:5005",
"jsWebView2Debugging": false,
"hotReloadEnabled": true
},