Beispiel #1
0
        private void InitTask()
        {
           // if (notes != null) return;
            Debug.WriteLine("isItEdit : "+isItEdit);
            if (!isItEdit)
            {
             
                notes = new Notes();
                
                
            }
            else
            {
                PageTitle.Text = "Edit ezNote";
                Debug.WriteLine("this is edit on inittask");
                int editNoteID;
                int.TryParse(NavigationContext.QueryString["editNoteID"], out editNoteID);

                Debug.WriteLine("Edit Note ID="+editNoteID);

                notes = SterlingService.Current.Database.Query<Notes, int>()
                        .Where(delegate(TableKey<Notes, int> key) { return key.Key == editNoteID; })
                        .First<TableKey<Notes, int>>()
                        .LazyValue.Value;

                
                textTitle.Text = notes.noteName;
                textNote.Text = notes.noteText;

                Debug.WriteLine("is it due = " + notes.isDue);
                if (notes.isDue == 1)
                {
                    Debug.WriteLine("is due is checked");
                    setDue.IsChecked = true;
                    noteDueChecked = 1;
                    this.dueStack.Visibility = Visibility.Visible;
                }

                DateTime dt2;

                

                

                dt2 = DateTime.Parse(notes.DueDate.ToString());


                Debug.WriteLine(notes.DueDate);

                dueDateSet.Value = DateTime.Parse(dt2.ToString("MM/dd/yyyy"));

                dueTimeSet.Value = DateTime.Parse(dt2.ToString("hh:mm tt"));

            }


                Debug.Assert(notes != null, "Task should not be null");
            
        }
Beispiel #2
0
        private void checkCategory(string catname)
        {
           

            var checkcategories = (from k in SterlingService.Current.Database.Query<Category, int>()
                                   where k.LazyValue.Value.categoryName == catname
                                   select k.LazyValue.Value).FirstOrDefault(); 

                if (checkcategories == null)
                {

                    MessageBoxResult res = MessageBox.Show("Would You like to create category named \"" + catname + "\" ?", "Category not found", MessageBoxButton.OKCancel);

                    if (res == MessageBoxResult.OK)
                    {
                        killProgress();
                        newCategories = new Category();
                        newCategories.categoryName = catname;
                        newCategories.Save();
                        //  NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        checkCategory(catname);

                    }
                    else
                    {
                        killProgress();

                    }
                }

                else
                {
                    Debug.WriteLine(checkcategories.Id);
                    Debug.WriteLine("category found");

                    notes = new Notes();

                    notes.categoryID = checkcategories.Id;
                    notes.noteName = notetitle;
                    notes.noteText = notetext;
                    notes.createDate = DateTime.Now;

                    if (!duedate)
                    {

                    }
                    else
                    {
                        notes.DueDate = noteduedate;
                        notes.isDue = 1;
                    }
                    Debug.WriteLine("notes.DueDate:"+ notes.DueDate);
                    notes.Save();

                    killProgress();

                    NavigationService.Navigate(new Uri("/CategoryPage.xaml?catID=" + notes.categoryID, UriKind.Relative));



                }
            
            
        }
Beispiel #3
0
        private void InitNote()
        {


            int.TryParse(NavigationContext.QueryString["noteID"], out noteID);


            Debug.Assert(noteID != -1, "TaskId should not be null");




            note = SterlingService.Current.Database.Query<Notes, int>()
                     .Where(delegate(TableKey<Notes, int> key) { return key.Key == noteID; })
                     .First<TableKey<Notes, int>>()
                     .LazyValue.Value;


            catID = note.categoryID;
            Debug.WriteLine(note.DueDate);
            Debug.WriteLine(note.isDue);
            Debug.WriteLine(note.dueCompleted);

            if (note.isDue == 0)
            {
                completeButton.IsEnabled = false;
                // this.DueDatePanel.Visibility = Visibility.Collapsed;
                this.dueDateText.Text = "No Due Date";
            }
            else
            {
                // this.DueDatePanel.Visibility = Visibility.Visible;
                if (note.dueCompleted == 0)
                    this.dueDateText.Text = "Due on " + note.DueDate.ToString();
                else
                    this.dueDateText.Text = "Completed";
            }


            if (note.dueCompleted == 1)
                completeButton.IsEnabled = false;
        }