Exemple #1
0
 public IActionResult CreateTask(ToDo task)
 {
     if (ModelState.IsValid)
     {
         TaskDB.AddTask(task, context);
     }
     return(View(task));
 }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                myTask taskItem = new myTask();
                taskItem.Name    = collection["Name"];
                taskItem.DueDate = Convert.ToDateTime(collection["DueDate"]);
                taskItem.Status  = collection["Status"];

                TaskDB.AddTask(taskItem);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                //Creates object mytask and adds task information
                myTask taskItem = new myTask();
                taskItem.Name    = collection["Name"];
                taskItem.DueDate = Convert.ToDateTime(collection["DueDate"]);
                taskItem.Status  = collection["Status"];

                TaskDB.AddTask(taskItem);


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 private void AddBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(TaskName.Text) || (AssignedToUser.SelectedIndex == -1) || (Priority.SelectedIndex == -1) ||
         (StartDate.Date == null) || (EndDate.Date == null))
     {
         ErrorTxt.Text = "Enter all the fields!";
     }
     else if (StartDate.Date > EndDate.Date)
     {
         ErrorTxt.Text = "Start Date cannot exceed End date!";
     }
     else
     {
         TaskModel task = new TaskModel();
         task.AssignedToUser = AssignedToUser.SelectedValue.ToString();
         task.AssignedByUser = App.CurrentUser;
         task.TaskName       = TaskName.Text;
         PriorityTypes priority = (PriorityTypes)Enum.Parse(typeof(PriorityTypes), Priority.SelectedItem.ToString());
         task.Priority    = (int)priority;
         task.StartDate   = (DateTimeOffset)StartDate.Date;
         task.EndDate     = (DateTimeOffset)EndDate.Date;
         task.Description = DescriptionTxt.Text;
         task.TaskId      = DateTime.Now.Ticks;
         TaskDB.AddTask(task);
         ErrorTxt.Text = "Successfully Added!";
         int index = Users.FindIndex(user => user.Username.Equals(App.CurrentUser.ToString()));
         AssignedToUser.ItemsSource       = Users;
         AssignedToUser.DisplayMemberPath = "Username";
         AssignedToUser.SelectedValuePath = "Username";
         AssignedToUser.SelectedIndex     = index;
         var enumval = Enum.GetValues(typeof(PriorityTypes)).Cast <PriorityTypes>();
         Priority.ItemsSource   = enumval.ToList();
         Priority.SelectedIndex = 1;
         StartDate.Date         = DateTime.Today;
         EndDate.Date           = DateTime.Today;
         TaskName.Text          = "";
         DescriptionTxt.Text    = "";
     }
 }
Exemple #5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (localSettings.Values["IsAppFirstTimeLaunch"] == null || (bool)value == true)
            {
                localSettings.Values["IsAppFirstTimeLaunch"] = false;
                var vault = new Windows.Security.Credentials.PasswordVault();
                vault.Add(new Windows.Security.Credentials.PasswordCredential("TaskManagerApp", "Sabi", "123"));
                vault.Add(new Windows.Security.Credentials.PasswordCredential("TaskManagerApp", "Sabitha", "123"));
                UserDB.AddUser("Sabi", "/Assets/avatar1.PNG");
                UserDB.AddUser("Sabitha", "/Assets/avatar4.PNG");
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq Login Page",
                    TaskId         = 1223334444112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 1,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "lopoioiui wtyetyuiyruiewo"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq SignIn Page",
                    TaskId         = 987654321112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "Associated with an existing code-behind file using a qualifier that's part of the file or folder name"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Content Writing",
                    TaskId         = 123456789112,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 1,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "lopoioiui wtyetyuiyruiewo yuwiyeueiytiu"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Cliq List Tasks",
                    TaskId         = 123456789113,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "name the XAML view MainPage.DeviceFamily-Tablet.xaml. To create a view for PC devices, name the view MainPage.DeviceFamily-Desktop.xaml"
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Fix Bugs in List Tasks",
                    TaskId         = 123456789115,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 0,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                });
                TaskDB.AddTask(new Model.TaskModel()
                {
                    TaskName       = "Fix Bugs in List Tasks",
                    TaskId         = 123456789116,
                    AssignedByUser = "******",
                    AssignedToUser = "******",
                    Priority       = 2,
                    StartDate      = (DateTimeOffset)DateTime.Today,
                    EndDate        = (DateTimeOffset)DateTime.Today,
                    Description    = "Load task module"
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName      = "Sabi",
                    CommentToTaskId = 123456789112,
                    Content         = " If you cannot find a way to fit supporting evidence in just one or two sentences, use a different example altogether. There are certain topics that require a lot of room for explanation, so be careful not to choose a topic for your essay that will require too much evidence to support.",
                    CommentId       = 99988660111,
                    Date            = DateTime.Now,
                    Heart           = 0,
                    Happy           = 0,
                    Sad             = 0,
                    Like            = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 123456789112, Content = "Okay Done!", CommentId = 99988661111, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabi", CommentToTaskId = 987654321112, Content = " Only by examining how you reflect on your qualities can college admissions officers gain an understanding", CommentId = 9998866211, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 1223334444112, Content = " Present, support, and introspect.", CommentId = 9998866311, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
                CommentDB.AddComment(new Model.Comment()
                {
                    AuthorName = "Sabitha", CommentToTaskId = 123456789116, Content = " Make sure a folder or the project, and not the solution, is selected in Solution Explorer.", CommentId = 999886631121, Date = DateTime.Now, Heart = 0, Happy = 0, Sad = 0, Like = 0
                });
            }


            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter

                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }