diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs index 205a3384..6c3713b7 100644 --- a/0_Framework/Application/Tools.cs +++ b/0_Framework/Application/Tools.cs @@ -1099,210 +1099,214 @@ public static class Tools return true; } - #region Mahan - public static string ToFarsiDuration(this string date) - { - var today = DateTime.Now.ToFarsi(); - var year = Convert.ToInt32(today.Substring(0, 4)); - var month = Convert.ToInt32(today.Substring(5, 2)); - var day = Convert.ToInt32(today.Substring(8, 2)); - var todayPersianDate = new PersianDateTime(year, month, day); + #region Mahan + public static string ToFarsiDuration(this string date) + { + var today = DateTime.Now.ToFarsi(); + var year = Convert.ToInt32(today.Substring(0, 4)); + var month = Convert.ToInt32(today.Substring(5, 2)); + var day = Convert.ToInt32(today.Substring(8, 2)); + var todayPersianDate = new PersianDateTime(year, month, day); - var planYear = Convert.ToInt32(date.Substring(0, 4)); - var planMonth = Convert.ToInt32(date.Substring(5, 2)); - var planDay = Convert.ToInt32(date.Substring(8, 2)); - var planPersianDate = new PersianDateTime(planYear, planMonth, planDay); + var planYear = Convert.ToInt32(date.Substring(0, 4)); + var planMonth = Convert.ToInt32(date.Substring(5, 2)); + var planDay = Convert.ToInt32(date.Substring(8, 2)); + var planPersianDate = new PersianDateTime(planYear, planMonth, planDay); - if (planPersianDate > todayPersianDate) - { - var countDay = 0; - var counMonth = 0; - var nextMonth = new PersianDateTime(todayPersianDate).AddMonths(1); - for (var start = todayPersianDate; start <= planPersianDate; start = start.AddDays(1)) - { - countDay++; - if (start == nextMonth) - { - counMonth++; - nextMonth = new PersianDateTime(start).AddMonths(1); - countDay = 0; - } - } + if (planPersianDate > todayPersianDate) + { + var countDay = 0; + var counMonth = 0; + var nextMonth = new PersianDateTime(todayPersianDate).AddMonths(1); + for (var start = todayPersianDate; start <= planPersianDate; start = start.AddDays(1)) + { + countDay++; + if (start == nextMonth) + { + counMonth++; + nextMonth = new PersianDateTime(start).AddMonths(1); + countDay = 0; + } + } - if (counMonth > 0) - { - if (countDay == 0) - { - return $"{counMonth} ماه"; - } - return $"{counMonth}ماه و {countDay} روز"; - } - else - { - return $"{countDay}روز"; - } - } - else - { - return ""; - } - } + if (counMonth > 0) + { + if (countDay == 0) + { + return $"{counMonth} ماه"; + } + return $"{counMonth}ماه و {countDay} روز"; + } + else + { + return $"{countDay}روز"; + } + } + else + { + return ""; + } + } - public static string ToFarsiDuration2(this string date) - { - var persianCalendar = new System.Globalization.PersianCalendar(); - var today = DateTime.Now; + public static string ToFarsiDuration2(this string date) + { + var persianCalendar = new System.Globalization.PersianCalendar(); + var today = DateTime.Now; - // Convert today's Gregorian date to Persian date - var todayYear = persianCalendar.GetYear(today); - var todayMonth = persianCalendar.GetMonth(today); - var todayDay = persianCalendar.GetDayOfMonth(today); + // Convert today's Gregorian date to Persian date + var todayYear = persianCalendar.GetYear(today); + var todayMonth = persianCalendar.GetMonth(today); + var todayDay = persianCalendar.GetDayOfMonth(today); - var todayPersianDate = new DateTime(todayYear, todayMonth, todayDay, persianCalendar); + var todayPersianDate = new DateTime(todayYear, todayMonth, todayDay, persianCalendar); - // Parse the target Persian date from the input string - var planYear = int.Parse(date.Substring(0, 4)); - var planMonth = int.Parse(date.Substring(5, 2)); - var planDay = int.Parse(date.Substring(8, 2)); + // Parse the target Persian date from the input string + var planYear = int.Parse(date.Substring(0, 4)); + var planMonth = int.Parse(date.Substring(5, 2)); + var planDay = int.Parse(date.Substring(8, 2)); - var planPersianDate = new DateTime(planYear, planMonth, planDay, persianCalendar); + var planPersianDate = new DateTime(planYear, planMonth, planDay, persianCalendar); - if (planPersianDate > todayPersianDate) - { - // Calculate the exact difference in years, months, and days - int yearDifference = planYear - todayYear; - int monthDifference = planMonth - todayMonth; - int dayDifference = planDay - todayDay; + if (planPersianDate > todayPersianDate) + { + // Calculate the exact difference in years, months, and days + int yearDifference = planYear - todayYear; + int monthDifference = planMonth - todayMonth; + int dayDifference = planDay - todayDay; - if (dayDifference < 0) - { - monthDifference--; - dayDifference += persianCalendar.GetDaysInMonth(todayYear, todayMonth); - } + if (dayDifference < 0) + { + monthDifference--; + dayDifference += persianCalendar.GetDaysInMonth(todayYear, todayMonth); + } - if (monthDifference < 0) - { - yearDifference--; - monthDifference += 12; - } + if (monthDifference < 0) + { + yearDifference--; + monthDifference += 12; + } - // Construct the duration string - var duration = ""; - if (yearDifference > 0) - { - duration += $"{yearDifference} سال "; - } + // Construct the duration string + var duration = ""; + if (yearDifference > 0) + { + duration += $"{yearDifference} سال "; + } - if (monthDifference > 0) - { - duration += $"{monthDifference} ماه "; - } + if (monthDifference > 0) + { + duration += $"{monthDifference} ماه "; + } - if (dayDifference > 0) - { - duration += $"{dayDifference} روز"; - } + if (dayDifference > 0) + { + duration += $"{dayDifference} روز"; + } - return duration.Trim(); - } - else - { - return ""; - } - } + return duration.Trim(); + } + else + { + return ""; + } + } - #region DayOfWeekMethods + #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 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) - { - persianDate = persianDate.ToEnglishNumber(); - try - { - var year = Convert.ToInt32(persianDate.Substring(0, 4)); - var month = Convert.ToInt32(persianDate.Substring(5, 2)); - var day = Convert.ToInt32(persianDate.Substring(8, 2)); + //این متد آخر همان روز را به صورت دیت تایم برمیگرداند + public static DateTime ToGeorgianDateTime2(this string persianDate) + { + persianDate = persianDate.ToEnglishNumber(); + try + { + var year = Convert.ToInt32(persianDate.Substring(0, 4)); + var month = Convert.ToInt32(persianDate.Substring(5, 2)); + var day = Convert.ToInt32(persianDate.Substring(8, 2)); - var res = new DateTime(year, month, day, new PersianCalendar()); - res = res.AddHours(23); - res = res.AddMinutes(59); - res = res.AddSeconds(59); + var res = new DateTime(year, month, day, new PersianCalendar()); + res = res.AddHours(23); + res = res.AddMinutes(59); + res = res.AddSeconds(59); - return res; + return res; - } - catch (Exception e) - { - return new DateTime(3000, 12, 20, new PersianCalendar()); - } + } + catch (Exception e) + { + return new DateTime(3000, 12, 20, new PersianCalendar()); + } - } - //تبدیل به تاریخ با ساعت - public static DateTime ToGeorgianDateWithTime(this string persianDate, string persianTime) - { - persianDate = persianDate.ToEnglishNumber(); - try - { - var year = Convert.ToInt32(persianDate.Substring(0, 4)); - var month = Convert.ToInt32(persianDate.Substring(5, 2)); - var day = Convert.ToInt32(persianDate.Substring(8, 2)); + } + //تبدیل به تاریخ با ساعت + public static DateTime ToGeorgianDateWithTime(this string persianDate, string persianTime) + { + persianDate = persianDate.ToEnglishNumber(); + try + { + var year = Convert.ToInt32(persianDate.Substring(0, 4)); + var month = Convert.ToInt32(persianDate.Substring(5, 2)); + var day = Convert.ToInt32(persianDate.Substring(8, 2)); - var hour = int.Parse(persianTime.Substring(0, 2)); - var minute = int.Parse(persianTime.Substring(3, 2)); + var hour = int.Parse(persianTime.Substring(0, 2)); + var minute = int.Parse(persianTime.Substring(3, 2)); - var res = new DateTime(year, month, day, new PersianCalendar()); - res = res.AddHours(hour); - res = res.AddMinutes(minute); - return res; + var res = new DateTime(year, month, day, new PersianCalendar()); + res = res.AddHours(hour); + res = res.AddMinutes(minute); + return res; - } - catch (Exception e) - { - return new DateTime(3000, 12, 20, new PersianCalendar()); - } + } + catch (Exception e) + { + return new DateTime(3000, 12, 20, new PersianCalendar()); + } - } + } - public static string DayOfWeeKToPersian(this DayOfWeek dayOfWeek) - { - return dayOfWeek switch - { - DayOfWeek.Friday => "جمعه", - DayOfWeek.Monday => "دوشنبه", - DayOfWeek.Saturday => "شنبه", - DayOfWeek.Sunday => "یکشنبه", - DayOfWeek.Thursday => "پنجشنبه", - DayOfWeek.Tuesday => "سه شنبه", - DayOfWeek.Wednesday => "چهارشنبه", - _ => "" - }; - } + public static string DayOfWeeKToPersian(this DayOfWeek dayOfWeek) + { + return dayOfWeek switch + { + DayOfWeek.Friday => "جمعه", + DayOfWeek.Monday => "دوشنبه", + DayOfWeek.Saturday => "شنبه", + DayOfWeek.Sunday => "یکشنبه", + DayOfWeek.Thursday => "پنجشنبه", + DayOfWeek.Tuesday => "سه شنبه", + DayOfWeek.Wednesday => "چهارشنبه", + _ => "" + }; + } + + public static bool IsInvalidDateTime(this DateTime date) + { + return date == new DateTime(3000, 12, 20, new PersianCalendar()); + + } + + #endregion + + #region Pooya - #endregion + public static DateTime GetUndefinedDateTime() + { + return new DateTime(2121, 03, 21); + } - #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 + 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 96c34de0..8e502ad0 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.12.06"; - AdminVersion = "2.5.26"; + StyleVersion = "2.12.07"; + AdminVersion = "2.5.27"; CameraVersion = "1.0.4"; } diff --git a/AccountManagement.Application/TaskApplication.cs b/AccountManagement.Application/TaskApplication.cs index f1b4ad8d..564c4537 100644 --- a/AccountManagement.Application/TaskApplication.cs +++ b/AccountManagement.Application/TaskApplication.cs @@ -380,7 +380,7 @@ public class TaskApplication : ITaskApplication foreach (var receiver in receivers) { var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue, receiver.Fullname, - receiver.Position.PositionValue, endTask); + receiver.Position.PositionValue, endTask,true); _assignRepository.Create(assign); } @@ -901,6 +901,10 @@ public class TaskApplication : ITaskApplication } DateTime timeGr = time.ToGeorgianDateTime2(); + if (timeGr.IsInvalidDateTime()) + { + return operation.Failed("لطفا تاریخ خود را به درستی وارد کنید"); + } assign.ChangeTimeTask(timeGr); var messageEntity = new TaskMessage(message, "تایید و تغییر درخواست کنسل", assign.id); _taskMessageRepository.Create(messageEntity); diff --git a/AccountManagement.Application/TicketApplication.cs b/AccountManagement.Application/TicketApplication.cs index 87bbbf4e..fedf373c 100644 --- a/AccountManagement.Application/TicketApplication.cs +++ b/AccountManagement.Application/TicketApplication.cs @@ -214,7 +214,7 @@ public class TicketApplication : ITicketApplication foreach (var receiver in receivers) { var assign = new Assign(task.id, task.SenderId, receiver.id, sender.Position.PositionValue, receiver.Fullname, - receiver.Position.PositionValue, endTask); + receiver.Position.PositionValue, endTask,true); _assignRepository.Create(assign); } _assignRepository.SaveChanges(); diff --git a/AccountManagement.Domain/AssignAgg/Assign.cs b/AccountManagement.Domain/AssignAgg/Assign.cs index 2bab15b8..60188e97 100644 --- a/AccountManagement.Domain/AssignAgg/Assign.cs +++ b/AccountManagement.Domain/AssignAgg/Assign.cs @@ -8,7 +8,7 @@ namespace AccountManagement.Domain.AssignAgg; public class Assign : EntityBase { - public Assign(long taskId, long assignerId, long assignedId, int assignerPositionValue, string assignedName, int assignedPositionValue, DateTime endTaskDate) + public Assign(long taskId, long assignerId, long assignedId, int assignerPositionValue, string assignedName, int assignedPositionValue, DateTime endTaskDate, bool firstTimeCreation = false) { TaskId = taskId; AssignerId = assignerId; @@ -17,7 +17,8 @@ public class Assign : EntityBase AssignedName = assignedName; AssignedPositionValue = assignedPositionValue; EndTaskDate = endTaskDate; - } + FirstTimeCreation = firstTimeCreation; + } //آیدی شخص ارسال کننده public long TaskId { get; private set; } @@ -51,7 +52,7 @@ public class Assign : EntityBase public string? DoneDescription { get; private set; } public bool IsCanceledRequest { get; private set; } - + public bool FirstTimeCreation { get; private set; } public Tasks Task { get; set; } public List TaskMessageList { get; set; } diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.Designer.cs b/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.Designer.cs new file mode 100644 index 00000000..4b2ef573 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.Designer.cs @@ -0,0 +1,954 @@ +// +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("20240908171608_addFirstTimeCreationToAssign")] + partial class addFirstTimeCreationToAssign + { + /// + 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("AdminAccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + 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("AcceptedTimeRequest") + .HasColumnType("int"); + + 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("CancelDescription") + .HasColumnType("ntext"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DoneDescription") + .HasColumnType("ntext"); + + b.Property("EndTaskDate") + .HasColumnType("datetime2"); + + b.Property("FirstTimeCreation") + .HasColumnType("bit"); + + 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("TaskId") + .HasColumnType("bigint"); + + b.Property("TimeRequest") + .HasColumnType("bit"); + + b.Property("TimeRequestDescription") + .HasColumnType("ntext"); + + 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("ContractingPartyName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("ntext"); + + b.Property("IsActiveString") + .HasMaxLength(7) + .HasColumnType("nvarchar(7)"); + + b.Property("SenderId") + .HasColumnType("bigint"); + + b.Property("StartTaskDate") + .HasColumnType("datetime2"); + + b.Property("TaskScheduleId") + .HasColumnType("bigint"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("TaskScheduleId"); + + 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.TaskMessageAgg.TaskMessage", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AssignId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Message") + .HasColumnType("ntext"); + + b.Property("RequestedDateFa") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("TypeOfMessage") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.HasKey("id"); + + b.HasIndex("AssignId"); + + b.ToTable("TaskMessages", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageItemsAgg.TaskMessageItems", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ReceiverAccountId") + .HasColumnType("bigint"); + + b.Property("SenderAccountId") + .HasColumnType("bigint"); + + b.Property("TaskMessageId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("TaskMessageId"); + + b.ToTable("TaskMessageItems", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Count") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("LastEndTaskDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("UnitNumber") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("UnitType") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.ToTable("TaskSchedules", (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.TicketAccessAccountAgg.TicketAccessAccount", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.ToTable("TicketAccessAccounts", (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("SubAccountSenderId") + .HasColumnType("bigint"); + + b.Property("TicketNumber") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("TicketType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Title") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + 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("Code") + .HasColumnType("int"); + + b1.Property("RoleId") + .HasColumnType("bigint"); + + b1.HasKey("Id"); + + b1.HasIndex("RoleId"); + + b1.ToTable("RolePermissions", (string)null); + + b1.WithOwner("Role") + .HasForeignKey("RoleId"); + + b1.Navigation("Role"); + }); + + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => + { + b.HasOne("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", "TaskSchedule") + .WithMany("TasksList") + .HasForeignKey("TaskScheduleId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("TaskSchedule"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMediaAgg.TaskMedia", b => + { + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("TaskMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.TaskAgg.Tasks", "Tasks") + .WithMany("TaskMedias") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageAgg.TaskMessage", b => + { + b.HasOne("AccountManagement.Domain.AssignAgg.Assign", "Assign") + .WithMany("TaskMessageList") + .HasForeignKey("AssignId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Assign"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageItemsAgg.TaskMessageItems", b => + { + b.HasOne("AccountManagement.Domain.TaskMessageAgg.TaskMessage", "TaskMessage") + .WithMany("TaskMessageItemsList") + .HasForeignKey("TaskMessageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaskMessage"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketMediasAgg.TicketMedia", b => + { + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("TicketMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket") + .WithMany("TicketMedias") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b => + { + b.Navigation("AccountLeftWorkList"); + + b.Navigation("CameraAccounts"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b => + { + b.Navigation("AdminResponseMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b => + { + b.Navigation("TaskMessageList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b => + { + b.Navigation("ClientResponseMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.MediaAgg.Media", b => + { + b.Navigation("AdminResponseMedias"); + + b.Navigation("ClientResponseMedias"); + + b.Navigation("TaskMedias"); + + b.Navigation("TicketMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b => + { + b.Navigation("Accounts"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => + { + b.Navigation("Assigns"); + + b.Navigation("TaskMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageAgg.TaskMessage", b => + { + b.Navigation("TaskMessageItemsList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", b => + { + b.Navigation("TasksList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketAgg.Ticket", b => + { + b.Navigation("AdminResponses"); + + b.Navigation("ClientResponses"); + + b.Navigation("TicketMedias"); + }); + + modelBuilder.Entity("TaskManager.Domain.PositionAgg.Position", b => + { + b.Navigation("Accounts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.cs b/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.cs new file mode 100644 index 00000000..9ddec223 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Migrations/20240908171608_addFirstTimeCreationToAssign.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AccountMangement.Infrastructure.EFCore.Migrations +{ + /// + public partial class addFirstTimeCreationToAssign : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "FirstTimeCreation", + table: "Assigns", + type: "bit", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "FirstTimeCreation", + table: "Assigns"); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs b/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs index 051be14a..1512697e 100644 --- a/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs +++ b/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs @@ -217,6 +217,9 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations b.Property("EndTaskDate") .HasColumnType("datetime2"); + b.Property("FirstTimeCreation") + .HasColumnType("bit"); + b.Property("IsCancel") .HasColumnType("bit"); diff --git a/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs index 207a27f4..3da08f6b 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs @@ -65,7 +65,7 @@ public class PositionRepository : RepositoryBase, IPositionRepos public List GetNoPositionAccounts() { - return _accountContext.Accounts.Where(x =>( x.PositionId == null || (x.PositionId !=null && x.PositionIsActive== "false"))&& x.IsActiveString == "true" && x.AdminAreaPermission == "true").Select(x => new AccountViewModel() + return _accountContext.Accounts.Where(x =>( x.PositionId == null || (x.PositionId !=null && x.PositionIsActive!= "true"))&& x.IsActiveString == "true" && x.AdminAreaPermission == "true").Select(x => new AccountViewModel() { Id = x.id, Fullname = x.Fullname diff --git a/Company.Domain/RollCallAgg/IRollCallRepository.cs b/Company.Domain/RollCallAgg/IRollCallRepository.cs index a95d44df..6392b8e8 100644 --- a/Company.Domain/RollCallAgg/IRollCallRepository.cs +++ b/Company.Domain/RollCallAgg/IRollCallRepository.cs @@ -13,7 +13,6 @@ namespace Company.Domain.RollCallAgg { EditRollCall GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId); EditRollCall GetById(long id); - List GetCurrentDay(RollCallSearchModel searchModel); RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel); List Search(RollCallSearchModel searchModel); CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId); diff --git a/CompanyManagment.App.Contracts/RollCall/EmployeeRollCallsByMonthViewModel.cs b/CompanyManagment.App.Contracts/RollCall/EmployeeRollCallsByMonthViewModel.cs index ff650aa4..5f951235 100644 --- a/CompanyManagment.App.Contracts/RollCall/EmployeeRollCallsByMonthViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCall/EmployeeRollCallsByMonthViewModel.cs @@ -1,17 +1,15 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CompanyManagment.App.Contracts.RollCall { - public class EmployeeRollCallsByMonthViewModel - { - public DateTime DateGr { get; set; } - public string PersianYear { get; set; } - public string PersianMonthName { get; set; } + public class EmployeeRollCallsByMonthViewModel + { + public DateTime DateGr { get; set; } + public string PersianYear { get; set; } + public string PersianMonthName { get; set; } - public IEnumerable RollCalls { get; set; } - } + public IEnumerable RollCalls { get; set; } + public string DateIndex { get; set; } + } } diff --git a/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs b/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs index 9ed7c80e..07463742 100644 --- a/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs +++ b/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs @@ -20,8 +20,7 @@ namespace CompanyManagment.App.Contracts.RollCall EditRollCall GetById(long id); List Search(RollCallSearchModel searchModel); - List GetCurrentDay(RollCallSearchModel searchModel); - List GetHistoryCase(RollCallSearchModel searchModel); + CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId); RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel); long Flag(long employeeId, long workshopId); diff --git a/CompanyManagment.App.Contracts/RollCall/RollCallViewModel.cs b/CompanyManagment.App.Contracts/RollCall/RollCallViewModel.cs index 2a695d35..b331ea80 100644 --- a/CompanyManagment.App.Contracts/RollCall/RollCallViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCall/RollCallViewModel.cs @@ -28,7 +28,6 @@ public class RollCallViewModel public int Month { get; set; } public bool IsAbsent { get; set; } public bool HasLeave { get; set; } - public DateTime? DateIndex { get; set; } public string DayOfWeekFa { get; set; } public bool IsHoliday { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeViewModel.cs b/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeViewModel.cs index 5b330634..1d142c8d 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployee/RollCallEmployeeViewModel.cs @@ -28,4 +28,5 @@ public class RollCallEmployeeViewModel : EditRollCallEmployee //نحوه محاسبه سنوات public string YearsOptions { get; set; } public string EmployeeSlug { get; set; } + public List PersonnelInfoViewModels { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.Application/RollCallApplication.cs b/CompanyManagment.Application/RollCallApplication.cs index c9a126d6..611d6512 100644 --- a/CompanyManagment.Application/RollCallApplication.cs +++ b/CompanyManagment.Application/RollCallApplication.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -54,30 +55,6 @@ public class RollCallApplication : IRollCallApplication { return _rollCallRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId); } - public EmployeeRollCallsByMonthViewModel GetEmployeeRollCallsHistory(long employeeId, long workshopId, string startDateTime, string endDateTime, string exactDateTime, - string dateIndex) - { - DateTime? startDateTimeGr = null; - DateTime? endDateTimeGr = null; - if (!string.IsNullOrWhiteSpace(startDateTime) && !string.IsNullOrWhiteSpace(endDateTime)) - { - startDateTimeGr = startDateTime.ToGeorgianDateTime(); - endDateTimeGr = endDateTime.ToGeorgianDateTime(); - } - - DateTime? exactDateTimeGr = - !string.IsNullOrWhiteSpace(exactDateTime) ? exactDateTime.ToGeorgianDateTime() : null; - DateTime? index; - try - { - index = DateTime.Parse(dateIndex); - } - catch - { - index = null; - } - return _rollCallRepository.GetEmployeeRollCallsHistory(employeeId, workshopId, startDateTimeGr, endDateTimeGr, exactDateTimeGr, index); - } @@ -91,43 +68,70 @@ public class RollCallApplication : IRollCallApplication return _rollCallRepository.Search(searchModel); } - public List GetCurrentDay(RollCallSearchModel searchModel) - { - return _rollCallRepository.GetCurrentDay(searchModel); - } - public List GetHistoryCase(RollCallSearchModel searchModel) - { - return _rollCallRepository.GetCurrentDay(searchModel); - } - - public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel) - { - return _rollCallRepository.GetWorkshopRollCallHistory(searchModel); - } - public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId) - { - return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId); - } + #region Pooya + + public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel) + { + return _rollCallRepository.GetWorkshopRollCallHistory(searchModel); + } + + public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId) + { + return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId); + } public List GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate, - string endDate) - { - if (!string.IsNullOrWhiteSpace(startDate) || !string.IsNullOrWhiteSpace(endDate)) - return new(); + string endDate) + { + if (!string.IsNullOrWhiteSpace(startDate) || !string.IsNullOrWhiteSpace(endDate)) + return new(); - var startDateGr = startDate.ToGeorgianDateTime(); - var endDateGr = endDate.ToGeorgianDateTime(); + var startDateGr = startDate.ToGeorgianDateTime(); + var endDateGr = endDate.ToGeorgianDateTime(); - if (startDateGr >= endDateGr) - return new(); + if (startDateGr >= endDateGr) + return new(); - //if (!_rollCallEmployeeRepository.Exists(x => x.EmployeeId == employeeId && - // x.WorkshopId == workshopId && x.IsActiveString == "true")) - // return new(); - return _rollCallRepository.GetEmployeeRollCallsForMonth(employeeId, workshopId, startDateGr, endDateGr); - } + //if (!_rollCallEmployeeRepository.Exists(x => x.EmployeeId == employeeId && + // x.WorkshopId == workshopId && x.IsActiveString == "true")) + // return new(); + return _rollCallRepository.GetEmployeeRollCallsForMonth(employeeId, workshopId, startDateGr, endDateGr); + } + + + public EmployeeRollCallsByMonthViewModel GetEmployeeRollCallsHistory(long employeeId, long workshopId, string startDateTime, string endDateTime, string exactDateTime, + string dateIndex) + { + DateTime? startDateTimeGr = null; + DateTime? endDateTimeGr = null; + if (!string.IsNullOrWhiteSpace(startDateTime) && !string.IsNullOrWhiteSpace(endDateTime)) + { + startDateTimeGr = startDateTime.ToGeorgianDateTime(); + endDateTimeGr = endDateTime.ToGeorgianDateTime(); + if (endDateTimeGr <= startDateTimeGr) + { + return new(); + } + + } + + DateTime? exactDateTimeGr = + !string.IsNullOrWhiteSpace(exactDateTime) ? exactDateTime.ToGeorgianDateTime() : null; + + + DateTime? index = null; + if (!string.IsNullOrWhiteSpace(dateIndex)) + { + index = dateIndex.ToGeorgianDateTime(); + index = (index.Value.Date >= DateTime.Now) || (index.Value == new DateTime(3000, 12, 20, new PersianCalendar())) ? null : index; + + } + + return _rollCallRepository.GetEmployeeRollCallsHistory(employeeId, workshopId, startDateTimeGr, endDateTimeGr, exactDateTimeGr, index); + } + #endregion public long Flag(long employeeId, long workshopId) { return _rollCallRepository.Flag(employeeId, workshopId); diff --git a/CompanyManagment.Application/RollCallEmployeeApplication.cs b/CompanyManagment.Application/RollCallEmployeeApplication.cs index 68e56b80..5b39cae8 100644 --- a/CompanyManagment.Application/RollCallEmployeeApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeApplication.cs @@ -1,29 +1,34 @@ -using System.Collections.Generic; -using System.Linq; -using _0_Framework.Application; +using _0_Framework.Application; using Company.Domain.EmployeeAgg; +using Company.Domain.LeftWorkAgg; using Company.Domain.RollCallEmployeeAgg; using CompanyManagment.App.Contracts.RollCallEmployee; using CompanyManagment.App.Contracts.RollCallEmployeeStatus; +using System; +using System.Collections.Generic; +using System.Linq; namespace CompanyManagment.Application; public class RollCallEmployeeApplication : IRollCallEmployeeApplication { private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository; - private readonly IEmployeeRepository _employeeRepository; private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication; + private readonly IEmployeeRepository _employeeRepository; + private readonly ILeftWorkRepository _leftWorkRepository; - public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication) + public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, ILeftWorkRepository leftWorkRepository) { _rollCallEmployeeRepository = rollCallEmployeeRepository; _employeeRepository = employeeRepository; _rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication; + _leftWorkRepository = leftWorkRepository; } public OperationResult Create(CreateRollCallEmployee command) { var opreation = new OperationResult(); + if (_rollCallEmployeeRepository.Exists(x => x.EmployeeId == command.EmployeeId && x.WorkshopId == command.EmployeeId)) return opreation.Succcedded(); @@ -32,19 +37,31 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication return opreation.Failed("پرسنل یافت نشد"); var create = new RollCallEmployee(command.WorkshopId, command.EmployeeId, fullname.EmployeeFullName); _rollCallEmployeeRepository.Create(create); + + if (command.HasUploadedImage == "true") + create.HasImage(); + _rollCallEmployeeRepository.SaveChanges(); - return opreation.Succcedded(); + return opreation.Succcedded(create.id); } public OperationResult Active(long id) { var opreation = new OperationResult(); + var emp = _rollCallEmployeeRepository.Get(id); + if (emp == null) return opreation.Failed("پرسنل یافت نشد"); - if(emp.HasUploadedImage == "false") + + if (!_leftWorkRepository.Exists(x => x.EmployeeId == emp.EmployeeId && x.WorkshopId == emp.WorkshopId && + x.StartWorkDate <= DateTime.Now && x.LeftWorkDate > DateTime.Now)) + return opreation.Failed("کارمند شروع به کار ندارد"); + + if (emp.HasUploadedImage == "false") return opreation.Failed("لطفا ابتدا عکس پرسنل را آپلود کنید"); + emp.Active(); _rollCallEmployeeRepository.SaveChanges(); _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() { RollCallEmployeeId = id }); @@ -58,8 +75,6 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication if (emp == null) return opreation.Failed("پرسنل یافت نشد"); var lastStatus = emp.EmployeesStatus.MaxBy(x => x.StartDate); - if (!lastStatus.EndDate.IsDateUndefined()) - return opreation.Failed("حضور و غیاب کارمند قبلا غیر فعال شده است"); emp.DeActive(); _rollCallEmployeeRepository.SaveChanges(); _rollCallEmployeeStatusApplication.Deactivate(lastStatus.id); @@ -72,7 +87,7 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication var emp = _rollCallEmployeeRepository.Get(Employeeid); if (emp == null) return opreation.Failed("پرسنل یافت نشد"); - + emp.HasImage(); _rollCallEmployeeRepository.SaveChanges(); return opreation.Succcedded(); diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index 8ca1acaf..391b00ab 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -32,57 +32,6 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos throw new NotImplementedException(); } - public List GetCurrentDay(RollCallSearchModel searchModel) - { - //PersonnelCode = _context.PersonnelCodeSet.FirstOrDefault(e => e.EmployeeId == x.EmployeeId && e.WorkshopId == x.WorkshopId).PersonnelCode.ToString(), - var rawQuery = _context.RollCalls.Where(x => x.WorkshopId == searchModel.WorkshopId && x.StartDate >= DateTime.Now.Date).Select(x => new RollCallViewModel() - { - EmployeeId = x.EmployeeId, - WorkshopId = x.WorkshopId, - EmployeeFullName = x.EmployeeFullName, - Id = x.id, - Month = x.Month, - Year = x.Year, - StartDate = x.StartDate, - EndDate = x.EndDate, - PersonnelCode = _context.PersonnelCodeSet - .FirstOrDefault(a => a.EmployeeId == x.EmployeeId && a.WorkshopId == x.WorkshopId).PersonnelCode - .ToString(), - }); - var groupedQuery = rawQuery.GroupBy(x => x.EmployeeId).Select(x => new RollCallViewModel() - { - EmployeeId = x.First().EmployeeId, - WorkshopId = x.First().WorkshopId, - EmployeeFullName = x.First().EmployeeFullName, - Id = x.First().Id, - Month = x.First().Month, - Year = x.First().Year, - RollCallTimesList = x.Select(d => new RollCallTimeViewModel() - { - StartDate = d.StartDate != null ? d.StartDate.Value.ToString("HH:mm") : "--:--", - EndDate = d.EndDate != null ? d.EndDate.Value.ToString("HH:mm") : "--:--" - }).ToList(), - PersonnelCode = x.First().PersonnelCode, - }).AsEnumerable(); - var orderedEnum = groupedQuery.OrderBy(x => Convert.ToInt32(x.PersonnelCode)); - - var query = orderedEnum.Select(x => new RollCallViewModel() - { - EmployeeId = x.EmployeeId, - WorkshopId = x.WorkshopId, - EndDate = x.EndDate, - StartDate = x.StartDate, - Id = x.Id, - EmployeeFullName = x.EmployeeFullName, - Month = x.Month, - Year = x.Year, - RollCallTimesList = x.RollCallTimesList, - PersonnelCode = x.PersonnelCode - }); - - return query.Skip(searchModel.PageIndex).Take(30).ToList(); - } - public List Search(RollCallSearchModel searchModel) { throw new NotImplementedException(); @@ -163,68 +112,65 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos DateTime? startDateTime, DateTime? endDateTime, DateTime? exactDateTime, DateTime? dateIndex) { - + //get RollCallEmployee and RollCallEmployeeStatus for that employee in that workshop var employeeRollCallStatuses = _context.RollCallEmployees.Include(x => x.EmployeesStatus) .FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId); + //if none was found return empty if (employeeRollCallStatuses == null) return new(); + //this list will have all the months which employee was active in var activeMonths = new List(); + //filling the list foreach (var status in employeeRollCallStatuses.EmployeesStatus) { - var persianEndDayOfMonth = new PersianDateTime(status.EndDate.Date); - var persianStartDayOfMonth = new PersianDateTime(status.StartDate.Date); + var persianEndDate = new PersianDateTime(status.EndDate.Date); + var persianStartDate = new PersianDateTime(status.StartDate.Date); - //var persianEndFirstDayOfMonth = - // new PersianDateTime(persianEndDayOfMonth.Year, persianEndDayOfMonth.Month, 1); - var persianStartFirstDayOfMonth = new PersianDateTime(persianStartDayOfMonth.Year, persianStartDayOfMonth.Month, 1); - for (PersianDateTime start = persianStartFirstDayOfMonth; start <= persianEndDayOfMonth; start = start.AddMonths(1)) + var persianStartFirstDayOfMonth = new PersianDateTime(persianStartDate.Year, persianStartDate.Month, 1); + + for (PersianDateTime start = persianStartFirstDayOfMonth; start <= persianEndDate && start < PersianDateTime.Today.Date; start = start.AddMonths(1)) { activeMonths.Add(start); - } } - var activeMonthsList = activeMonths.Distinct().ToList(); + //might have duplicated records, this is the reason for distinct + var activeMonthsList = activeMonths.OrderByDescending(x => x.Date).Distinct().ToList(); - PersianDateTime startSearch; - PersianDateTime endSearch; + PersianDateTime startSearch = new(); + PersianDateTime endSearch = new(); + //if search has these parameters below if (startDateTime.HasValue && endDateTime.HasValue) { + //change them to persian date time and save them startSearch = new PersianDateTime(startDateTime.Value); endSearch = new PersianDateTime(endDateTime.Value); - activeMonthsList = activeMonthsList.Where(x => x.Date >= startSearch && x.Date <= endSearch).ToList(); + //get the months that include these dates + activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); } - + //if exact datetime is given if (exactDateTime.HasValue) { + //start and end will be the same date startSearch = new PersianDateTime(exactDateTime.Value); endSearch = startSearch; + //get the + activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); } - //else - //{ - // startSearch = employeeRollCallStatuses.EmployeesStatus.Max(x => x.StartDate.Date).To; - // endSearch = employeeRollCallStatuses.EmployeesStatus.Min(x => x.EndDate.Date); - //} - - //var statusesByMonth = - // employeeRollCallStatuses.EmployeesStatus - // .GroupBy(x => new DateTime(Convert.ToInt32(x.StartDate.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.StartDate.ToFarsi().Substring(5, 2)), 1, new PersianCalendar()).Date) - // .OrderByDescending(x => x.Key); if (dateIndex != null) { var persianDateIndex = new PersianDateTime(dateIndex.Value); var dateIndexFirstOfMonth = persianDateIndex.AddDays(-(persianDateIndex.Day - 1)); - activeMonthsList = activeMonthsList.Where(x => dateIndexFirstOfMonth == x).OrderByDescending(x => x).ToList(); + activeMonthsList = activeMonthsList.Where(x => dateIndexFirstOfMonth >= x).ToList(); } if (!activeMonthsList.Any()) return new(); - //get the last month which user was active in PersianDateTime selectedMonthPersian = activeMonthsList.First(); @@ -247,51 +193,64 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && x.EndDate != null && x.StartDate >= selectedMonthFirstDay && x.StartDate < nextMonthFirstDay); + var personnelCode = + _context.PersonnelCodeSet.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)?.PersonnelCode; + + var employeeName = _context.Employees.Select(x => new { x.id, x.FName, x.LName }).FirstOrDefault(x => x.id == employeeId); var rollCallsList = rollCalls.ToList(); var leavesList = leavesQuery.ToList(); int dateRange = (int)(nextMonthFirstDay - selectedMonthFirstDay).TotalDays; + var todayDate = DateTime.Now.Date; //all the dates from start to end, to be compared with present days to get absent dates - var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => selectedMonthFirstDay.AddDays(offset).Date); - var result = completeDaysList.Where(x => statusesOfMonth.Any(y => x >= y.StartDate.Date && x <= y.EndDate.Date)) - .Select(x => new RollCallViewModel() - { + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => selectedMonthFirstDay.AddDays(offset).Date).Where(x => x.Date < todayDate); - DateGr = x.Date.Date, - DateFa = x.Date.Date.ToFarsi(), - RollCallTimesList = rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date).Select(y => - new RollCallTimeViewModel() - { - StartDate = y.StartDate.Value.ToString("HH:mm"), - EndDate = y.EndDate!.Value.ToString("HH:mm") - }), - TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date) - .Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)), - Reason = leavesList.FirstOrDefault(y => y.EndLeave >= x.Date.Date && y.StartLeave <= x.Date.Date)?.LeaveType ?? "" - }); + //if user search range is within a month for example, we dont want 30/31/29 days for month, we want it to be the size of the search range + //user input = 2024/04/15~2024/04/21, output days count is 21-15+1=6 days from 15th to 21st + if (exactDateTime.HasValue || (startDateTime.HasValue && endDateTime.HasValue)) + completeDaysList = completeDaysList.Where(x => x.Date >= startSearch.Date && x.Date <= endSearch.Date); + var result = completeDaysList.Where(x => statusesOfMonth.Any(y => x >= y.StartDate.Date && x <= y.EndDate.Date)) + .Select(x => new RollCallViewModel() + { + + DateGr = x.Date.Date, + DateFa = x.Date.Date.ToFarsi(), + RollCallTimesList = rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date).Select(y => + new RollCallTimeViewModel() + { + StartDate = y.StartDate.Value.ToString("HH:mm"), + EndDate = y.EndDate!.Value.ToString("HH:mm") + }), + TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date) + .Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)), + Reason = leavesList.FirstOrDefault(y => y.EndLeave >= x.Date.Date && y.StartLeave <= x.Date.Date)?.LeaveType ?? "" + }); result = result.Select(x => new RollCallViewModel() { + EmployeeFullName = $"{employeeName?.FName} {employeeName?.LName}", + PersonnelCode = personnelCode.ToString(), DateGr = x.DateGr, DateFa = x.DateFa, DayOfWeekFa = x.DateGr.DayOfWeek.DayOfWeeKToPersian(), IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr), + IsAbsent = !x.RollCallTimesList.Any(), RollCallTimesList = x.RollCallTimesList, TotalWorkingHours = $"{Convert.ToInt32(x.TotalWorkingHoursSpan.TotalHours)}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", - DateIndex = activeMonthsList.Count > 2 ? activeMonthsList.Skip(1).First().ToDateTime() : null }).ToList(); return new EmployeeRollCallsByMonthViewModel() { PersianMonthName = selectedMonthPersian.ToString("MMMM"), PersianYear = selectedMonthPersian.ToString("yyyy"), DateGr = selectedMonthFirstDay, - RollCalls = result + RollCalls = result, + DateIndex = activeMonthsList.Count > 1 ? activeMonthsList.Skip(1).First().ToString("yyyy/MM/dd") : null + }; } //سوابق حضور غیاب کارگاه - //dateIndex starts at 0 public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel) { @@ -431,7 +390,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos //get activated employees var activeEmployees = _context.RollCallEmployees.Include(x => x.EmployeesStatus) - .Where(x => x.WorkshopId == workshopId && x.EmployeesStatus.Any(y => + .Where(x => x.WorkshopId == workshopId && x.IsActiveString == "true" && x.EmployeesStatus.Any(y => y.StartDate.Date <= date && y.EndDate.Date >= date)); diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsTaskTicketsModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsTaskTicketsModal.cshtml index 6a061b27..36ba4272 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsTaskTicketsModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsTaskTicketsModal.cshtml @@ -410,13 +410,36 @@
-
- +
+ @* + *@ + +
+
+ طرف حساب: + @Model.ContractingPartyName +
+
+ عنوان وظیفه: + @Model.Title +
+
+
+
+ تاریخ ایجاد: + @Model.CreateDateFa +
+
+ تاریخ سررسید: + @Model.AssignViewModels?.First().EndTaskDateFa +
+
@if (!String.IsNullOrWhiteSpace(Model.Description)) { -
+
+
توضیحات :
@Html.Raw(Model.Description)
} diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/OperationRequestModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/OperationRequestModal.cshtml index 53333000..740cdc25 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/OperationRequestModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/OperationRequestModal.cshtml @@ -48,10 +48,16 @@
+
+
+
+ +
+
الی
+ +
+
+
+ +
+ + +
+ + + + + حذف جستجو +
+
@@ -131,25 +140,39 @@
- +
@if (@Model.RollCallViewModels.ActiveEmployees.Any()) { + + + + +
-
+
ردیف
نام پرسنل
شماره پرسنلی
+
تاریخ
تاخیر در ورود
ورود
خروج
تجمیع در خروج
مجموع ساعات کاری
- -
+ +
@@ -166,12 +189,101 @@
+ + + + + + + @section Script { + - + } \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs index d4f2bf55..81096169 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml.cs @@ -2,6 +2,7 @@ using CompanyManagment.App.Contracts.RollCall; using CompanyManagment.App.Contracts.RollCallEmployee; using CompanyManagment.App.Contracts.Workshop; +using CompanyManagment.App.Contracts.YearlySalary; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -17,6 +18,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall private readonly IWorkshopApplication _workshopApplication; private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication; private readonly IRollCallApplication _rollCallApplication; + private readonly IYearlySalaryApplication _yearlySalaryApplication; public RollCallsByDateViewModel RollCallViewModels { get; set; } public EmployeeRollCallsByMonthViewModel RollCallEmployeeViewModels { get; set; } @@ -24,14 +26,16 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall public List RollCallEmployeeList; public RollCallSearchModel SearchModel { get; set; } = new(); + public List YearlyList { get; set; } - public CaseHistoryModel(IAuthHelper authHelper, IPasswordHasher passwordHasher, IRollCallEmployeeApplication rollCallEmployeeApplication, IWorkshopApplication workshopApplication, IRollCallApplication rollCallApplication) + public CaseHistoryModel(IAuthHelper authHelper, IPasswordHasher passwordHasher, IRollCallEmployeeApplication rollCallEmployeeApplication, IWorkshopApplication workshopApplication, IRollCallApplication rollCallApplication, IYearlySalaryApplication yearlySalaryApplication) { _authHelper = authHelper; _passwordHasher = passwordHasher; _rollCallEmployeeApplication = rollCallEmployeeApplication; _workshopApplication = workshopApplication; _rollCallApplication = rollCallApplication; + _yearlySalaryApplication = yearlySalaryApplication; } @@ -52,6 +56,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall }; RollCallViewModels = _rollCallApplication.GetWorkshopRollCallHistory(searchModel); + YearlyList = _yearlySalaryApplication.GetYears(); + return Page(); } else diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs index 855a58cb..f7bd4896 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs @@ -67,22 +67,6 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall } } - public IActionResult OnGetCurrentDayPagination() - { - var workshopHash = User.FindFirstValue("WorkshopSlug"); - var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - var searchModel = new RollCallSearchModel() - { - WorkshopId = workshopId, - }; - - var list= _rollCallApplication.GetCurrentDay(searchModel); - return new JsonResult(new - { - isSuccess = true, - list - }); - } public IActionResult OnGetCurrentDayAjax(string type) diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml index 4259508d..2c0be50a 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml @@ -78,10 +78,10 @@
-

تعداد افراد فعال: @Model.Employees.Count(x => x.IsActiveString == "true")

+

تعداد افراد فعال: @Model.Employees.PersonnelInfoViewModels.Count(x => x.IsActiveString == "true")

-

تعداد افراد غیرفعال: @Model.Employees.Count(x => x.IsActiveString == "false")

+

تعداد افراد غیرفعال: @Model.Employees.PersonnelInfoViewModels.Count(x => x.IsActiveString == "false")

@@ -99,9 +99,9 @@
عملیات
- @foreach (var item in @Model.Employees) + @foreach (var item in @Model.Employees.PersonnelInfoViewModels) { -
+
@@ -159,7 +159,7 @@ }
@@ -168,7 +168,7 @@
- + @index
@@ -176,7 +176,7 @@ @if (item.HasUploadedImage == "true") { - @* *@ + } else { @@ -185,33 +185,36 @@
-
@item.EmployeeFullName
-
عکس پرسنل آپلود شده است.
+
@item.EmployeeFullName
+
+ @if (item.HasUploadedImage == "true") + { +

عکس پرسنل آپلود شده است

+ } + else { +

عکس پرسنل آپلود نشده است

+ } +
-
-
- @* @if (item.IsActiveString == "true") - { - - } - else - { - - } *@ - - - - @* *@ + @if (item.IsActiveString == "true") + { + + } + else + { + + }
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs index fb5ae650..109dd716 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs @@ -16,7 +16,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall public class EmployeeUploadPictureModel : PageModel { public string WorkshopFullName; - public List Employees; + public RollCallEmployeeViewModel Employees; public bool HasEmployees; public int MaxPersonValid; public long WorkshopId; @@ -54,9 +54,21 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall MaxPersonValid = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId).MaxPersonValid; - Employees = _rollCallEmployeeApplication.GetPersonnelRollCallList(workshopId); - - HasEmployees = Employees.Count > 0 ? true : false; + var distinctEmployees = _rollCallEmployeeApplication + .GetPersonnelRollCallList(workshopId) + .GroupBy(x => x.EmployeeId) + .Select(g => g.First()) + .OrderBy(x => x.Black ? 1 : 0) + .ThenBy(x => x.PersonelCode) + .ToList(); + + + Employees = new RollCallEmployeeViewModel + { + PersonnelInfoViewModels = distinctEmployees + }; + + HasEmployees = Employees.PersonnelInfoViewModels.Count > 0 ? true : false; return Page(); } else diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml index d8bd25a5..fe79d129 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml @@ -181,19 +181,20 @@
-
- +
+ @* asp-page="/Company/RollCall/Plans" *@ +
@if (!Model.CheckRollCallService) { - خرید سرویس + خرید سرویس } else { - ارتقا یا تغییر سرویس + ارتقا یا تغییر سرویس }
@@ -237,7 +238,7 @@
-
تاریخچه حضور و غیاب
+
سوابق حضور و غیاب
-
+
@@ -84,11 +98,10 @@
-
-

@Model.AmountFa

-

تومان

-
- +
+

@Model.AmountFa

+

تومان

+
@*
@@ -97,10 +110,11 @@
*@
-
-

@Model.AmountFa

-

تومان

-
+
+

@Model.AmountFa

+

تومان

+
+
@@ -168,7 +182,7 @@