Compare commits

..

16 Commits

108 changed files with 3254 additions and 2096 deletions

View File

@@ -445,30 +445,6 @@ public static class Tools
return myMoney.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir")); return myMoney.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
} }
/// <summary>
/// اگر مبلغ صفر باشد خط تیره برمیگرداند
/// </summary>
/// <param name="myMoney"></param>
/// <returns></returns>
public static string ToMoneyCheckZero(this double myMoney)
{
if (myMoney == 0)
return "-";
return myMoney.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
}
/// <summary>
/// اگر مبلغ صفر یا نال باشد خط تیره برمیگرداند
/// </summary>
/// <param name="myMoney"></param>
/// <returns></returns>
public static string ToMoneyCheckZeroNullable(this double? myMoney)
{
if (myMoney == 0 || myMoney == null)
return "-";
return myMoney?.ToString("N0", CultureInfo.CreateSpecificCulture("fa-ir"));
}
public static string ToMoneyNullable(this double? myMoney) public static string ToMoneyNullable(this double? myMoney)
{ {

View File

@@ -1,10 +1,9 @@
using _0_Framework.Application; using System;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Checkout.Dto;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Checkout;
namespace Company.Domain.CheckoutAgg; namespace Company.Domain.CheckoutAgg;
@@ -81,31 +80,4 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
#endregion #endregion
Task<Checkout> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate); Task<Checkout> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate);
#region ForApi
/// <summary>
/// دریافت سلکت لیست پرسنل کارگاه
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id);
/// <summary>
/// دریافت لیست فیش حقوقی
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel);
/// <summary>
/// پرینت فیش حقوقی
/// Api
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids);
#endregion
} }

View File

@@ -15,7 +15,6 @@ public interface ISalaryAidRepository:IRepository<long,SalaryAid>
void RemoveRange(IEnumerable<SalaryAid> salaryAids); void RemoveRange(IEnumerable<SalaryAid> salaryAids);
#region Pooya #region Pooya
/// <summary> /// <summary>
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند /// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
/// </summary> /// </summary>

View File

@@ -106,14 +106,4 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
#endregion #endregion
#region ForApi
/// <summary>
/// دریافت لیست کارگاه های ادمین برای سلکت تو
/// Api
/// </summary>
/// <returns></returns>
Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList();
#endregion
} }

View File

@@ -1,92 +0,0 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class CheckoutDto
{
/// <summary>
/// آی دی فیش
/// </summary>
public long Id { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// شماره قراداد
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// تاریخ شروع فیش
/// </summary>
public string ContractStart { get; set; }
/// <summary>
/// تاریخ پایان فیش
/// </summary>
public string ContractEnd { get; set; }
/// <summary>
/// ماه
/// </summary>
public string Month { get; set; }
/// <summary>
/// سال
/// </summary>
public string Year { get; set; }
/// <summary>
/// روزهای کارکرد
/// </summary>
public string SumOfWorkingDays { get; set; }
/// <summary>
/// شماره کارگاه
/// </summary>
public string ArchiveCode { get; set; }
/// <summary>
/// کد پرسنلی
/// </summary>
public string PersonnelCode { get; set; }
/// <summary>
/// فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// امضاء فیش
/// </summary>
public bool Signature { get; set; }
/// <summary>
/// نام کارفرما
/// </summary>
public string EmployerName { get; set; }
public bool IsBlockCantracingParty { get; set; }
/// <summary>
/// آیا فیش نیاز به بروزرسانی دارد
/// </summary>
public bool IsUpdateNeeded { get; set; }
/// <summary>
/// لیست پیام های هشدار فیش حقوقی
/// </summary>
public List<CheckoutWarningMessageModel> CheckoutWarningMessageList { get; set; }
/// <summary>
/// نیاز به امزا دارد یا خیر
/// </summary>
public bool HasSignCheckoutOption { get; set; }
}

View File

@@ -1,247 +0,0 @@
using System;
using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.SalaryAid;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class CheckoutPrintDto
{
// هدر فیش
// اطلاعات هویتی
// اطلاعات کارگاه
#region Header
public long Id { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
/// <summary>
/// نام پدر
/// </summary>
public string FathersName { get; set; }
/// <summary>
/// کد ملی
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// تاریخ تولد
/// </summary>
public string DateOfBirth { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// شماره قراداد
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// ماه
/// </summary>
public string Month { get; set; }
/// <summary>
/// سال
/// </summary>
public string Year { get; set; }
/// <summary>
/// لیست کارفرما
/// </summary>
public List<CheckoutEmployersList> EmployersLists { get; set; }
/// <summary>
/// آیا کارقرما حقوقی است
/// </summary>
public bool EmployerIslegal { get; set; }
/// <summary>
/// آیا ترک کار کرده
/// </summary>
public bool HasLeft { get; set; }
/// <summary>
/// آخرین روز کاری
/// </summary>
public string LastDayOfWork { get; set; }
/// <summary>
/// روز ترک کار
/// </summary>
public string LeftWorkDate { get; set; }
#endregion
//جدول مطالبات و کسورات
#region PaymentAndDeductionTable
/// <summary>
/// مطالبات
/// </summary>
public List<PaymentAndDeductionList> PaymentList { get; set; }
/// <summary>
/// کسورات
/// </summary>
public List<PaymentAndDeductionList> DeductionList { get; set; }
/// <summary>
/// جمع مطالبات
/// </summary>
public string TotalPayment { get; set; }
/// <summary>
/// جمع کسورات
/// </summary>
public string TotalDeductions { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string TotalClaims { get; set; }
#endregion
//لیست ورود و خروج پرسنل
//اطلاعات ساعات کار و موظقی
#region RollCallData
/// <summary>
/// لیست حضورغیاب
/// </summary>
public List<CheckoutPrintRollCallDto> MonthlyRollCall { get; set; }
/// <summary>
/// دیتای جدول حضورغیاب
/// </summary>
public CheckoutRollCallViewModel CheckoutRollCall { get; set; }
#endregion
//اقساط - مساعده
#region SalaryAidAndInstallmentData
public List<CheckoutPrintInstallmentDto> Installments { get; set; }
public List<CheckoutPrintSalaryAidDto> SalaryAids { get; set; }
#endregion
}
/// <summary>
/// کسورات
/// </summary>
public class PaymentData
{
/// <summary>
/// حقوق و مزد
/// </summary>
public string MonthlySalary { get; set; }
/// <summary>
/// پایه سنوات
/// </summary>
public string BaseYearsPay { get; set; }
/// <summary>
/// کمک هزینه اقلام مصرفی
/// </summary>
public string ConsumableItems { get; set; }
/// <summary>
/// کمک هزینه مسکن
/// </summary>
public string HousingAllowance { get; set; }
/// <summary>
/// فوق العاده اضافه کاری
/// </summary>
public string OvertimePay { get; set; }
/// <summary>
/// فوق العاده شبکاری
/// </summary>
public string NightworkPay { get; set; }
/// <summary>
/// فوق العاده جمعه کاری
/// </summary>
public string FridayPay { get; set; }
/// <summary>
/// فوق العاده ماموریت
/// </summary>
public string MissionPay { get; set; }
/// <summary>
/// فوق العاده نوبت کاری
/// </summary>
public string ShiftPay { get; set; }
/// <summary>
/// کمک هزینه عائله مندی
/// </summary>
public string FamilyAllowance { get; set; }
/// <summary>
/// حق تاهل
/// </summary>
public string MarriedAllowance { get; set; }
}
/// <summary>
/// کسورات
/// </summary>
public class DeductionData
{
}
public class PaymentAndDeductionList
{
public int RowNumber { get; set; }
/// <summary>
/// عنوان
/// </summary>
public string Title { get; set; }
/// <summary>
/// مقدار/روز/ساعت
/// </summary>
public string Value { get; set; }
/// <summary>
/// مبلغ
/// </summary>
public string Amount { get; set; }
}
/// <summary>
/// لیست کارفرما
/// </summary>
public class CheckoutEmployersList
{
public string IsLegal { get; set; }
public string EmployerFullName { get; set; }
}
public class CheckoutGetData : CheckoutPrintDto
{
public DateTime ContractStart { get; set; }
public int PersonnelCode { get; set; }
public long WorkshopId { get; set; }
public long EmployeeId { get; set; }
}

View File

@@ -1,47 +0,0 @@
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class CheckoutSearchModelDto : PaginationRequest
{
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// شماره قرارداد
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// تاریخ شروع فیش
/// </summary>
public string ContractStart { get; set; }
/// <summary>
/// تاریخ پاین فیش
/// </summary>
public string ContractEnd { get; set; }
/// <summary>
/// ماه
/// </summary>
public string Month { get; set; }
/// <summary>
/// سال
/// </summary>
public string Year { get; set; }
/// <summary>
/// آی دی گارفرما
/// </summary>
public long EmployerId { get; set; }
}

View File

@@ -1,14 +0,0 @@
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class EmployeeSelectListDto
{
/// <summary>
/// آی دی پرسنل
/// </summary>
public long Id { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
}

View File

@@ -1,75 +0,0 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class RotatingShiftOfCheckoutDto
{
/// <summary>
/// نام پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// وضعیت نوبتکاری
/// </summary>
public string RotatingShiftStatus { get; set; }
/// <summary>
/// آیا نوبت کاری دارد
/// </summary>
public bool HasRotatingShift { get; set; }
/// <summary>
/// سال و ماه
/// </summary>
public string YearAndMonth { get; set; }
/// <summary>
/// نوع ساعت کاری
/// </summary>
public string TypeOfWorkingHours { get; set; }
/// <summary>
/// لیست نوبت کاری
/// </summary>
public List<RotatingShiftListDto> RotatingShiftList { get; set; }
}
public class RotatingShiftListDto
{
/// <summary>
/// بازه کاری صبح
/// </summary>
public string MorningShiftSpan { get; set; }
/// <summary>
/// بازه کاری عصر
/// </summary>
public string EveningShiftSpan { get; set; }
/// <summary>
/// بازه کاری شب
/// </summary>
public string NightShiftSpan { get; set; }
/// <summary>
/// آیا صبح کاری داشته
/// </summary>
public bool IsMorningShift { get; set; }
/// <summary>
/// آیا عصرکاری داشته
/// </summary>
public bool IsEveningShift { get; set; }
/// <summary>
/// آیا شبکاری داشته
/// </summary>
public bool IsNightShift { get; set; }
/// <summary>
/// تاریخ شیفت
/// </summary>
public string ShiftDate { get; set; }
}

View File

@@ -1,10 +1,9 @@
using _0_Framework.Application; using System;
using CompanyManagment.App.Contracts.Checkout.Dto;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.Checkout; namespace CompanyManagment.App.Contracts.Checkout;
@@ -63,49 +62,4 @@ public interface ICheckoutApplication
long workshopId, DateTime start, DateTime end); long workshopId, DateTime start, DateTime end);
#endregion #endregion
#region ForApi
/// <summary>
/// دریافت سلکت لیست پرسنل کارگاه
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id);
/// <summary>
/// دریافت لیست فیش های حقوقی ادمین
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel);
/// <summary>
/// دریافت نوبتکاری
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<RotatingShiftOfCheckoutDto> GetRotatingShiftApi(long id);
/// <summary>
/// پرینت فیش حقوقی
/// Api
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids);
#endregion
}
public class CheckoutPrintInstallmentDto
{
public string RemainingAmount { get; set; }
public string LoanAmount { get; set; }
public string Amount { get; set; }
}
public class CheckoutPrintSalaryAidDto
{
public string Amount { get; set; }
public string SalaryAidDateTimeFa { get; set; }
} }

View File

@@ -45,42 +45,4 @@ namespace CompanyManagment.App.Contracts.RollCall
} }
#endregion #endregion
public class CheckoutPrintRollCallDto
{
public string RollCallDateFa { get; set; }
public string StartDate1 { get; set; }
public string EndDate1 { get; set; }
public string StartDate2 { get; set; }
public string EndDate2 { get; set; }
//منقطع بودن شیفت کاری
public bool IsSliced { get; set; }
public string TotalWorkingHours { get; set; }
public string DayOfWeek { get; set; }
public string BreakTimeString { get; set; }
/// <summary>
/// اگر مرخصی نداشته باشد خالی خواهد بود، اگر داشته باشد نوع مرخصی جانشانی می شود
/// </summary>
public string LeaveType { get; set; }
public bool IsAbsent { get; set; }
public bool IsFriday { get; set; }
public bool IsHoliday { get; set; }
public bool IsBirthDay { get; set; }
public string EnterDifferencesMinutes1 { get; set; }
public string ExitDifferencesMinutes1 { get; set; }
public string EnterDifferencesMinutes2 { get; set; }
public string ExitDifferencesMinutes2 { get; set; }
}
} }

View File

@@ -1,24 +0,0 @@
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AdminWorkshopSelectListDto
{
/// <summary>
/// آی دی کارگاه
/// </summary>
public long Id { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopFullName { get; set; }
/// <summary>
/// کد بایگانی
/// </summary>
public string ArchiveCode { get; set; }
/// <summary>
/// آیا بلاک شده است
/// </summary>
public bool IsBlock { get; set; }
}

View File

@@ -1,11 +1,10 @@
using _0_Framework.Application; using System.Collections.Generic;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Checkout.Dto;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.Workshop; namespace CompanyManagment.App.Contracts.Workshop;
@@ -93,19 +92,6 @@ public interface IWorkshopApplication
#endregion #endregion
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command); Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
#region ForApi
/// <summary>
/// دریافت لیست کارگاه های ادمین برای سلکت تو
/// Api
/// </summary>
/// <returns></returns>
Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList();
#endregion
} }
public class CreateWorkshopWorkflowRegistration public class CreateWorkshopWorkflowRegistration

View File

@@ -1,34 +1,28 @@
using _0_Framework.Application; using System;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.CheckoutAgg;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.EmployeeAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.LeaveAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.RollCallAgg;
using Company.Domain.WorkingHoursTempAgg;
using Company.Domain.WorkshopAgg;
using Company.Domain.YearlySalaryAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Checkout.Dto;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.HolidayItem;
using CompanyManagment.App.Contracts.Leave;
using CompanyManagment.App.Contracts.MandantoryHours;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
using CompanyManagment.EFCore.Repository;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.CheckoutAgg;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.LeftWorkAgg;
using Company.Domain.YearlySalaryAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.RollCallAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Leave;
using CompanyManagment.App.Contracts.MandantoryHours;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.EmployeeAgg;
using CompanyManagment.App.Contracts.HolidayItem;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.EFCore.Migrations;
using CompanyManagment.EFCore.Repository;
using System.Globalization;
using Company.Domain.LeaveAgg;
using Company.Domain.WorkshopAgg;
namespace CompanyManagment.Application; namespace CompanyManagment.Application;
@@ -44,14 +38,11 @@ public class CheckoutApplication : ICheckoutApplication
private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository; private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
private readonly IRollCallRepository _rollCallRepository; private readonly IRollCallRepository _rollCallRepository;
private readonly IHolidayItemApplication _holidayItemApplication; private readonly IHolidayItemApplication _holidayItemApplication;
private readonly IWorkingHoursTempRepository _workingHoursTempRepository;
private readonly IWorkshopRepository _workshopRepository;
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
ILeftWorkRepository leftWorkRepository, ILeftWorkRepository leftWorkRepository,
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication, IWorkingHoursTempRepository workingHoursTempRepository, IWorkshopRepository workshopRepository) IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication)
{ {
_checkoutRepository = checkoutRepository; _checkoutRepository = checkoutRepository;
_yearlySalaryRepository = yearlySalaryRepository; _yearlySalaryRepository = yearlySalaryRepository;
@@ -63,9 +54,7 @@ public class CheckoutApplication : ICheckoutApplication
_rollCallMandatoryRepository = rollCallMandatoryRepository; _rollCallMandatoryRepository = rollCallMandatoryRepository;
_rollCallRepository = rollCallRepository; _rollCallRepository = rollCallRepository;
_holidayItemApplication = holidayItemApplication; _holidayItemApplication = holidayItemApplication;
_workingHoursTempRepository = workingHoursTempRepository; }
_workshopRepository = workshopRepository;
}
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")] [SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
public void Create(CreateCheckout command) public void Create(CreateCheckout command)
@@ -717,69 +706,5 @@ public class CheckoutApplication : ICheckoutApplication
return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end); return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
} }
public async Task<List<EmployeeSelectListDto>> GetEmployeeSelectListByWorkshopId(long id) #endregion
{
return await _checkoutRepository.GetEmployeeSelectListByWorkshopId(id);
}
#endregion
#region ForApi
public async Task<PagedResult<CheckoutDto>> GetList(CheckoutSearchModelDto searchModel)
{
return await _checkoutRepository.GetList(searchModel);
}
public async Task<RotatingShiftOfCheckoutDto> GetRotatingShiftApi(long id)
{
var result = new ComputingViewModel();
var checkout = GetDetails(id);
var workingHours = _workingHoursTempRepository.GetByContractIdConvertToShiftwork4(checkout.ContractId);
var typeOfWorkingHours = "";
if (checkout.HasRollCall)
{
result = await _rollCallMandatoryRepository.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId, checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork, true, workingHours, false);
typeOfWorkingHours = "دارای حضورغیاب";
}
else
{
var workshop = _workshopRepository.GetDetails(checkout.WorkshopId);
result = await _rollCallMandatoryRepository.RotatingShiftReport(checkout.WorkshopId, checkout.EmployeeId, checkout.ContractStartGr, checkout.ContractEndGr, workingHours.ShiftWork, false, workingHours, workshop.WorkshopHolidayWorking);
typeOfWorkingHours = "بدون حضورغیاب";
}
var items = result.RotatingResultList.Select(x => new RotatingShiftListDto()
{
MorningShiftSpan = x.MorningString,
EveningShiftSpan = x.EveningString,
NightShiftSpan = x.NightString,
IsMorningShift = x.IsMorningShift,
IsEveningShift = x.IsEveningShift,
IsNightShift = x.IsNightShift,
ShiftDate = x.RotatingDate
}).ToList();
return new RotatingShiftOfCheckoutDto()
{
FullName = checkout.EmployeeFullName,
YearAndMonth = $"{checkout.Month} {checkout.Year}",
HasRotatingShift = result.RotatingStatus != "نوبت کاری ندارد",
RotatingShiftStatus = result.RotatingStatus,
TypeOfWorkingHours = typeOfWorkingHours,
RotatingShiftList = items
};
}
public Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids)
{
return _checkoutRepository.CheckoutPrint(ids);
}
#endregion
} }

View File

@@ -1524,8 +1524,7 @@ public class InsuranceListApplication : IInsuranceListApplication
var dateOfBirth = employeeData.DateOfBirthGr.ToFarsi(); var dateOfBirth = employeeData.DateOfBirthGr.ToFarsi();
var dateOfIssue = employeeData.DateOfIssueGr.ToFarsi(); var dateOfIssue = employeeData.DateOfIssueGr.ToFarsi();
var leftDate = employeeData.LeftWorkDateGr != null ? employeeData.LeftWorkDateGr.Value.AddDays(-1) : new DateTime(); var leftDate = employeeData.LeftWorkDateGr != null ? employeeData.LeftWorkDateGr.Value.AddDays(-1) : new DateTime();
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
var leftWorkFa = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr.ToFarsi() : ""; var leftWorkFa = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr.ToFarsi() : "";
var startWorkFa = employeeData.StartWorkDateGr.ToFarsi(); var startWorkFa = employeeData.StartWorkDateGr.ToFarsi();
var workshop = _workShopRepository.GetDetails(workshopId); var workshop = _workShopRepository.GetDetails(workshopId);
@@ -1607,7 +1606,7 @@ public class InsuranceListApplication : IInsuranceListApplication
MaritalStatus = employeeData.MaritalStatus, MaritalStatus = employeeData.MaritalStatus,
StartMonthCurrent = startMonthFa, StartMonthCurrent = startMonthFa,
WorkingDays = employeeData.WorkingDays, WorkingDays = workingDays.countWorkingDays,
StartWorkDate = startWorkFa, StartWorkDate = startWorkFa,
StartWorkDateGr = employeeData.StartWorkDateGr, StartWorkDateGr = employeeData.StartWorkDateGr,
LeftWorkDate = leftWorkFa, LeftWorkDate = leftWorkFa,

View File

@@ -11,7 +11,6 @@ using Company.Domain.InstitutionContractAgg;
using Company.Domain.LeftWorkAgg; using Company.Domain.LeftWorkAgg;
using Company.Domain.LeftWorkInsuranceAgg; using Company.Domain.LeftWorkInsuranceAgg;
using Company.Domain.WorkshopAgg; using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Checkout.Dto;
using CompanyManagment.App.Contracts.Employee; using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.EmployeeChildren; using CompanyManagment.App.Contracts.EmployeeChildren;
using CompanyManagment.App.Contracts.LeftWork; using CompanyManagment.App.Contracts.LeftWork;
@@ -1131,17 +1130,5 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Succcedded(); return operation.Succcedded();
} }
#endregion
#region ForApi
public async Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList()
{
return await _workshopRepository.GetAdminWorkshopSelectList();
}
#endregion #endregion
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1607,11 +1607,6 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
#region Entities #region Entities
if (string.IsNullOrWhiteSpace(command.ContarctStart) || string.IsNullOrWhiteSpace(command.ContractEnd))
{
command.ContarctStart = command.ContractStartGr.ToFarsi();
command.ContractEnd = command.ContractEndGr.ToFarsi();
}
var sdate = command.ContarctStart.ToEnglishNumber(); var sdate = command.ContarctStart.ToEnglishNumber();
var edate = command.ContractEnd.ToEnglishNumber(); var edate = command.ContractEnd.ToEnglishNumber();
var syear = Convert.ToInt32(sdate.Substring(0, 4)); var syear = Convert.ToInt32(sdate.Substring(0, 4));

View File

@@ -2024,52 +2024,5 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
}).OrderByDescending(x => x.StartWork).ToList(); }).OrderByDescending(x => x.StartWork).ToList();
} }
#endregion
#region ForApi
public async Task<List<AdminWorkshopSelectListDto>> GetAdminWorkshopSelectList()
{
var watch = new Stopwatch();
watch.Start();
var acountId = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.AsNoTracking().Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
var employers = await
_context.WorkshopEmployers.AsNoTracking().Where(x => workshopIds.Contains(x.WorkshopId))
.Select(x => new { x.Employer, x.WorkshopId }).ToListAsync();
var blockedContractingParties =await _context.PersonalContractingParties
.Where(x => x.IsBlock == "true").Select(x=>x.id).ToListAsync();
var workshops = await _context.Workshops.AsNoTracking()
.Where(x => workshopIds.Contains(x.id))
.Where(x => x.IsActiveString == "true").ToListAsync();
var result = workshops.Select(x =>
{
var empl = employers.First(em => em.WorkshopId == x.id);
var isBlock = blockedContractingParties.Any(cp => cp == empl.Employer.ContractingPartyId);
return new AdminWorkshopSelectListDto
{
Id = x.id,
WorkshopFullName = x.WorkshopFullName,
ArchiveCode = x.ArchiveCode,
IsBlock = isBlock
};
}).OrderBy(x=>x.IsBlock ? 1 : 0)
.ToList();
Console.WriteLine("workshopSelectList : " +watch.Elapsed);
return result;
}
#endregion #endregion
} }

View File

@@ -2,6 +2,9 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Domain.SkillAgg.Repositories; using GozareshgirProgramManager.Domain.SkillAgg.Repositories;

View File

@@ -2,6 +2,7 @@ using System.Linq;
using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeDeployStatusProject; namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeDeployStatusProject;

View File

@@ -1,6 +1,8 @@
using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
@@ -69,7 +71,7 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
if (phase is null) if (phase is null)
return OperationResult.NotFound("فاز یافت نشد"); return OperationResult.NotFound("فاز یافت نشد");
var tasks = phase.Tasks?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectTask>(); var tasks = phase.Tasks?.ToList() ?? new List<ProjectTask>();
foreach (var t in tasks) foreach (var t in tasks)
{ {
if (t.Priority != priority) if (t.Priority != priority)
@@ -89,10 +91,10 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
if (project is null) if (project is null)
return OperationResult.NotFound("پروژه یافت نشد"); return OperationResult.NotFound("پروژه یافت نشد");
var phases = project.Phases?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectPhase>(); var phases = project.Phases?.ToList() ?? new List<ProjectPhase>();
foreach (var phase in phases) foreach (var phase in phases)
{ {
var tasks = phase.Tasks?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectTask>(); var tasks = phase.Tasks?.ToList() ?? new List<ProjectTask>();
foreach (var t in tasks) foreach (var t in tasks)
{ {
if (t.Priority != priority) if (t.Priority != priority)

View File

@@ -3,6 +3,9 @@ using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain._Common.Exceptions; using GozareshgirProgramManager.Domain._Common.Exceptions;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using MediatR; using MediatR;

View File

@@ -1,5 +1,7 @@
using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application.Modules.Projects.DTOs; using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject; namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject;
@@ -15,4 +17,5 @@ public class SetTimeSectionTime
public string Description { get; set; } public string Description { get; set; }
public int Hours { get; set; } public int Hours { get; set; }
public int Minutes { get; set; } public int Minutes { get; set; }
public TaskSectionAdditionalTimeType Type { get; set; }
} }

View File

@@ -4,6 +4,9 @@ using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain._Common.Exceptions; using GozareshgirProgramManager.Domain._Common.Exceptions;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Domain.SkillAgg.Repositories; using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
@@ -369,7 +372,7 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
foreach (var additionalTime in sectionItem.AdditionalTime) foreach (var additionalTime in sectionItem.AdditionalTime)
{ {
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes)); var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes));
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Description, addedByUserId); section.AddAdditionalTime(additionalTimeSpan, additionalTime.Type, additionalTime.Description, addedByUserId);
hasAdditionalTime = true; hasAdditionalTime = true;
} }

View File

@@ -1,5 +1,9 @@
using GozareshgirProgramManager.Application.Modules.Projects.DTOs; using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
namespace GozareshgirProgramManager.Application.Modules.Projects.Extensions; namespace GozareshgirProgramManager.Application.Modules.Projects.Extensions;

View File

@@ -4,6 +4,10 @@ using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Linq; using System.Linq;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList; namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;

View File

@@ -3,6 +3,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList; using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,6 +1,7 @@
using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs; using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums; using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@@ -28,7 +29,7 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
} }
private List<MessageDto> CreateAdditionalTimeNotes( private List<MessageDto> CreateAdditionalTimeNotes(
IEnumerable<Domain.ProjectAgg.Entities.TaskSectionAdditionalTime> additionalTimes, IEnumerable<TaskSectionAdditionalTime> additionalTimes,
Dictionary<long, string> users, Dictionary<long, string> users,
Guid taskId) Guid taskId)
{ {

View File

@@ -0,0 +1,136 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
using GozareshgirProgramManager.Application.Services.FileManagement;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
using GozareshgirProgramManager.Domain.FileManagementAgg.Enums;
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using Microsoft.AspNetCore.Http;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.CreateTaskSectionRevision;
public record CreateTaskSectionRevisionCommand(string Message, List<IFormFile> Files, Guid SectionId) : IBaseCommand;
public class CreateTaskSectionRevisionCommandHandler : IBaseCommandHandler<CreateTaskSectionRevisionCommand>
{
private readonly ITaskSectionRevisionRepository _revisionRepository;
private readonly IFileStorageService _fileStorageService;
private readonly IAuthHelper _authHelper;
private readonly IUnitOfWork _unitOfWork;
private readonly IUploadedFileRepository _fileRepository;
private readonly IThumbnailGeneratorService _thumbnailService;
public CreateTaskSectionRevisionCommandHandler(ITaskSectionRevisionRepository revisionRepository,
IFileStorageService fileStorageService, IAuthHelper authHelper, IUnitOfWork unitOfWork, IUploadedFileRepository fileRepository, IThumbnailGeneratorService thumbnailService)
{
_revisionRepository = revisionRepository;
_fileStorageService = fileStorageService;
_authHelper = authHelper;
_unitOfWork = unitOfWork;
_fileRepository = fileRepository;
_thumbnailService = thumbnailService;
}
public async Task<OperationResult> Handle(CreateTaskSectionRevisionCommand request,
CancellationToken cancellationToken)
{
var currentId = _authHelper.GetCurrentUserId();
var entity = new Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision(request.SectionId, request.Message, currentId!.Value);
if (request.Files is { Count: > 0 })
{
foreach (var file in request.Files)
{
if (file.Length == 0)
{
return OperationResult.ValidationError("فایل خالی است");
}
const long maxFileSize = 100 * 1024 * 1024;
if (file.Length > maxFileSize)
{
return OperationResult.ValidationError("حجم فایل بیش از حد مجاز است (حداکثر 100MB)");
}
var fileType = DetectFileType(file.ContentType, Path.GetExtension(file.FileName));
var uploadedFile = new UploadedFile(
originalFileName: file.FileName,
fileSizeBytes: file.Length,
mimeType: file.ContentType,
fileType: fileType,
category: FileCategory.TaskSectionRevision,
uploadedByUserId: currentId!.Value,
storageProvider: StorageProvider.LocalFileSystem
);
await _fileRepository.AddAsync(uploadedFile);
await _fileRepository.SaveChangesAsync();
try
{
await using var stream = file.OpenReadStream();
var uploadResult = await _fileStorageService.UploadAsync(
stream,
uploadedFile.UniqueFileName,
"TaskSectionRevision"
);
uploadedFile.CompleteUpload(uploadResult.StoragePath, uploadResult.StorageUrl);
if (fileType == FileType.Image)
{
var dimensions = await _thumbnailService.GetImageDimensionsAsync(uploadResult.StoragePath);
if (dimensions.HasValue)
{
uploadedFile.SetImageDimensions(dimensions.Value.Width, dimensions.Value.Height);
}
var thumbnail = await _thumbnailService
.GenerateImageThumbnailAsync(uploadResult.StoragePath, category: "TaskSectionRevision");
if (thumbnail.HasValue)
{
uploadedFile.SetThumbnail(thumbnail.Value.ThumbnailUrl);
}
}
await _fileRepository.UpdateAsync(uploadedFile);
await _fileRepository.SaveChangesAsync();
var taskRevisionFile = new TaskRevisionFile(uploadedFile.Id);
entity.AddFile(taskRevisionFile);
}
catch (Exception ex)
{
await _fileRepository.DeleteAsync(uploadedFile);
await _fileRepository.SaveChangesAsync();
return OperationResult<MessageDto>.ValidationError($"خطا در آپلود فایل: {ex.Message}");
}
}
}
await _revisionRepository.CreateAsync(entity);
await _unitOfWork.SaveChangesAsync(cancellationToken);
return OperationResult.Success();
}
private FileType DetectFileType(string mimeType, string extension)
{
if (mimeType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
return FileType.Image;
if (mimeType.StartsWith("video/", StringComparison.OrdinalIgnoreCase))
return FileType.Video;
if (mimeType.StartsWith("audio/", StringComparison.OrdinalIgnoreCase))
return FileType.Audio;
if (new[] { ".zip", ".rar", ".7z", ".tar", ".gz" }.Contains(extension.ToLower()))
return FileType.Archive;
return FileType.Document;
}
}

View File

@@ -0,0 +1,14 @@
using FluentValidation;
using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.CreateTaskSectionRevision;
public class CreateTaskSectionRevisionValidator:AbstractValidator<CreateTaskSectionRevisionCommand>
{
public CreateTaskSectionRevisionValidator()
{
RuleFor(x=>x.Message)
.NotEmpty()
.WithMessage("توضیحات اجباری است");
}
}

View File

@@ -0,0 +1,35 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.SetStatusReviewedRevision;
public record SetStatusReviewedRevisionCommand(Guid TaskSectionId):IBaseCommand;
public class SetStatusReviewedRevisionCommandHandler : IBaseCommandHandler<SetStatusReviewedRevisionCommand>
{
private readonly ITaskSectionRevisionRepository _revisionRepository;
private readonly IUnitOfWork _unitOfWork;
public SetStatusReviewedRevisionCommandHandler(ITaskSectionRevisionRepository revisionRepository, IUnitOfWork unitOfWork)
{
_revisionRepository = revisionRepository;
_unitOfWork = unitOfWork;
}
public async Task<OperationResult> Handle(SetStatusReviewedRevisionCommand request, CancellationToken cancellationToken)
{
var taskSectionRevisions = await _revisionRepository.GetByTaskSectionId(request.TaskSectionId);
if (taskSectionRevisions == null || taskSectionRevisions.Count == 0)
return OperationResult.NotFound("اصلاحی برای این بخش یافت نشد");
foreach (var revision in taskSectionRevisions)
{
revision.MarkReviewed();
}
await _unitOfWork.SaveChangesAsync(cancellationToken);
return OperationResult.Success();
}
}

View File

@@ -0,0 +1,92 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId;
public record TaskRevisionsByTaskSectionIdQuery(Guid TaskSectionId)
: IBaseQuery<TaskRevisionsByTaskSectionIdResponse>;
public class TaskRevisionsByTaskSectionIdQueryHandler : IBaseQueryHandler<TaskRevisionsByTaskSectionIdQuery,
TaskRevisionsByTaskSectionIdResponse>
{
private readonly IProgramManagerDbContext _dbContext;
public TaskRevisionsByTaskSectionIdQueryHandler(IProgramManagerDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<OperationResult<TaskRevisionsByTaskSectionIdResponse>> Handle(
TaskRevisionsByTaskSectionIdQuery request, CancellationToken cancellationToken)
{
var taskSectionEntity = await _dbContext.TaskSections
.Include(x=>x.Task)
.ThenInclude(x => x.Phase)
.ThenInclude(x => x.Project)
.FirstOrDefaultAsync(x => x.Id == request.TaskSectionId,
cancellationToken: cancellationToken);
if (taskSectionEntity == null)
{
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("بخش فرعی یافت نشد");
}
var taskRevisions = await _dbContext.TaskSectionRevisions
.Include(x => x.Files).Where(x => x.TaskSectionId == request.TaskSectionId)
.ToListAsync(cancellationToken);
if (taskRevisions.Count == 0)
{
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("اصلاحی یافت نشد");
}
var skill = await _dbContext.Skills.FirstOrDefaultAsync(x => x.Id == taskSectionEntity.SkillId,
cancellationToken: cancellationToken);
if (skill == null)
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("مهارت مورد نظر یافت نشد");
var user =await _dbContext.Users.FirstOrDefaultAsync(x => x.Id == taskSectionEntity.CurrentAssignedUserId,
cancellationToken: cancellationToken);
if (user == null)
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("کاربر مورد نظر یافت نشد");
var fileIds = taskRevisions.SelectMany(x => x.Files)
.Select(x => x.FileId).Distinct().ToList();
var uploadedFiles = _dbContext.UploadedFiles
.Where(x => fileIds.Contains(x.Id)).ToList();
var resItems = taskRevisions.Select(x =>
{
var itemFileIds = x.Files.Select(f => f.FileId).Distinct().ToList();
var files = uploadedFiles
.Where(f => itemFileIds.Contains(f.Id))
.Select(file => new TaskRevisionsByTaskSectionIdItemFile()
{
Id = file.Id,
FileName = file.OriginalFileName,
FileUrl = file.StorageUrl ?? "",
FileSizeBytes = file.FileSizeBytes,
FileType = file.FileType.ToString(),
ThumbnailUrl = file.ThumbnailUrl,
ImageWidth = file.ImageWidth,
ImageHeight = file.ImageHeight,
DurationSeconds = file.DurationSeconds
}).ToList();
return new TaskRevisionsByTaskSectionIdItem(x.Message, files,$"{x.CreationDate.ToFarsi()} {x.CreationDate:HH:mm}");
}).ToList();
var res = new TaskRevisionsByTaskSectionIdResponse(resItems, taskSectionEntity.Task.Phase.Project.Name,
taskSectionEntity.Task.Phase.Name, taskSectionEntity.Task.Name,
skill.Name,
user.FullName
);
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.Success(res);
}
}

View File

@@ -0,0 +1,16 @@
using GozareshgirProgramManager.Application._Common.Models;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId;
public record TaskRevisionsByTaskSectionIdResponse(
List<TaskRevisionsByTaskSectionIdItem> Items,
string ProjectName,
string PhaseName,
string TaskName,
string SkillName,
string UserName);
public record TaskRevisionsByTaskSectionIdItem(string Message, List<TaskRevisionsByTaskSectionIdItemFile> Files,string CreationDate);
public class TaskRevisionsByTaskSectionIdItemFile:UploadedFileDto;

View File

@@ -0,0 +1,56 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.AcceptTimeRequest;
public record AcceptTimeRequestCommand(Guid TimeRequestId,
Guid SectionId,TaskSectionAdditionalTimeType TimeType,int Hour,int Minute):IBaseCommand;
public class AcceptTimeRequestCommandHandler:IBaseCommandHandler<AcceptTimeRequestCommand>
{
private readonly ITaskSectionTimeRequestRepository _timeRequestRepository;
private readonly ITaskSectionRepository _taskSectionRepository;
private readonly IUnitOfWork _unitOfWork;
public AcceptTimeRequestCommandHandler(ITaskSectionTimeRequestRepository timeRequestRepository, ITaskSectionRepository taskSectionRepository, IUnitOfWork unitOfWork)
{
_timeRequestRepository = timeRequestRepository;
_taskSectionRepository = taskSectionRepository;
_unitOfWork = unitOfWork;
}
public async Task<OperationResult> Handle(AcceptTimeRequestCommand request, CancellationToken cancellationToken)
{
var timeRequest = await _timeRequestRepository.GetByIdAsync(request.TimeRequestId, cancellationToken);
if (timeRequest == null)
{
return OperationResult.NotFound("درخواست زمان شما یافت نشد");
}
var taskSection = await _taskSectionRepository.GetByIdAsync(request.SectionId, cancellationToken);
if (taskSection == null)
{
return OperationResult.NotFound("بخش فرعی وارد شده نامعتبر است");
}
if (timeRequest.RequestStatus == TaskSectionTimeRequestStatus.Accepted)
{
return OperationResult.Failure("این درخواست قبلا تایید شده است");
}
// تایید درخواست زمان
timeRequest.AcceptTimeRequest();
// اضافه کردن زمان به TaskSection
var totalMinutes = (request.Hour * 60) + request.Minute;
var additionalTime = TimeSpan.FromMinutes(totalMinutes);
taskSection.AddAdditionalTime(additionalTime, request.TimeType, timeRequest.Description);
await _unitOfWork.SaveChangesAsync(cancellationToken);
return OperationResult.Success();
}
}

View File

@@ -0,0 +1,24 @@
using FluentValidation;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.AcceptTimeRequest;
public class AcceptTimeRequestCommandValidator : AbstractValidator<AcceptTimeRequestCommand>
{
public AcceptTimeRequestCommandValidator()
{
RuleFor(c => c.TimeRequestId)
.NotEmpty().WithMessage("شناسه درخواست نمیتواند خالی باشد");
RuleFor(c => c.SectionId)
.NotEmpty().WithMessage("شناسه بخش فرعی نمیتواند خالی باشد");
RuleFor(c => c.TimeType)
.NotNull().WithMessage("نوع زمان درخواست شده نامعتبر است")
.IsInEnum();
RuleFor(c => c.Hour)
.InclusiveBetween(0, 100).WithMessage("ساعت وارد شده میتواند بین 0 تا 100 باشد");
RuleFor(c => c.Minute)
.InclusiveBetween(0, 60).WithMessage("دقیقه وارد شده میتواند بین 0 تا 60 باشد");
}
}

View File

@@ -0,0 +1,52 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.CreateTimeRequest;
public record CreateTimeRequestCommand(int Hours, int Minutes, string Description,
TaskSectionTimeRequestType RequestType,Guid TaskSectionId) : IBaseCommand;
public class CreateTimeRequestCommandHandler : IBaseCommandHandler<CreateTimeRequestCommand>
{
private readonly IAuthHelper _authHelper;
private readonly ITaskSectionTimeRequestRepository _timeRequestRepository;
private readonly ITaskSectionRepository _taskSectionRepository;
private readonly IUnitOfWork _unitOfWork;
public CreateTimeRequestCommandHandler
(ITaskSectionTimeRequestRepository timeRequestRepository, IAuthHelper authHelper, IUnitOfWork unitOfWork, ITaskSectionRepository taskSectionRepository)
{
_timeRequestRepository = timeRequestRepository;
_authHelper = authHelper;
_unitOfWork = unitOfWork;
_taskSectionRepository = taskSectionRepository;
}
public async Task<OperationResult> Handle(CreateTimeRequestCommand request, CancellationToken cancellationToken)
{
var currentUser = _authHelper.GetCurrentUserId();
if (!currentUser.HasValue)
{
return OperationResult.Unauthorized();
}
if (!_taskSectionRepository.Exists(x=>x.Id == request.TaskSectionId))
{
return OperationResult.NotFound("وظیفه فرعی مورد نظر یافت نشد");
}
var requestTimeSpan = TimeSpan.FromHours(request.Hours) + TimeSpan.FromMinutes(request.Minutes);
var entity = new TaskSectionTimeRequest(currentUser.Value, request.Description, requestTimeSpan,
request.RequestType,request.TaskSectionId);
await _timeRequestRepository.CreateAsync(entity);
await _unitOfWork.SaveChangesAsync(cancellationToken);
return OperationResult.Success();
}
}

View File

@@ -0,0 +1,20 @@
using FluentValidation;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.CreateTimeRequest;
public class CreateTimeRequestValidator : AbstractValidator<CreateTimeRequestCommand>
{
public CreateTimeRequestValidator()
{
RuleFor(c => c.Hours)
.InclusiveBetween(0, 100).WithMessage("ساعت درخواست شده باید کمتر از 100 ساعت باشد");
RuleFor(c => c.Minutes)
.InclusiveBetween(0, 59)
.WithMessage("دقیقه وارد شده باید بین 0 تا 60 باشد");
RuleFor(x => x.RequestType)
.IsInEnum()
.NotNull();
}
}

View File

@@ -0,0 +1,66 @@
using GozareshgirProgramManager.Application._Common.Extensions;
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain._Common.Exceptions;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Queries.CreateTimeRequestDetails;
public record CreateTimeRequestDetailsResponse(List<CreateTimeRequestDetailsRevision> Revisions,
string ProjectName,string PhaseName,string SectionName,string SkillName);
public record CreateTimeRequestDetailsRevision(string Message, List<UploadedFileDto> Files,Guid Id,string CreationDate);
public record CreateTimeRequestDetailsQuery(Guid TaskSectionId) : IBaseQuery<CreateTimeRequestDetailsResponse>;
public class
CreateTimeRequestDetailsQueryHandler : IBaseQueryHandler<CreateTimeRequestDetailsQuery,
CreateTimeRequestDetailsResponse>
{
private readonly IProgramManagerDbContext _context;
public CreateTimeRequestDetailsQueryHandler(IProgramManagerDbContext context)
{
_context = context;
}
public async Task<OperationResult<CreateTimeRequestDetailsResponse>> Handle(CreateTimeRequestDetailsQuery request,
CancellationToken cancellationToken)
{
var section =await _context.TaskSections
.Include(x => x.Task)
.ThenInclude(x => x.Phase)
.ThenInclude(x => x.Project)
.Include(x => x.Skill)
.FirstOrDefaultAsync(x => x.Id == request.TaskSectionId, cancellationToken: cancellationToken);
if (section == null)
{
throw new BadRequestException("بخش فرعی نامعتبر است");
}
var revisions = await _context.TaskSectionRevisions.Where(x =>
x.TaskSectionId == request.TaskSectionId && x.Status == RevisionReviewStatus.Pending).ToListAsync(cancellationToken: cancellationToken);
var fileIds = revisions.SelectMany(x => x.Files)
.Select(x => x.FileId).ToList();
var files =await _context.UploadedFiles
.Where(x => fileIds.Contains(x.Id)).ToListAsync(cancellationToken: cancellationToken);
var resItem = revisions.Select(x =>
{
var selectFileIds = x.Files.Select(f => f.FileId).ToList();
var filesDto = files.Where(f => selectFileIds.Contains(f.Id))
.Select(f => f.ToDto()).ToList();
return new CreateTimeRequestDetailsRevision(x.Message, filesDto,x.Id,x.CreationDate.ToFarsi());
}).ToList();
var res = new CreateTimeRequestDetailsResponse(resItem,section.Task.Phase.Project.Name,section.Task.Phase.Name,section.Task.Name,
section.Skill!.Name);
return OperationResult<CreateTimeRequestDetailsResponse>.Success(res);
}
}

View File

@@ -0,0 +1,11 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
public interface IWorkflowProvider
{
WorkflowType Type { get; }
Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken);
Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken);
}

View File

@@ -0,0 +1,31 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
public class NotAssignedWorkflowProvider : IWorkflowProvider
{
public WorkflowType Type => WorkflowType.NotAssigned;
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
// Assuming 0 means unassigned in CurrentAssignedUserId
var sections = await context.TaskSections
.Where(x => x.CurrentAssignedUserId == 0)
.ToListAsync(cancellationToken);
return sections.Select(ts => new WorkflowListItem
{
EntityId = ts.Id,
Title = "تخصیص‌ نیافته",
Type = WorkflowType.NotAssigned
}).ToList();
}
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
return await context.TaskSections
.Where(x => x.CurrentAssignedUserId == 0)
.CountAsync(cancellationToken);
}
}

View File

@@ -0,0 +1,41 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
public class RejectedRevisionsWorkflowProvider : IWorkflowProvider
{
public WorkflowType Type => WorkflowType.Rejected;
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
var query = from revision in context.TaskSectionRevisions
.Where(x => x.Status == RevisionReviewStatus.Pending)
join taskSection in context.TaskSections
on revision.TaskSectionId equals taskSection.Id
where taskSection.CurrentAssignedUserId == currentUserId
select taskSection;
var sections = await query.ToListAsync(cancellationToken);
return sections.Select(ts => new WorkflowListItem
{
EntityId = ts.Id,
Title = "برگشت از سمت مدیر",
Type = WorkflowType.Rejected
}).ToList();
}
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
{
var query = from revision in context.TaskSectionRevisions
.Where(x => x.Status == RevisionReviewStatus.Pending)
join taskSection in context.TaskSections
on revision.TaskSectionId equals taskSection.Id
where taskSection.CurrentAssignedUserId == currentUserId
select revision.Id;
return await query.CountAsync(cancellationToken);
}
}

View File

@@ -0,0 +1,50 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
public record WorkflowCountResponse(int Total, int Rejected, int NotAssigned, int PendingForApproval);
public record WorkflowCountQuery() : IBaseQuery<WorkflowCountResponse>;
public class WorkflowCountQueryHandler : IBaseQueryHandler<WorkflowCountQuery, WorkflowCountResponse>
{
private readonly IProgramManagerDbContext _context;
private readonly IAuthHelper _authHelper;
private readonly IEnumerable<IWorkflowProvider> _providers;
public WorkflowCountQueryHandler(IProgramManagerDbContext context, IAuthHelper authHelper, IEnumerable<IWorkflowProvider> providers)
{
_context = context;
_authHelper = authHelper;
_providers = providers;
}
public async Task<OperationResult<WorkflowCountResponse>> Handle(WorkflowCountQuery request, CancellationToken cancellationToken)
{
long currentUserId = _authHelper.GetCurrentUserId()!.Value;
int rejectedCount = 0;
int notAssignedCount = 0;
int pendingForApprovalCount = 0;
foreach (var provider in _providers)
{
var count = await provider.GetCount(currentUserId, _context, cancellationToken);
switch (provider.Type)
{
case WorkflowType.Rejected:
rejectedCount += count; break;
case WorkflowType.NotAssigned:
notAssignedCount += count; break;
case WorkflowType.PendingForApproval:
pendingForApprovalCount += count; break;
}
}
var total = rejectedCount + notAssignedCount + pendingForApprovalCount;
var response = new WorkflowCountResponse(total, rejectedCount, notAssignedCount, pendingForApprovalCount);
return OperationResult<WorkflowCountResponse>.Success(response);
}
}

View File

@@ -0,0 +1,56 @@
using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
public record WorkflowListResponse(List<WorkflowListItem>Items);
public class WorkflowListItem
{
public string Title { get; set; }
public WorkflowType Type { get; set; }
public Guid EntityId { get; set; }
}
public enum WorkflowType
{
Rejected,
NotAssigned,
PendingForApproval,
}
public record WorkflowListQuery():IBaseQuery<WorkflowListResponse>;
public class WorkflowListQueryHandler:IBaseQueryHandler<WorkflowListQuery,WorkflowListResponse>
{
private readonly IProgramManagerDbContext _context;
private readonly IAuthHelper _authHelper;
private readonly IEnumerable<IWorkflowProvider> _providers;
public WorkflowListQueryHandler(IProgramManagerDbContext context,
IAuthHelper authHelper,
IEnumerable<IWorkflowProvider> providers)
{
_context = context;
_authHelper = authHelper;
_providers = providers;
}
public async Task<OperationResult<WorkflowListResponse>> Handle(WorkflowListQuery request, CancellationToken cancellationToken)
{
var currentUserId = _authHelper.GetCurrentUserId()!.Value;
var items = new List<WorkflowListItem>();
foreach (var provider in _providers)
{
var providerItems = await provider.GetItems(currentUserId, _context, cancellationToken);
if (providerItems?.Count > 0)
items.AddRange(providerItems);
}
var res = new WorkflowListResponse(items);
return OperationResult<WorkflowListResponse>.Success(res);
}
}

View File

@@ -0,0 +1,23 @@
using GozareshgirProgramManager.Application._Common.Models;
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
namespace GozareshgirProgramManager.Application._Common.Extensions;
public static class FileExtensions
{
public static UploadedFileDto ToDto(this UploadedFile file)
{
return new UploadedFileDto()
{
Id = file.Id,
FileName = file.OriginalFileName,
FileUrl = file.StorageUrl ?? "",
FileSizeBytes = file.FileSizeBytes,
FileType = file.FileType.ToString(),
ThumbnailUrl = file.ThumbnailUrl,
ImageWidth = file.ImageWidth,
ImageHeight = file.ImageHeight,
DurationSeconds = file.DurationSeconds
};
}
}

View File

@@ -9,6 +9,10 @@ using GozareshgirProgramManager.Domain.UserAgg.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using GozareshgirProgramManager.Domain.TaskChatAgg.Entities; using GozareshgirProgramManager.Domain.TaskChatAgg.Entities;
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities; using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Application._Common.Interfaces; namespace GozareshgirProgramManager.Application._Common.Interfaces;
@@ -31,6 +35,12 @@ public interface IProgramManagerDbContext
DbSet<TaskChatMessage> TaskChatMessages { get; set; } DbSet<TaskChatMessage> TaskChatMessages { get; set; }
DbSet<UploadedFile> UploadedFiles { get; set; } DbSet<UploadedFile> UploadedFiles { get; set; }
//Task Section Time Request
DbSet<TaskSectionTimeRequest> TaskSectionTimeRequests { get; set; }
// Task Section Revision
DbSet<TaskSectionRevision> TaskSectionRevisions { get; set; }
DbSet<Skill> Skills { get; set; } DbSet<Skill> Skills { get; set; }
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default); Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
} }

View File

@@ -31,7 +31,7 @@ public class OperationResult
// Helper methods for specific error types // Helper methods for specific error types
public static OperationResult NotFound(string errorMessage) => new(false, errorMessage, errorType: ErrorType.NotFound); public static OperationResult NotFound(string errorMessage) => new(false, errorMessage, errorType: ErrorType.NotFound);
public static OperationResult Unauthorized(string errorMessage) => new(false, errorMessage, errorType: ErrorType.Unauthorized); public static OperationResult Unauthorized(string errorMessage="احراز هویت شما منقضی شده است. لطفا دوباره وارد شوید") => new(false, errorMessage, errorType: ErrorType.Unauthorized);
public static OperationResult ValidationError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.Validation); public static OperationResult ValidationError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.Validation);
public static OperationResult ValidationError(List<string> errors) => new(false, errors: errors, errorType: ErrorType.Validation); public static OperationResult ValidationError(List<string> errors) => new(false, errors: errors, errorType: ErrorType.Validation);
public static OperationResult InternalServerError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.InternalServerError); public static OperationResult InternalServerError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.InternalServerError);

View File

@@ -0,0 +1,34 @@
namespace GozareshgirProgramManager.Application._Common.Models;
public class UploadedFileDto
{
public Guid Id { get; set; }
public string FileName { get; set; } = string.Empty;
public string FileUrl { get; set; } = string.Empty;
public long FileSizeBytes { get; set; }
public string FileType { get; set; } = string.Empty;
public string? ThumbnailUrl { get; set; }
public int? ImageWidth { get; set; }
public int? ImageHeight { get; set; }
public int? DurationSeconds { get; set; }
public string FileSizeFormatted
{
get
{
const long kb = 1024;
const long mb = kb * 1024;
const long gb = mb * 1024;
if (FileSizeBytes >= gb)
return $"{FileSizeBytes / (double)gb:F2} GB";
if (FileSizeBytes >= mb)
return $"{FileSizeBytes / (double)mb:F2} MB";
if (FileSizeBytes >= kb)
return $"{FileSizeBytes / (double)kb:F2} KB";
return $"{FileSizeBytes} Bytes";
}
}
}

View File

@@ -10,6 +10,7 @@ public enum FileCategory
ProjectDocument = 3, // مستندات پروژه ProjectDocument = 3, // مستندات پروژه
UserProfilePhoto = 4, // عکس پروفایل کاربر UserProfilePhoto = 4, // عکس پروفایل کاربر
Report = 5, // گزارش Report = 5, // گزارش
Other = 6 // سایر Other = 6, // سایر
TaskSectionRevision
} }

View File

@@ -1,7 +1,7 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.SkillAgg.Entities; using GozareshgirProgramManager.Domain.SkillAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
/// <summary> /// <summary>
/// بخش فاز - برای ذخیره تخصیص کاربر و مهارت در سطح Phase /// بخش فاز - برای ذخیره تخصیص کاربر و مهارت در سطح Phase

View File

@@ -1,8 +1,9 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Events; using GozareshgirProgramManager.Domain.ProjectAgg.Events;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
/// <summary> /// <summary>
/// فاز پروژه - سطح میانی در سلسله مراتب /// فاز پروژه - سطح میانی در سلسله مراتب
@@ -28,7 +29,7 @@ public class ProjectPhase : ProjectHierarchyNode
} }
public Guid ProjectId { get; private set; } public Guid ProjectId { get; private set; }
public Project Project { get; private set; } = null!; public Project.Project Project { get; private set; } = null!;
public IReadOnlyList<ProjectTask> Tasks => _tasks.AsReadOnly(); public IReadOnlyList<ProjectTask> Tasks => _tasks.AsReadOnly();
public IReadOnlyList<PhaseSection> PhaseSections => _phaseSections.AsReadOnly(); public IReadOnlyList<PhaseSection> PhaseSections => _phaseSections.AsReadOnly();

View File

@@ -1,8 +1,8 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Events; using GozareshgirProgramManager.Domain.ProjectAgg.Events;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
/// <summary> /// <summary>
/// پروژه - بالاترین سطح در سلسله مراتب و Aggregate Root /// پروژه - بالاترین سطح در سلسله مراتب و Aggregate Root

View File

@@ -1,7 +1,7 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.SkillAgg.Entities; using GozareshgirProgramManager.Domain.SkillAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
/// <summary> /// <summary>
/// ProjectSection: shortcut container for UserId + SkillId at Project level /// ProjectSection: shortcut container for UserId + SkillId at Project level

View File

@@ -1,32 +1,32 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Events; using GozareshgirProgramManager.Domain.ProjectAgg.Events;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
/// <summary> /// <summary>
/// تسک - پایین‌ترین سطح در سلسله مراتب که شامل بخش‌ها می‌شود /// تسک - پایین‌ترین سطح در سلسله مراتب که شامل بخش‌ها می‌شود
/// </summary> /// </summary>
public class ProjectTask : ProjectHierarchyNode public class ProjectTask : ProjectHierarchyNode
{ {
private readonly List<TaskSection> _sections; private readonly List<TaskSection.TaskSection> _sections;
private ProjectTask() private ProjectTask()
{ {
_sections = new List<TaskSection>(); _sections = new List<TaskSection.TaskSection>();
} }
public ProjectTask(string name, Guid phaseId, string? description = null) : base(name, description) public ProjectTask(string name, Guid phaseId, string? description = null) : base(name, description)
{ {
PhaseId = phaseId; PhaseId = phaseId;
_sections = new List<TaskSection>(); _sections = new List<TaskSection.TaskSection>();
Priority = ProjectTaskPriority.Low; Priority = ProjectTaskPriority.Low;
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name)); AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
} }
public Guid PhaseId { get; private set; } public Guid PhaseId { get; private set; }
public ProjectPhase Phase { get; private set; } = null!; public ProjectPhase Phase { get; private set; } = null!;
public IReadOnlyList<TaskSection> Sections => _sections.AsReadOnly(); public IReadOnlyList<TaskSection.TaskSection> Sections => _sections.AsReadOnly();
// Task-specific properties // Task-specific properties
public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted; public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted;
@@ -40,7 +40,7 @@ public class ProjectTask : ProjectHierarchyNode
#region Section Management #region Section Management
public void AddSection(TaskSection section, bool cascadeToChildren = false) public void AddSection(TaskSection.TaskSection section, bool cascadeToChildren = false)
{ {
var existingSection = _sections.FirstOrDefault(s => s.SkillId == section.SkillId); var existingSection = _sections.FirstOrDefault(s => s.SkillId == section.SkillId);
if (existingSection != null) if (existingSection != null)
@@ -84,7 +84,7 @@ public class ProjectTask : ProjectHierarchyNode
return; return;
} }
var section = new TaskSection(Id, skillId, assignedUserId); var section = new TaskSection.TaskSection(Id, skillId, assignedUserId);
_sections.Add(section); _sections.Add(section);
AddDomainEvent(new TaskSectionAddedEvent(Id, section.Id, skillId)); AddDomainEvent(new TaskSectionAddedEvent(Id, section.Id, skillId));
} }
@@ -204,12 +204,12 @@ public class ProjectTask : ProjectHierarchyNode
#region Query Helpers #region Query Helpers
public IEnumerable<TaskSection> GetSectionsBySkill(Guid skillId) public IEnumerable<TaskSection.TaskSection> GetSectionsBySkill(Guid skillId)
{ {
return _sections.Where(s => s.SkillId == skillId); return _sections.Where(s => s.SkillId == skillId);
} }
public TaskSection? GetSectionBySkill(Guid skillId) public TaskSection.TaskSection? GetSectionBySkill(Guid skillId)
{ {
return _sections.FirstOrDefault(s => s.SkillId == skillId); return _sections.FirstOrDefault(s => s.SkillId == skillId);
} }
@@ -219,7 +219,7 @@ public class ProjectTask : ProjectHierarchyNode
return _sections.Any(s => s.SkillId == skillId); return _sections.Any(s => s.SkillId == skillId);
} }
public IEnumerable<TaskSection> GetAssignedSections(long userId) public IEnumerable<TaskSection.TaskSection> GetAssignedSections(long userId)
{ {
return _sections.Where(s => s.CurrentAssignedUserId == userId); return _sections.Where(s => s.CurrentAssignedUserId == userId);
} }

View File

@@ -1,12 +1,10 @@
using System.Linq; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain._Common.Exceptions; using GozareshgirProgramManager.Domain._Common.Exceptions;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Events; using GozareshgirProgramManager.Domain.ProjectAgg.Events;
using GozareshgirProgramManager.Domain.ProjectAgg.Models;
using GozareshgirProgramManager.Domain.SkillAgg.Entities; using GozareshgirProgramManager.Domain.SkillAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
/// <summary> /// <summary>
/// بخش تسک - برای ذخیره کار واقعی که کاربر روی یک مهارت خاص انجام می‌دهد /// بخش تسک - برای ذخیره کار واقعی که کاربر روی یک مهارت خاص انجام می‌دهد
@@ -61,12 +59,13 @@ public class TaskSection : EntityBase<Guid>
// برای backward compatibility // برای backward compatibility
public TimeSpan EstimatedHours => FinalEstimatedHours; public TimeSpan EstimatedHours => FinalEstimatedHours;
public void AddAdditionalTime(TimeSpan additionalHours, string? reason = null, long? addedByUserId = null) public void AddAdditionalTime(TimeSpan additionalHours, TaskSectionAdditionalTimeType type, string? reason = null,
long? addedByUserId = null)
{ {
if (additionalHours <= TimeSpan.Zero) if (additionalHours <= TimeSpan.Zero)
throw new BadRequestException("تایم اضافی باید بزرگتر از صفر باشد", nameof(additionalHours)); throw new BadRequestException("تایم اضافی باید بزرگتر از صفر باشد", nameof(additionalHours));
var additionalTime = new TaskSectionAdditionalTime(additionalHours, reason, addedByUserId); var additionalTime = new TaskSectionAdditionalTime(additionalHours,type, reason, addedByUserId);
_additionalTimes.Add(additionalTime); _additionalTimes.Add(additionalTime);
} }

View File

@@ -1,7 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
/// <summary> /// <summary>
/// فعالیت کاری روی یک بخش /// فعالیت کاری روی یک بخش

View File

@@ -1,6 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities; namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
/// <summary> /// <summary>
/// زمان اضافی اضافه شده بعد از تخمین اولیه /// زمان اضافی اضافه شده بعد از تخمین اولیه
@@ -9,12 +9,13 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
{ {
private TaskSectionAdditionalTime() { } private TaskSectionAdditionalTime() { }
public TaskSectionAdditionalTime(TimeSpan hours, string? reason = null, long? addedByUserId = null) public TaskSectionAdditionalTime(TimeSpan hours, TaskSectionAdditionalTimeType type, string? reason = null,long? addedByUserId = null)
{ {
Hours = hours; Hours = hours;
Reason = reason; Reason = reason;
AddedByUserId = addedByUserId; AddedByUserId = addedByUserId;
AddedAt = DateTime.UtcNow; AddedAt = DateTime.Now;
Type = type;
} }
public TimeSpan Hours { get; private set; } public TimeSpan Hours { get; private set; }
@@ -22,8 +23,15 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
public long? AddedByUserId { get; private set; } public long? AddedByUserId { get; private set; }
public DateTime AddedAt { get; private set; } public DateTime AddedAt { get; private set; }
public TaskSectionAdditionalTimeType Type { get; set; }
public void UpdateReason(string? reason) public void UpdateReason(string? reason)
{ {
Reason = reason; Reason = reason;
} }
} }
public enum TaskSectionAdditionalTimeType
{
Effective,
Ineffective,
}

View File

@@ -0,0 +1,56 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
public class TaskSectionRevision : EntityBase<Guid>
{
public TaskSectionRevision(Guid taskSectionId,
string message, long createdByUserId)
{
TaskSectionId = taskSectionId;
Status = RevisionReviewStatus.Pending;
Message = message;
CreatedByUserId = createdByUserId;
}
public Guid TaskSectionId { get; private set; }
public RevisionReviewStatus Status { get; private set; }
public string Message { get; private set; }
public long CreatedByUserId { get; private set; }
public IReadOnlyCollection<TaskRevisionFile> Files => _files;
private readonly List<TaskRevisionFile> _files = new();
public void AddFile(TaskRevisionFile file)
{
_files.Add(file);
}
public void MarkReviewed()
{
if (Status == RevisionReviewStatus.Reviewed)
return;
Status = RevisionReviewStatus.Reviewed;
}
}
public class TaskRevisionFile: EntityBase<Guid>
{
public TaskRevisionFile(Guid fileId)
{
FileId = fileId;
}
public Guid FileId { get; private set; }
}
public enum RevisionReviewStatus : short
{
Pending = 1,
Reviewed = 2
}

View File

@@ -0,0 +1,33 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
public class TaskSectionTimeRequest:EntityBase<Guid>
{
public TaskSectionTimeRequest(long userId, string description,
TimeSpan requestedTime, TaskSectionTimeRequestType requestType,
Guid taskSectionId)
{
UserId = userId;
Description = description;
RequestedTime = requestedTime;
RequestType = requestType;
TaskSectionId = taskSectionId;
RequestStatus = TaskSectionTimeRequestStatus.Pending;
}
public TaskSection TaskSection { get; set; }
public Guid TaskSectionId { get; set; }
public long UserId { get; private set; }
public string Description { get; private set; }
public TimeSpan RequestedTime { get; private set; }
public TaskSectionTimeRequestType RequestType { get; private set; }
public TaskSectionTimeRequestStatus RequestStatus { get; private set; }
public void AcceptTimeRequest()
{
RequestStatus = TaskSectionTimeRequestStatus.Accepted;
}
}

View File

@@ -0,0 +1,8 @@
namespace GozareshgirProgramManager.Domain.ProjectAgg.Enums;
public enum TaskSectionTimeRequestStatus
{
Pending,
Accepted,
Rejected
}

View File

@@ -0,0 +1,8 @@
namespace GozareshgirProgramManager.Domain.ProjectAgg.Enums;
public enum TaskSectionTimeRequestType
{
InitialTime,
AdditionalTime,
RejectedTime,
}

View File

@@ -1,5 +1,7 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
public interface IPhaseSectionRepository : IRepository<Guid, PhaseSection> public interface IPhaseSectionRepository : IRepository<Guid, PhaseSection>
{ {

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories; namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;

View File

@@ -0,0 +1,9 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
public interface ITaskSectionRevisionRepository:IRepository<Guid,TaskSectionRevision>
{
Task<List<TaskSectionRevision>> GetByTaskSectionId(Guid requestTaskSectionId);
}

View File

@@ -0,0 +1,10 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
public interface ITaskSectionTimeRequestRepository:IRepository<Guid,TaskSectionTimeRequest>
{
}

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain._Common; using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
namespace GozareshgirProgramManager.Domain.SkillAgg.Entities; namespace GozareshgirProgramManager.Domain.SkillAgg.Entities;

View File

@@ -2,7 +2,7 @@
public class UnAuthorizedException:Exception public class UnAuthorizedException:Exception
{ {
public UnAuthorizedException(string message) : base(message) public UnAuthorizedException(string message="احراز هویت شما منقضی شده است. لطفا دوباره وارد شوید") : base(message)
{ {
} }
} }

View File

@@ -1,7 +1,3 @@
using FluentValidation;
using GozareshgirProgramManager.Application._Common.Behaviors; using GozareshgirProgramManager.Application._Common.Behaviors;
using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Application.Services.FileManagement; using GozareshgirProgramManager.Application.Services.FileManagement;
@@ -11,10 +7,7 @@ using GozareshgirProgramManager.Domain.CustomerAgg.Repositories;
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories; using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Domain.RoleAgg.Repositories; using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories; using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
using GozareshgirProgramManager.Domain.SkillAgg.Repositories; using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
using GozareshgirProgramManager.Domain.TaskChatAgg.Repositories; using GozareshgirProgramManager.Domain.TaskChatAgg.Repositories;
using GozareshgirProgramManager.Domain.UserAgg.Repositories; using GozareshgirProgramManager.Domain.UserAgg.Repositories;
@@ -32,6 +25,9 @@ using Shared.Contracts.PmRole.Commands;
using Shared.Contracts.PmRole.Queries; using Shared.Contracts.PmRole.Queries;
using Shared.Contracts.PmUser.Commands; using Shared.Contracts.PmUser.Commands;
using Shared.Contracts.PmUser.Queries; using Shared.Contracts.PmUser.Queries;
using System.Reflection;
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
namespace GozareshgirProgramManager.Infrastructure; namespace GozareshgirProgramManager.Infrastructure;
@@ -101,6 +97,11 @@ public static class DependencyInjection
services.AddScoped<IAuthHelper, AuthHelper>(); services.AddScoped<IAuthHelper, AuthHelper>();
//TaskSection Time Request
services.AddScoped<ITaskSectionTimeRequestRepository, TaskSectionTimeRequestRepository>();
//TaskSection Revision
services.AddScoped<ITaskSectionRevisionRepository, TaskSectionRevisionRepository>();
#region ServicesInjection #region ServicesInjection
@@ -116,6 +117,16 @@ public static class DependencyInjection
// MediatR Validation Behavior // MediatR Validation Behavior
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
// Workflow providers: auto-register all IWorkflowProvider implementations in the Application assembly
var appAssembly = typeof(IWorkflowProvider).Assembly;
var providerTypes = appAssembly
.GetTypes()
.Where(t => !t.IsAbstract && !t.IsInterface && typeof(IWorkflowProvider).IsAssignableFrom(t))
.ToList();
foreach (var providerType in providerTypes)
{
services.AddScoped(typeof(IWorkflowProvider), providerType);
}
return services; return services;
} }

View File

@@ -0,0 +1,121 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GozareshgirProgramManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddtimeRequestandTasksectionrevision : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Type",
table: "TaskSectionAdditionalTimes",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "TaskSectionRevisions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TaskSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Message = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
CreatedByUserId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TaskSectionRevisions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TaskSectionTimeRequests",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TaskSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<long>(type: "bigint", nullable: false),
Description = table.Column<string>(type: "nvarchar(1200)", maxLength: 1200, nullable: false),
RequestedTime = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
RequestType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
RequestStatus = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TaskSectionTimeRequests", x => x.Id);
table.ForeignKey(
name: "FK_TaskSectionTimeRequests_TaskSections_TaskSectionId",
column: x => x.TaskSectionId,
principalTable: "TaskSections",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TaskRevisionFile",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TaskSectionRevisionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TaskRevisionFile", x => x.Id);
table.ForeignKey(
name: "FK_TaskRevisionFile_TaskSectionRevisions_TaskSectionRevisionId",
column: x => x.TaskSectionRevisionId,
principalTable: "TaskSectionRevisions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TaskRevisionFile_UploadedFiles_FileId",
column: x => x.FileId,
principalTable: "UploadedFiles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_TaskRevisionFile_FileId",
table: "TaskRevisionFile",
column: "FileId");
migrationBuilder.CreateIndex(
name: "IX_TaskRevisionFile_TaskSectionRevisionId",
table: "TaskRevisionFile",
column: "TaskSectionRevisionId");
migrationBuilder.CreateIndex(
name: "IX_TaskSectionTimeRequests_TaskSectionId",
table: "TaskSectionTimeRequests",
column: "TaskSectionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "TaskRevisionFile");
migrationBuilder.DropTable(
name: "TaskSectionTimeRequests");
migrationBuilder.DropTable(
name: "TaskSectionRevisions");
migrationBuilder.DropColumn(
name: "Type",
table: "TaskSectionAdditionalTimes");
}
}
}

View File

@@ -227,7 +227,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("UploadedFiles", (string)null); b.ToTable("UploadedFiles", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -254,49 +254,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("PhaseSections"); b.ToTable("PhaseSections");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("HasAssignmentOverride")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("PlannedEndDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("PlannedStartDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Projects", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -348,7 +306,49 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("ProjectPhases", (string)null); b.ToTable("ProjectPhases", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("HasAssignmentOverride")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("PlannedEndDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("PlannedStartDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Projects", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -374,7 +374,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("ProjectSections"); b.ToTable("ProjectSections");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -433,7 +433,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("ProjectTasks", (string)null); b.ToTable("ProjectTasks", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -476,7 +476,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("TaskSections", (string)null); b.ToTable("TaskSections", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionActivity", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -514,7 +514,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("TaskSectionActivities", (string)null); b.ToTable("TaskSectionActivities", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionAdditionalTime", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -540,6 +540,11 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Property<Guid?>("TaskSectionId") b.Property<Guid?>("TaskSectionId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TaskSectionId"); b.HasIndex("TaskSectionId");
@@ -547,6 +552,76 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("TaskSectionAdditionalTimes", (string)null); b.ToTable("TaskSectionAdditionalTimes", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<long>("CreatedByUserId")
.HasColumnType("bigint");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("Message")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid>("TaskSectionId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("TaskSectionRevisions");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(1200)
.HasColumnType("nvarchar(1200)");
b.Property<string>("RequestStatus")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RequestType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RequestedTime")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<Guid>("TaskSectionId")
.HasColumnType("uniqueidentifier");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("TaskSectionId");
b.ToTable("TaskSectionTimeRequests");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
@@ -792,9 +867,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.ToTable("UserRefreshTokens", (string)null); b.ToTable("UserRefreshTokens", (string)null);
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase")
.WithMany("PhaseSections") .WithMany("PhaseSections")
.HasForeignKey("PhaseId") .HasForeignKey("PhaseId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -810,9 +885,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Skill"); b.Navigation("Skill");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", "Project") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project")
.WithMany("Phases") .WithMany("Phases")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -821,9 +896,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Project"); b.Navigation("Project");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", "Project") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project")
.WithMany("ProjectSections") .WithMany("ProjectSections")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -839,9 +914,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Skill"); b.Navigation("Skill");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase")
.WithMany("Tasks") .WithMany("Tasks")
.HasForeignKey("PhaseId") .HasForeignKey("PhaseId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -850,7 +925,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Phase"); b.Navigation("Phase");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill") b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill")
.WithMany("Sections") .WithMany("Sections")
@@ -858,7 +933,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "Task") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "Task")
.WithMany("Sections") .WithMany("Sections")
.HasForeignKey("TaskId") .HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -869,9 +944,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Task"); b.Navigation("Task");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionActivity", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", "Section") b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "Section")
.WithMany("Activities") .WithMany("Activities")
.HasForeignKey("SectionId") .HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -880,13 +955,61 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("Section"); b.Navigation("Section");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionAdditionalTime", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b =>
{ {
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", null) b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", null)
.WithMany("AdditionalTimes") .WithMany("AdditionalTimes")
.HasForeignKey("TaskSectionId"); .HasForeignKey("TaskSectionId");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b =>
{
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskRevisionFile", "Files", b1 =>
{
b1.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b1.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b1.Property<Guid>("FileId")
.HasColumnType("uniqueidentifier");
b1.Property<Guid>("TaskSectionRevisionId")
.HasColumnType("uniqueidentifier");
b1.HasKey("Id");
b1.HasIndex("FileId");
b1.HasIndex("TaskSectionRevisionId");
b1.ToTable("TaskRevisionFile");
b1.HasOne("GozareshgirProgramManager.Domain.FileManagementAgg.Entities.UploadedFile", null)
.WithMany()
.HasForeignKey("FileId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b1.WithOwner()
.HasForeignKey("TaskSectionRevisionId");
});
b.Navigation("Files");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b =>
{
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "TaskSection")
.WithMany()
.HasForeignKey("TaskSectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TaskSection");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b =>
{ {
b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 => b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 =>
@@ -1031,26 +1154,26 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.Navigation("User"); b.Navigation("User");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
{
b.Navigation("Phases");
b.Navigation("ProjectSections");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b =>
{ {
b.Navigation("PhaseSections"); b.Navigation("PhaseSections");
b.Navigation("Tasks"); b.Navigation("Tasks");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b =>
{
b.Navigation("Phases");
b.Navigation("ProjectSections");
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
{ {
b.Navigation("Sections"); b.Navigation("Sections");
}); });
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b =>
{ {
b.Navigation("Activities"); b.Navigation("Activities");

View File

@@ -5,6 +5,10 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
using GozareshgirProgramManager.Domain.CustomerAgg; using GozareshgirProgramManager.Domain.CustomerAgg;
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities; using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.RoleAgg.Entities; using GozareshgirProgramManager.Domain.RoleAgg.Entities;
using GozareshgirProgramManager.Domain.RoleUserAgg; using GozareshgirProgramManager.Domain.RoleUserAgg;
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities; using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
@@ -49,6 +53,12 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
// Task Chat // Task Chat
public DbSet<TaskChatMessage> TaskChatMessages { get; set; } = null!; public DbSet<TaskChatMessage> TaskChatMessages { get; set; } = null!;
//Task Section Time Request
public DbSet<TaskSectionTimeRequest> TaskSectionTimeRequests { get; set; }
// Task Section Revision
public DbSet<TaskSectionRevision> TaskSectionRevisions { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ProgramManagerDbContext).Assembly); modelBuilder.ApplyConfigurationsFromAssembly(typeof(ProgramManagerDbContext).Assembly);

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -33,6 +34,9 @@ public class TaskSectionAdditionalTimeMapping : IEntityTypeConfiguration<TaskSec
builder.Property(at => at.CreationDate) builder.Property(at => at.CreationDate)
.IsRequired(); .IsRequired();
builder.Property(x=>x.Type)
.HasConversion<string>()
.HasMaxLength(50);
// Ignore domain events // Ignore domain events
builder.Ignore(at => at.DomainEvents); builder.Ignore(at => at.DomainEvents);
} }

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;

View File

@@ -0,0 +1,34 @@
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
public class TaskSectionRevisionMapping:IEntityTypeConfiguration<TaskSectionRevision>
{
public void Configure(EntityTypeBuilder<TaskSectionRevision> builder)
{
builder.HasKey(x => x.Id);
builder.Property(x => x.Id)
.ValueGeneratedNever();
builder.Property(x => x.Status).HasConversion<string>()
.HasMaxLength(50);
builder.Property(x => x.Message).HasMaxLength(500);
builder.OwnsMany(x => x.Files, file =>
{
file.HasKey(x => x.Id);
file.Property(x => x.Id).ValueGeneratedNever();
file.HasOne<UploadedFile>()
.WithMany()
.HasForeignKey(x => x.FileId)
.IsRequired()
.OnDelete(DeleteBehavior.Restrict);
});
}
}

View File

@@ -0,0 +1,33 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
public class TaskSectionTimeRequestMapping:IEntityTypeConfiguration<TaskSectionTimeRequest>
{
public void Configure(EntityTypeBuilder<TaskSectionTimeRequest> builder)
{
builder.HasKey(x => x.Id);
builder.Property(x => x.Id)
.ValueGeneratedNever();
builder.Property(x => x.RequestStatus).
HasConversion<string>().HasMaxLength(50);
builder.Property(x=>x.RequestType).
HasConversion<string>().HasMaxLength(50);
builder.Property(x => x.RequestedTime)
.HasTimeSpanConversion();
builder.Property(x=>x.Description)
.HasMaxLength(1200);
builder.HasOne(x=>x.TaskSection)
.WithMany().HasForeignKey(x=>x.TaskSectionId);
}
}

View File

@@ -1,6 +1,7 @@
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Infrastructure.Persistence.Context; using GozareshgirProgramManager.Infrastructure.Persistence.Context;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories; namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;

View File

@@ -1,5 +1,6 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Infrastructure.Persistence.Context; using GozareshgirProgramManager.Infrastructure.Persistence.Context;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;

View File

@@ -1,6 +1,7 @@
using GozareshgirProgramManager.Application.Modules.Projects.DTOs; using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
using GozareshgirProgramManager.Application.Modules.Projects.Extensions; using GozareshgirProgramManager.Application.Modules.Projects.Extensions;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Infrastructure.Persistence.Context; using GozareshgirProgramManager.Infrastructure.Persistence.Context;

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities; using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common; using GozareshgirProgramManager.Infrastructure.Persistence._Common;

View File

@@ -0,0 +1,24 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
public class TaskSectionRevisionRepository:RepositoryBase<Guid,TaskSectionRevision>,ITaskSectionRevisionRepository
{
private readonly ProgramManagerDbContext _programManagerDbContext;
public TaskSectionRevisionRepository(ProgramManagerDbContext programManagerDbContext) : base(programManagerDbContext)
{
_programManagerDbContext = programManagerDbContext;
}
public async Task<List<TaskSectionRevision>> GetByTaskSectionId(Guid requestTaskSectionId)
{
var res = await _programManagerDbContext.TaskSectionRevisions
.Where(x => requestTaskSectionId == x.TaskSectionId)
.ToListAsync();
return res;
}
}

View File

@@ -0,0 +1,16 @@
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
using Microsoft.EntityFrameworkCore;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
public class TaskSectionTimeRequestRepository:RepositoryBase<Guid,TaskSectionTimeRequest>,ITaskSectionTimeRequestRepository
{
private readonly ProgramManagerDbContext _context;
public TaskSectionTimeRequestRepository(ProgramManagerDbContext context) : base(context)
{
_context = context;
}
}

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