Beispiel #1
0
        private void SaveItemAppBarButton_Click(object sender, EventArgs e)
        {
            
            // Confirm a title is provided 
            if (titleTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please give your idea a name.");
                return;
            }
            else
            {

                (DataContext as IdeaViewModel).SelectedIdea.Title = titleTextBox.Text;          // Save title 
                (DataContext as IdeaViewModel).SelectedIdea.Overview = overviewTextBox1.Text;       //  overview
                (DataContext as IdeaViewModel).SelectedIdea.Notes = notesTextBox.Text;              // and notes 

                //// If the system requirements textbox isn't empty, save that
                if (systemReqsTextBox.Text != "")
                {
                    string reqTitle = systemReqsTextBox.Text;
                    var req = new SystemRequirement() { Requirement = reqTitle };
                    (DataContext as IdeaViewModel).AddRequirement(req);
                }

                // same thing for use cases 
                if (useCaseTextBox.Text != "")
                {
                    string ucTitle = useCaseTextBox.Text;
                    var uc = new UseCase() { UCase = ucTitle };
                    (DataContext as IdeaViewModel).AddUseCase(uc);
                }

            }

            lastSelectedIdea = (DataContext as IdeaViewModel).SelectedIdea; 
            (DataContext as IdeaViewModel).SaveIdeasToDB();

            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

        }
Beispiel #2
0
 private void OnSystemRequirementRemoved(SystemRequirement sysRequirement)
 {
     sysRequirement.Idea = null;
 }
Beispiel #3
0
        // Define functions for: adding/removing a system requirement 
        private void addSysReqButton_Click(object sender, RoutedEventArgs e)
        {
            // Add the contents of systemReqsTextbox to the Table<SystemRequirements>
            string reqTitle = systemReqsTextBox.Text;
            // (DataContext as MainPageViewModel).SelectedIdea.SystemRequirements.Add(newSysReq);
            if (reqTitle != "")
            {
                var req = new SystemRequirement() { Requirement = reqTitle };

                (DataContext as IdeaViewModel).AddRequirement(req);             // Add to Datatable, EntitySet & Observable collection 

            }

            (DataContext as IdeaViewModel).SaveIdeasToDB();
            systemReqsTextBox.Text = "";

        }
Beispiel #4
0
 // Are these ever even evoked?
 private void OnSystemRequirementAdded(SystemRequirement sysRequirement)
 {
     sysRequirement.Idea = this;
 }
Beispiel #5
0
 // Called during a remove operation 
 private void detach_SysReq(SystemRequirement req)
 {
     NotifyPropertyChanging("Idea");
 }
Beispiel #6
0
 // Called during add operation 
 private void attach_SysReq(SystemRequirement newRequirement)
 {
     NotifyPropertyChanging("Idea");
 }
Beispiel #7
0
        public void RemoveSelectedReq(SystemRequirement reqForDelete)
        {

            // Remove from the datatable 
            _DB.SystemRequirements.DeleteOnSubmit(reqForDelete);
            _DB.SubmitChanges();

            // Remove from the entity set
            SelectedIdea.SystemRequirements.Remove(reqForDelete);

            // Remove from the observable collection 
            SelectedIdea.SysReqsOC.Remove(SelectedReq);
        }
Beispiel #8
0
        public void AddRequirement(SystemRequirement req)
        {
            /* Set the idea context to the appropriate idea 
            critical for multidimensional DB, if you don't do this 
            the req doesn't know which Idea it's attached to. Maybe done internally when adding to the entity set? */
            req.Idea = SelectedIdea;
            // Add to the entity set 
            SelectedIdea.SystemRequirements.Add(req);

            // Add to SystemRequirements datatable 
            _DB.SystemRequirements.InsertOnSubmit(req);

            // Add to the observable collection 
            SelectedIdea.SysReqsOC.Add(req);

            // Save the data context 
            _DB.SubmitChanges();

        }