Esempio n. 1
0
        private void InitCategory()
        {
            if (newCategory != null) return;




            newCategory = new Category();

            int newID = newCategory.Id;
                Debug.WriteLine("category = " + newID);
                Debug.WriteLine("category ID = " + newCategory.categoryID);
                Debug.Assert(newCategory != null, "Task should not be null");

                
               // newCategory.categoryID = newID;     
                
        }
Esempio n. 2
0
        private void OnLoaded(object sender, RoutedEventArgs e)
		{
            
            if (NavigationContext.QueryString.ContainsKey("catID"))
            {
                int.TryParse(NavigationContext.QueryString["catID"], out catID);

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


                catTitle.Text = categories.categoryName;

                notes.categoryID = categories.Id;


            }
            
			this.isLoaded = true;
		}
Esempio n. 3
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));



                }
            
            
        }
Esempio n. 4
0
        private void setCategoryName()
        {

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

            this.PageTitle.Text = categories.categoryName;

        }
Esempio n. 5
0
        private void setCategoryName()
        {
            setCategory = SterlingService.Current.Database.Query<Category, int>()
                                .Where(delegate(TableKey<Category, int> key) { return key.Key == catID; })
                                .First<TableKey<Category, int>>()
                                .LazyValue.Value;

            categoryName = setCategory.categoryName;
        }