
2009年3月28日
- 在SectionEdit.aspx页面的form中填入数据,点击按钮提交。(表示层)
- 调用btnSave_Click(object sender, EventArgs e)函数
- 检查section是否已经存在,if (this._activeSection.Id == -1 || this._activeSection.PlaceholderId != oldPlaceholderId)
- SaveSection(); 保持新的section
- 检查是否已经添加过if (this._activeSection.Id > 0)(控制层)
- 如果是,更新base.CoreRepository.UpdateObject(this._activeSection);
- 否则添加base.CoreRepository.SaveObject(this._activeSection);(数据层)
- 添加成功的画跳转到Context.Response.Redirect(String.Format("NodeEdit.aspx?NodeId={0}", this.ActiveNode.Id));
- 否则Context.Response.Redirect("Sections.aspx");
posted @ 2009-03-28 23:50 石榴 阅读(27) 评论(0)
编辑
查找用户
1. 在界面,单击按钮,触发btnFind_Click事件
2. 调用BindUsers();方法
a) 调用GetUserData();方法设置数据源,如下
b) 调用this.rptUsers.DataBind()方法绑定;
3. 刷新页面,显示查找所得数据
GetUserData();设置数据源
1. this.rptUsers.DataSource= = base.CoreRepository.FindUsersByUsername(this.txtUsername.Text);
a) hql = "from User u where u.UserName like ? order by u.UserName ";
b) NHibernate.ISession.Find(hql, searchString + "%", NHibernateUtil.String);
posted @ 2009-03-28 19:57 石榴 阅读(14) 评论(0)
编辑