Dynamicweb 8 Documentation
Save Method (OrderLineCollection)
Example 

The order ID.
Saves the specified order ID.
Syntax
'Declaration
 
Public Sub Save( _ 
   ByVal OrderID As String _ 
) 
public void Save( 
   string OrderID 
)

Parameters

OrderID
The order ID.
Example
class MyPage : System.Web.UI.Page
{
 
    public void SaveOrder( Order order )
    {
	    IDbConnection objConn = Database.CreateConnection("Ecom.mdb");
       	System.Data.IDbCommand objCommand = objConn.CreateCommand();
       	DataSet objDataset = new DataSet();
       	IDbDataAdapter objDataAdapter = Database.GetAdapter();
       	DataRow objRow = null;

       	//Prepare adapter and fill data
    	string SQL = string.Format("SELECT * FROM EcomOrders WHERE OrderID = '{0}'", order.ID);
   		objCommand.CommandText = SQL;
   		objDataAdapter.SelectCommand = objCommand;
  	 	object objCommandBuilder = Database.GetCommandBuilder(objDataAdapter);
   		objDataAdapter.Fill(objDataset);

   		if (objDataset.Tables[0].Rows.Count > 0)
  	 	{
   			objRow = objDataset.Tables[0].Rows[0];
   		}
   		else
  	 	{
   			objRow = objDataset.Tables[0].NewRow();
   			objDataset.Tables[0].Rows.Add(objRow);
   			if (order.IsCart())
   			{
   				order.ID = NumberGenerator.GetNumber("CART");
   			}
   		    else
   		    {
   			    order.ID = NumberGenerator.GetNumber("ORDER");
   		    }
        }

   	    objRow["OrderID"] = order.ID;
        objRow["OrderShopID"] = order.ShopID;
        objRow["OrderDate"] = order.Date;
        objRow["OrderModified"] = DateTime.Now;
        objRow["OrderComplete"] = order.Complete;
        objRow["OrderDeleted"] = order.Deleted;
        objRow["OrderStateID"] = ((string.IsNullOrEmpty(order.StateID)) ? null : order.StateID); 
        objRow["OrderVAT"] = Convert.ToSingle(order.Price.VAT);
        objRow["OrderTrackTraceNumber"] = order.TrackTraceNumber;
        objRow["OrderShippingMethod"] = order.ShippingMethod;
        objRow["OrderPaymentMethod"] = order.PaymentMethod;
        objRow["OrderSalesDiscount"] = order.SalesDiscount;
        objRow["OrderCurrencyName"] = order.CurrencyName;
        objRow["OrderCurrencyRate"] = order.CurrencyRate;
        objRow["OrderCurrencyCode"] = order.CurrencyCode;
        objRow["OrderReSendEmail"] = order.ReSendEmail;
        objRow["OrderCart"] = order.IsCart;
        objRow["OrderFieldsXML"] = order.FieldsXML;
        objRow["OrderCustomerAccessUserID"] = order.CustomerAccessUserID; 
        objRow["OrderCustomerAccessUserUserName"] = order.CustomerAccessUserUserName;
        objRow["OrderCustomerNumber"] = order.CustomerNumber;
        objRow["OrderCustomerCompany"] = order.CustomerCompany;
        objRow["OrderCustomerName"] = order.CustomerName;
        objRow["OrderCustomerAddress"] = order.CustomerAddress;
        objRow["OrderTotalPrice"] = order.TotalPrice;

        objRow["OrderPriceWithVAT"] = order.Price.PriceWithVAT;
        objRow["OrderPriceWithoutVAT"] = order.Price.PriceWithoutVAT;
        objRow["OrderPriceVAT"] = Convert.ToSingle(order.Price.VAT);
        objRow["OrderPriceVATPercent"] = order.Price.VATPercent;

     	if (order.OrderFieldValues != null)
    	{
   		    order.OrderFieldValues.Save(objRow);
    	}

    	objDataAdapter.Update(objDataset);

   	    objDataset.Dispose();
    	objCommand.Dispose();
    	objConn.Close();
    	objConn.Dispose();

   	    if (order.OrderLines != null)
     	{
   		    order.OrderLines.Save(ID);
    	}

   }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

OrderLineCollection Class
OrderLineCollection Members

Send Feedback