Ejemplo n.º 1
0
        public static OrderStatusAction Load(Int32 orderStatusId, Int16 orderActionId)
        {
            OrderStatusAction orderStatusAction = new OrderStatusAction();

            if (orderStatusAction.Load(orderStatusId, orderActionId))
            {
                return(orderStatusAction);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public static bool Delete(Int32 orderStatusId, Int16 orderActionId)
        {
            OrderStatusAction orderStatusAction = new OrderStatusAction();

            if (orderStatusAction.Load(orderStatusId, orderActionId))
            {
                return(orderStatusAction.Delete());
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static OrderStatusActionCollection LoadForOrderStatus(Int32 orderStatusId, 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(" " + OrderStatusAction.GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_OrderStatusActions");
            selectQuery.Append(" WHERE OrderStatusId = @orderStatusId");
            if (!string.IsNullOrEmpty(sortExpression))
            {
                selectQuery.Append(" ORDER BY " + sortExpression);
            }
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

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

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