London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
private void SaveCartForCurrentUser() { if(UnifiedPrincipal.Current == null || UnifiedPrincipal.Current.UserData == null) throw new NullReferenceException("Cannot call SaveOrder when UnifiedPrincipal.Current or UnifiedPrincipal.Current.UserData is null"); if(Cart.Current == null) throw new NullReferenceException("Cannot call SaveOrder when Cart.Current is null"); int storeID =((PageReference)CurrentPage["EPiStoreRootPage"]).ID Order order = new Order(); order.ID = Cart.Current.OrderID; order.StoreStartPageID = storeID; order.Cart = Cart.Current; order.Status = OrderStatus.Processing; order.Comments = Comments.Text; order.CreatedByID = UnifiedPrincipal.CurrentSid; order.Address = UnifiedPrincipal.Current.UserData.Address; order.Email = UnifiedPrincipal.Current.UserData.Email; order.Firstname = UnifiedPrincipal.Current.UserData.FirstName; order.Lastname = UnifiedPrincipal.Current.UserData.LastName; //An example how to add additional settings for an order //order.Property.Add("shippingamount", "205"); order.Save(); SendMail(order); }
it is theorder.Save()
that throws the exception! Stack trace looks like this:[InvalidOperationException: String[0]: the Size property has an invalid size of 0.] System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717107 System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters) +97 System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc) +81 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 EPiServer.DataAccess.AbstractCommand.ExecuteNonQuery() +10 EPiStore.DataAccess.ShoppingDB.ᐁ(Cart , Boolean ) +674 EPiStore.DataAccess.ShoppingDB.SaveOrder(Order order) +917 EPiStore.DataAbstraction.Order.Save() +33
Any help will be appriciated! Best Regards, Christian Jørgensen, Denmark