Esempio n. 1
0
		private void detach_Ideas(Ideas entity)
		{
			this.SendPropertyChanging();
			entity.Categories = null;
		}
Esempio n. 2
0
		private void attach_Ideas(Ideas entity)
		{
			this.SendPropertyChanging();
			entity.Categories = this;
		}
Esempio n. 3
0
 partial void DeleteIdeas(Ideas instance);
Esempio n. 4
0
 partial void UpdateIdeas(Ideas instance);
Esempio n. 5
0
 partial void InsertIdeas(Ideas instance);
Esempio n. 6
0
        private void CreateIdea()
        {

            if (IdeaTitle.Text.Length > 250)
            {
                MessageBox.Show("Idea title is too long!");
            }
            else if (IdeaContent.Text.Length > 3990)
            {
                MessageBox.Show("Sorry, idea content is too long!");
            }
            else if (IdeaTitle.Text.Length > 0 && IdeaContent.Text.Length > 0)
            {
                using (IdeasContext ctx = new IdeasContext(IdeasContext.ConnectionString))
                {
                    ctx.CreateIfNotExists();

                    int CatId = (from p in ctx.Categories where p.Name == lpkCategories.SelectedItem.ToString() select p.Id).Single();

                    var idea = new Ideas() { Title = IdeaTitle.Text, Cat_id = CatId, Content = IdeaContent.Text };

                    ctx.Ideas.InsertOnSubmit(idea);
                    ctx.SubmitChanges();

                    NavigationService.GoBack();
                }
            }
        }