Exemplo n.º 1
0
        /// <summary>
        /// Loads and returns a record list of all ShoppingCartOrder objects.
        /// Parameters: itemsPerPage = max records to fetch; pageNum = one based page number if multiple pages (otherwise itemsPerPage is effectively TOP)
        /// eg LoadActive() = returns all records; LoadActive(10) = returns top 10 records by default sort order; LoadActive(10, 2) = returns second page of 10 records by default sort order
        /// ("Default sort order" can be defined for each record type by overriding in the partial model file. By default it looks for fields: SortPosition,SortOrder,Position, DateAdded,CreateDate,DateCreated and ShoppingCartOrderID desc.)
        /// </summary>
        public static ShoppingCartOrderList LoadAll()
        {
            var result = new ShoppingCartOrderList();

            result.LoadRecords(null);
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a record list of ShoppingCartOrder objects, given a SQL statement.
        /// </summary>
        /// <param name="sql">A SQL statement constructed using the Beweb.Sql class</param>
        /// <returns>A list of ShoppingCartOrder records.</returns>
        public static ShoppingCartOrderList Load(Sql sql)
        {
            var result = new ShoppingCartOrderList();

            result.LoadRecords(sql);
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads all records which are active plus the one with the given ID. For situations where you want to only show active records except you also want to include the record that is already current.
        /// </summary>
        public static ShoppingCartOrderList LoadActivePlusExisting(object existingRecordID)
        {
            var result = new ShoppingCartOrderList();
            var sql    = (new ShoppingCartOrder()).GetSqlWhereActivePlusExisting(existingRecordID);

            result.LoadRecords(sql);
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads and returns a record list of all the "active" ShoppingCartOrder objects.
        /// Parameters: itemsPerPage = max records to fetch; pageNum = one based page number if multiple pages (otherwise itemsPerPage is effectively TOP)
        /// eg LoadActive() = returns all active records; LoadActive(10) = returns top 10 active records by default sort order; LoadActive(10, 2) = returns second page of 10 active records by default sort order
        /// ("Active" can be defined for each record type by overriding in the partial model file. By default it looks for fields: PublishDate/ExpiryDate, IsActive,IsEnabled,IsPublished,Active,Enabled,Published,IsVisible,Visible.)
        /// </summary>
        public static ShoppingCartOrderList LoadActive()
        {
            var result = new ShoppingCartOrderList();
            var sql    = (new ShoppingCartOrder()).GetSqlWhereActive();

            result.LoadRecords(sql);
            return(result);
        }
Exemplo n.º 5
0
        public static ShoppingCartOrderList LoadIDs(string[] ids, bool useDefaultOrderBy)
        {
            var sql    = new Sql("where ShoppingCartOrderID in (", ids.SqlizeNumberList(), ")");
            var result = new ShoppingCartOrderList();

            result.LoadRecords(sql, useDefaultOrderBy);
            return(result);
        }
Exemplo n.º 6
0
        public static ShoppingCartOrderList LoadActive(int itemsPerPage, int pageNum)
        {
            var result = new ShoppingCartOrderList();
            var sql    = (new ShoppingCartOrder()).GetSqlWhereActive();

            sql.Paging(itemsPerPage, pageNum);
            result.LoadRecords(sql);
            return(result);
        }
Exemplo n.º 7
0
        public static ShoppingCartOrderList LoadAll(int itemsPerPage, int pageNum)
        {
            var result = new ShoppingCartOrderList();
            var sql    = new Sql("where 1=1");

            sql.Paging(itemsPerPage, pageNum);
            result.LoadRecords(sql);
            return(result);
        }
Exemplo n.º 8
0
        //protected override void OnAfterLoadData()		{		}

        /// <summary>
        /// generate a unique reference number for this cart using readble characters
        /// </summary>
        /// <returns></returns>
        public static string GenerateRef()
        {
            string result = "";

            for (int sc = 0; ; sc++)
            {
                if (sc > 20)
                {
                    throw new Exception("ref gen failed");
                }
                result = RandomPassword.Generate(6, 6, "Q", "QWERTYPASDFGHJKLZXBNM", "23456", "2") + "-" + RandomPassword.Generate(3, 3, "W", "WXYZ", "23456", "2");
                if (ShoppingCartOrderList.LoadByOrderRef(result).RecordCount == 0)
                {
                    break;
                }
            }

            return(result);
        }