Example #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));

        }
Example #2
0
 private void OnUseCaseRemoved(UseCase uc)
 {
     uc.Idea = null;
 }
Example #3
0
 private void addUseCaseButton_Click(object sender, RoutedEventArgs e)
 {
     string ucTitle = useCaseTextBox.Text;
     if (ucTitle != "")
     {
         var uc = new UseCase() { UCase = ucTitle };
         (DataContext as IdeaViewModel).AddUseCase(uc);
     }
     useCaseTextBox.Text = "";
 }
Example #4
0
 private void OnUseCaseAdded(UseCase uc)
 {
     uc.Idea = this;
 }
Example #5
0
 private void detach_UseCase(UseCase uc)
 {
     NotifyPropertyChanging("Idea");
 }
Example #6
0
 private void attach_UseCase(UseCase newUseCase)
 {
     NotifyPropertyChanging("Idea");
 }
Example #7
0
        public void RemoveSelectedUseCase(UseCase ucForDelete)
        {
            // Remove from the data table 
            _DB.UseCases.DeleteOnSubmit(ucForDelete);
            _DB.SubmitChanges();

            // Remove from the entity set 
            SelectedIdea.UseCases.Remove(ucForDelete);

            // Remove from the observable collection 
            SelectedIdea.UseCaseOC.Remove(ucForDelete);
        }
Example #8
0
        public void AddUseCase(UseCase uc)
        {
            // Set the idea context to the appropriate idea 
            uc.Idea = SelectedIdea;

            // Add to the entity set 
            SelectedIdea.UseCases.Add(uc);

            // Add to UseCases datatable 
            _DB.UseCases.InsertOnSubmit(uc);

            // Add to the observable collection 
            SelectedIdea.UseCaseOC.Add(uc);

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

        }