//[Transactional(TransactionalTypes.TransactionScope)]
        protected void DataPortal_Delete(EmailQueueCriteria criteria)
        {
            bool cancel = false;

            OnDeleting(criteria, ref cancel);
            if (cancel)
            {
                return;
            }

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_EmailQueue_Delete]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    //result: The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed.
                    int result = command.ExecuteNonQuery();
                    if (result == 0)
                    {
                        throw new DBConcurrencyException("The entity is out of date on the client. Please update the entity and try again. This could also be thrown if the sql statement failed to execute.");
                    }
                }
            }

            OnDeleted();
        }
Ejemplo n.º 2
0
        public static void DeleteEmailQueue(System.Int32 emailQueueID)
        {
            var criteria = new EmailQueueCriteria {
                EmailQueueID = emailQueueID
            };


            new EmailQueue().DataPortal_Delete(criteria);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a <see cref="EmailQueue"/> object of the specified criteria.
        /// </summary>
        /// <param name="emailQueueID">No additional detail available.</param>
        /// <returns>A <see cref="EmailQueue"/> object of the specified criteria.</returns>
        public static EmailQueue GetByEmailQueueID(System.Int32 emailQueueID)
        {
            var criteria = new EmailQueueCriteria {
                EmailQueueID = emailQueueID
            };


            return(new EmailQueue().DataPortal_Fetch(criteria));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// CodeSmith generated stub method that is called after the child <see cref="EmailQueue"/> object with the specified criteria has been deleted.
        /// </summary>
        //partial void OnDeleted();
        //partial void OnChildLoading(Csla.Core.IPropertyInfo childProperty, ref bool cancel);

        #endregion


        #region Exists Command

        /// <summary>
        /// Determines if a record exists in the EmailQueue table in the database for the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria parameter is an <see cref="EmailQueue"/> object.</param>
        /// <returns>A boolean value of true is returned if a record is found.</returns>
        public static EmailQueue Exists(EmailQueueCriteria criteria)
        {
            try
            {
                return(new EmailQueue().DataPortal_Fetch(criteria));
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns a <see cref="EmailQueue"/> object of the specified criteria.
        /// </summary>
        /// <param name="mailingTemplateID">No additional detail available.</param>
        /// <returns>A <see cref="EmailQueue"/> object of the specified criteria.</returns>
        public static EmailQueue GetByMailingTemplateID(System.Int32?mailingTemplateID)
        {
            var criteria = new EmailQueueCriteria {
            };

            if (mailingTemplateID.HasValue)
            {
                criteria.MailingTemplateID = mailingTemplateID.Value;
            }

            return(new EmailQueue().DataPortal_Fetch(criteria));
        }
        private EmailQueueList DataPortal_Fetch(EmailQueueCriteria criteria)
        {
            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(null);
            }

            //RaiseListChangedEvents = false;

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_EmailQueue_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_MailingTemplateIDHasValue", criteria.MailingTemplateIDHasValue);
                    command.Parameters.AddWithValue("@p_SendToHasValue", criteria.SendToHasValue);
                    command.Parameters.AddWithValue("@p_MailingTextHasValue", criteria.MailingTextHasValue);
                    command.Parameters.AddWithValue("@p_MailingSubjectHasValue", criteria.MailingSubjectHasValue);
                    command.Parameters.AddWithValue("@p_MailingFromHasValue", criteria.MailingFromHasValue);
                    command.Parameters.AddWithValue("@p_ProcessedDateHasValue", criteria.ProcessedDateHasValue);
                    command.Parameters.AddWithValue("@p_ProcessResultHasValue", criteria.ProcessResultHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            var rowParser = reader.GetRowParser <CFMData.EmailQueue>();
                            do
                            {
                                this.Add(CFMData.EmailQueue.GetEmailQueue(rowParser, reader));
                            }while(reader.Read());
                        }
                        OnFetched();
                        return(this);
                    }
                }
            }

            //RaiseListChangedEvents = true;
        }
        private EmailQueue DataPortal_Fetch(EmailQueueCriteria criteria)
        {
            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(null);
            }
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[spCFM_EmailQueue_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_MailingTemplateIDHasValue", criteria.MailingTemplateIDHasValue);
                    command.Parameters.AddWithValue("@p_SendToHasValue", criteria.SendToHasValue);
                    command.Parameters.AddWithValue("@p_MailingTextHasValue", criteria.MailingTextHasValue);
                    command.Parameters.AddWithValue("@p_MailingSubjectHasValue", criteria.MailingSubjectHasValue);
                    command.Parameters.AddWithValue("@p_MailingFromHasValue", criteria.MailingFromHasValue);
                    command.Parameters.AddWithValue("@p_ProcessedDateHasValue", criteria.ProcessedDateHasValue);
                    command.Parameters.AddWithValue("@p_ProcessResultHasValue", criteria.ProcessResultHasValue);
                    using (var reader = command.ExecuteReader())
                    {
                        var rowParser = reader.GetRowParser <EmailQueue>();
                        if (reader.Read())
                        {
                            return(GetEmailQueue(rowParser, reader));
                        }
                        else
                        {
                            throw new Exception(String.Format("The record was not found in 'dbo.EmailQueue' using the following criteria: {0}.", criteria));
                        }
                    }
                }
            }
            OnFetched();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="EmailQueue"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="EmailQueueCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 //partial void OnDeleting(EmailQueueCriteria criteria, ref bool cancel);
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the child <see cref="EmailQueue"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="EmailQueueCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="connection"></param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 partial void OnDeleting(EmailQueueCriteria criteria, SqlConnection connection, ref bool cancel);
Ejemplo n.º 9
0
 /// <summary>
 /// CodeSmith generated stub method that is called when fetching the child <see cref="EmailQueue"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="EmailQueueCriteria"/> object containing the criteria of the object to fetch.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object fetching should proceed.</param>
 partial void OnChildFetching(EmailQueueCriteria criteria, ref bool cancel);
Ejemplo n.º 10
0
 /// <summary>
 /// CodeSmith generated stub method that is called when deleting the <see cref="EmailQueue"/> object.
 /// </summary>
 /// <param name="criteria"><see cref="EmailQueueCriteria"/> object containing the criteria of the object to delete.</param>
 /// <param name="cancel">Value returned from the method indicating whether the object deletion should proceed.</param>
 partial void OnDeleting(EmailQueueCriteria criteria, ref bool cancel);
Ejemplo n.º 11
0
        public static EmailQueueList GetByCriteria(EmailQueueCriteria criteria)
        {
            return(new EmailQueueList().DataPortal_Fetch(criteria));
//            return DataPortal.Fetch<EmailQueueList>(criteria);
        }