diff --git a/0_Framework/0_Framework.csproj b/0_Framework/0_Framework.csproj
index e8784139..eb73e124 100644
--- a/0_Framework/0_Framework.csproj
+++ b/0_Framework/0_Framework.csproj
@@ -11,6 +11,7 @@
+
diff --git a/0_Framework/Application/AuthHelper.cs b/0_Framework/Application/AuthHelper.cs
index 1c5f8349..4e46f902 100644
--- a/0_Framework/Application/AuthHelper.cs
+++ b/0_Framework/Application/AuthHelper.cs
@@ -91,6 +91,12 @@ public class AuthHelper : IAuthHelper
}
}
+ public string GetWorkshopSlug()
+ {
+ return CurrentAccountInfo().ClientAriaPermission == "true"
+ ? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "WorkshopSlug")?.Value
+ : "";
+ }
#endregion
diff --git a/0_Framework/Application/IAuthHelper.cs b/0_Framework/Application/IAuthHelper.cs
index e2569b53..0ae1ad48 100644
--- a/0_Framework/Application/IAuthHelper.cs
+++ b/0_Framework/Application/IAuthHelper.cs
@@ -20,4 +20,6 @@ public interface IAuthHelper
void UpdateWorkshopSlugClaim(string workshopSlug);
#endregion
+
+ string GetWorkshopSlug();
}
\ No newline at end of file
diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs
index 98905a4a..205a3384 100644
--- a/0_Framework/Application/Tools.cs
+++ b/0_Framework/Application/Tools.cs
@@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
using System.Globalization;
+using System.IO;
using System.Text.RegularExpressions;
using _0_Framework.Infrastructure;
using PersianTools.Core;
+using static System.Net.Mime.MediaTypeNames;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
+using Image = System.Drawing.Image;
namespace _0_Framework.Application;
@@ -865,8 +871,109 @@ public static class Tools
var day = Convert.ToInt32(persianDate.Substring(8, 2));
return new PersianDateTime(year, month, day);
}
+
+ public static string ResizeImage(string imagePath, int width, int height)
+ {
+ using (var srcImage = Image.FromFile(imagePath))
+ {
+ var newImage = new Bitmap(width, height);
+ using (var graphics = Graphics.FromImage(newImage))
+ {
+ graphics.CompositingQuality = CompositingQuality.HighQuality;
+ graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ graphics.SmoothingMode = SmoothingMode.HighQuality;
+ graphics.DrawImage(srcImage, 0, 0, width, height);
+ }
+
+ using (var memoryStream = new MemoryStream())
+ {
+ newImage.Save(memoryStream, ImageFormat.Jpeg);
+ return Convert.ToBase64String(memoryStream.ToArray());
+ }
+ }
+ }
+
+ public static PersianDateTime ToFirstDayOfNextMonth(this DateTime date)
+ {
+ var pc = new PersianCalendar();
+ var year = pc.GetYear(date);
+ var month = pc.GetMonth(date);
+
+ if (month == 12)
+ {
+ year += 1;
+ month = 1;
+ }
+ else
+ {
+ month += 1;
+ }
+
+ return new PersianDateTime(year, month, 1);
+
+ }
#endregion
+ #region Safa
+
+ public static string GetContentTypeImage(string extension)
+ {
+ if (!extension.StartsWith("."))
+ {
+ extension = "." + extension;
+ }
+
+ return extension.ToLower() switch
+ {
+ ".jpg" => "image/jpeg",
+ ".jpeg" => "image/jpeg",
+ ".png" => "image/png",
+ ".gif" => "image/gif",
+ ".bmp" => "image/bmp",
+ ".svg" => "image/svg+xml",
+ ".ico" => "image/x-icon",
+ _ => "",
+ };
+ }
+
+ public static string GetContentType(string extension)
+ {
+
+ // Ensure the extension starts with a dot
+ if (!extension.StartsWith("."))
+ {
+ extension = "." + extension;
+ }
+
+ // Use switch expression to return the appropriate content type
+ return extension.ToLower() switch
+ {
+ ".txt" => "text/plain",
+ ".htm" => "text/html",
+ ".html" => "text/html",
+ ".css" => "text/css",
+ ".js" => "application/javascript",
+ ".json" => "application/json",
+ ".xml" => "application/xml",
+ ".pdf" => "application/pdf",
+ ".zip" => "application/zip",
+ ".rar" => "application/x-rar-compressed",
+ ".tar" => "application/x-tar",
+ ".mp3" => "audio/mpeg",
+ ".wav" => "audio/wav",
+ ".mp4" => "video/mp4",
+ ".avi" => "video/x-msvideo",
+ ".doc" => "application/msword",
+ ".docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ ".xls" => "application/vnd.ms-excel",
+ ".xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ ".ppt" => "application/vnd.ms-powerpoint",
+ ".pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
+ _ => "application/octet-stream",
+ };
+ }
+
+ #endregion
public static string ConvertToEnglish(this string value)
{
if (string.IsNullOrEmpty(value))
@@ -991,6 +1098,7 @@ public static class Tools
return false;
return true;
}
+
#region Mahan
public static string ToFarsiDuration(this string date)
{
@@ -1103,6 +1211,14 @@ public static class Tools
}
}
+ #region DayOfWeekMethods
+
+ public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek)
+ {
+ int numberOfNextDayOfWeek = ((int)dayOfWeek - (int)date.DayOfWeek + 7) % 7;
+ return date.AddDays(numberOfNextDayOfWeek == 0 ? 7 : numberOfNextDayOfWeek);
+ }
+ #endregion
//این متد آخر همان روز را به صورت دیت تایم برمیگرداند
public static DateTime ToGeorgianDateTime2(this string persianDate)
@@ -1121,8 +1237,6 @@ public static class Tools
return res;
-
-
}
catch (Exception e)
{
@@ -1158,6 +1272,37 @@ public static class Tools
}
+ public static string DayOfWeeKToPersian(this DayOfWeek dayOfWeek)
+ {
+ return dayOfWeek switch
+ {
+ DayOfWeek.Friday => "جمعه",
+ DayOfWeek.Monday => "دوشنبه",
+ DayOfWeek.Saturday => "شنبه",
+ DayOfWeek.Sunday => "یکشنبه",
+ DayOfWeek.Thursday => "پنجشنبه",
+ DayOfWeek.Tuesday => "سه شنبه",
+ DayOfWeek.Wednesday => "چهارشنبه",
+ _ => ""
+ };
+ }
+
+
+ #endregion
+
+ #region Pooya
+
+
+
+ public static DateTime GetUndefinedDateTime()
+ {
+ return new DateTime(2121, 03, 21);
+ }
+
+ public static bool IsDateUndefined(this DateTime date)
+ {
+ return date == new DateTime(2121, 03, 21);
+ }
#endregion
}
\ No newline at end of file
diff --git a/0_Framework/Application/Version.cs b/0_Framework/Application/Version.cs
index 6f239308..0984e674 100644
--- a/0_Framework/Application/Version.cs
+++ b/0_Framework/Application/Version.cs
@@ -10,8 +10,8 @@ public static class Version
{
static Version()
{
- StyleVersion = "2.11.34";
- AdminVersion = "2.5.19";
+ StyleVersion = "2.12.00";
+ AdminVersion = "2.5.20";
CameraVersion = "1.0.3";
}
diff --git a/AccountManagement.Application.Contracts/Account/AccountViewModel.cs b/AccountManagement.Application.Contracts/Account/AccountViewModel.cs
index 2794917e..fea1dcd8 100644
--- a/AccountManagement.Application.Contracts/Account/AccountViewModel.cs
+++ b/AccountManagement.Application.Contracts/Account/AccountViewModel.cs
@@ -21,6 +21,8 @@ public class AccountViewModel
public int PositionValue { get; set; }
public long PositionId { get; set; }
+ public string PositionIsActive { get; set; }
+
#endregion
public string AdminAreaPermission { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
index 08f1c7ea..f071ccfb 100644
--- a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
+++ b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
@@ -37,7 +37,7 @@ public interface IAccountApplication
OperationResult CreateNewWorkshopAccount(long currentAccountId, long newAccountId);
#region Mahan
- List AccountsForAssign(long accountId);
+ List AccountsForAssign(long taskId);
List GetAccountsByPositionId(long positionId);
List GetAccountLowerPositionvalue();
diff --git a/AccountManagement.Application.Contracts/Assign/AssignViewModel.cs b/AccountManagement.Application.Contracts/Assign/AssignViewModel.cs
index fcb0cd54..9a60702f 100644
--- a/AccountManagement.Application.Contracts/Assign/AssignViewModel.cs
+++ b/AccountManagement.Application.Contracts/Assign/AssignViewModel.cs
@@ -1,9 +1,41 @@
+using System.Collections.Generic;
+using System;
+
namespace AccountManagement.Application.Contracts.Assign;
-public class AssignViewModel:EditAssign
+public class AssignViewModel
{
+ public long Id { get; set; }
public string AssignedName { get; set; }
public int AssignedPositionValue { get; set; }
+ public long AssignerId { get; set; }
+ public long AssignedId { get; set; }
+ public long TaskId { get; set; }
+ public int AssignerPositionValue { get; set; }
+ //زمان پایان وظیفه
+ public string EndTaskDateFa { get; set; }
+ public DateTime EndTaskDateGr { get; set; }
+ //آیا درخواست مهلت کرده است؟
+ public bool TimeRequest { get; set; }
+ //تعداد تایید درخواست مهلت
+ public int AcceptedTimeRequest { get; set; }
+ //مهلت زمان درخواست شده
+ public DateTime? RequestDate { get; set; }
+ public string? RequestDateFa { get; set; }
+ //توضیحات درخواست مهلت
+ public string? TimeRequestDescription { get; set; }
+ //آیا درخواست انصراف داده شده
+
+ //آیا کنسل شده است
+ public bool IsCancel { get; set; }
+ //توضیحات درخواست انصراف
+ public string? CancelDescription { get; set; }
+ public bool IsDone { get; set; }
+ public bool IsDoneRequest { get; set; }
+
+ public string? DoneDescription { get; set; }
+ public bool IsCanceledRequest { get; set; }
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Assign/CreateAssign.cs b/AccountManagement.Application.Contracts/Assign/CreateAssign.cs
index ff5361c7..f3aad268 100644
--- a/AccountManagement.Application.Contracts/Assign/CreateAssign.cs
+++ b/AccountManagement.Application.Contracts/Assign/CreateAssign.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace AccountManagement.Application.Contracts.Assign;
@@ -8,5 +9,27 @@ public class CreateAssign
public List AssignedId { get; set; }
public long TaskId { get; set; }
public int AssignerPositionValue { get; set; }
+ //زمان پایان وظیفه
+ public string EndTaskDateFa { get; set; }
+ public DateTime EndTaskDateGr { get; set; }
+ //آیا درخواست مهلت کرده است؟
+ public bool TimeRequest { get; set; }
+ //تعداد تایید درخواست مهلت
+ public int AcceptedTimeRequest { get; set; }
+ //مهلت زمان درخواست شده
+ public DateTime? RequestDate { get; set; }
+ //توضیحات درخواست مهلت
+ public string? TimeRequestDescription { get; set; }
+ //آیا درخواست انصراف داده شده
+
+ //آیا کنسل شده است
+ public bool IsCancel { get; set; }
+ //توضیحات درخواست انصراف
+ public string? CancelDescription { get; set; }
+ public bool IsDone { get; set; }
+ public bool IsDoneRequest { get; set; }
+
+ public string? DoneDescription { get; set; }
+ public bool IsCanceledRequest { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/CameraAccount/CreateCameraAccount.cs b/AccountManagement.Application.Contracts/CameraAccount/CreateCameraAccount.cs
index 477d36d9..0c405125 100644
--- a/AccountManagement.Application.Contracts/CameraAccount/CreateCameraAccount.cs
+++ b/AccountManagement.Application.Contracts/CameraAccount/CreateCameraAccount.cs
@@ -10,6 +10,7 @@ public class CreateCameraAccount
{
public string Username { get; set; }
public string Password { get; set; }
+ public string RePassword { get; set; }
public string Mobile { get; set; }
public long WorkshopId { get; set; }
public string WorkshopName { get; set; }
diff --git a/AccountManagement.Application.Contracts/Task/CompleteTaskViewModel.cs b/AccountManagement.Application.Contracts/Task/CompleteTaskViewModel.cs
index 73389d6e..9a2133e9 100644
--- a/AccountManagement.Application.Contracts/Task/CompleteTaskViewModel.cs
+++ b/AccountManagement.Application.Contracts/Task/CompleteTaskViewModel.cs
@@ -2,6 +2,6 @@
public class CompleteTaskViewModel
{
- public long Id { get; set; }
+ public long TaskId { get; set; }
public string? Description { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Task/CreateTask.cs b/AccountManagement.Application.Contracts/Task/CreateTask.cs
index 8b951b5f..47f37d30 100644
--- a/AccountManagement.Application.Contracts/Task/CreateTask.cs
+++ b/AccountManagement.Application.Contracts/Task/CreateTask.cs
@@ -16,6 +16,17 @@ public class CreateTask
public List UploadedMedia { get; set; }
public long UploadedVoiceMedia { get; set; }
+ #region Task Schedule
+
+ public string ScheduleCount { get; set; }
+ public string ScheduleType{ get; set; }
+ public bool HasSchedule { get; set; }
+ public string ScheduleUnitType { get; set; }
+ public string ScheduleUnitNumber { get; set; }
+
+
+ #endregion
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Task/CreateTaskCancel.cs b/AccountManagement.Application.Contracts/Task/CreateTaskCancel.cs
index b7e2ffee..a20c74c6 100644
--- a/AccountManagement.Application.Contracts/Task/CreateTaskCancel.cs
+++ b/AccountManagement.Application.Contracts/Task/CreateTaskCancel.cs
@@ -1,4 +1,6 @@
-namespace AccountManagement.Application.Contracts.Task;
+using System.Security.AccessControl;
+
+namespace AccountManagement.Application.Contracts.Task;
public class CreateTaskCancel
{
public long TaskId { get; set; }
diff --git a/AccountManagement.Application.Contracts/Task/CreateTaskModal.cs b/AccountManagement.Application.Contracts/Task/CreateTaskModal.cs
new file mode 100644
index 00000000..30064a53
--- /dev/null
+++ b/AccountManagement.Application.Contracts/Task/CreateTaskModal.cs
@@ -0,0 +1,19 @@
+using AccountManagement.Application.Contracts.Account;
+using AccountManagement.Application.Contracts.Position;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccountManagement.Application.Contracts.Task;
+public class CreateTaskModal
+{
+ public CreateTask Command { get; set; }
+ public long TicketId{ get; set; }
+ public List AccountsList { get; set; }
+ public List PositionViewModels { get; set; }
+ public string DateFa { get; set; }
+ public long Id { get; set; }
+}
+
diff --git a/AccountManagement.Application.Contracts/Task/EditTask.cs b/AccountManagement.Application.Contracts/Task/EditTask.cs
index 7974ddb9..4c9f1fbc 100644
--- a/AccountManagement.Application.Contracts/Task/EditTask.cs
+++ b/AccountManagement.Application.Contracts/Task/EditTask.cs
@@ -1,5 +1,8 @@
using System.Collections.Generic;
+using AccountManagement.Application.Contracts.Account;
+using AccountManagement.Application.Contracts.Assign;
using AccountManagement.Application.Contracts.Media;
+using AccountManagement.Application.Contracts.Ticket;
namespace AccountManagement.Application.Contracts.Task;
public class EditTask:CreateTask
@@ -8,5 +11,12 @@ public class EditTask:CreateTask
public List medias { get; set; }
public string? CompleteDescription { get; set; }
public bool IsDone { get; set; }
+ public bool IsCancel { get; set; }
+ public string CreateDateFa { get; set; }
public List DeletedFileIds { get; set; }
+ public List AssignViewModels { get; set; }
+ public AccountViewModel SenderViewModel { get; set; }
+ public EditTicket TicketViewModel { get; set; }
+ public long? TicketId { get; set; }
+ public List AssignsLists { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Task/ITaskApplication.cs b/AccountManagement.Application.Contracts/Task/ITaskApplication.cs
index b2cf6640..9318f10e 100644
--- a/AccountManagement.Application.Contracts/Task/ITaskApplication.cs
+++ b/AccountManagement.Application.Contracts/Task/ITaskApplication.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Assign;
+using AccountManagement.Application.Contracts.TaskMessage;
using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application.Contracts.Task;
@@ -11,44 +12,53 @@ public interface ITaskApplication
OperationResult RemoveTask(long TaskId);
OperationResult RemoveFile(long MediaId);
OperationResult Edit(EditTask command);
-
OperationResult CreateAssign(CreateAssign command);
-
OperationResult CreateTask(CreateTask command);
OperationResult CreateTaskByPosition(CreateTask command);
- EditTask GetDetails(long taskId);
+ EditTask GetDetails(long taskId);
//گرفتن تمامی وظایف
List GetTasks(TaskSearchModel searchModel);
List GetSelfTasks(TaskSearchModel searchModel);
- List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel);
+ List GetAllTasks(TaskSearchModel searchModel);
+ //List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel);
List GetReceivedTasks(TaskSearchModel searchModel);
List GetSentTasks(TaskSearchModel searchModel);
- // گرفتن مهلت برای یک وظیفه
- OperationResult CreateRequestTime(CreateTaskTimeRequest command);
+ // گرفتن مهلت برای یک وظیفه
+ OperationResult CreateRequestTime(CreateTaskTimeRequest command);
//تایید مهلت وظیفه
- OperationResult AcceptRequestDatetime(long taskId);
- OperationResult RejectTimeRequest(long taskId);
+ OperationResult AcceptRequestDatetime(long taskId, long assignedId,string message);
+ OperationResult RejectTimeRequest(long taskId, long assignedId, string message);
+
//درخواست انصراف وظیفه
OperationResult CreateCancelRequest(CreateTaskCancel command);
//تایید اانصراف وظیفه
- OperationResult AcceptCancelRequest(long taskId);
- OperationResult RejectCancelRequest(long taskId);
+ OperationResult AcceptCancelRequest(long taskId,long assignedId, string message);
+ OperationResult RejectCancelRequest(long taskId, long assignedId, string message);
OperationResult CreateCompleteTaskRequest(CompleteTaskViewModel command);
- OperationResult AcceptCompleteRequest(long taskId);
- OperationResult RejectCompleteRequest(long taskId);
+ OperationResult AcceptCompleteRequest(long taskId, long assignedId, string message);
+ OperationResult RejectCompleteRequest(long taskId, long assignedId, string message);
OperationResult CreateTaskByPosition(CreateTask command, List positionIds);
List GetRequestedTasks(TaskSearchModel searchModel);
List AllRequestedTasks(TaskSearchModel searchModel);
int GetRequestedTasksCount();
+ List GetTaskMessages(long assignId);
- OperationResult ChangeRequestTimeAndAccept(string time,long taskId);
- TaskViewModel GetRequestDetails(long id);
- OperationResult UploadMedia(IFormFile mediaFile,long senderId);
+ OperationResult ChangeRequestTimeAndAccept(string time,long taskId,long assignedId, string message);
+ EditTask GetRequestDetails(long id);
+ OperationResult UploadMedia(IFormFile mediaFile, long senderId);
OperationResult RemoveMedia(long mediaId);
void RemoveTempUploadedFiles(long userId);
+
+ OperationResult SendTicketResponseInTask(long assignId,string message,long ticketId);
+
+ List GetAssignsByTaskId(long taskId);
+
+
+ //متد انتقال داده از تسک به ارجاعی ها
+ //OperationResult MoveDataFRomTaskToAssign();
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Task/TaskViewModel.cs b/AccountManagement.Application.Contracts/Task/TaskViewModel.cs
index 9cbafc26..f66b07a2 100644
--- a/AccountManagement.Application.Contracts/Task/TaskViewModel.cs
+++ b/AccountManagement.Application.Contracts/Task/TaskViewModel.cs
@@ -18,26 +18,22 @@ public class TaskViewModel
public string EndTaskDateFA { get; set; }
public string EndTaskTime { get; set; }
public string RequestTaskDate { get; set; }
-
public bool IsDone { get; set; }
public bool IsDoneRequest { get; set; }
public string IsDoneDescription { get; set; }
-
- public bool RequestCancel { get; set; }
+ public bool RequestCancel { get; set; }
public bool RequestTime { get; set; }
public bool IsCancel { get; set; }
public bool IsCancelRequest { get; set; }
public string CancelDescription { get; set; }
public int AcceptedTimeRequest { get; set; }
public string TimeRequestDescription { get; set; }
-
- public DateTime EndTaskDateGE { get; set; }
+ public DateTime EndTaskDateGE { get; set; }
public DateTime CreateTaskDateGE { get; set; }
public string ContractingPartyName { get; set; }
public string? Description { get; set; }
public AccountViewModel Sender { get; set; }
public string Assigner { get; set; }
-
public string SelfName { get; set; }
public long SenderId { get; set; }
public string Color { get; set; }
@@ -52,5 +48,7 @@ public class TaskViewModel
public bool CanDelete { get; set; }
public bool CanAssign { get; set; }
public bool CanCheckRequests { get; set; }
+ public AssignViewModel AssignedReceiverViewModel { get; set; }
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TaskMessage/CreateTaskMessage.cs b/AccountManagement.Application.Contracts/TaskMessage/CreateTaskMessage.cs
new file mode 100644
index 00000000..b7f604b7
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TaskMessage/CreateTaskMessage.cs
@@ -0,0 +1,9 @@
+namespace AccountManagement.Application.Contracts.TaskMessage;
+
+public class CreateTaskMessage
+{
+ public string Message { get; set; }
+ public long AssignId { get; set; }
+ public long SenderId { get; set; }
+ public long ReceiverId { get; set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TaskMessage/EditTaskMessage.cs b/AccountManagement.Application.Contracts/TaskMessage/EditTaskMessage.cs
new file mode 100644
index 00000000..6129b1d3
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TaskMessage/EditTaskMessage.cs
@@ -0,0 +1,6 @@
+namespace AccountManagement.Application.Contracts.TaskMessage;
+
+public class EditTaskMessage:CreateTaskMessage
+{
+ public long Id { get; set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TaskMessage/TaskMessageViewModel.cs b/AccountManagement.Application.Contracts/TaskMessage/TaskMessageViewModel.cs
new file mode 100644
index 00000000..9a25249b
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TaskMessage/TaskMessageViewModel.cs
@@ -0,0 +1,14 @@
+using System.Security.Cryptography;
+
+namespace AccountManagement.Application.Contracts.TaskMessage;
+
+public class TaskMessageViewModel
+{
+ public string Message { get; set; }
+ public string SenderName { get; set; }
+ public long SenderId { get; set; }
+ public long ReceiverId { get; set; }
+ public string TypeOfMessage { get; set; }
+ public string RequestedDateFa { get; set; }
+ public string CreationDate { get; set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TaskSchedule/ITaskScheduleApplication.cs b/AccountManagement.Application.Contracts/TaskSchedule/ITaskScheduleApplication.cs
new file mode 100644
index 00000000..a67e9ac8
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TaskSchedule/ITaskScheduleApplication.cs
@@ -0,0 +1,12 @@
+using _0_Framework.Application;
+using AccountManagement.Application.Contracts.Task;
+
+namespace AccountManagement.Application.Contracts.TaskSchedule;
+
+public interface ITaskScheduleApplication
+{
+ OperationResult Create(CreateTask command);
+ OperationResult CreateLimitedTasks(CreateTask command);
+ OperationResult CreateUnlimitedTasks(CreateTask command);
+
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/AdminResponseViewModel.cs b/AccountManagement.Application.Contracts/Ticket/AdminResponseViewModel.cs
index bc15c709..0bf58190 100644
--- a/AccountManagement.Application.Contracts/Ticket/AdminResponseViewModel.cs
+++ b/AccountManagement.Application.Contracts/Ticket/AdminResponseViewModel.cs
@@ -1,11 +1,17 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using AccountManagement.Application.Contracts.Media;
namespace AccountManagement.Application.Contracts.Ticket;
public class AdminResponseViewModel
{
+ public long Id { get; set; }
+ public string FullName { get; set; }
+ public string IsActive { get; set; }
public long TicketId { get; set; }
public string Response { get; set; }
+ public long AdminAccountId { get; set; }
+ public DateTime CreationDate { get; set; }
public List MediaViewModels { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/CreateTicket.cs b/AccountManagement.Application.Contracts/Ticket/CreateTicket.cs
index 5821c6e1..ce17caec 100644
--- a/AccountManagement.Application.Contracts/Ticket/CreateTicket.cs
+++ b/AccountManagement.Application.Contracts/Ticket/CreateTicket.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application.Contracts.Ticket;
@@ -12,5 +13,7 @@ public class CreateTicket
public string TicketType { get; set; }
public List UploadedMediaIds { get; set; }
public long ScreenShotId { get; set; }
- public long VoiceId { get; set; }
+ public long VoiceId { get; set; }
+ public DateTime CreationDate { get; set; }
+ public long WorkshopId { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/CreateTicketViewModel.cs b/AccountManagement.Application.Contracts/Ticket/CreateTicketViewModel.cs
new file mode 100644
index 00000000..a7c691e4
--- /dev/null
+++ b/AccountManagement.Application.Contracts/Ticket/CreateTicketViewModel.cs
@@ -0,0 +1,10 @@
+namespace AccountManagement.Application.Contracts.Ticket;
+
+public class CreateTicketViewModel
+{
+ public string FullName { get; set; }
+ public string CreateDate { get; set; }
+ public string WorkshopName { get; set; }
+ public string PhoneNumber { get; set; }
+
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/EditTicket.cs b/AccountManagement.Application.Contracts/Ticket/EditTicket.cs
index 77ec0ae0..84327f00 100644
--- a/AccountManagement.Application.Contracts/Ticket/EditTicket.cs
+++ b/AccountManagement.Application.Contracts/Ticket/EditTicket.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using AccountManagement.Application.Contracts.Account;
using AccountManagement.Application.Contracts.Media;
namespace AccountManagement.Application.Contracts.Ticket;
@@ -7,6 +8,12 @@ public class EditTicket:CreateTicket
{
public long Id { get; set; }
public List MediaViewModels { get; set; }
- public List AdminResponseViewModels{ get; set; }
+ public List ResponseViewModels { get; set; }
+ public List AdminResponseViewModels{ get; set; }
public List ClientResponseViewModels { get; set; }
+ public AccountViewModel Sender { get; set; }
+ public string WorkshopName { get; set; }
+ public string TicketNumber { get; set; }
+ public string CreationDateStr { get; set; }
+ public string Status { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/ITicketApplication.cs b/AccountManagement.Application.Contracts/Ticket/ITicketApplication.cs
index b4095f5a..64878bee 100644
--- a/AccountManagement.Application.Contracts/Ticket/ITicketApplication.cs
+++ b/AccountManagement.Application.Contracts/Ticket/ITicketApplication.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Task;
+using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application.Contracts.Ticket;
@@ -12,6 +13,21 @@ public interface ITicketApplication
OperationResult AdminResponseTicket(ResponseTicket command);
OperationResult ClientResponseTicket(ResponseTicket command);
EditTicket GetDetails(long id);
+ EditTicket GetDetailsForClient(long id);
List GetAll(TicketSearchModel searchModel);
bool IsExist(long id);
+ OperationResult UploadMedia(IFormFile mediaFile, long senderId);
+ OperationResult RemoveMedia(long mediaId);
+ void RemoveTempUploadedFiles(long userId);
+ List GetTicketsForClients(TicketSearchModel searchModel);
+
+ OperationResult AcceptPendingAdminResponse(long adminResId);
+ OperationResult RejectPendingAdminResponse(long adminResId);
+ OperationResult EditAndAcceptPendingAdminResponse(long adminResId,string newResponse);
+ OperationResult DeletePendingAdminResponse(int adminResId);
+ OperationResult EditPendingAdminResponse(long adminResId, string newMessage);
+ OperationResult CloseTicket(long ticketId);
+
+
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/Response.cs b/AccountManagement.Application.Contracts/Ticket/Response.cs
index 5b09069a..9604fdeb 100644
--- a/AccountManagement.Application.Contracts/Ticket/Response.cs
+++ b/AccountManagement.Application.Contracts/Ticket/Response.cs
@@ -8,9 +8,16 @@ using System.Threading.Tasks;
namespace AccountManagement.Application.Contracts.Ticket;
public class Response
{
+ public long AdminResponseId { get; set; }
+ public long ClientResponseId { get; set; }
public long TicketId { get; set; }
+ public string FullName { get; set; }
public string ResponseMessage { get; set; }
public bool IsAdmin { get; set; }
public bool IsClient { get; set; }
+ public string IsActive { get; set; }
+ public long AdminAccountId { get; set; }
public List MediaViewModels { get; set; }
+ public DateTime CreationDate { get; set; }
+ public string CreationDateStr { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/ResponseTicket.cs b/AccountManagement.Application.Contracts/Ticket/ResponseTicket.cs
index a233e0d9..bca66c91 100644
--- a/AccountManagement.Application.Contracts/Ticket/ResponseTicket.cs
+++ b/AccountManagement.Application.Contracts/Ticket/ResponseTicket.cs
@@ -6,6 +6,7 @@ public class ResponseTicket
{
public long TicketId { get; set; }
public string Response { get; set; }
+ public long AdminId { get; set; }
public List UploadedFileIds { get; set; }
public long VoiceId { get; set; }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Ticket/TicketSearchModel.cs b/AccountManagement.Application.Contracts/Ticket/TicketSearchModel.cs
index 074e9689..57cd63ba 100644
--- a/AccountManagement.Application.Contracts/Ticket/TicketSearchModel.cs
+++ b/AccountManagement.Application.Contracts/Ticket/TicketSearchModel.cs
@@ -2,6 +2,14 @@
public class TicketSearchModel
{
+ public int PageIndex { get; set; }
+
+ public string TicketNumber { get; set; }
+
+ public long WorkshopId { get; set; }
+
+ public long ClientAccountId { get; set; }
+
public string StartDate { get; set; }
public string EndDate { get; set; }
@@ -10,11 +18,7 @@ public class TicketSearchModel
public string OneDay { get; set; }
- public string IsAssigned { get; set; }
-
- public string TypeOfTicket { get; set; }
-
- public string Title { get; set; }
+ public string GeneralSearch { get; set; }
public string Status { get; set; }
diff --git a/AccountManagement.Application.Contracts/Ticket/TicketViewModel.cs b/AccountManagement.Application.Contracts/Ticket/TicketViewModel.cs
index 123a2681..33e2f08f 100644
--- a/AccountManagement.Application.Contracts/Ticket/TicketViewModel.cs
+++ b/AccountManagement.Application.Contracts/Ticket/TicketViewModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Security.AccessControl;
namespace AccountManagement.Application.Contracts.Ticket;
@@ -11,5 +12,10 @@ public class TicketViewModel:EditTicket
public string CreationDateTime { get; set; }
public DateTime CreationDateTimeGr { get; set; }
public long? TaskId { get; set; }
+ public bool HasTask { get; set; }
+ public string RawTicketNumber { get; set; }
+ public int PageIndex { get; set; }
+
+
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TicketAccessAccount/ITicketAccessAccountApplication.cs b/AccountManagement.Application.Contracts/TicketAccessAccount/ITicketAccessAccountApplication.cs
new file mode 100644
index 00000000..c8ba6b33
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TicketAccessAccount/ITicketAccessAccountApplication.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using System.Runtime.InteropServices.ComTypes;
+using _0_Framework.Application;
+using AccountManagement.Application.Contracts.Account;
+
+namespace AccountManagement.Application.Contracts.TicketAccessAccount;
+
+public interface ITicketAccessAccountApplication
+{
+ bool HasTicketAccess(long accountId);
+ OperationResult Create(long accountId);
+ OperationResult Delete(long id);
+ List GetAllAccessedAccounts();
+}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/TicketAccessAccount/TicketAccessAccountViewModel.cs b/AccountManagement.Application.Contracts/TicketAccessAccount/TicketAccessAccountViewModel.cs
new file mode 100644
index 00000000..0036aab3
--- /dev/null
+++ b/AccountManagement.Application.Contracts/TicketAccessAccount/TicketAccessAccountViewModel.cs
@@ -0,0 +1,9 @@
+namespace AccountManagement.Application.Contracts.TicketAccessAccount;
+
+public class TicketAccessAccountViewModel
+{
+ public long Id { get; set; }
+ public long AccountId { get; set; }
+ public string Name { get; set; }
+ public string CreateDateFa { get; set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs
index 23fcacd0..52004db4 100644
--- a/AccountManagement.Application/AccountApplication.cs
+++ b/AccountManagement.Application/AccountApplication.cs
@@ -444,15 +444,15 @@ public class AccountApplication : IAccountApplication
{
return this._accountLeftworkRepository.SaveWorkshopAccount(workshopAccountList, startDate, leftDate, accountId);
}
-
public OperationResult CreateNewWorkshopAccount(long currentAccountId, long newAccountId)
{
return this._accountLeftworkRepository.CopyWorkshopToNewAccount(currentAccountId, newAccountId);
}
+ #region Mahan
- public List AccountsForAssign(long accountId)
+ public List AccountsForAssign(long taskId)
{
- return _accountRepository.AccountsForAssign(accountId);
+ return _accountRepository.AccountsForAssign(taskId);
}
public List GetAccountsByPositionId(long positionId)
@@ -471,25 +471,28 @@ public class AccountApplication : IAccountApplication
public OperationResult ReLogin()
{
- var prAcc = _authHelper.CurrentAccountInfo();
- var operation = new OperationResult();
- var account = _accountRepository.GetIncludePositions(prAcc.Id);
- if (account == null)
- return operation.Failed("این اکانت وجود ندارد");
+ var prAcc = _authHelper.CurrentAccountInfo();
+ var operation = new OperationResult();
+ var account = _accountRepository.GetIncludePositions(prAcc.Id);
+ if (account == null)
+ return operation.Failed("این اکانت وجود ندارد");
- var permissions = _roleRepository.Get(account.RoleId)
- .Permissions
- .Select(x => x.Code)
- .ToList();
+ var permissions = _roleRepository.Get(account.RoleId)
+ .Permissions
+ .Select(x => x.Code)
+ .ToList();
- _authHelper.SignOut();
- var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
- , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, account.Position.PositionValue);
- _authHelper.Signin(authViewModel);
- return operation.Succcedded(2);
+ _authHelper.SignOut();
+ var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
+ , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, account.Position.PositionValue);
+ _authHelper.Signin(authViewModel);
+ return operation.Succcedded(2);
+
+ }
+
+ #endregion
- }
}
\ No newline at end of file
diff --git a/AccountManagement.Application/AccountManagement.Application.csproj b/AccountManagement.Application/AccountManagement.Application.csproj
index cab6f7be..7fcb4ebe 100644
--- a/AccountManagement.Application/AccountManagement.Application.csproj
+++ b/AccountManagement.Application/AccountManagement.Application.csproj
@@ -7,6 +7,7 @@
+
diff --git a/AccountManagement.Application/PositionApplication.cs b/AccountManagement.Application/PositionApplication.cs
index decf6050..8f7e969a 100644
--- a/AccountManagement.Application/PositionApplication.cs
+++ b/AccountManagement.Application/PositionApplication.cs
@@ -3,21 +3,24 @@ using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using AccountManagement.Application.Contracts.Position;
using AccountManagement.Domain.AccountAgg;
+using AccountManagement.Domain.AssignAgg;
using TaskManager.Domain.PositionAgg;
namespace TaskManager.Application;
-public class PositionApplication:IPositionApplication
+public class PositionApplication : IPositionApplication
{
private readonly IPositionRepository _positionRepository;
private readonly IAccountRepository _accountRepository;
private readonly IAccountApplication _accountApplication;
+ private readonly IAssignRepository _assignRepository;
- public PositionApplication(IPositionRepository positionRepository, IAccountRepository accountRepository, IAccountApplication accountApplication)
+ public PositionApplication(IPositionRepository positionRepository, IAccountRepository accountRepository, IAccountApplication accountApplication, IAssignRepository assignRepository)
{
_positionRepository = positionRepository;
_accountRepository = accountRepository;
_accountApplication = accountApplication;
+ _assignRepository = assignRepository;
}
//ساخت پوزیشن
public OperationResult Create(CreatePosition command)
@@ -29,18 +32,18 @@ public class PositionApplication:IPositionApplication
}
- if (command.Value==0)
+ if (command.Value == 0)
{
return operation.Failed("لطفا سطح سمت را وارد کنید");
}
- if (command.Value>5)
+ if (command.Value > 5)
{
return operation.Failed(" سطح سمت وارد شده معتبر نمیباشد");
}
- if (_positionRepository.Exists(x=>x.PositionValue==command.Value))
+ if (_positionRepository.Exists(x => x.PositionValue == command.Value))
{
return operation.Failed("سطح انتخاب شده قبلا تعریف شده است");
}
@@ -54,12 +57,12 @@ public class PositionApplication:IPositionApplication
public OperationResult SaveAccountPosition(List accountIds, long positionId)
{
var operation = new OperationResult();
- if (!_positionRepository.Exists(x=>x.id==positionId))
+ if (!_positionRepository.Exists(x => x.id == positionId))
{
return operation.Failed("چنین سمتی وجود ندارد");
}
- if (accountIds.Count<1)
+ if (accountIds.Count < 1)
{
return operation.Failed("لطفا شخصی برای ذخیره انتخاب کنید");
}
@@ -80,21 +83,31 @@ public class PositionApplication:IPositionApplication
public List GetUnUsedPositionValues()
{
- return _positionRepository.GetUnUsedPositionValues();
+ return _positionRepository.GetUnUsedPositionValues();
}
public OperationResult Remove(long id)
{
var operation = new OperationResult();
- if (!_positionRepository.Exists(x=>x.id==id))
+ if (!_positionRepository.Exists(x => x.id == id))
{
- return operation.Failed("سمت مورد نظر یافت نشد");
+ return operation.Failed("گروه مورد نظر یافت نشد");
}
- if (_accountApplication.GetAccountsByPositionId(id).Count>0)
+ if (_accountApplication.GetAccountsByPositionId(id).Count > 0)
{
- return operation.Failed("شما نمیتوانید سمتی که در آن شخصی وجود دارد را حذف کنید.");
+ return operation.Failed("شما نمیتوانید گروهی که در آن شخصی وجود دارد را حذف کنید.");
+ }
+ var deActives = _accountRepository.GetAccountsDeactivePositionValue(id);
+
+ if (deActives?.Count > 0)
+ {
+ foreach (var acc in deActives)
+ {
+ var account = _accountRepository.Get(acc.Id);
+ account.RemovePosition();
+ }
}
_positionRepository.Remove(id);
@@ -105,7 +118,7 @@ public class PositionApplication:IPositionApplication
public OperationResult Edit(EditPosition command)
{
var operation = new OperationResult();
- if (_positionRepository.Exists(x=>x.id!=command.Id&&x.PositionName==command.Name))
+ if (_positionRepository.Exists(x => x.id != command.Id && x.PositionName == command.Name))
{
return operation.Failed("سمتی با این نام وجود دارد");
}
@@ -115,13 +128,13 @@ public class PositionApplication:IPositionApplication
}
var position = _positionRepository.Get(command.Id);
- position.Edit(command.Name,command.Value);
+ position.Edit(command.Name, command.Value);
_positionRepository.SaveChanges();
return operation.Succcedded(command.Id);
}
//گرفتن تمامی پوزیشن ها برای نمایش
- public List GetPositions()=>
+ public List GetPositions() =>
_positionRepository.GetPositions();
//ذخیره پوزیشن
public OperationResult Save()
@@ -132,7 +145,7 @@ public class PositionApplication:IPositionApplication
//حذف یک شخص از یک گروه
public OperationResult RemoveAccountFromPosition(long positionId, long AccountId)
{
- var operation=new OperationResult();
+ var operation = new OperationResult();
if (!_accountRepository.Exists(x => x.id == AccountId))
{
return operation.Failed("چنین شخصی وجود ندارد");
@@ -142,19 +155,24 @@ public class PositionApplication:IPositionApplication
{
return operation.Failed("چنین شخصی در این گروه وجود ندارد");
}
- account.DeletePositionId();
+ account.DeActivePosition();
_positionRepository.SaveChanges();
-
- return operation.Succcedded();
+
+ return operation.Succcedded();
}
//حذف یک لیستی از اشخاص از یک گروه
public OperationResult RemoveAccountListFromPosition(List accountIdList, long PositionId)
{
- var operation= new OperationResult();
+ var operation = new OperationResult();
foreach (var account in accountIdList)
{
var acc = _accountRepository.GetIncludePositions(account);
- acc.DeletePositionId();
+ if (_assignRepository.Exists(x => x.AssignerId == acc.id || x.AssignedId == acc.id))
+ acc.DeActivePosition();
+
+ else
+
+ acc.RemovePosition();
}
_accountRepository.SaveChanges();
return operation.Succcedded();
diff --git a/AccountManagement.Application/TaskApplication.cs b/AccountManagement.Application/TaskApplication.cs
index 1bc26aec..c264deac 100644
--- a/AccountManagement.Application/TaskApplication.cs
+++ b/AccountManagement.Application/TaskApplication.cs
@@ -1,7 +1,6 @@
using _0_Framework.Application;
using System;
using System.Collections.Generic;
-using System.Data.OleDb;
using System.IO;
using System.Linq;
using AccountManagement.Application.Contracts.Assign;
@@ -10,12 +9,13 @@ using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.AssignAgg;
using AccountManagement.Domain.MediaAgg;
using AccountManagement.Domain.TaskAgg;
-using IPE.SmsIrClient.Models.Results;
using TaskManager.Domain.PositionAgg;
-using System.Reflection;
-
using Microsoft.AspNetCore.Http;
using System.Globalization;
+using AccountManagement.Application.Contracts.TaskMessage;
+using AccountManagement.Domain.AdminResponseAgg;
+using AccountManagement.Domain.TaskMessageAgg;
+using AccountManagement.Domain.TicketAgg;
namespace AccountManagement.Application;
@@ -27,11 +27,13 @@ public class TaskApplication : ITaskApplication
private readonly IPositionRepository _positionRepository;
private readonly IAssignRepository _assignRepository;
private readonly IHttpContextAccessor _contextAccessor;
-
+ private readonly ITaskMessageRepository _taskMessageRepository;
+ private readonly ITicketRepository _ticketRepository;
+
private readonly IAuthHelper _authHelper;
- public TaskApplication(ITaskRepository taskRepository, IAccountRepository accountRepository, IMediaRepository mediaRepository, IAssignRepository assignRepository, IHttpContextAccessor contextAccessor, IPositionRepository positionRepository, IAuthHelper authHelper)
+ public TaskApplication(ITaskRepository taskRepository, IAccountRepository accountRepository, IMediaRepository mediaRepository, IAssignRepository assignRepository, IHttpContextAccessor contextAccessor, IPositionRepository positionRepository, IAuthHelper authHelper, ITaskMessageRepository taskMessageRepository, ITicketRepository ticketRepository)
{
_taskRepository = taskRepository;
_accountRepository = accountRepository;
@@ -39,8 +41,9 @@ public class TaskApplication : ITaskApplication
_assignRepository = assignRepository;
_contextAccessor = contextAccessor;
_positionRepository = positionRepository;
-
_authHelper = authHelper;
+ _taskMessageRepository = taskMessageRepository;
+ _ticketRepository = ticketRepository;
}
//غیرفعال سازی تسک
public OperationResult DeActiveTask(long TaskId)
@@ -67,6 +70,7 @@ public class TaskApplication : ITaskApplication
}
var task = _taskRepository.Get(TaskId);
+ var assigns = _assignRepository.GetAssignsByTaskId(TaskId);
var positionValue = int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value);
var sender = _accountRepository.GetIncludePositions(task.SenderId);
if (sender.Position.PositionValue < positionValue)
@@ -74,7 +78,7 @@ public class TaskApplication : ITaskApplication
return operation.Failed("شما نمیتواند وظیفه ای که سطحی از شما پایین تر دارد را حذف کنید");
}
var medias = _mediaRepository.GetMediaByTaskId(TaskId);
- if (task.IsCanceledRequest || task.IsDone || task.IsCancel || task.TimeRequest || task.AcceptedTimeRequest > 0)
+ if (assigns.Any(x => x.IsCanceledRequest || x.IsDone || x.IsCancel || x.TimeRequest || x.AcceptedTimeRequest > 0))
{
task.DeActive();
}
@@ -114,22 +118,18 @@ public class TaskApplication : ITaskApplication
{
return operation.Failed("لطفا عنوان وظیفه خود ار وارد کنید");
}
-
if (string.IsNullOrEmpty(command.EndTaskDate))
{
return operation.Failed("لطفا تاریخ انجام وظیفه را وارد کنید");
}
-
if (command.ReceiverId.Count < 1)
{
return operation.Failed("طرف وظیفه خود را وارد کنید");
}
-
if (command.SenderId < 1)
{
return operation.Failed("خطای سیستمی!!!");
}
-
var sender = _accountRepository.GetIncludePositions(command.SenderId);
if (sender.Position.PositionValue < posValue)
{
@@ -167,14 +167,14 @@ public class TaskApplication : ITaskApplication
return operation.Failed("لطفا تاریخ را به درستی وارد کنید");
}
- task.Edit(command.Title, endTask, command.Description, command.SenderId, command.ContractingPartyName);
+ task.Edit(command.Title, command.Description, command.SenderId, command.ContractingPartyName);
_taskRepository.SaveChanges();
_assignRepository.RemoveRangeAssigns(task.id);
foreach (var receiver in receivers)
{
var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue,
receiver.Fullname,
- receiver.Position.PositionValue);
+ receiver.Position.PositionValue, endTask);
_assignRepository.Create(assign);
}
_assignRepository.SaveChanges();
@@ -184,53 +184,19 @@ public class TaskApplication : ITaskApplication
#region SaveDocuments
- if (command.UploadedMedia?.Count>0)
+ if (command.UploadedMedia?.Count > 0)
{
foreach (var mediaId in command.UploadedMedia)
{
- var media = _mediaRepository.Get(mediaId);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
-
-
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, media.Category);
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
+ MoveTaskFile(mediaId, task.id);
}
}
-
-
-
-
#endregion
-
-
if (command.UploadedVoiceMedia > 0)
{
- var media = _mediaRepository.Get(command.UploadedVoiceMedia);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
-
-
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, "صوت");
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
+ MoveTaskFile(command.UploadedVoiceMedia, task.id, "voice");
}
#region DeleteMedias
@@ -269,6 +235,28 @@ public class TaskApplication : ITaskApplication
return operation.Failed("خطای سیستمی!!");
}
+ var assignEntity = _assignRepository.GetAssignByAssignedIdAndTaskId(command.AssignerId, command.TaskId);
+ var now = DateTime.Now;
+ if (assignEntity.EndTaskDate < now)
+ {
+ operation.Failed("شما نمیتوانید وظیفه ای که مهلت آن گذشته است را به کسی ارجاع دهید");
+ }
+
+ if (_assignRepository.Exists(x => x.TaskId == command.TaskId && command.AssignedId.Contains(x.AssignedId)))
+ {
+ var assignedIdsInDataBase = _assignRepository.GetAssignedIdsByTaskId(command.TaskId);
+ var similarIds = assignedIdsInDataBase.Intersect(command.AssignedId).ToList();
+ var assignedAccounts = _accountRepository.GetAccountsByIds(similarIds);
+ string accNames = "";
+ foreach (var account in assignedAccounts)
+ {
+ accNames = accNames + account.Fullname + "،";
+
+ }
+ return operation.Failed($"به اشخاص {accNames} قبلا این تسک ارجاع داده شده است");
+ }
+
+
foreach (var assignedId in command.AssignedId)
{
if (!_accountRepository.Exists(x => x.id == assignedId))
@@ -278,13 +266,19 @@ public class TaskApplication : ITaskApplication
}
+
+
+ var task = _taskRepository.Get(command.TaskId);
+
+ var endOfDayDateTime = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
+
+
var assigner = _accountRepository.GetIncludePositions(command.AssignerId);
foreach (var assignedId in command.AssignedId)
{
var assigned = _accountRepository.GetIncludePositions(assignedId);
-
var assign = new Assign(command.TaskId, command.AssignerId, assignedId, assigner.Position.PositionValue,
- assigned.Fullname, assigned.Position.PositionValue);
+ assigned.Fullname, assigned.Position.PositionValue, endOfDayDateTime);
_assignRepository.Create(assign);
}
_assignRepository.SaveChanges();
@@ -296,8 +290,9 @@ public class TaskApplication : ITaskApplication
var operation = new OperationResult();
if (string.IsNullOrEmpty(command.Title))
{
- return operation.Failed("لطفا عنوان وظیفه خود ار وارد کنید");
+ return operation.Failed("لطفا عنوان وظیفه خود را وارد کنید");
}
+
var now = DateTime.Now.Date;
if (string.IsNullOrEmpty(command.EndTaskDate))
{
@@ -305,11 +300,9 @@ public class TaskApplication : ITaskApplication
return operation.Failed("لطفا تاریخ انجام وظیفه را وارد کنید");
}
-
-
if (string.IsNullOrEmpty(command.ContractingPartyName))
{
- return operation.Failed("لطفا طرف حساب خودرا وارد کنید");
+ return operation.Failed("لطفا طرف حساب خود را وارد کنید");
}
@@ -361,8 +354,6 @@ public class TaskApplication : ITaskApplication
{
}
-
-
var endTask = string.IsNullOrWhiteSpace(command.EndTaskTime) || command.EndTaskTime == "00:00" ? command.EndTaskDate.ToGeorgianDateTime2() : command.EndTaskDate.ToGeorgianDateWithTime(command.EndTaskTime);
var errorDateTime = new DateTime(3000, 12, 20, new PersianCalendar());
@@ -375,65 +366,34 @@ public class TaskApplication : ITaskApplication
{
return operation.Failed("لطفا تاریخ آینده را وارد کنید");
}
- var task = new Tasks(command.Title, endTask, command.Description, command.SenderId, command.ContractingPartyName);
+ var task = new Tasks(command.Title, command.Description, command.SenderId, command.ContractingPartyName);
_taskRepository.Create(task);
_assignRepository.SaveChanges();
foreach (var receiver in receivers)
{
var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue, receiver.Fullname,
- receiver.Position.PositionValue);
+ receiver.Position.PositionValue, endTask);
_assignRepository.Create(assign);
}
-
-
#region SaveMedias
#region SaveDocuments
if (command.UploadedMedia?.Count > 0)
- {
- foreach (var mediaId in command.UploadedMedia)
- {
- var media = _mediaRepository.Get(mediaId);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
+ {
+ foreach (var mediaId in command.UploadedMedia)
+ {
+ MoveTaskFile(mediaId, task.id);
+ }
+ }
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, media.Category);
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
- }
- }
-
-
#endregion
if (command.UploadedVoiceMedia > 0)
{
- var media = _mediaRepository.Get(command.UploadedVoiceMedia);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
-
-
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, "صوت");
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
-
+ MoveTaskFile(command.UploadedVoiceMedia, task.id, "voice");
}
#endregion
@@ -446,7 +406,7 @@ public class TaskApplication : ITaskApplication
var operation = new OperationResult();
var sender = _accountRepository.GetIncludePositions(command.SenderId);
- var receivers = _positionRepository.GetAccountsByIds(command.PositionId);
+ var receivers = _positionRepository.GetAccountsByPositionIds(command.PositionId);
if (sender.Position.PositionValue == 1)
@@ -461,9 +421,6 @@ public class TaskApplication : ITaskApplication
{
}
-
-
-
DateTime endTask;
if (string.IsNullOrWhiteSpace(command.EndTaskTime))
{
@@ -474,62 +431,33 @@ public class TaskApplication : ITaskApplication
endTask = command.EndTaskDate.ToGeorgianDateWithTime(command.EndTaskTime);
}
-
-
- var task = new Tasks(command.Title, endTask, command.Description, command.SenderId, command.ContractingPartyName);
+ var task = new Tasks(command.Title, command.Description, command.SenderId, command.ContractingPartyName);
_taskRepository.Create(task);
_assignRepository.SaveChanges();
foreach (var receiver in receivers)
{
var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue, receiver.Fullname,
- receiver.Position.PositionValue);
+ receiver.Position.PositionValue, endTask);
_assignRepository.Create(assign);
}
-
-
#region SaveMedias
#region SaveDocuments
- foreach (var mediaId in command.UploadedMedia)
+ if (command.UploadedMedia?.Count > 0)
{
- var media = _mediaRepository.Get(mediaId);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
-
-
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, media.Category);
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
+ foreach (var mediaId in command.UploadedMedia)
+ {
+ MoveTaskFile(mediaId, task.id);
+ }
}
#endregion
if (command.UploadedVoiceMedia > 0)
{
- var media = _mediaRepository.Get(command.UploadedVoiceMedia);
- var oldPath = media.Path;
- var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
- "Task", $"{task.id}");
- Directory.CreateDirectory(path);
-
-
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- File.Move(oldPath, filepath);
-
- media.Edit(filepath, media.Type, "صوت");
-
- _mediaRepository.SaveChanges();
- _mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
+ MoveTaskFile(command.UploadedVoiceMedia, task.id, "voice");
}
@@ -539,7 +467,7 @@ public class TaskApplication : ITaskApplication
return operation.Succcedded(task.id);
}
- // ویرایش تسک
+ // جزئیات تسک
public EditTask GetDetails(long taskId)
{
return _taskRepository.GetDetails(taskId);
@@ -558,11 +486,16 @@ public class TaskApplication : ITaskApplication
return _taskRepository.GetSelfTasks(searchModel);
}
- public List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel)
+ public List GetAllTasks(TaskSearchModel searchModel)
{
- return _taskRepository.GetAllNotSelfIncludedTasks(searchModel);
+ return _taskRepository.GetAllTasks(searchModel);
}
+ //public List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel)
+ //{
+ // return _taskRepository.GetAllNotSelfIncludedTasks(searchModel);
+ //}
+
public List GetReceivedTasks(TaskSearchModel searchModel)
{
return _taskRepository.GetReceivedTasks(searchModel);
@@ -594,7 +527,7 @@ public class TaskApplication : ITaskApplication
}
- var task = _taskRepository.Get(command.TaskId);
+ var task = _taskRepository.GetIncludeAssign(command.TaskId);
var requestTime = command.RequestTime.ToGeorgianDateTime();
var errorDateTime = new DateTime(3000, 12, 20, new PersianCalendar());
if (requestTime == errorDateTime)
@@ -603,39 +536,91 @@ public class TaskApplication : ITaskApplication
}
if (task.SenderId == accountId)
{
- task.ChangeTimeTask(requestTime);
+ foreach (var assign in task.Assigns)
+ {
+ assign.ChangeTimeTask(requestTime);
+ var message = new TaskMessage(command.Description, "تغییر تاریخ", assign.id);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.AssignedId, message.id);
+ }
+ _taskMessageRepository.SaveChanges();
+
}
else
{
- task.CreateTimeRequest(requestTime, command.Description);
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(accountId, command.TaskId);
+ assign.CreateTimeRequest(requestTime, command.Description);
+ var message = new TaskMessage(command.Description, "درخواست مهلت", assign.id, command.RequestTime);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.Task.SenderId, message.id);
+
}
_taskRepository.SaveChanges();
return operation.Succcedded(task.id);
}
//تایید درخواست مهلت
- public OperationResult AcceptRequestDatetime(long taskId)
+ public OperationResult AcceptRequestDatetime(long taskId, long assignedId, string message)
{
+ var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
if (!_taskRepository.Exists(x => x.id == taskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(taskId);
- if (!task.TimeRequest)
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.TimeRequest)
{
return operation.Failed("چنین وظیفه ای درخواستی برای مهلت ندارد");
}
- if (task.RequestDate == null)
+ if (assign.RequestDate == null)
{
return operation.Failed("تاریخی برای درخواست وظیفه ثبت نشده است");
}
- task.AcceptTimeRequest();
- _taskRepository.SaveChanges();
- return operation.Succcedded(task.id);
+ assign.AcceptTimeRequest();
+ message = string.IsNullOrWhiteSpace(message) ? "درخواست شما مورد تایید قرار گرفت" : message;
+ var messageEntity = new TaskMessage(message, "تایید درخواست مهلت", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
+ return operation.Succcedded(taskId);
}
+ //لغو درخواست مهلت تسک
+ public OperationResult RejectTimeRequest(long taskId, long assignedId, string message)
+ {
+ var accountId = _authHelper.CurrentAccountId();
+ var operation = new OperationResult();
+ if (!_taskRepository.Exists(x => x.id == taskId))
+ {
+ return operation.Failed("چنین وظیفه ای وجود ندارد");
+ }
+
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.TimeRequest)
+ {
+ return operation.Failed("چنین وظیفه ای درخواستی برای مهلت ندارد");
+ }
+ assign.RejectTimeRequest();
+ if (assign.EndTaskDate.Date <= DateTime.Now.Date)
+ {
+ var now = DateTime.Now;
+ var endOfDay = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
+ assign.EditTime(endOfDay);
+ }
+
+ var messageEntity = new TaskMessage(message, "رد درخواست مهلت", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
+ return operation.Succcedded(taskId);
+ }
+
//ساخت درخواست کنسل
public OperationResult CreateCancelRequest(CreateTaskCancel command)
{
@@ -650,120 +635,188 @@ public class TaskApplication : ITaskApplication
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(command.TaskId);
- task.CreateCancelRequest(command.Description);
+ var task = _taskRepository.GetIncludeAssign(command.TaskId);
+
+
+
if (task.SenderId == accountId)
{
- task.AcceptCancelRequest();
+ foreach (var assign in task.Assigns)
+ {
+ assign.CreateCancelRequest(command.Description);
+ assign.AcceptCancelRequest();
+ var message = new TaskMessage(command.Description, "لغو", assign.id);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.AssignedId, message.id);
+
+ }
+ _taskMessageRepository.SaveChanges();
}
- _taskRepository.SaveChanges();
+ else
+ {
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(accountId, task.id);
+ assign.CreateCancelRequest(command.Description);
+ var message = new TaskMessage(command.Description, "درخواست کنسل", assign.id);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.Task.SenderId, message.id);
+ }
+ _assignRepository.SaveChanges();
return operation.Succcedded(task.id);
}
//تایید درخواست کنسل
- public OperationResult AcceptCancelRequest(long taskId)
+ public OperationResult AcceptCancelRequest(long taskId, long assignedId, string message)
{
+ var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
if (!_taskRepository.Exists(x => x.id == taskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(taskId);
- if (!task.IsCanceledRequest)
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.IsCanceledRequest)
{
return operation.Failed("چنین وظیفه ای درخواستی برای انصراف ندارد");
}
- task.AcceptCancelRequest();
- _taskRepository.SaveChanges();
+ assign.AcceptCancelRequest();
+ message = string.IsNullOrWhiteSpace(message) ? "درخواست شما مورد تایید قرار گرفت" : message;
+ var messageEntity = new TaskMessage(message, "تایید درخواست کنسل", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
return operation.Succcedded(taskId);
}
+ //لغو درخواست کنسل تسک
+ public OperationResult RejectCancelRequest(long taskId, long assignedId, string message)
+ {
+ var accountId = _authHelper.CurrentAccountId();
+ var operation = new OperationResult();
+ if (!_taskRepository.Exists(x => x.id == taskId))
+ {
+ return operation.Failed("چنین وظیفه ای وجود ندارد");
+ }
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.IsCanceledRequest)
+ {
+ return operation.Failed("چنین وظیفه ای درخواستی برای انصراف ندارد");
+ }
+ assign.RejectCancel();
+ if (assign.EndTaskDate.Date <= DateTime.Now.Date)
+ {
+ var now = DateTime.Now;
+ var endOfDay = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
+ assign.EditTime(endOfDay);
+ }
+ var messageEntity = new TaskMessage(message, "رد درخواست کنسل", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
+ return operation.Succcedded(taskId);
+ }
+
//انجام شدن تسک
public OperationResult CreateCompleteTaskRequest(CompleteTaskViewModel command)
{
var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
- if (!_taskRepository.Exists(x => x.id == command.Id))
+ if (!_taskRepository.Exists(x => x.id == command.TaskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(command.Id);
- task.CompleteRequest(command.Description);
+ var task = _taskRepository.GetIncludeAssign(command.TaskId);
+
+ if (task.SenderId ==accountId)
+ {
+ command.Description=string.IsNullOrWhiteSpace(command.Description) ? "وظیفه محولشده توسط ارسال کننده به پایان رسیده است." :command.Description;
+ }
+ else
+ {
+ command.Description = string.IsNullOrWhiteSpace(command.Description) ? "وظیفه محول شده با موفقیت به اتمام رسید." : command.Description;
+ }
+
if (task.SenderId == accountId)
{
- task.Completed();
+ foreach (var assign in task.Assigns)
+ {
+ assign.CompleteRequest(command.Description);
+ assign.Completed();
+ var message = new TaskMessage(command.Description, "تکمیل", assign.id);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.AssignedId, message.id);
+
+ }
+ _taskMessageRepository.SaveChanges();
}
- _taskRepository.SaveChanges();
+ else
+ {
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(accountId, task.id);
+ assign.CompleteRequest(command.Description);
+ var message = new TaskMessage(command.Description, "درخواست انجام", assign.id);
+ _taskMessageRepository.Create(message);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assign.Task.SenderId, message.id);
+ }
+ _assignRepository.SaveChanges();
return operation.Succcedded(task.id);
}
- public OperationResult AcceptCompleteRequest(long taskId)
+ public OperationResult AcceptCompleteRequest(long taskId, long assignedId, string message)
{
+ var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
if (!_taskRepository.Exists(x => x.id == taskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(taskId);
- if (!task.IsDoneRequest)
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.IsDoneRequest)
{
return operation.Failed("چنین وظیفه ای درخواستی برای تایید ندارد");
}
- task.Completed();
- _taskRepository.SaveChanges();
+ assign.Completed();
+ message = string.IsNullOrWhiteSpace(message) ? "درخواست شما مورد تایید قرار گرفت" : message;
+ var messageEntity = new TaskMessage(message, "تایید درخواست انجام", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
return operation.Succcedded(taskId);
}
- public OperationResult RejectCompleteRequest(long taskId)
+ public OperationResult RejectCompleteRequest(long taskId, long assignedId, string message)
{
+ var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
if (!_taskRepository.Exists(x => x.id == taskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(taskId);
- if (!task.IsDoneRequest)
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.IsDoneRequest)
{
return operation.Failed("چنین وظیفه ای درخواستی برای انصراف ندارد");
}
- task.RejectCompleteRequest();
- _taskRepository.SaveChanges();
+ assign.RejectCompleteRequest();
+ if (assign.EndTaskDate.Date <= DateTime.Now.Date)
+ {
+ var now = DateTime.Now;
+ var endOfDay = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
+ assign.EditTime(endOfDay);
+ }
+ var messageEntity = new TaskMessage(message, "رد درخواست انجام", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
+ _assignRepository.SaveChanges();
return operation.Succcedded(taskId);
}
- //لغو درخواست کنسل تسک
- public OperationResult RejectCancelRequest(long taskId)
- {
- var operation = new OperationResult();
- if (!_taskRepository.Exists(x => x.id == taskId))
- {
- return operation.Failed("چنین وظیفه ای وجود ندارد");
- }
- var task = _taskRepository.Get(taskId);
- if (!task.IsCanceledRequest)
- {
- return operation.Failed("چنین وظیفه ای درخواستی برای انصراف ندارد");
- }
- task.RejectCancel();
- _taskRepository.SaveChanges();
- return operation.Succcedded(taskId);
- }
- //لغو درخواست مهلت تسک
- public OperationResult RejectTimeRequest(long taskId)
- {
- var operation = new OperationResult();
- if (!_taskRepository.Exists(x => x.id == taskId))
- {
- return operation.Failed("چنین وظیفه ای وجود ندارد");
- }
- var task = _taskRepository.Get(taskId);
- if (!task.TimeRequest)
- {
- return operation.Failed("چنین وظیفه ای درخواستی برای مهلت ندارد");
- }
- task.RejectTimeRequest();
- _taskRepository.SaveChanges();
- return operation.Succcedded(task.id);
- }
+
public OperationResult CreateTaskByPosition(CreateTask command, List positionIds)
{
@@ -801,7 +854,12 @@ public class TaskApplication : ITaskApplication
public List AllRequestedTasks(TaskSearchModel searchModel)
{
- return _taskRepository.AllRequestedTasks(searchModel);
+ return _taskRepository.AllRequestedTasks(searchModel);
+ }
+
+ public List GetTaskMessages(long assignId)
+ {
+ return _taskMessageRepository.GetTaskMessages(assignId);
}
public int GetRequestedTasksCount()
@@ -809,40 +867,45 @@ public class TaskApplication : ITaskApplication
return _taskRepository.GetRequestedTasksCount();
}
- public OperationResult ChangeRequestTimeAndAccept(string time, long taskId)
+ public OperationResult ChangeRequestTimeAndAccept(string time, long taskId, long assignedId, string message)
{
+ var accountId = _authHelper.CurrentAccountId();
var operation = new OperationResult();
if (!_taskRepository.Exists(x => x.id == taskId))
{
return operation.Failed("چنین وظیفه ای وجود ندارد");
}
- var task = _taskRepository.Get(taskId);
- if (!task.TimeRequest)
+ var assign = _assignRepository.GetAssignByAssignedIdAndTaskId(assignedId, taskId);
+ if (!assign.TimeRequest)
{
return operation.Failed("چنین وظیفه ای درخواستی برای مهلت ندارد");
}
- if (task.RequestDate == null)
+ if (assign.RequestDate == null)
{
return operation.Failed("تاریخی برای درخواست وظیفه ثبت نشده است");
}
DateTime timeGr = time.ToGeorgianDateTime2();
- task.ChangeTimeTask(timeGr);
+ assign.ChangeTimeTask(timeGr);
+ var messageEntity = new TaskMessage(message, "تایید و تغییر درخواست کنسل", assign.id);
+ _taskMessageRepository.Create(messageEntity);
+ _taskMessageRepository.SaveChanges();
+ _taskMessageRepository.CreateTaskMessageItems(accountId, assignedId, messageEntity.id);
_taskRepository.SaveChanges();
- return operation.Succcedded(task.id);
+ return operation.Succcedded(taskId);
}
- public TaskViewModel GetRequestDetails(long id)
+ public EditTask GetRequestDetails(long id)
{
return _taskRepository.GetRequestDetails(id);
}
public OperationResult UploadMedia(IFormFile mediaFile, long senderId)
{
var operation = new OperationResult();
- if ((mediaFile.Length > 2000000) || (mediaFile.Length > 2000000) || (mediaFile.Length > 2000000))
- return operation.Failed("حجم فایل نمیتواند از 2 مگابایت بیشتر باشد");
+ if ((mediaFile.Length > 5000000))
+ return operation.Failed("حجم فایل نمیتواند از 5 مگابایت بیشتر باشد");
var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
"temp", $"{senderId}");
Directory.CreateDirectory(path);
@@ -897,4 +960,51 @@ public class TaskApplication : ITaskApplication
}
}
+
+ public OperationResult SendTicketResponseInTask(long assignId, string message, long ticketId)
+ {
+ var accountId = _authHelper.CurrentAccountId();
+ var operation = new OperationResult();
+ var assign = _assignRepository.GetIncludeTask(assignId);
+ if (ticketId != assign.Task.TicketId)
+ {
+ return operation.Failed("خطای سیستمی!");
+
+ }
+
+ var adminRes = new AdminResponse(message, ticketId, accountId);
+ _ticketRepository.CreateAdminResponse(adminRes);
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public List GetAssignsByTaskId(long taskId)
+ {
+ return _assignRepository.GetAssignsByTaskId(taskId);
+ }
+
+ //public OperationResult MoveDataFRomTaskToAssign()
+ //{
+ // return _taskRepository.MoveDataFRomTaskToAssign();
+ //}
+
+ public void MoveTaskFile(long mediaId, long taskId, string category = "file")
+ {
+ var media = _mediaRepository.Get(mediaId);
+ var oldPath = media.Path;
+ var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
+ "Task", $"{taskId}");
+ Directory.CreateDirectory(path);
+
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
+ File.Move(oldPath, filepath);
+
+ string categoryMedia = category == "file" ? media.Category :
+ category == "voice" ? "صوت" : throw new InvalidDataException();
+
+ media.Edit(filepath, media.Type, categoryMedia);
+
+ _mediaRepository.SaveChanges();
+ _mediaRepository.CreateMediaWithTaskMedia(taskId, media.id);
+ }
}
\ No newline at end of file
diff --git a/AccountManagement.Application/TaskScheduleApplication.cs b/AccountManagement.Application/TaskScheduleApplication.cs
new file mode 100644
index 00000000..158e6165
--- /dev/null
+++ b/AccountManagement.Application/TaskScheduleApplication.cs
@@ -0,0 +1,223 @@
+using _0_Framework.Application;
+using AccountManagement.Application.Contracts.Task;
+using AccountManagement.Application.Contracts.TaskSchedule;
+using AccountManagement.Domain.TaskScheduleAgg;
+using System;
+using System.IO;
+using Company.Domain.HolidayItemAgg;
+
+namespace AccountManagement.Application;
+
+public class TaskScheduleApplication : ITaskScheduleApplication
+{
+ private readonly ITaskApplication _taskApplication;
+ private readonly ITaskScheduleRepository _taskScheduleRepository;
+ private readonly IHolidayItemRepository _holidayItemRepository;
+
+ public TaskScheduleApplication(ITaskApplication taskApplication, ITaskScheduleRepository taskScheduleRepository, IHolidayItemRepository holidayItemRepository)
+ {
+ _taskApplication = taskApplication;
+ _taskScheduleRepository = taskScheduleRepository;
+ _holidayItemRepository = holidayItemRepository;
+ }
+
+ public OperationResult Create(CreateTask command)
+ {
+ OperationResult operation = new OperationResult();
+
+
+ if (command.HasSchedule)
+ {
+ switch (command.ScheduleType)
+ {
+ case "limited":
+ if (Convert.ToInt32(command.ScheduleCount) > 60)
+ {
+ return operation.Failed("تعداد وارد شده بیشتر از حد مجاز است");
+ }
+ return CreateLimitedTasks(command);
+ break;
+
+ case "unlimited":
+ return CreateUnlimitedTasks(command);
+ break;
+
+ default:
+ return operation.Failed("خطای سیستمی!");
+
+ }
+ }
+ else
+ {
+ return operation.Failed("این تسک بصورت زمان بندی شده نمیباشد");
+ }
+ }
+
+ public OperationResult CreateLimitedTasks(CreateTask command)
+ {
+ OperationResult operation = new OperationResult();
+ if (Convert.ToInt32(command.ScheduleCount) < 1 || string.IsNullOrWhiteSpace(command.ScheduleCount))
+ {
+ return operation.Failed("تعداد وارد شده باید بیشتر از 2 باشد");
+ }
+
+ switch (command.ScheduleUnitType)
+ {
+ case "year":
+ if (Convert.ToInt32(command.ScheduleCount) != 1)
+ {
+ return operation.Failed("دوره نمیتواند بیشتر از 1 سال باشد");
+ }
+ break;
+ case "month":
+ if (Convert.ToInt32(command.ScheduleCount) > 12)
+ {
+ return operation.Failed("بازه وارد شده نا معتبر است");
+ }
+ break;
+ case "week":
+ if (command.ScheduleUnitNumber != "first" && command.ScheduleUnitNumber != "last")
+ {
+ return operation.Failed("بازه وارد شده نا معتبر است");
+ }
+ break;
+ case "day":
+ if (Convert.ToInt32(command.ScheduleUnitNumber) > 29)
+ {
+ return operation.Failed("بازه وارد شده نا معتبر است");
+ }
+ break;
+ default:
+ return operation.Failed("نوع بازه مشخص نمیباشد");
+ break;
+
+ }
+ try
+ {
+ DateTime previousDateRaw = command.EndTaskDate.ToGeorgianDateTime2();
+ DateTime previousDateEdited = command.EndTaskDate.ToGeorgianDateTime2();
+
+ int count = Convert.ToInt32(command.ScheduleCount);
+ bool isInt = int.TryParse(command.ScheduleUnitNumber, out int unitNumber);
+ string kindOfWeekUnit = isInt ? "" : command.ScheduleUnitNumber;
+
+ switch (command.ScheduleUnitType)
+ {
+ case "year":
+ for (int i = 1; i <= count; i++)
+ {
+ command.EndTaskDate = previousDateEdited.ToFarsi();
+ operation = _taskApplication.CreateTask(command);
+
+ bool isHoliday = _holidayItemRepository.GetHoliday(previousDateRaw);
+ while (isHoliday || previousDateEdited.DayOfWeek == DayOfWeek.Friday)
+ {
+ previousDateEdited = previousDateRaw.AddDays(1);
+ isHoliday = _holidayItemRepository.GetHoliday(previousDateEdited);
+
+ }
+ previousDateRaw = previousDateRaw.AddYears(unitNumber);
+ previousDateEdited = previousDateRaw;
+
+ }
+ break;
+
+ case "month":
+ for (int i = 1; i <= count; i++)
+ {
+ command.EndTaskDate = previousDateEdited.ToFarsi();
+ operation = _taskApplication.CreateTask(command);
+ bool isHoliday = _holidayItemRepository.GetHoliday(previousDateRaw);
+ while (isHoliday || previousDateEdited.DayOfWeek == DayOfWeek.Friday)
+ {
+ previousDateEdited = previousDateRaw.AddDays(1);
+ isHoliday = _holidayItemRepository.GetHoliday(previousDateEdited);
+
+ }
+ previousDateRaw = previousDateRaw.AddMonths(unitNumber);
+ previousDateEdited = previousDateRaw;
+
+ }
+ break;
+
+ case "week":
+ for (int i = 1; i <= count; i++)
+ {
+ if (string.IsNullOrWhiteSpace(kindOfWeekUnit))
+ {
+ throw new InvalidDataException();
+ }
+
+ command.EndTaskDate = kindOfWeekUnit switch
+ {
+ "first" => previousDateRaw.GetNextDayOfWeek(DayOfWeek.Saturday).ToFarsi(),
+ "last" => previousDateRaw.GetNextDayOfWeek(DayOfWeek.Thursday).ToFarsi(),
+ _ => throw new InvalidDataException()
+ };
+ operation = _taskApplication.CreateTask(command);
+ bool isHoliday = _holidayItemRepository.GetHoliday(previousDateRaw);
+ while (isHoliday || previousDateEdited.DayOfWeek == DayOfWeek.Friday)
+ {
+ previousDateEdited = previousDateRaw.AddDays(1);
+ isHoliday = _holidayItemRepository.GetHoliday(previousDateEdited);
+
+ }
+ previousDateRaw = command.EndTaskDate.ToGeorgianDateTime();
+ previousDateEdited = previousDateRaw;
+
+
+ }
+ break;
+
+ case "day":
+
+ for (int i = 1; i <= count; i++)
+ {
+ command.EndTaskDate = previousDateEdited.ToFarsi();
+ operation = _taskApplication.CreateTask(command);
+ previousDateRaw = previousDateRaw.AddDays(unitNumber);
+ bool isHoliday = _holidayItemRepository.GetHoliday(previousDateRaw);
+ while (isHoliday || previousDateEdited.DayOfWeek == DayOfWeek.Friday)
+ {
+ previousDateEdited = previousDateRaw.AddDays(1);
+ isHoliday = _holidayItemRepository.GetHoliday(previousDateEdited);
+
+ }
+
+ previousDateEdited = previousDateRaw;
+ }
+ break;
+
+ default:
+ return operation.Failed("نوع بازه درست نمیباشد");
+ }
+
+ var lastDate = command.EndTaskDate.ToGeorgianDateTime();
+ var taskSchedule = new TaskSchedule(command.ScheduleCount, command.ScheduleType, command.ScheduleUnitType,
+ command.ScheduleUnitNumber, lastDate);
+ _taskScheduleRepository.Create(taskSchedule);
+ _taskScheduleRepository.SaveChanges();
+ operation = operation.Succcedded();
+ return operation;
+ }
+ catch (Exception e)
+ {
+ return operation.Failed(e.ToString());
+ }
+ }
+
+ public OperationResult CreateUnlimitedTasks(CreateTask command)
+ {
+ var operation = _taskApplication.CreateTask(command);
+ if (!operation.IsSuccedded)
+ return operation;
+ var lastDate = command.EndTaskDate.ToGeorgianDateTime();
+ var taskSchedule = new TaskSchedule(command.ScheduleCount, command.ScheduleType, command.ScheduleUnitType,
+ command.ScheduleUnitNumber, lastDate);
+ _taskScheduleRepository.Create(taskSchedule);
+ _taskScheduleRepository.SaveChanges();
+ return operation.Succcedded();
+
+ }
+
+}
\ No newline at end of file
diff --git a/AccountManagement.Application/TaskSubjectApplication.cs b/AccountManagement.Application/TaskSubjectApplication.cs
index 42383942..c27fa674 100644
--- a/AccountManagement.Application/TaskSubjectApplication.cs
+++ b/AccountManagement.Application/TaskSubjectApplication.cs
@@ -1,9 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.TaskSubject;
using AccountManagement.Domain.TaskSubjectAgg;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace AccountManagement.Application;
diff --git a/AccountManagement.Application/TicketAccessAccountApplication.cs b/AccountManagement.Application/TicketAccessAccountApplication.cs
new file mode 100644
index 00000000..c7e27be9
--- /dev/null
+++ b/AccountManagement.Application/TicketAccessAccountApplication.cs
@@ -0,0 +1,60 @@
+using System.Collections.Generic;
+using _0_Framework.Application;
+using AccountManagement.Application.Contracts.TicketAccessAccount;
+using AccountManagement.Domain.AccountAgg;
+using AccountManagement.Domain.TicketAccessAccountAgg;
+
+namespace AccountManagement.Application;
+
+public class TicketAccessAccountApplication : ITicketAccessAccountApplication
+{
+ private readonly ITicketAccessAccountRepository _ticketAccessAccountRepository;
+ private readonly IAccountRepository _accountRepository;
+
+ public TicketAccessAccountApplication(ITicketAccessAccountRepository ticketAccessAccountRepository, IAccountRepository accountRepository)
+ {
+ _ticketAccessAccountRepository = ticketAccessAccountRepository;
+ _accountRepository = accountRepository;
+ }
+
+ public bool HasTicketAccess(long accountId)
+ {
+ return _ticketAccessAccountRepository.HasTicketAccess(accountId);
+ }
+
+ public OperationResult Create(long accountId)
+ {
+ OperationResult operation = new();
+ if (!_accountRepository.Exists(x => x.id == accountId && x.AdminAreaPermission == "true"))
+ {
+ return operation.Failed("شخص انتخاب شده نا معتبر است");
+
+ }
+
+ if (_ticketAccessAccountRepository.Exists(x => x.AccountId == accountId))
+ return operation.Failed("به این شخص قبلا دسترسی داده شده است");
+
+ TicketAccessAccount accessAccountEntity = new(accountId);
+ _ticketAccessAccountRepository.Create(accessAccountEntity);
+ _ticketAccessAccountRepository.SaveChanges();
+
+ return operation.Succcedded(accessAccountEntity.id);
+
+ }
+
+ public OperationResult Delete(long id)
+ {
+ OperationResult operation = new();
+ if (!_ticketAccessAccountRepository.Exists(x => x.id == id))
+ return operation.Failed("اطلاعات داده شده نامعتبر است");
+ _ticketAccessAccountRepository.Remove(id);
+ _ticketAccessAccountRepository.SaveChanges();
+ return operation.Succcedded(id);
+
+ }
+
+ public List GetAllAccessedAccounts()
+ {
+ return _ticketAccessAccountRepository.GetAllAccessedAccounts();
+ }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application/TicketApplication.cs b/AccountManagement.Application/TicketApplication.cs
index bb665d9d..a17f3040 100644
--- a/AccountManagement.Application/TicketApplication.cs
+++ b/AccountManagement.Application/TicketApplication.cs
@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Net.Sockets;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Task;
using AccountManagement.Application.Contracts.Ticket;
+using AccountManagement.Application.Contracts.TicketAccessAccount;
using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.AdminResponseAgg;
using AccountManagement.Domain.AssignAgg;
@@ -13,7 +13,7 @@ using AccountManagement.Domain.ClientResponseAgg;
using AccountManagement.Domain.MediaAgg;
using AccountManagement.Domain.TaskAgg;
using AccountManagement.Domain.TicketAgg;
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application;
@@ -24,14 +24,18 @@ public class TicketApplication : ITicketApplication
private readonly ITaskRepository _taskRepository;
private readonly IAssignRepository _assignRepository;
private readonly IMediaRepository _mediaRepository;
+ private readonly ITicketAccessAccountApplication _ticketAccessAccountApplication;
+ private readonly IAuthHelper _authHelper;
- public TicketApplication(ITicketRepository ticketRepository, IAccountRepository accountRepository, ITaskRepository taskRepository, IAssignRepository assignRepository, IMediaRepository mediaRepository)
+ public TicketApplication(ITicketRepository ticketRepository, IAccountRepository accountRepository, ITaskRepository taskRepository, IAssignRepository assignRepository, IMediaRepository mediaRepository, ITicketAccessAccountApplication ticketAccessAccountApplication, IAuthHelper authHelper)
{
_ticketRepository = ticketRepository;
_accountRepository = accountRepository;
_taskRepository = taskRepository;
_assignRepository = assignRepository;
_mediaRepository = mediaRepository;
+ _ticketAccessAccountApplication = ticketAccessAccountApplication;
+ _authHelper = authHelper;
}
public OperationResult CreateTicket(CreateTicket command)
@@ -47,21 +51,24 @@ public class TicketApplication : ITicketApplication
return operation.Failed("لطفا عنوان را وارد کنید");
}
- if (string.IsNullOrWhiteSpace(command.Description))
+ if (string.IsNullOrWhiteSpace(command.Description) && command.VoiceId < 1)
{
return operation.Failed("لطفا توضیحات خودرا وارد کنید");
}
-
-
+ else if (string.IsNullOrWhiteSpace(command.Description))
+ {
+ command.Description = "";
+ }
+ var ticketNumber = (_ticketRepository.GetLastTicketNumber() + 1).ToString("D5");
var ticket = new Ticket(command.Title, command.Description, command.SenderId, command.ContractingPartyName,
- command.TicketType);
+ command.TicketType, command.WorkshopId, ticketNumber);
_ticketRepository.Create(ticket);
_ticketRepository.SaveChanges();
+
#region SaveDocuments
-
- if (command.UploadedMediaIds?.Count>0)
+ if (command.UploadedMediaIds?.Count > 0)
{
foreach (var mediaId in command.UploadedMediaIds)
{
@@ -80,6 +87,7 @@ public class TicketApplication : ITicketApplication
_mediaRepository.SaveChanges();
_mediaRepository.CreateTicketMedia(ticket.id, media.id);
+ _mediaRepository.SaveChanges();
}
}
if (command.ScreenShotId > 0)
@@ -90,13 +98,14 @@ public class TicketApplication : ITicketApplication
"Ticket", $"{ticket.id}");
Directory.CreateDirectory(path);
- string filepath = Path.Combine(path, Path.GetFileName(path));
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
File.Move(oldPath, filepath);
- media.Edit(filepath, media.Type, media.Category);
+ media.Edit(filepath, media.Type, "اسکرین شات");
_mediaRepository.SaveChanges();
_mediaRepository.CreateTicketMedia(ticket.id, media.id);
+
}
@@ -105,13 +114,13 @@ public class TicketApplication : ITicketApplication
#region SaveVoice
if (command.VoiceId > 0)
{
- var media = _mediaRepository.Get(command.ScreenShotId);
+ var media = _mediaRepository.Get(command.VoiceId);
var oldPath = media.Path;
var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
"Ticket", $"{ticket.id}");
Directory.CreateDirectory(path);
- string filepath = Path.Combine(path, Path.GetFileName(path));
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
File.Move(oldPath, filepath);
media.Edit(filepath, media.Type, "صوت");
@@ -119,6 +128,7 @@ public class TicketApplication : ITicketApplication
_mediaRepository.SaveChanges();
_mediaRepository.CreateTicketMedia(ticket.id, media.id);
+
}
#endregion
@@ -181,27 +191,34 @@ public class TicketApplication : ITicketApplication
{
}
+ var ticket = _ticketRepository.Get(ticketId);
+ if (ticket == null)
+ return operation.Failed("چنین پشتیبانی وجود ندارد");
+
var endTask = string.IsNullOrWhiteSpace(command.EndTaskTime) ? command.EndTaskDate.ToGeorgianDateTime2() : command.EndTaskDate.ToGeorgianDateWithTime(command.EndTaskTime);
-
- var task = new Tasks(command.Title, endTask, command.Description, command.SenderId, command.ContractingPartyName, ticketId);
+
+ var task = new Tasks(command.Title, command.Description, command.SenderId, command.ContractingPartyName, ticketId);
_taskRepository.Create(task);
+ ticket.AssignedToTasks();
_assignRepository.SaveChanges();
+
+
foreach (var receiver in receivers)
{
var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue, receiver.Fullname,
- receiver.Position.PositionValue);
+ receiver.Position.PositionValue, endTask);
_assignRepository.Create(assign);
}
-
+ _assignRepository.SaveChanges();
#region SaveMedias
#region SaveDocuments
- if (command.UploadedMedia?.Count>0)
+ if (command.UploadedMedia?.Count > 0)
{
foreach (var mediaId in command.UploadedMedia)
{
@@ -221,7 +238,7 @@ public class TicketApplication : ITicketApplication
_mediaRepository.SaveChanges();
_mediaRepository.CreateMediaWithTaskMedia(task.id, media.id);
}
-
+
}
#endregion
@@ -245,7 +262,7 @@ public class TicketApplication : ITicketApplication
}
#endregion
-
+
_taskRepository.SaveChanges();
@@ -268,18 +285,28 @@ public class TicketApplication : ITicketApplication
public OperationResult AdminResponseTicket(ResponseTicket command)
{
var operation = new OperationResult();
- if (string.IsNullOrWhiteSpace(command.Response))
+ if (string.IsNullOrWhiteSpace(command.Response) && !(command.UploadedFileIds?.Count > 0) && !(command.VoiceId > 0))
{
- return operation.Failed("لطفا پیغام خود را وارد کنبد");
+ return operation.Failed("لطفا پیغام یا فایل را وارد کنید");
}
- var adminRes = new AdminResponse(command.Response, command.TicketId);
- _ticketRepository.CreateAdminResponse(adminRes);
- _ticketRepository.SaveChanges();
+ if (string.IsNullOrWhiteSpace(command.Response))
+ {
+ command.Response = "$GOzaReshgirMediaVoIce@";
+ }
+
+ var adminRes = new AdminResponse(command.Response, command.TicketId, command.AdminId);
+ if (_ticketAccessAccountApplication.HasTicketAccess(command.AdminId))
+ adminRes.Active();
+ var ticket = _ticketRepository.Get(command.TicketId);
+ _ticketRepository.CreateAdminResponse(adminRes);
+ ticket.Responded();
+ _ticketRepository.SaveChanges();
+
#region SaveDocuments
- if (command.UploadedFileIds?.Count>0)
+ if (command.UploadedFileIds?.Count > 0)
{
foreach (var mediaId in command.UploadedFileIds)
{
@@ -300,10 +327,28 @@ public class TicketApplication : ITicketApplication
_mediaRepository.CreateAdminResponseMedia(adminRes.id, media.id);
}
}
+ if (command.VoiceId > 0)
+ {
+ var media = _mediaRepository.Get(command.VoiceId);
+ var oldPath = media.Path;
+ var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
+ "TicketAdminResponse", $"{adminRes.id}");
+ Directory.CreateDirectory(path);
+
+
+
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
+ File.Move(oldPath, filepath);
+
+ media.Edit(filepath, media.Type, "صوت");
+
+ _mediaRepository.SaveChanges();
+ _mediaRepository.CreateAdminResponseMedia(adminRes.id, media.id);
+ }
#endregion
_mediaRepository.SaveChanges();
-
+
return operation.Succcedded(adminRes.id);
}
@@ -311,17 +356,24 @@ public class TicketApplication : ITicketApplication
public OperationResult ClientResponseTicket(ResponseTicket command)
{
var operation = new OperationResult();
+ if (string.IsNullOrWhiteSpace(command.Response) && !(command.UploadedFileIds?.Count > 0) && !(command.VoiceId > 0))
+ {
+ return operation.Failed("لطفا پیغام یا فایل را وارد کنید");
+ }
+
if (string.IsNullOrWhiteSpace(command.Response))
{
- return operation.Failed("لطفا پیغام خود را وارد کنبد");
+ command.Response = "$GOzaReshgirMediaVoIce@";
}
var clientRes = new ClientResponse(command.Response, command.TicketId);
+ var ticket = _ticketRepository.Get(command.TicketId);
_ticketRepository.CreateClientResponse(clientRes);
- _ticketRepository.SaveChanges();
+ ticket.Open();
+ _ticketRepository.SaveChanges();
#region SaveDocuments
- if (command.UploadedFileIds?.Count>0)
+ if (command.UploadedFileIds?.Count > 0)
{
foreach (var mediaId in command.UploadedFileIds)
{
@@ -343,6 +395,25 @@ public class TicketApplication : ITicketApplication
}
}
+ if (command.VoiceId > 0)
+ {
+ var media = _mediaRepository.Get(command.VoiceId);
+ var oldPath = media.Path;
+ var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
+ "TicketClientResponse", $"{clientRes.id}");
+ Directory.CreateDirectory(path);
+
+
+
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
+ File.Move(oldPath, filepath);
+
+ media.Edit(filepath, media.Type, "صوت");
+
+ _mediaRepository.SaveChanges();
+ _mediaRepository.CreateClientResponseMedia(clientRes.id, media.id);
+ }
+
#endregion
_mediaRepository.SaveChanges();
return operation.Succcedded(clientRes.id);
@@ -353,6 +424,11 @@ public class TicketApplication : ITicketApplication
return _ticketRepository.GetDetails(id);
}
+ public EditTicket GetDetailsForClient(long id)
+ {
+ return _ticketRepository.GetDetailsForClient(id);
+ }
+
public List GetAll(TicketSearchModel searchModel)
{
return _ticketRepository.GetAll(searchModel);
@@ -360,6 +436,168 @@ public class TicketApplication : ITicketApplication
public bool IsExist(long id)
{
- return _ticketRepository.Exists(x => x.id == id);
+ return _ticketRepository.Exists(x => x.id == id);
+ }
+ public OperationResult UploadMedia(IFormFile mediaFile, long senderId)
+ {
+ var operation = new OperationResult();
+ if ((mediaFile.Length > 5000000) || (mediaFile.Length > 5000000) || (mediaFile.Length > 5000000))
+ return operation.Failed("حجم فایل نمیتواند از 5 مگابایت بیشتر باشد");
+ var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
+ "temp", $"{senderId}");
+ Directory.CreateDirectory(path);
+
+ string uniqueFileName = $"{Path.GetFileNameWithoutExtension(mediaFile.FileName)}_{DateTime.Now.Ticks}{Path.GetExtension(mediaFile.FileName)}";
+ string filepath = Path.Combine(path, uniqueFileName);
+
+ using (var stream = new FileStream(filepath, FileMode.Create))
+ {
+ mediaFile.CopyTo(stream);
+
+ }
+ var type = Path.GetExtension(filepath);
+ var media = new Media(filepath, type, "فایل");
+ _mediaRepository.Create(media);
+ _mediaRepository.SaveChanges();
+ return operation.Succcedded(media.id);
+
+ }
+
+ public OperationResult RemoveMedia(long mediaId)
+ {
+ var operation = new OperationResult();
+ try
+ {
+ var media = _mediaRepository.Get(mediaId);
+ var path = media.Path;
+ if (File.Exists(path))
+ {
+ File.Delete(path);
+ }
+ _mediaRepository.Remove(mediaId);
+ return operation.Succcedded();
+ }
+ catch
+ {
+ return operation.Failed("مشکلی در حذف این فایل وجود دارد");
+ }
+
+ }
+
+ public void RemoveTempUploadedFiles(long userId)
+ {
+ var path = Path.Combine($"{_taskRepository.GetWebEnvironmentPath()}", "Storage",
+ "temp", $"{userId}");
+
+
+ if (Directory.Exists(path))
+ {
+
+ Directory.Delete(path, true);
+ }
+
+ }
+
+ public List GetTicketsForClients(TicketSearchModel searchModel)
+ {
+ return _ticketRepository.GetTicketsForClients(searchModel);
+ }
+
+ public OperationResult AcceptPendingAdminResponse(long adminResId)
+ {
+ var operation = new OperationResult();
+ var adminRes = _ticketRepository.GetAdminResponse(adminResId);
+ var ticket = _ticketRepository.Get(adminRes.TicketId);
+
+
+ if (adminRes.IsActiveString == "true")
+ {
+ return operation.Failed("خطایی رخ داده است . لطفا با مدیر سیستم تماس بگیرید");
+ }
+ adminRes.Active();
+ ticket.Responded();
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult RejectPendingAdminResponse(long adminResId)
+ {
+ var operation = new OperationResult();
+ var adminRes = _ticketRepository.GetAdminResponse(adminResId);
+ if (adminRes.IsActiveString == "true")
+ {
+ return operation.Failed("خطایی رخ داده است . لطفا با مدیر سیستم تماس بگیرید");
+ }
+ _ticketRepository.RemoveAdminResponse(adminResId);
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
+
+ }
+
+ public OperationResult EditAndAcceptPendingAdminResponse(long adminResId, string newResponse)
+ {
+ var operation = new OperationResult();
+ var adminRes = _ticketRepository.GetAdminResponse(adminResId);
+ var ticket = _ticketRepository.Get(adminRes.TicketId);
+ if (adminRes.IsActiveString == "true")
+ {
+ return operation.Failed("خطایی رخ داده است . لطفا با مدیر سیستم تماس بگیرید");
+ }
+ adminRes.Edit(newResponse);
+ adminRes.Active();
+ ticket.Responded();
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult DeletePendingAdminResponse(int adminResId)
+ {
+ var operation = new OperationResult();
+ var userId = _authHelper.CurrentAccountId();
+ try
+ {
+ var adminRes = _ticketRepository.GetAdminResponse(adminResId);
+ if (adminRes.AdminAccountId!=userId)
+ {
+ return operation.Failed("شما نمیتوانید این پیام را پاک کنید");
+ }
+ if (adminRes.IsActiveString=="true")
+ {
+ return operation.Failed("شما نمیتوانید این پیام را پاک کنید");
+ }
+ _ticketRepository.RemoveAdminResponse(adminResId);
+ _taskRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+ catch (Exception e)
+ {
+ return operation.Failed(e.ToString());
+ }
+ }
+
+ public OperationResult EditPendingAdminResponse(long adminResId,string newMessage)
+ {
+ var operation = new OperationResult();
+ var entity=_ticketRepository.GetAdminResponse(adminResId);
+ if (entity==null)
+ {
+ return operation.Failed("مشکل سیستمی!!");
+ }
+ entity.Edit(newMessage);
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
+ }
+
+ public OperationResult CloseTicket(long ticketId)
+ {
+ var operation= new OperationResult();
+ var ticket = _ticketRepository.Get(ticketId);
+ if (ticket == null)
+ {
+ return operation.Failed("اطلاعات وارد شده نامعتبر است");
+ }
+ ticket.Completed();
+ _ticketRepository.SaveChanges();
+ return operation.Succcedded();
}
}
\ No newline at end of file
diff --git a/AccountManagement.Configuration/AccountManagementBootstrapper.cs b/AccountManagement.Configuration/AccountManagementBootstrapper.cs
index 492d7547..cd8c1b25 100644
--- a/AccountManagement.Configuration/AccountManagementBootstrapper.cs
+++ b/AccountManagement.Configuration/AccountManagementBootstrapper.cs
@@ -6,6 +6,7 @@ using AccountManagement.Application.Contracts.Role;
using AccountManagement.Application.Contracts.Task;
using AccountManagement.Application.Contracts.TaskSubject;
using AccountManagement.Application.Contracts.Ticket;
+using AccountManagement.Application.Contracts.TicketAccessAccount;
using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.AccountLeftWorkAgg;
using AccountManagement.Domain.AssignAgg;
@@ -13,7 +14,9 @@ using AccountManagement.Domain.CameraAccountAgg;
using AccountManagement.Domain.MediaAgg;
using AccountManagement.Domain.RoleAgg;
using AccountManagement.Domain.TaskAgg;
+using AccountManagement.Domain.TaskMessageAgg;
using AccountManagement.Domain.TaskSubjectAgg;
+using AccountManagement.Domain.TicketAccessAccountAgg;
using AccountManagement.Domain.TicketAgg;
using AccountMangement.Infrastructure.EFCore;
using AccountMangement.Infrastructure.EFCore.Repository;
@@ -41,13 +44,15 @@ namespace AccountManagement.Configuration
services.AddTransient();
- //services.AddTransient();
- #region Mahan
- services.AddTransient();
+ //services.AddTransient();
+ #region Mahan
+
+ services.AddTransient();
services.AddTransient();
+ services.AddScoped();
services.AddTransient();
- services.AddTransient();
+
services.AddTransient();
services.AddTransient();
@@ -59,6 +64,12 @@ namespace AccountManagement.Configuration
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+
+
#endregion
diff --git a/AccountManagement.Domain/AccountAgg/Account.cs b/AccountManagement.Domain/AccountAgg/Account.cs
index b398098a..60ba1f0b 100644
--- a/AccountManagement.Domain/AccountAgg/Account.cs
+++ b/AccountManagement.Domain/AccountAgg/Account.cs
@@ -27,7 +27,7 @@ namespace AccountManagement.Domain.AccountAgg
public string IsActiveString { get; private set; }
#region Mahan
-
+ public string PositionIsActive { get; private set; }
public long? PositionId { get; private set; }
public Position Position { get; private set; }
@@ -128,13 +128,19 @@ namespace AccountManagement.Domain.AccountAgg
public void SetPosition(long positionId)
{
PositionId = positionId;
+ PositionIsActive = "true";
}
- public void DeletePositionId()
+ public void DeActivePosition()
+ {
+ PositionIsActive = "false";
+ }
+
+ public void RemovePosition()
{
PositionId = null;
+ PositionIsActive = null;
}
-
#endregion
}
}
diff --git a/AccountManagement.Domain/AccountAgg/IAccountRepository.cs b/AccountManagement.Domain/AccountAgg/IAccountRepository.cs
index 65d20cd0..278ed596 100644
--- a/AccountManagement.Domain/AccountAgg/IAccountRepository.cs
+++ b/AccountManagement.Domain/AccountAgg/IAccountRepository.cs
@@ -9,6 +9,7 @@ namespace AccountManagement.Domain.AccountAgg
{
Account GetBy(string username);
Account GetById(long id);
+
EditAccount GetDetails(long id);
EditAccount GetByVerifyCode(string code, string phone);
EditAccount GetByUserNameAndId(long id, string username);
@@ -17,15 +18,15 @@ namespace AccountManagement.Domain.AccountAgg
List GetClientsAccount();
List Search(AccountSearchModel searchModel);
Task RemoveCode(long id);
-
#region Mahan
-
+
Account GetIncludePositions(long id);
List GetAccountsByPositionId(long positionId);
List AccountsForAssign(long taskId);
List GetAccountsByIds(List ids);
List GetAccountLowerPositionvalue();
AccountViewModel GetAccountViewModel(long id);
+ List GetAccountsDeactivePositionValue(long Positionid);
#endregion
}
diff --git a/AccountManagement.Domain/AdminResponseAgg/AdminResponse.cs b/AccountManagement.Domain/AdminResponseAgg/AdminResponse.cs
index a8c6cc40..b6df36e6 100644
--- a/AccountManagement.Domain/AdminResponseAgg/AdminResponse.cs
+++ b/AccountManagement.Domain/AdminResponseAgg/AdminResponse.cs
@@ -7,16 +7,31 @@ namespace AccountManagement.Domain.AdminResponseAgg;
public class AdminResponse:EntityBase
{
- public AdminResponse(string response,long ticketId)
+ public AdminResponse(string response,long ticketId, long adminAccountId)
{
Response = response;
TicketId = ticketId;
+ AdminAccountId = adminAccountId;
+ IsActiveString = "false";
}
public long TicketId { get; private set; }
+ public long AdminAccountId { get; private set; }
public string Response { get; private set; }
+ public string IsActiveString { get; private set; }
public Ticket Ticket { get; set; }
public List AdminResponseMedias { get; set; }
+ public void Active()
+ {
+ IsActiveString = "true";
+ }
+
+ public void Edit(string response)
+ {
+ Response=response;
+ }
+
+
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/AssignAgg/Assign.cs b/AccountManagement.Domain/AssignAgg/Assign.cs
index 0ebc9ac1..2bab15b8 100644
--- a/AccountManagement.Domain/AssignAgg/Assign.cs
+++ b/AccountManagement.Domain/AssignAgg/Assign.cs
@@ -1,11 +1,14 @@
using _0_Framework.Domain;
using AccountManagement.Domain.TaskAgg;
+using System;
+using System.Collections.Generic;
+using AccountManagement.Domain.TaskMessageAgg;
namespace AccountManagement.Domain.AssignAgg;
public class Assign : EntityBase
{
- public Assign(long taskId, long assignerId, long assignedId, int assignerPositionValue, string assignedName, int assignedPositionValue)
+ public Assign(long taskId, long assignerId, long assignedId, int assignerPositionValue, string assignedName, int assignedPositionValue, DateTime endTaskDate)
{
TaskId = taskId;
AssignerId = assignerId;
@@ -13,21 +16,129 @@ public class Assign : EntityBase
AssignerPositionValue = assignerPositionValue;
AssignedName = assignedName;
AssignedPositionValue = assignedPositionValue;
+ EndTaskDate = endTaskDate;
}
-
- public long TaskId { get; private set; }
- //آیدی شخص ارسال کننده
- public long AssignerId { get; private set; }
- //نام دریافت کننده
- public string AssignedName { get; private set; }
- //آیدی شخص دریافت کننده
- public long AssignedId { get; private set; }
- //سطح شخص ارسال کننده
- public int AssignerPositionValue { get; private set; }
+
+ //آیدی شخص ارسال کننده
+ public long TaskId { get; private set; }
+ //نام دریافت کننده
+ public long AssignerId { get; private set; }
+ //آیدی شخص دریافت کننده
+ public string AssignedName { get; private set; }
+ //سطح شخص ارسال کننده
+ public long AssignedId { get; private set; }
+
+ public int AssignerPositionValue { get; private set; }
public int AssignedPositionValue { get; private set; }
+ //زمان پایان وظیفه
+ public DateTime EndTaskDate { get; private set; }
+ //آیا درخواست مهلت کرده است؟
+ public bool TimeRequest { get; private set; }
+ //تعداد تایید درخواست مهلت
+ public int AcceptedTimeRequest { get; private set; }
+ //مهلت زمان درخواست شده
+ public DateTime? RequestDate { get; private set; }
+ //توضیحات درخواست مهلت
+ public string? TimeRequestDescription { get; private set; }
+ //آیا درخواست انصراف داده شده
- public Tasks Task { get; set; }
+ //آیا کنسل شده است
+ public bool IsCancel { get; private set; }
+ //توضیحات درخواست انصراف
+ public string? CancelDescription { get; private set; }
+ public bool IsDone { get; private set; }
+ public bool IsDoneRequest { get; private set; }
+
+ public string? DoneDescription { get; private set; }
+ public bool IsCanceledRequest { get; private set; }
+
+ public Tasks Task { get; set; }
+ public List TaskMessageList { get; set; }
+
+ public void EditTime(DateTime endTaskDate)
+ {
+ EndTaskDate = endTaskDate;
+ }
+ public void CreateTimeRequest(DateTime requestDate, string timeRequestDescription)
+ {
+ RequestDate = requestDate;
+ TimeRequestDescription = timeRequestDescription;
+ TimeRequest = true;
+ }
+
+ public void AcceptTimeRequest()
+ {
+ TimeRequest = false;
+ AcceptedTimeRequest++;
+ EndTaskDate = RequestDate.Value;
+
+ }
+ public void RejectTimeRequest()
+ {
+ TimeRequest = false;
+ TimeRequestDescription = null;
+ RequestDate = null;
+ }
+
+ public void CreateCancelRequest(string cancelDescription)
+ {
+ CancelDescription = cancelDescription;
+ IsCanceledRequest = true;
-
+ }
+ public void AcceptCancelRequest()
+ {
+ IsCanceledRequest = false;
+ IsCancel = true;
+
+
+ }
+ public void RejectCancel()
+ {
+ CancelDescription = null;
+ IsCanceledRequest = false;
+ }
+
+ public void CompleteRequest(string? doneDescription)
+ {
+ DoneDescription = doneDescription;
+ IsDoneRequest = true;
+ }
+
+ public void RejectCompleteRequest()
+ {
+ IsDoneRequest = false;
+ DoneDescription = null;
+ }
+ public void Completed()
+ {
+ IsDoneRequest = false;
+ IsDone = true;
+ }
+
+ public void ChangeTimeTask(DateTime time)
+ {
+ EndTaskDate = time;
+ AcceptedTimeRequest++;
+ RequestDate = null;
+ TimeRequest = false;
+ }
+
+ public void InsertNewData(DateTime endTaskDate,bool timeRequest,int acceptedTimeRequest,DateTime? requestDate, string timeRequestDescription, bool isCanceledRequest,
+ bool isCancel,string cancelDescription,bool isDone,bool isDoneRequest,string? doneDescription)
+ {
+ EndTaskDate = endTaskDate;
+ TimeRequest=timeRequest;
+ AcceptedTimeRequest = acceptedTimeRequest;
+ RequestDate = requestDate;
+ TimeRequestDescription = timeRequestDescription;
+ IsCanceledRequest = isCanceledRequest;
+ IsCancel=isCancel;
+ IsDone=isDone;
+ CancelDescription=cancelDescription;
+ IsDone=isDone;
+ IsDoneRequest=isDoneRequest;
+ DoneDescription=doneDescription;
+ }
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/AssignAgg/IAssignRepository.cs b/AccountManagement.Domain/AssignAgg/IAssignRepository.cs
index 8a8bdef1..cf1453f6 100644
--- a/AccountManagement.Domain/AssignAgg/IAssignRepository.cs
+++ b/AccountManagement.Domain/AssignAgg/IAssignRepository.cs
@@ -1,13 +1,17 @@
using System.Collections.Generic;
using _0_Framework.Domain;
using AccountManagement.Application.Contracts.Assign;
+using Microsoft.VisualBasic.CompilerServices;
namespace AccountManagement.Domain.AssignAgg;
-public interface IAssignRepository:IRepository
+public interface IAssignRepository : IRepository
{
- List GetAssignsByTaskId(long id);
- void RemoveRangeAssigns(long taskId);
+ List GetAssignsByTaskId(long id);
+ void RemoveRangeAssigns(long taskId);
+ List GetAssignedIdsByTaskId(long taskId);
+ Assign GetAssignByAssignedIdAndTaskId(long assignedId, long taskId);
+ Assign GetIncludeTask(long id);
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PositionAgg/IPositionRepository.cs b/AccountManagement.Domain/PositionAgg/IPositionRepository.cs
index 60cbc802..8e93c3c2 100644
--- a/AccountManagement.Domain/PositionAgg/IPositionRepository.cs
+++ b/AccountManagement.Domain/PositionAgg/IPositionRepository.cs
@@ -14,7 +14,7 @@ public interface IPositionRepository : IRepository
List GetUnUsedPositionValues();
List GetNoPositionAccounts();
- List GetAccountsByIds(List ids);
+ List GetAccountsByPositionIds(List ids);
void Remove(long id);
diff --git a/AccountManagement.Domain/TaskAgg/ITaskRepository.cs b/AccountManagement.Domain/TaskAgg/ITaskRepository.cs
index 571c7f6e..24040064 100644
--- a/AccountManagement.Domain/TaskAgg/ITaskRepository.cs
+++ b/AccountManagement.Domain/TaskAgg/ITaskRepository.cs
@@ -1,25 +1,38 @@
using System;
using System.Collections.Generic;
+using _0_Framework.Application;
using _0_Framework.Domain;
using AccountManagement.Application.Contracts.Task;
+using AccountManagement.Application.Contracts.TaskMessage;
namespace AccountManagement.Domain.TaskAgg;
public interface ITaskRepository:IRepository
{
EditTask GetDetails(long TaskId);
+ Tasks GetIncludeAssign(long taskId);
void Remove(long id);
//گرفتن تمامی وظایف
List GetTasks(TaskSearchModel searchModel);
+ List GetAllTasks(TaskSearchModel searchModel);
List GetRequestedTasks(TaskSearchModel searchModel);
List GetSelfTasks(TaskSearchModel searchModel);
- List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel);
+ //List GetAllNotSelfIncludedTasks(TaskSearchModel searchModel);
List GetReceivedTasks(TaskSearchModel searchModel);
List GetSentTasks(TaskSearchModel searchModel);
List AllRequestedTasks(TaskSearchModel searchModel);
string SetTasksColors(DateTime time,bool isCancel);
int GetRequestedTasksCount();
- TaskViewModel GetRequestDetails(long id);
+ EditTask GetRequestDetails(long id);
string GetWebEnvironmentPath();
+ bool HasOverdueTasks();
+
+
+
+ /// گرفتن پیام های مربوط به هر تسک
+
+
+
+ //OperationResult MoveDataFRomTaskToAssign();
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskAgg/Tasks.cs b/AccountManagement.Domain/TaskAgg/Tasks.cs
index e2c75ca9..39d94082 100644
--- a/AccountManagement.Domain/TaskAgg/Tasks.cs
+++ b/AccountManagement.Domain/TaskAgg/Tasks.cs
@@ -4,61 +4,48 @@ using System.Security.AccessControl;
using _0_Framework.Domain;
using AccountManagement.Domain.AssignAgg;
using AccountManagement.Domain.TaskMediaAgg;
+using AccountManagement.Domain.TaskScheduleAgg;
namespace AccountManagement.Domain.TaskAgg;
public class Tasks : EntityBase
{
- public Tasks(string title, DateTime endTaskDate, string? description, long senderId, string contractingPartyName)
+ public Tasks(string title, string? description, long senderId, string contractingPartyName)
{
Title = title;
- EndTaskDate = endTaskDate;
+
Description = description;
SenderId = senderId;
ContractingPartyName = contractingPartyName;
StartTaskDate = DateTime.Now;
IsActiveString = "true";
+ TaskScheduleId = null;
}
//عنوان وظیفه
public string Title { get; private set; }
- //زمان پایان وظیفه
- public DateTime EndTaskDate { get; private set; }
//زمان ارسال وظیفه
public DateTime StartTaskDate { get; private set; }
//توضیحات وظیفه
public string? Description { get; private set; }
//آیدی شخص ارسال کننده
public long SenderId { get; private set; }
- //آیا درخواست مهلت کرده است؟
- public bool TimeRequest { get; private set; }
- //تعداد تایید درخواست مهلت
- public int AcceptedTimeRequest { get; set; }
- //مهلت زمان درخواست شده
- public DateTime? RequestDate { get; private set; }
- //توضیحات درخواست مهلت
- public string? TimeRequestDescription { get; private set; }
- //آیا درخواست انصراف داده شده
- public bool IsCanceledRequest { get; private set; }
//نام طرف حساب
public string ContractingPartyName { get; set; }
- //آیا کنسل شده است
- public bool IsCancel { get; private set; }
- //توضیحات درخواست انصراف
- public string? CancelDescription { get; private set; }
- public bool IsDone { get; private set; }
- public bool IsDoneRequest { get; private set; }
-
- public string? DoneDescription { get; private set; }
public string IsActiveString { get; private set; }
+
+ public long? TicketId { get; private set; }
+
+ public long? TaskScheduleId { get; private set; }
+
public List Assigns { get; set; }
public List TaskMedias { get; set; }
- public long? TicketId { get; set; }
+ public TaskSchedule TaskSchedule { get; set; }
- public Tasks(string title, DateTime endTaskDate, string? description, long senderId, string contractingPartyName, long ticketId)
+
+ public Tasks(string title, string? description, long senderId, string contractingPartyName, long ticketId)
{
Title = title;
- EndTaskDate = endTaskDate;
Description = description;
SenderId = senderId;
ContractingPartyName = contractingPartyName;
@@ -67,93 +54,30 @@ public class Tasks : EntityBase
TicketId = ticketId;
}
- public void Edit(string title, DateTime endTaskDate, string? description, long senderId, string contractingPartyName)
+ public void Edit(string title, string? description, long senderId, string contractingPartyName)
{
Title = title;
- EndTaskDate = endTaskDate;
Description = description;
SenderId = senderId;
- ContractingPartyName= contractingPartyName;
+ ContractingPartyName = contractingPartyName;
}
//برای ایجاد یک درخواست مهلت
- public void CreateTimeRequest(DateTime requestDate, string timeRequestDescription)
+
+ public void DeActive()
{
- RequestDate = requestDate;
- TimeRequestDescription = timeRequestDescription;
- TimeRequest = true;
+ IsActiveString = "false";
}
- public void AcceptTimeRequest()
+ public void Activator()
{
- TimeRequest = false;
- AcceptedTimeRequest++;
- EndTaskDate = (DateTime)RequestDate;
-
- }
- public void RejectTimeRequest()
- {
- TimeRequest = false;
- TimeRequestDescription = null;
- RequestDate = null;
+ IsActiveString = "true";
}
- public void CreateCancelRequest(string cancelDescription)
+ public void SetTaskSchedule(long taskScheduleId)
{
- CancelDescription = cancelDescription;
- IsCanceledRequest=true;
-
-
+ TaskScheduleId = taskScheduleId;
}
- public void AcceptCancelRequest()
- {
- IsCanceledRequest=false;
- IsCancel = true;
-
- }
- public void RejectCancel()
- {
- CancelDescription = null;
- IsCanceledRequest = false;
- }
-
- public void CompleteRequest(string? doneDescription)
- {
- DoneDescription = doneDescription;
- IsDoneRequest = true;
- }
-
- public void RejectCompleteRequest()
- {
- IsDoneRequest = false;
- DoneDescription=null;
- }
- public void Completed()
- {
- IsDoneRequest = false;
- IsDone=true;
- }
-
- public void DeActive()
- {
- IsActiveString = "false";
- }
-
- public void Activator()
- {
- IsActiveString = "true";
- }
-
-
- public void ChangeTimeTask(DateTime time)
- {
- EndTaskDate = time;
- AcceptedTimeRequest++;
- RequestDate = null;
- TimeRequest = false;
- }
-
-
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskMessageAgg/ITaskMessageRepository.cs b/AccountManagement.Domain/TaskMessageAgg/ITaskMessageRepository.cs
new file mode 100644
index 00000000..10f7145d
--- /dev/null
+++ b/AccountManagement.Domain/TaskMessageAgg/ITaskMessageRepository.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+using _0_Framework.Domain;
+using AccountManagement.Application.Contracts.TaskMessage;
+
+namespace AccountManagement.Domain.TaskMessageAgg;
+
+public interface ITaskMessageRepository: IRepository
+{
+ void CreateTaskMessageItems(long senderId,long receiverId,long messageId);
+ List GetTaskMessages(long assignId);
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskMessageAgg/TaskMessage.cs b/AccountManagement.Domain/TaskMessageAgg/TaskMessage.cs
new file mode 100644
index 00000000..d9222cad
--- /dev/null
+++ b/AccountManagement.Domain/TaskMessageAgg/TaskMessage.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using System.Runtime;
+using _0_Framework.Domain;
+using AccountManagement.Domain.AssignAgg;
+using AccountManagement.Domain.TaskMessageItemsAgg;
+
+namespace AccountManagement.Domain.TaskMessageAgg;
+
+public class TaskMessage:EntityBase
+{
+ public TaskMessage(string message, string typeOfMessage, long assignId, string requestedDateFa="")
+ {
+ Message = message;
+ TypeOfMessage = typeOfMessage;
+ AssignId = assignId;
+ RequestedDateFa = requestedDateFa;
+ }
+
+ public string Message { get; private set; }
+ public string TypeOfMessage { get; private set; }
+ public string RequestedDateFa { get; private set; }
+ public long AssignId { get; private set; }
+
+ public List TaskMessageItemsList { get; set; }
+ public Assign Assign { get; set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs b/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs
new file mode 100644
index 00000000..155017f2
--- /dev/null
+++ b/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs
@@ -0,0 +1,22 @@
+using _0_Framework.Domain;
+using AccountManagement.Domain.TaskMessageAgg;
+
+namespace AccountManagement.Domain.TaskMessageItemsAgg;
+
+public class TaskMessageItems:EntityBase
+{
+ public TaskMessageItems(long senderAccountId, long receiverAccountId, long taskMessageId)
+ {
+ SenderAccountId = senderAccountId;
+ ReceiverAccountId = receiverAccountId;
+ TaskMessageId = taskMessageId;
+ }
+
+ public long SenderAccountId { get; private set; }
+ public long ReceiverAccountId { get; private set; }
+ public long TaskMessageId { get; private set; }
+
+ public TaskMessage TaskMessage { get; set; }
+
+
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskScheduleAgg/ITaskScheduleRepository.cs b/AccountManagement.Domain/TaskScheduleAgg/ITaskScheduleRepository.cs
new file mode 100644
index 00000000..21bb249d
--- /dev/null
+++ b/AccountManagement.Domain/TaskScheduleAgg/ITaskScheduleRepository.cs
@@ -0,0 +1,8 @@
+using _0_Framework.Domain;
+
+namespace AccountManagement.Domain.TaskScheduleAgg;
+
+public interface ITaskScheduleRepository:IRepository
+{
+
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskScheduleAgg/TaskSchedule.cs b/AccountManagement.Domain/TaskScheduleAgg/TaskSchedule.cs
new file mode 100644
index 00000000..da4a037f
--- /dev/null
+++ b/AccountManagement.Domain/TaskScheduleAgg/TaskSchedule.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using _0_Framework.Domain;
+using AccountManagement.Domain.TaskAgg;
+
+namespace AccountManagement.Domain.TaskScheduleAgg;
+
+public class TaskSchedule:EntityBase
+{
+ public TaskSchedule(string count, string type, string unitType, string unitNumber, DateTime lastEndTaskDate)
+ {
+ Count = count;
+ Type = type;
+ UnitType = unitType;
+ UnitNumber = unitNumber;
+ LastEndTaskDate = lastEndTaskDate;
+ }
+ public string Count { get; private set; }
+ public string Type { get; private set; }
+ public string UnitType { get; private set; }
+ public string UnitNumber { get; private set; }
+ public DateTime LastEndTaskDate { get; private set; }
+ public List TasksList { get; set; }
+
+ public void SetLastEndTaskDate(DateTime lastEndTaskDate)
+ {
+ LastEndTaskDate = lastEndTaskDate;
+ }
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TicketAccessAccountAgg/ITicketAccessAccountRepository.cs b/AccountManagement.Domain/TicketAccessAccountAgg/ITicketAccessAccountRepository.cs
new file mode 100644
index 00000000..cc326a38
--- /dev/null
+++ b/AccountManagement.Domain/TicketAccessAccountAgg/ITicketAccessAccountRepository.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using _0_Framework.Domain;
+using AccountManagement.Application.Contracts.TicketAccessAccount;
+
+namespace AccountManagement.Domain.TicketAccessAccountAgg;
+
+public interface ITicketAccessAccountRepository:IRepository
+{
+ bool HasTicketAccess(long accountId);
+ List GetAllAccessedAccounts();
+ void Remove (long id);
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TicketAccessAccountAgg/TicketAccessAccount.cs b/AccountManagement.Domain/TicketAccessAccountAgg/TicketAccessAccount.cs
new file mode 100644
index 00000000..e1014cde
--- /dev/null
+++ b/AccountManagement.Domain/TicketAccessAccountAgg/TicketAccessAccount.cs
@@ -0,0 +1,13 @@
+using _0_Framework.Domain;
+
+namespace AccountManagement.Domain.TicketAccessAccountAgg;
+
+public class TicketAccessAccount:EntityBase
+{
+ public TicketAccessAccount(long accountId)
+ {
+ AccountId = accountId;
+ }
+
+ public long AccountId { get; private set; }
+}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TicketAgg/ITicketRepository.cs b/AccountManagement.Domain/TicketAgg/ITicketRepository.cs
index c6aa0aee..c782d472 100644
--- a/AccountManagement.Domain/TicketAgg/ITicketRepository.cs
+++ b/AccountManagement.Domain/TicketAgg/ITicketRepository.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using _0_Framework.Application;
using _0_Framework.Domain;
using AccountManagement.Application.Contracts.Ticket;
using AccountManagement.Domain.AdminResponseAgg;
@@ -9,9 +10,16 @@ namespace AccountManagement.Domain.TicketAgg;
public interface ITicketRepository:IRepository
{
List GetAll(TicketSearchModel searchModel);
+ List GetTicketsForClients(TicketSearchModel searchModel);
void CreateAdminResponse(AdminResponse command);
void CreateClientResponse(ClientResponse command);
EditTicket GetDetails(long id);
+ EditTicket GetDetailsForClient(long id);
+ int GetLastTicketNumber();
+ AdminResponse GetAdminResponse(long adminResId);
+ ClientResponse GetClientResponse(long adminResId);
+ void RemoveAdminResponse(long adminResId);
+
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TicketAgg/Ticket.cs b/AccountManagement.Domain/TicketAgg/Ticket.cs
index b3d0e84a..b16a895d 100644
--- a/AccountManagement.Domain/TicketAgg/Ticket.cs
+++ b/AccountManagement.Domain/TicketAgg/Ticket.cs
@@ -9,23 +9,27 @@ namespace AccountManagement.Domain.TicketAgg;
public class Ticket:EntityBase
{
- public Ticket(string title, string description, long senderId, string contractingPartyName, string ticketType)
+ public Ticket(string title, string description, long senderId, string contractingPartyName, string ticketType, long workshopId, string ticketNumber,long subAccountSenderId=0)
{
Title = title;
Description = description;
- Status = "درحال بررسی";
+ Status = "باز";
SenderId = senderId;
ContractingPartyName = contractingPartyName;
TicketType = ticketType;
+ WorkshopId = workshopId;
+ TicketNumber = ticketNumber;
+ SubAccountSenderId = subAccountSenderId;
}
-
public string Title { get; private set; }
public string Description { get; private set; }
public string TicketType { get; set; }
+ public string TicketNumber { get; set; }
public string Status { get; private set; }
public long SenderId { get; private set; }
+ public long SubAccountSenderId { get; set; }
public string ContractingPartyName { get; private set; }
- public long? TaskId { get; private set; }
+ public long WorkshopId { get; private set; }
public List ClientResponses { get; set; }
public List AdminResponses{ get; set; }
public List TicketMedias { get; set; }
@@ -39,4 +43,14 @@ public class Ticket:EntityBase
{
Status = "پاسخ داده شده";
}
+
+ public void AssignedToTasks()
+ {
+ Status = "درحال بررسی";
+ }
+
+ public void Open()
+ {
+ Status = "باز";
+ }
}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/AccountContext.cs b/AccountMangement.Infrastructure.EFCore/AccountContext.cs
index 2c4e2d04..bf99a681 100644
--- a/AccountMangement.Infrastructure.EFCore/AccountContext.cs
+++ b/AccountMangement.Infrastructure.EFCore/AccountContext.cs
@@ -17,6 +17,9 @@ using AccountManagement.Domain.ClientResponseAgg;
using AccountManagement.Domain.ClientResponseMediaAgg;
using AccountManagement.Domain.TicketAgg;
using AccountManagement.Domain.TicketMediasAgg;
+using AccountManagement.Domain.TaskMessageAgg;
+using AccountManagement.Domain.TaskMessageItemsAgg;
+using AccountManagement.Domain.TicketAccessAccountAgg;
namespace AccountMangement.Infrastructure.EFCore
{
@@ -42,6 +45,10 @@ namespace AccountMangement.Infrastructure.EFCore
public DbSet ClientResponseMedias { get; set; }
public DbSet Tickets { get; set; }
public DbSet TicketMedias { get; set; }
+ public DbSet TaskMessages { get; set; }
+ public DbSet TaskMessageItems { get; set; }
+
+ public DbSet TicketAccessAccounts { get; set; }
#endregion
public AccountContext(DbContextOptions options) : base(options)
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/AccountMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/AccountMapping.cs
index 4bb3309f..6ae53575 100644
--- a/AccountMangement.Infrastructure.EFCore/Mappings/AccountMapping.cs
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/AccountMapping.cs
@@ -23,7 +23,8 @@ public class AccountMapping : IEntityTypeConfiguration
builder.Property(x => x.Email).HasMaxLength(150);
builder.Property(x => x.VerifyCode).HasMaxLength(1000);
builder.Property(x => x.IsActiveString).HasMaxLength(6);
- builder.Property(x => x.PositionId).HasMaxLength(10).IsRequired(false);
+ builder.Property(x => x.PositionId).HasMaxLength(10).IsRequired(false);
+ builder.Property(x => x.PositionIsActive).HasMaxLength(5);
builder.HasOne(x => x.Role).WithMany(x => x.Accounts).HasForeignKey(x => x.RoleId);
builder.HasMany(x => x.CameraAccounts)
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/AdminResponseMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/AdminResponseMapping.cs
index 526b9872..bc03cef0 100644
--- a/AccountMangement.Infrastructure.EFCore/Mappings/AdminResponseMapping.cs
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/AdminResponseMapping.cs
@@ -13,6 +13,7 @@ public class AdminResponseMapping : IEntityTypeConfiguration
builder.Property(x => x.Response).HasColumnType("ntext");
+ builder.Property(x => x.IsActiveString).HasMaxLength(5);
builder.HasMany(x => x.AdminResponseMedias).WithOne(x => x.AdminResponse).HasForeignKey(x => x.AdminResponseId);
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/AssignMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/AssignMapping.cs
index f58602fb..60ef205a 100644
--- a/AccountMangement.Infrastructure.EFCore/Mappings/AssignMapping.cs
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/AssignMapping.cs
@@ -11,8 +11,13 @@ public class AssignMapping:IEntityTypeConfiguration
builder.ToTable("Assigns");
builder.HasKey(x => x.id);
builder.Property(x => x.AssignedName).HasMaxLength(200);
-
+ builder.Property(x => x.RequestDate).IsRequired(false);
+ builder.Property(x => x.EndTaskDate).IsRequired();
+ builder.Property(x => x.CancelDescription).IsRequired(false).HasColumnType("ntext");
+ builder.Property(x => x.TimeRequestDescription).IsRequired(false).HasColumnType("ntext");
+ builder.Property(x => x.DoneDescription).IsRequired(false).HasColumnType("ntext");
- builder.HasOne(x => x.Task).WithMany(x => x.Assigns).HasForeignKey(x => x.TaskId).IsRequired(false);
+
+ builder.HasOne(x => x.Task).WithMany(x => x.Assigns).HasForeignKey(x => x.TaskId).IsRequired(false);
}
}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TaskMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMapping.cs
index fc66ab7c..0fd84437 100644
--- a/AccountMangement.Infrastructure.EFCore/Mappings/TaskMapping.cs
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMapping.cs
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
-public class TaskMapping:IEntityTypeConfiguration
+public class TaskMapping : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
@@ -12,19 +12,20 @@ public class TaskMapping:IEntityTypeConfiguration
builder.HasKey(t => t.id);
- builder.Property(x => x.RequestDate).IsRequired(false);
- builder.Property(x => x.EndTaskDate).IsRequired();
+
builder.Property(x => x.Description).IsRequired(false).HasColumnType("ntext");
- builder.Property(x => x.CancelDescription).IsRequired(false).HasColumnType("ntext");
- builder.Property(x => x.TimeRequestDescription).IsRequired(false).HasColumnType("ntext");
builder.Property(x => x.Title).IsRequired().HasMaxLength(100);
builder.Property(x => x.IsActiveString).HasMaxLength(7);
builder.Property(x => x.ContractingPartyName).HasMaxLength(200);
- builder.Property(x => x.DoneDescription).IsRequired(false).HasColumnType("ntext");
- builder.Property(x => x.TicketId).IsRequired(false);
+ builder.Property(x => x.TaskScheduleId).IsRequired(false);
+ builder.Property(x => x.TicketId).IsRequired(false);
- builder.HasMany(x => x.Assigns).WithOne(x => x.Task).HasForeignKey(x => x.TaskId).IsRequired(false).OnDelete(DeleteBehavior.Cascade);
+ builder.HasOne(x => x.TaskSchedule).WithMany(x => x.TasksList).HasForeignKey(x => x.TaskScheduleId)
+ .IsRequired(false).OnDelete(DeleteBehavior.Cascade);
+
+ builder.HasMany(x => x.Assigns).WithOne(x => x.Task).HasForeignKey(x => x.TaskId)
+ .IsRequired(false).OnDelete(DeleteBehavior.Cascade);
}
}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageItemsMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageItemsMapping.cs
new file mode 100644
index 00000000..b18be0d4
--- /dev/null
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageItemsMapping.cs
@@ -0,0 +1,17 @@
+using AccountManagement.Domain.TaskMessageAgg;
+using AccountManagement.Domain.TaskMessageItemsAgg;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace AccountMangement.Infrastructure.EFCore.Mappings;
+
+public class TaskMessageItemsMapping: IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.ToTable("TaskMessageItems");
+ builder.HasKey(x => x.id);
+
+ builder.HasOne(x => x.TaskMessage).WithMany(x => x.TaskMessageItemsList).HasForeignKey(x => x.TaskMessageId);
+ }
+}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageMapping.cs
new file mode 100644
index 00000000..cb45f26b
--- /dev/null
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TaskMessageMapping.cs
@@ -0,0 +1,23 @@
+using AccountManagement.Domain.AccountLeftWorkAgg;
+using AccountManagement.Domain.TaskMessageAgg;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace AccountMangement.Infrastructure.EFCore.Mappings;
+
+public class TaskMessageMapping : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.ToTable("TaskMessages");
+ builder.HasKey(x => x.id);
+
+ builder.Property(x => x.TypeOfMessage).HasMaxLength(30);
+ builder.Property(x=>x.Message).HasColumnType("ntext");
+ builder.Property(x => x.RequestedDateFa).HasMaxLength(25);
+
+
+ builder.HasMany(x => x.TaskMessageItemsList).WithOne(x => x.TaskMessage).HasForeignKey(x => x.TaskMessageId);
+ builder.HasOne(x => x.Assign).WithMany(x => x.TaskMessageList).HasForeignKey(x => x.AssignId);
+ }
+}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TaskScheduleMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TaskScheduleMapping.cs
new file mode 100644
index 00000000..2f4a0f50
--- /dev/null
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TaskScheduleMapping.cs
@@ -0,0 +1,22 @@
+using AccountManagement.Domain.TaskScheduleAgg;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace AccountMangement.Infrastructure.EFCore.Mappings;
+
+public class TaskScheduleMapping : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.ToTable("TaskSchedules");
+ builder.HasKey(x => x.id);
+
+ builder.Property(x => x.Count).HasMaxLength(10);
+ builder.Property(x => x.Type).HasMaxLength(12);
+ builder.Property(x => x.UnitNumber).HasMaxLength(10);
+ builder.Property(x => x.UnitType).HasMaxLength(10);
+
+ builder.HasMany(x => x.TasksList).WithOne(x => x.TaskSchedule)
+ .HasForeignKey(x => x.TaskScheduleId);
+ }
+}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TicketAccessAccountMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TicketAccessAccountMapping.cs
new file mode 100644
index 00000000..9c1ac463
--- /dev/null
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TicketAccessAccountMapping.cs
@@ -0,0 +1,14 @@
+using AccountManagement.Domain.TicketAccessAccountAgg;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+namespace AccountMangement.Infrastructure.EFCore.Mappings;
+
+public class TicketAccessAccountMapping:IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.ToTable("TicketAccessAccounts");
+ builder.HasKey(x => x.id);
+ }
+}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/TicketMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/TicketMapping.cs
index 0ca34f93..d346e318 100644
--- a/AccountMangement.Infrastructure.EFCore/Mappings/TicketMapping.cs
+++ b/AccountMangement.Infrastructure.EFCore/Mappings/TicketMapping.cs
@@ -13,15 +13,12 @@ public class TicketMapping:IEntityTypeConfiguration
builder.ToTable("Tickets");
- builder.Property(x => x.TaskId).IsRequired(false);
builder.Property(x => x.ContractingPartyName).HasMaxLength(155);
builder.Property(x => x.TicketType).HasMaxLength(50);
builder.Property(x => x.Title).HasMaxLength(200);
builder.Property(x => x.Description).HasColumnType("ntext");
builder.Property(x => x.Status).HasMaxLength(30);
-
-
-
+ builder.Property(x => x.TicketNumber).HasMaxLength(12);
builder.HasMany(x => x.ClientResponses).WithOne(x => x.Ticket).HasForeignKey(x => x.TicketId);
builder.HasMany(x => x.TicketMedias).WithOne(x => x.Ticket).HasForeignKey(x => x.MediaId);
builder.HasMany(x => x.AdminResponses).WithOne(x => x.Ticket).HasForeignKey(x => x.TicketId);
diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/20240821152830_AccountTableChanges.Designer.cs b/AccountMangement.Infrastructure.EFCore/Migrations/20240821152830_AccountTableChanges.Designer.cs
new file mode 100644
index 00000000..232bc598
--- /dev/null
+++ b/AccountMangement.Infrastructure.EFCore/Migrations/20240821152830_AccountTableChanges.Designer.cs
@@ -0,0 +1,772 @@
+//
+using System;
+using AccountMangement.Infrastructure.EFCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace AccountMangement.Infrastructure.EFCore.Migrations
+{
+ [DbContext(typeof(AccountContext))]
+ [Migration("20240821152830_AccountTableChanges")]
+ partial class AccountTableChanges
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AdminAreaPermission")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("ClientAriaPermission")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Email")
+ .HasMaxLength(150)
+ .HasColumnType("nvarchar(150)");
+
+ b.Property("Fullname")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("IsActiveString")
+ .HasMaxLength(6)
+ .HasColumnType("nvarchar(6)");
+
+ b.Property("Mobile")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("nvarchar(20)");
+
+ b.Property("NationalCode")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.Property("PositionId")
+ .HasMaxLength(10)
+ .HasColumnType("bigint");
+
+ b.Property("PositionIsActive")
+ .HasMaxLength(5)
+ .HasColumnType("nvarchar(5)");
+
+ b.Property("ProfilePhoto")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("RoleId")
+ .HasColumnType("bigint");
+
+ b.Property("RoleName")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("VerifyCode")
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.HasKey("id");
+
+ b.HasIndex("PositionId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("Accounts", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AccountLeftWorkAgg.AccountLeftWork", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AccountId")
+ .HasColumnType("bigint");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("LeftWorkGr")
+ .HasColumnType("datetime2");
+
+ b.Property("StartWorkGr")
+ .HasColumnType("datetime2");
+
+ b.HasKey("id");
+
+ b.HasIndex("AccountId");
+
+ b.ToTable("AccountLeftWork", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Response")
+ .HasColumnType("ntext");
+
+ b.Property("TicketId")
+ .HasColumnType("bigint");
+
+ b.HasKey("id");
+
+ b.HasIndex("TicketId");
+
+ b.ToTable("AdminResponses", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AdminResponseMediaAgg.AdminResponseMedia", b =>
+ {
+ b.Property("AdminResponseId")
+ .HasColumnType("bigint");
+
+ b.Property("MediaId")
+ .HasColumnType("bigint");
+
+ b.HasKey("AdminResponseId", "MediaId");
+
+ b.HasIndex("MediaId");
+
+ b.ToTable("AdminResponseMedias", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AssignedId")
+ .HasColumnType("bigint");
+
+ b.Property("AssignedName")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("AssignedPositionValue")
+ .HasColumnType("int");
+
+ b.Property("AssignerId")
+ .HasColumnType("bigint");
+
+ b.Property("AssignerPositionValue")
+ .HasColumnType("int");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("TaskId")
+ .HasColumnType("bigint");
+
+ b.HasKey("id");
+
+ b.HasIndex("TaskId");
+
+ b.ToTable("Assigns", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.CameraAccountAgg.CameraAccount", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AccountId")
+ .HasColumnType("bigint");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("IsActiveSting")
+ .IsRequired()
+ .HasMaxLength(5)
+ .HasColumnType("nvarchar(5)");
+
+ b.Property("Mobile")
+ .HasMaxLength(11)
+ .HasColumnType("nvarchar(11)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.Property("WorkshopName")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("id");
+
+ b.HasIndex("AccountId");
+
+ b.ToTable("CameraAccounts", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Response")
+ .HasColumnType("ntext");
+
+ b.Property("TicketId")
+ .HasColumnType("bigint");
+
+ b.HasKey("id");
+
+ b.HasIndex("TicketId");
+
+ b.ToTable("ClientResponses", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.ClientResponseMediaAgg.ClientResponseMedia", b =>
+ {
+ b.Property("ClientResponseId")
+ .HasColumnType("bigint");
+
+ b.Property("MediaId")
+ .HasColumnType("bigint");
+
+ b.HasKey("ClientResponseId", "MediaId");
+
+ b.HasIndex("MediaId");
+
+ b.ToTable("ClientResponseMedias", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.MediaAgg.Media", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("Category")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Path")
+ .HasColumnType("ntext");
+
+ b.Property("Type")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.HasKey("id");
+
+ b.ToTable("Medias", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("id");
+
+ b.ToTable("Roles", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AcceptedTimeRequest")
+ .HasColumnType("int");
+
+ b.Property("CancelDescription")
+ .HasColumnType("ntext");
+
+ b.Property("ContractingPartyName")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("ntext");
+
+ b.Property("DoneDescription")
+ .HasColumnType("ntext");
+
+ b.Property("EndTaskDate")
+ .HasColumnType("datetime2");
+
+ b.Property("IsActiveString")
+ .HasMaxLength(7)
+ .HasColumnType("nvarchar(7)");
+
+ b.Property("IsCancel")
+ .HasColumnType("bit");
+
+ b.Property("IsCanceledRequest")
+ .HasColumnType("bit");
+
+ b.Property("IsDone")
+ .HasColumnType("bit");
+
+ b.Property("IsDoneRequest")
+ .HasColumnType("bit");
+
+ b.Property("RequestDate")
+ .HasColumnType("datetime2");
+
+ b.Property("SenderId")
+ .HasColumnType("bigint");
+
+ b.Property("StartTaskDate")
+ .HasColumnType("datetime2");
+
+ b.Property("TicketId")
+ .HasColumnType("bigint");
+
+ b.Property("TimeRequest")
+ .HasColumnType("bit");
+
+ b.Property("TimeRequestDescription")
+ .HasColumnType("ntext");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("id");
+
+ b.ToTable("TasksManager", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.TaskMediaAgg.TaskMedia", b =>
+ {
+ b.Property("MediaId")
+ .HasColumnType("bigint");
+
+ b.Property("TaskId")
+ .HasColumnType("bigint");
+
+ b.HasKey("MediaId", "TaskId");
+
+ b.HasIndex("TaskId");
+
+ b.ToTable("TasksMedias", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.TaskSubjectAgg.TaskSubject", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Subject")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("id");
+
+ b.ToTable("TaskSubjects", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.TicketAgg.Ticket", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("ContractingPartyName")
+ .HasMaxLength(155)
+ .HasColumnType("nvarchar(155)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("ntext");
+
+ b.Property("SenderId")
+ .HasColumnType("bigint");
+
+ b.Property("Status")
+ .HasMaxLength(30)
+ .HasColumnType("nvarchar(30)");
+
+ b.Property("TaskId")
+ .HasColumnType("bigint");
+
+ b.Property("TicketType")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Title")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("id");
+
+ b.ToTable("Tickets", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.TicketMediasAgg.TicketMedia", b =>
+ {
+ b.Property("TicketId")
+ .HasColumnType("bigint");
+
+ b.Property("MediaId")
+ .HasColumnType("bigint");
+
+ b.HasKey("TicketId", "MediaId");
+
+ b.HasIndex("MediaId");
+
+ b.ToTable("TicketMedias", (string)null);
+ });
+
+ modelBuilder.Entity("TaskManager.Domain.PositionAgg.Position", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("PositionName")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("PositionValue")
+ .HasMaxLength(2)
+ .HasColumnType("int");
+
+ b.HasKey("id");
+
+ b.ToTable("Positions", (string)null);
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b =>
+ {
+ b.HasOne("TaskManager.Domain.PositionAgg.Position", "Position")
+ .WithMany("Accounts")
+ .HasForeignKey("PositionId");
+
+ b.HasOne("AccountManagement.Domain.RoleAgg.Role", "Role")
+ .WithMany("Accounts")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Position");
+
+ b.Navigation("Role");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AccountLeftWorkAgg.AccountLeftWork", b =>
+ {
+ b.HasOne("AccountManagement.Domain.AccountAgg.Account", "Account")
+ .WithMany("AccountLeftWorkList")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Account");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b =>
+ {
+ b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket")
+ .WithMany("AdminResponses")
+ .HasForeignKey("TicketId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Ticket");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AdminResponseMediaAgg.AdminResponseMedia", b =>
+ {
+ b.HasOne("AccountManagement.Domain.AdminResponseAgg.AdminResponse", "AdminResponse")
+ .WithMany("AdminResponseMedias")
+ .HasForeignKey("AdminResponseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media")
+ .WithMany("AdminResponseMedias")
+ .HasForeignKey("MediaId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AdminResponse");
+
+ b.Navigation("Media");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b =>
+ {
+ b.HasOne("AccountManagement.Domain.TaskAgg.Tasks", "Task")
+ .WithMany("Assigns")
+ .HasForeignKey("TaskId")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.Navigation("Task");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.CameraAccountAgg.CameraAccount", b =>
+ {
+ b.HasOne("AccountManagement.Domain.AccountAgg.Account", "Account")
+ .WithMany("CameraAccounts")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Account");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b =>
+ {
+ b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket")
+ .WithMany("ClientResponses")
+ .HasForeignKey("TicketId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Ticket");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.ClientResponseMediaAgg.ClientResponseMedia", b =>
+ {
+ b.HasOne("AccountManagement.Domain.ClientResponseAgg.ClientResponse", "ClientResponse")
+ .WithMany("ClientResponseMedias")
+ .HasForeignKey("ClientResponseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media")
+ .WithMany("ClientResponseMedias")
+ .HasForeignKey("MediaId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ClientResponse");
+
+ b.Navigation("Media");
+ });
+
+ modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b =>
+ {
+ b.OwnsMany("AccountManagement.Domain.RoleAgg.Permission", "Permissions", b1 =>
+ {
+ b1.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id"));
+
+ b1.Property