/// <summary> /// 点击添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ZhuJi.Modules.ArticleModule.Domain.Article domainArticle = new ZhuJi.Modules.ArticleModule.Domain.Article(); ZhuJi.Modules.Core.Domain.ContentBase domainContentBase = new ZhuJi.Modules.Core.Domain.ContentBase(); UIMapping.BindControlsToObject(domainArticle, this); UIMapping.BindControlsToObject(domainContentBase, this); domainArticle.ContentBaseInfo = domainContentBase; ZhuJi.Modules.ArticleModule.IDAL.IArticle article = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.ArticleModule.NHibernateDAL.Article)) as ZhuJi.Modules.ArticleModule.IDAL.IArticle; article.Insert(domainArticle); _identity = domainArticle.Id; Edit(); } catch (Exception ex) { ShowMessage(ex); return; } } }
/// <summary> /// 点击删除按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { try { ZhuJi.Modules.SinglePageModule.Domain.SinglePage domainSinglePage = new ZhuJi.Modules.SinglePageModule.Domain.SinglePage(); ZhuJi.Modules.Core.Domain.ContentBase domainContentBase = new ZhuJi.Modules.Core.Domain.ContentBase(); domainContentBase.Id = int.Parse(ContentBaseId.Text.Trim()); domainSinglePage.Id = int.Parse(Id.Text); domainSinglePage.ContentBaseInfo = domainContentBase; ZhuJi.Modules.SinglePageModule.IDAL.ISinglePage singlePage = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.SinglePageModule.NHibernateDAL.SinglePage)) as ZhuJi.Modules.SinglePageModule.IDAL.ISinglePage; singlePage.Delete(domainSinglePage); } catch (Exception ex) { ShowMessage(ex); } Response.Redirect(Request.Url.ToString(), true); }
/// <summary> /// 点击添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ZhuJi.Modules.SinglePageModule.Domain.SinglePage domainSinglePage = new ZhuJi.Modules.SinglePageModule.Domain.SinglePage(); ZhuJi.Modules.Core.Domain.ContentBase domainContentBase = new ZhuJi.Modules.Core.Domain.ContentBase(); UIMapping.BindControlsToObject(domainSinglePage, this); UIMapping.BindControlsToObject(domainContentBase, this); domainSinglePage.ContentBaseInfo = domainContentBase; ZhuJi.Modules.SinglePageModule.IDAL.ISinglePage singlePage = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.SinglePageModule.NHibernateDAL.SinglePage)) as ZhuJi.Modules.SinglePageModule.IDAL.ISinglePage; singlePage.Insert(domainSinglePage); } catch (Exception ex) { ShowMessage(ex); } Response.Redirect(Request.Url.ToString(), true); } }