Bläddra i källkod

почти готоффо

Rhomaios 3 år sedan
förälder
incheckning
eb4b322dee

BIN
.vs/Reconstruction/DesignTimeBuild/.dtbcache.v2


+ 6 - 1
.vs/Reconstruction/project-colors.json

@@ -5,7 +5,12 @@
       "ProjectGuid": "a2fe74e1-b743-11d0-ae1a-00a0c90fffc3",
       "DisplayName": "Прочие файлы",
       "ColorIndex": -1
+    },
+    "3edf3c66-3414-4010-8054-77ae1b4f9580": {
+      "ProjectGuid": "3edf3c66-3414-4010-8054-77ae1b4f9580",
+      "DisplayName": "Reconstruction",
+      "ColorIndex": 0
     }
   },
-  "NextColorIndex": 0
+  "NextColorIndex": 1
 }

BIN
.vs/Reconstruction/v17/.futdcache.v1


BIN
.vs/Reconstruction/v17/.suo


BIN
.vs/slnx.sqlite


+ 114 - 7
Reconstruction/Functions/LoggedUser/Display.cs

@@ -5,6 +5,95 @@ namespace Reconstruction.Functions
 { 
     public static class Display
     {
+
+        public static void ShowCompletedTask()
+        {
+            Console.WriteLine("Tasks completed by " + Service.LoggedUser.Login);
+            ObservableCollection<Task> TaskCollection = new ObservableCollection<Task>(Service.db.Tasks.Where(x => x.AccUserId == Service.LoggedUser.Id && x.StatusId = 3).ToList());
+
+            foreach (Task t in TaskCollection)
+            {
+                User user = (User)Service.db.Users.Where(u => u.Id == t.CreatorUserId).SingleOrDefault();
+                Status status = (Status)Service.db.Statuses.Where(s => s.Id == t.StatusId).SingleOrDefault();
+
+                Console.WriteLine("Title: " + t.Title +
+                                  "\nDescription: " + t.Description +
+                                  "\nCreated by " + user.Login +
+                                  "\nStatus: " + status.Title + "\n");
+            }
+
+            Console.ReadKey();
+
+        }
+
+        public static void ShowUsersTasks()
+        {
+            ObservableCollection<Task> TaskCollection = new ObservableCollection<Task>(Service.db.Tasks.Where(x => x.AccUserId == Service.LoggedUser.Id).ToList());
+
+            foreach (Task t in TaskCollection)
+            {
+                User user = (User)Service.db.Users.Where(u => u.Id == t.CreatorUserId).SingleOrDefault();
+                Status status = (Status)Service.db.Statuses.Where(s => s.Id == t.StatusId).SingleOrDefault();
+
+                Console.WriteLine("Title: " + t.Title +
+                                  "\nDescription: " + t.Description +
+                                  "\nCreated by " + user.Login +
+                                  "\nStatus: " + status.Title +
+                                  "\nEnter " + t.Id + " to change its status\n");
+            }
+
+            int id = 0;
+            Task task;
+
+            while (true)
+            {
+                try
+                {
+                    id = int.Parse(Console.ReadLine());
+                    task = (Task)Service.db.Tasks.Where(x => x.Id == id).SingleOrDefault();
+                    break;
+                }
+                catch
+                {
+                    Console.WriteLine("You entered a wrong value");
+                }
+            }
+            if(task != null)
+            {
+                Console.WriteLine("Enter:\n1 - to set task 'incompleted'\n2 - to set task 'in progress'\n3 - to set task 'completed'\n0 - to abolish this operation\n");
+                int statusID;
+
+                while(true)
+                {
+                    try
+                    {
+                        statusID = int.Parse(Console.ReadLine());
+                        break;
+                    }
+                    catch
+                    {
+                        Console.WriteLine("You entered a wrong value");
+                    }
+                }
+                if(statusID != 0 && statusID < 4)
+                {
+                    task.StatusId = statusID;
+                    Service.db.Tasks.Update(task);
+                    Service.db.SaveChanges();
+                    Console.WriteLine("Operation performed successfully");
+                }
+                else
+                {
+                    Console.WriteLine("Operation abolished");
+                }
+
+            }
+
+            Console.ReadKey();
+
+        }
+
+
         public static void ShowUserList()
         {
             Console.WriteLine("Login  |" + "  Lastname  |" + "  Firstname  |" + "  Middlename ");
@@ -41,20 +130,38 @@ namespace Reconstruction.Functions
             {
                 User user = (User)Service.db.Users.Where(u => u.Id == t.CreatorUserId).SingleOrDefault();
 
-                if(user == null)
-                {
-                    user.Login = "No user attached";
-                }
-
-                if(t.StatusId == 1)
+                if(t.StatusId != 1 && t.AccUserId == null)
                 {
                     Console.WriteLine("Title: " + t.Title +
                                       "\nDescription: " + t.Description +
-                                      "\nCreated by " + user.Login + "\n");
+                                      "\nCreated by " + user.Login + 
+                                      "\nEnter " + t.Id + " to take this task\n");
                 }
+            }
 
+            int id = 0;
+            Task task;
 
+            while (true)
+            {
+                try
+                {
+                    id = int.Parse(Console.ReadLine());
+                    task = (Task)Service.db.Tasks.Where(x => x.Id == id).SingleOrDefault();
+                    break;
+                }
+                catch
+                {
+                    Console.WriteLine("You entered a wrong value");
+                }
+                
             }
+
+            task.AccUserId = Service.LoggedUser.Id;
+
+            Service.db.Tasks.Update(task);
+            Service.db.SaveChanges();
+
             Console.ReadKey();
         }
 

+ 1 - 0
Reconstruction/Program.cs

@@ -54,6 +54,7 @@ while(Service.IsLoggedIn == true)
             }
         case 5:
             {
+                Display.ShowUsersTasks();
                 break;
             }
     }

BIN
Reconstruction/bin/Debug/net6.0/Reconstruction.dll


BIN
Reconstruction/bin/Debug/net6.0/Reconstruction.pdb


BIN
Reconstruction/bin/Debug/net6.0/ref/Reconstruction.dll


+ 1 - 1
Reconstruction/obj/Debug/net6.0/Reconstruction.GeneratedMSBuildEditorConfig.editorconfig

@@ -7,4 +7,4 @@ build_property.InvariantGlobalization =
 build_property.PlatformNeutralAssembly = 
 build_property._SupportedPlatformList = Linux,macOS,Windows
 build_property.RootNamespace = Reconstruction
-build_property.ProjectDir = C:\Users\gr602_horse\Source\Repos\Reconstruction\Reconstruction\
+build_property.ProjectDir = C:\Users\gr602_horse\source\repos\Reconstruction\Reconstruction\

BIN
Reconstruction/obj/Debug/net6.0/Reconstruction.assets.cache


BIN
Reconstruction/obj/Debug/net6.0/Reconstruction.dll


+ 1 - 1
Reconstruction/obj/Debug/net6.0/Reconstruction.genruntimeconfig.cache

@@ -1 +1 @@
-50bc6798a4a1339af14f0a27485d0395f1190958
+76af094c30bb5949e155f1c77a6b4418d43af162

BIN
Reconstruction/obj/Debug/net6.0/Reconstruction.pdb


BIN
Reconstruction/obj/Debug/net6.0/ref/Reconstruction.dll


+ 5 - 5
Reconstruction/obj/Reconstruction.csproj.nuget.dgspec.json

@@ -1,17 +1,17 @@
 {
   "format": 1,
   "restore": {
-    "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj": {}
+    "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj": {}
   },
   "projects": {
-    "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj": {
+    "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj": {
       "version": "1.0.0",
       "restore": {
-        "projectUniqueName": "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
+        "projectUniqueName": "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
         "projectName": "Reconstruction",
-        "projectPath": "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
+        "projectPath": "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
         "packagesPath": "C:\\Users\\gr602_horse\\.nuget\\packages\\",
-        "outputPath": "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\obj\\",
+        "outputPath": "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\obj\\",
         "projectStyle": "PackageReference",
         "fallbackFolders": [
           "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"

+ 2 - 2
Reconstruction/obj/project.nuget.cache

@@ -1,8 +1,8 @@
 {
   "version": 2,
-  "dgSpecHash": "PxcvDcb2Hxf384JlJ57QLb3qjGJsnLybFAJWhqHFKe6IYPv69hSgp2vlSRb3pPN0tUoiAqN7Ok1izmL5gsayIA==",
+  "dgSpecHash": "Kz0xvtKoHplMq6vvurkdRoBFRvqFmdu6HM7UB1dbmzQ7p6N4w55uxxn+SlEYK9axJjPSFdILY3S94uJajGrWJQ==",
   "success": true,
-  "projectFilePath": "C:\\Users\\gr602_horse\\Source\\Repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
+  "projectFilePath": "C:\\Users\\gr602_horse\\source\\repos\\Reconstruction\\Reconstruction\\Reconstruction.csproj",
   "expectedPackageFiles": [
     "C:\\Users\\gr602_horse\\.nuget\\packages\\humanizer.core\\2.8.26\\humanizer.core.2.8.26.nupkg.sha512",
     "C:\\Users\\gr602_horse\\.nuget\\packages\\microsoft.csharp\\4.5.0\\microsoft.csharp.4.5.0.nupkg.sha512",