Example #1
0
        public static EmailListSignup Load(Int32 emailListSignupId, bool useCache)
        {
            if (emailListSignupId == 0)
            {
                return(null);
            }
            EmailListSignup emailListSignup = null;
            string          key             = "EmailListSignup_" + emailListSignupId.ToString();

            if (useCache)
            {
                emailListSignup = ContextCache.GetObject(key) as EmailListSignup;
                if (emailListSignup != null)
                {
                    return(emailListSignup);
                }
            }
            emailListSignup = new EmailListSignup();
            if (emailListSignup.Load(emailListSignupId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, emailListSignup);
                }
                return(emailListSignup);
            }
            return(null);
        }
Example #2
0
        public static bool Delete(Int32 emailListSignupId)
        {
            EmailListSignup emailListSignup = new EmailListSignup();

            if (emailListSignup.Load(emailListSignupId))
            {
                return(emailListSignup.Delete());
            }
            return(false);
        }
Example #3
0
        public static EmailListSignupCollection LoadForEmailList(Int32 emailListId, int maximumRows, int startRowIndex, string sortExpression)
        {
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT");
            if (maximumRows > 0)
            {
                selectQuery.Append(" TOP " + (startRowIndex + maximumRows).ToString());
            }
            selectQuery.Append(" " + EmailListSignup.GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_EmailListSignups");
            selectQuery.Append(" WHERE EmailListId = @emailListId");
            if (!string.IsNullOrEmpty(sortExpression))
            {
                selectQuery.Append(" ORDER BY " + sortExpression);
            }
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@emailListId", System.Data.DbType.Int32, emailListId);
            //EXECUTE THE COMMAND
            EmailListSignupCollection results = new EmailListSignupCollection();
            int thisIndex = 0;
            int rowCount  = 0;

            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows)))
                {
                    if (thisIndex >= startRowIndex)
                    {
                        EmailListSignup emailListSignup = new EmailListSignup();
                        EmailListSignup.LoadDataReader(emailListSignup, dr);
                        results.Add(emailListSignup);
                        rowCount++;
                    }
                    thisIndex++;
                }
                dr.Close();
            }
            return(results);
        }
Example #4
0
 public static SaveResult Insert(EmailListSignup emailListSignup)
 {
     return(emailListSignup.Save());
 }
Example #5
0
 public static SaveResult Update(EmailListSignup emailListSignup)
 {
     return(emailListSignup.Save());
 }
Example #6
0
 public static bool Delete(EmailListSignup emailListSignup)
 {
     return(emailListSignup.Delete());
 }