public void SetSessionValue(string key, string value)
 {
     WcfSession myCartSession = new WcfSession();
     myCartSession.SetSessionVariable(key, value);
 }
    public void AddOrderDetails(OrderDetailsCollection OrderData)
    {
        SQLHandler sqlH = new SQLHandler();
        SqlTransaction tran;
        tran = (SqlTransaction)sqlH.GetTransaction();
        WcfSession sn = new WcfSession();
        try
        {
            AspxOrderDetails ObjOrderDetails = new AspxOrderDetails();

            int billingAddressID = 0;
            int shippingAddressId = 0;
            int orderID = 0;
            if (OrderData.ObjOrderDetails.IsMultipleCheckOut == false)
            {
                if (OrderData.ObjBillingAddressInfo.IsBillingAsShipping == true)
                {
                    if (int.Parse(OrderData.ObjBillingAddressInfo.AddressID) == 0 &&
                        int.Parse(OrderData.ObjShippingAddressInfo.AddressID) == 0)
                    {
                        int addressID = ObjOrderDetails.AddAddress(OrderData, tran);
                        billingAddressID = ObjOrderDetails.AddBillingAddress(OrderData, tran, addressID);
                        shippingAddressId = ObjOrderDetails.AddShippingAddress(OrderData, tran, addressID);
                    }
                }
                else
                {
                    if (int.Parse(OrderData.ObjBillingAddressInfo.AddressID) == 0)
                        billingAddressID = ObjOrderDetails.AddBillingAddress(OrderData, tran);
                    if (int.Parse(OrderData.ObjShippingAddressInfo.AddressID) == 0)
                        shippingAddressId = ObjOrderDetails.AddShippingAddress(OrderData, tran);
                }
            }
            int paymentMethodID = ObjOrderDetails.AddPaymentInfo(OrderData, tran);

            if (billingAddressID > 0)
            {
                orderID = ObjOrderDetails.AddOrder(OrderData, tran, billingAddressID, paymentMethodID);

                sn.SetSessionVariable("OrderID", orderID);

            }
            else
            {
                orderID = ObjOrderDetails.AddOrderWithMultipleCheckOut(OrderData, tran, paymentMethodID);

                sn.SetSessionVariable("OrderID", orderID);
            }

            if (shippingAddressId > 0)
                ObjOrderDetails.AddOrderItems(OrderData, tran, orderID, shippingAddressId);
            else
                ObjOrderDetails.AddOrderItemsList(OrderData, tran, orderID);

            tran.Commit();
        }
        catch (SqlException sqlEX)
        {

            throw new ArgumentException(sqlEX.Message);
        }
        catch (Exception ex)
        {
            tran.Rollback();
            throw ex;
        }
    }