Exemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if ((txtTitle.TextLength > 0) && (txtApiUrl.TextLength > 0))
     {
         DBDataContext ctx = new DBDataContext(Properties.Settings.Default.ConnStr);
         if (editMode)
         {
             CategoryContent c = (from cat in ctx.CategoryContents
                           where cat.Id.Equals(this.contentID)
                           select cat).Single();
             c.Title = txtTitle.Text;
             c.ApiUrl = txtApiUrl.Text;
             ctx.SubmitChanges();
         }
         else
         {
             CategoryContent c = new CategoryContent
             {
                 Title = txtTitle.Text,
                 ApiUrl = txtApiUrl.Text,
                 CatId = this.catID
             };
             ctx.CategoryContents.InsertOnSubmit(c);
             ctx.SubmitChanges();
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("You need to have both a title and a url.");
     }
 }
Exemplo n.º 2
0
 partial void DeleteCategoryContent(CategoryContent instance);
Exemplo n.º 3
0
 partial void UpdateCategoryContent(CategoryContent instance);
Exemplo n.º 4
0
 partial void InsertCategoryContent(CategoryContent instance);
Exemplo n.º 5
0
		private void detach_CategoryContents(CategoryContent entity)
		{
			this.SendPropertyChanging();
			entity.Category = null;
		}
Exemplo n.º 6
0
		private void attach_CategoryContents(CategoryContent entity)
		{
			this.SendPropertyChanging();
			entity.Category = this;
		}