简单快速开发C\S架构程序用最简单的不分层最快的效率达到功能要求的例子程序FrmUserEdit...
这个页面进行评论的功能也进行了优化,当没有评论时,直接显示添加页面,有评论时显示评论列表页面,这样用户操作起来会非常方便,有时候可以会少操作1次,提高软件的有善性。
1privatevoid btnComment_Click(object sender, EventArgs e)
2 {
3bool commnets = false;
4 List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string,object>>();
5 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldCategoryCode, this.Name));
6 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldObjectId, this.EntityId));
7 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldDeletionStateCode, 0));
8 commnets = DbLogic.Exists(this.UserCenterDbHelper, BaseCommentEntity.TableName, parameters);
9// 若有记录显示列表页面,若没记录直接显示添加页面
10if (commnets)
11 {
12 FrmCommnets frmCommnets = new FrmCommnets(this.Name, this.EntityId);
13 frmCommnets.ShowDialog();
14 }
15else
16 {
17 FrmCommentAdd frmCommentAdd = new FrmCommentAdd(this.Name, this.EntityId);
18 frmCommentAdd.ShowDialog();
19 }
20 }
2 {
3bool commnets = false;
4 List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string,object>>();
5 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldCategoryCode, this.Name));
6 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldObjectId, this.EntityId));
7 parameters.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldDeletionStateCode, 0));
8 commnets = DbLogic.Exists(this.UserCenterDbHelper, BaseCommentEntity.TableName, parameters);
9// 若有记录显示列表页面,若没记录直接显示添加页面
10if (commnets)
11 {
12 FrmCommnets frmCommnets = new FrmCommnets(this.Name, this.EntityId);
13 frmCommnets.ShowDialog();
14 }
15else
16 {
17 FrmCommentAdd frmCommentAdd = new FrmCommentAdd(this.Name, this.EntityId);
18 frmCommentAdd.ShowDialog();
19 }
20 }
本文转自 jirigala 51CTO博客,原文链接:http://blog.51cto.com/2347979/1196203,如需转载请自行联系原作者