コード例 #1
0
        protected override void View()
        {
            base.View();

            TasksDetailsView taskDetails = new TasksDetailsView(this.entity);

            taskDetails.Show();
        }
コード例 #2
0
        private void View()
        {
            Console.Clear();
            Console.Write("Task ID: ");
            int id = int.Parse(Console.ReadLine());

            TaskRepository taskRepo = new TaskRepository();

            Task task = taskRepo.GetByID(id);

            if (task == null)
            {
                Console.WriteLine("Task not found!");
                Console.ReadKey(true);
                return;
            }

            else if (task.CreatorID == AuthenticationService.LoggedUser.ID || task.ResponsibleID == AuthenticationService.LoggedUser.ID)
            {
                Console.WriteLine("ID: " + task.ID);
                Console.WriteLine("Title: " + task.Title);
                Console.WriteLine("Description: " + task.Description);
                Console.WriteLine("Working Hours: " + task.WorkingHours);
                Console.WriteLine("Creator ID: " + task.CreatorID);
                Console.WriteLine("Responsible ID: " + task.ResponsibleID);
                Console.WriteLine("Created Date: " + task.CreateDate);
                Console.WriteLine("Last Edit Date: " + task.LastEditDate);
                Console.WriteLine("Status: " + task.Status);

                Console.WriteLine("########################################");

                TasksDetailsView taskDetails = new TasksDetailsView(entity);
                taskDetails.Show();
            }

            else
            {
                Console.WriteLine("You are not allowed to view this task!");
                Console.ReadKey(true);
                return;
            }

            Console.ReadKey(true);
        }