示例#1
0
 public bool Insert(CommentType commenttype)
 {
     int autonumber = 0;
     CommentTypeDAC commenttypeComponent = new CommentTypeDAC();
     bool endedSuccessfuly = commenttypeComponent.InsertNewCommentType( ref autonumber,  commenttype.CommentTypeName);
     if(endedSuccessfuly)
     {
         commenttype.CommentTypeId = autonumber;
     }
     return endedSuccessfuly;
 }
示例#2
0
 public CommentType GetByID(int _commentTypeId)
 {
     CommentTypeDAC _commentTypeComponent = new CommentTypeDAC();
      IDataReader reader = _commentTypeComponent.GetByIDCommentType(_commentTypeId);
      CommentType _commentType = null;
      while(reader.Read())
      {
          _commentType = new CommentType();
          if(reader["CommentTypeId"] != DBNull.Value)
              _commentType.CommentTypeId = Convert.ToInt32(reader["CommentTypeId"]);
          if(reader["CommentTypeName"] != DBNull.Value)
              _commentType.CommentTypeName = Convert.ToString(reader["CommentTypeName"]);
      _commentType.NewRecord = false;             }             reader.Close();
      return _commentType;
 }
示例#3
0
 public List<CommentType> GetAll()
 {
     CommentTypeDAC _commentTypeComponent = new CommentTypeDAC();
      IDataReader reader =  _commentTypeComponent.GetAllCommentType().CreateDataReader();
      List<CommentType> _commentTypeList = new List<CommentType>();
      while(reader.Read())
      {
      if(_commentTypeList == null)
          _commentTypeList = new List<CommentType>();
          CommentType _commentType = new CommentType();
          if(reader["CommentTypeId"] != DBNull.Value)
              _commentType.CommentTypeId = Convert.ToInt32(reader["CommentTypeId"]);
          if(reader["CommentTypeName"] != DBNull.Value)
              _commentType.CommentTypeName = Convert.ToString(reader["CommentTypeName"]);
      _commentType.NewRecord = false;
      _commentTypeList.Add(_commentType);
      }             reader.Close();
      return _commentTypeList;
 }
示例#4
0
 public bool Update(CommentType commenttype ,int old_commentTypeId)
 {
     CommentTypeDAC commenttypeComponent = new CommentTypeDAC();
     return commenttypeComponent.UpdateCommentType( commenttype.CommentTypeName,  old_commentTypeId);
 }