Ejemplo n.º 1
0
        /// <summary>
        /// Finds a MailMessage entity using it's primary key.
        /// </summary>
        /// <param name="MailMessageId">A key field.</param>
        /// <returns>A MailMessage object.</returns>
        /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no entity exists witht he specified primary key..</exception>
        public MailMessage Load(IdType mailMessageId)
        {
            SqlFilter filter = new SqlFilter();

            filter.And(new SqlEqualityPredicate("MailMessageId", EqualityOperatorEnum.Equal, mailMessageId.IsValid ? mailMessageId.ToInt32() as Object : DBNull.Value));
            IDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, filter, null);

            return(GetDataObject(dataReader));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a list of objects which match the values for the fields specified.
        /// </summary>
        /// <param name="MailMessageStatus">A field value to be matched.</param>
        /// <returns>The list of MailMessageDAO objects found.</returns>
        public MailMessageList FindByStatus(MailMessageStatusEnum mailMessageStatus)
        {
            OrderByClause sort   = new OrderByClause("MailMessageStatus");
            SqlFilter     filter = new SqlFilter();

            filter.And(new SqlEqualityPredicate("MailMessageStatus", EqualityOperatorEnum.Equal, mailMessageStatus.DBValue));
            IDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, filter, null);

            return(GetList(dataReader));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Repopulates an existing business entity instance
        /// </summary>
        public void Reload(MailMessage instance)
        {
            SqlFilter filter = new SqlFilter();

            filter.And(new SqlEqualityPredicate("MailMessageId", EqualityOperatorEnum.Equal, instance.MailMessageId.IsValid ? instance.MailMessageId.ToInt32() as Object : DBNull.Value));
            IDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, filter, null);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("Reload found no rows for MailMessage.");
            }
            GetDataObjectFromReader(instance, dataReader);
            dataReader.Close();
        }