The function of this page comment has been optimized when there is no comment, displayed directly add pages, the page displays a list of comments when there are comments, so users will be very easy to operate, can sometimes be less one more time, to improve the software has goodness.
1
private
void btnComment_Click(
object sender, EventArgs e)
2 {
3 bool 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 new KeyValuePair < String , Object > (BaseCommentEntity.FieldObjectId, the this .EntityId));
. 7 Parameters.Add ( new new KeyValuePair < String , Object > (BaseCommentEntity.FieldDeletionStateCode, 0 ));
. 8 commnets = DbLogic.Exists ( the this .UserCenterDbHelper, BaseCommentEntity.TableName, the Parameters);
9 // if the page displays a list of records, if no record is displayed directly add pages 10
if (commnets)
11 {
12 FrmCommnets frmCommnets = new FrmCommnets( this.Name, this.EntityId);
13 frmCommnets.ShowDialog();
14 }
15 else
16 {
17 FrmCommentAdd frmCommentAdd = new FrmCommentAdd( this.Name, this.EntityId);
18 frmCommentAdd.ShowDialog();
19 }
20 }
2 {
3 bool 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 new KeyValuePair < String , Object > (BaseCommentEntity.FieldObjectId, the this .EntityId));
. 7 Parameters.Add ( new new KeyValuePair < String , Object > (BaseCommentEntity.FieldDeletionStateCode, 0 ));
. 8 commnets = DbLogic.Exists ( the this .UserCenterDbHelper, BaseCommentEntity.TableName, the Parameters);
9 // if the page displays a list of records, if no record is displayed directly add pages 10
if (commnets)
11 {
12 FrmCommnets frmCommnets = new FrmCommnets( this.Name, this.EntityId);
13 frmCommnets.ShowDialog();
14 }
15 else
16 {
17 FrmCommentAdd frmCommentAdd = new FrmCommentAdd( this.Name, this.EntityId);
18 frmCommentAdd.ShowDialog();
19 }
20 }
Reproduced in: https: //my.oschina.net/iwenr/blog/227668