Ver Fonte

avalonia: Fixed some assignment bugs

Kenric Nugteren há 1 mês atrás
pai
commit
d2a549c6eb

+ 8 - 1
PRS.Avalonia/PRS.Avalonia/Modules/Assignments/AssignmentsViewModel.cs

@@ -137,7 +137,9 @@ public partial class AssignmentsViewModel : ModuleViewModel
                 });
         }, args =>
         {
-            return ActivityModel.Refresh(args.Force);
+            ActivityModel.Refresh(args.Force);
+            ActivityModel.Search(x => x is ActivityShell shell && !shell.IsLeave);
+            return ActivityModel;
         }))?.FirstOrDefault();
         if (activity is null) return false;
 
@@ -151,6 +153,11 @@ public partial class AssignmentsViewModel : ModuleViewModel
 
         assignment.EmployeeID = employeeID;
 
+        assignment.ActivityID = activity.ID;
+        assignment.ActivityColor = activity.Color;
+        assignment.ActivityCode = activity.Code;
+        assignment.ActivityDescription = activity.Description;
+
         Navigation.Navigate<AssignmentEditViewModel>(x =>
         {
             x.Shell = assignment;

+ 4 - 1
PRS.Avalonia/PRS.Avalonia/Repositories/Activity/ActivityShell.cs

@@ -10,6 +10,7 @@ public class ActivityShell : Shell<ActivityModel, EmployeeActivity>
     public string Code => Get<string>();
     public string Description => Get<string>();
     public bool IsLeave => Get<bool>();
+    public string Color => Get<string>();
 
     public IEnumerable<ActivityFormShell> Forms
         => Parent.Forms.Where(x => x.ActivityID == ID);
@@ -22,6 +23,8 @@ public class ActivityShell : Shell<ActivityModel, EmployeeActivity>
             .Map(nameof(ID), x => x.Activity.ID)
             .Map(nameof(Code), x => x.Activity.Code)
             .Map(nameof(Description), x => x.Activity.Description)
-            .Map(nameof(IsLeave), x => x.Activity.IsLeave);
+            .Map(nameof(IsLeave), x => x.Activity.IsLeave)
+            .Map(nameof(Color), x => x.Activity.Color)
+            ;
     }
 }