protected void btnSaveCat_Click(object sender, EventArgs e) { try { if (tvCats.SelectedNode != null) { using (CatalogDataContext dct = new CatalogDataContext()) { Mapping_Category mc = new Mapping_Category() { id = System.Guid.NewGuid(), ss_cat_id = ddlSSCats.SelectedValue, ss_cat_name = ddlSSCats.SelectedItem.Text, tb_cid = long.Parse(tvCats.SelectedValue), tb_name = tvCats.SelectedNode.Text }; dct.Mapping_Categories.InsertOnSubmit(mc); dct.SubmitChanges(); } } else throw new ApplicationException("请选择淘宝分类"); } catch (Exception ex) { string message = ex.Message.Replace("\n", "\\n").Replace("\r", "").Replace("'", "\\'"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + message + "')", true); } }
partial void DeleteMapping_Category(Mapping_Category instance);
partial void InsertMapping_Category(Mapping_Category instance);
partial void UpdateMapping_Category(Mapping_Category instance);
private void detach_Mapping_Categories(Mapping_Category entity) { this.SendPropertyChanging(); entity.TB_ItemCat = null; }