示例#1
0
		private void detach_Ideas(Ideas entity)
		{
			this.SendPropertyChanging();
			entity.Categories = null;
		}
示例#2
0
		private void attach_Ideas(Ideas entity)
		{
			this.SendPropertyChanging();
			entity.Categories = this;
		}
示例#3
0
 partial void DeleteIdeas(Ideas instance);
示例#4
0
 partial void UpdateIdeas(Ideas instance);
示例#5
0
 partial void InsertIdeas(Ideas instance);
示例#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();
                }
            }
        }