private void DocumentAfterCopy(Document sender, CopyEventArgs e) { if (sender.Level > 2 && sender.ContentType.Alias == Order.NodeAlias) { Guid currentGuid; var orderGuid = sender.getProperty("orderGuid").Value.ToString(); Guid.TryParse(orderGuid, out currentGuid); var order = OrderHelper.GetOrder(currentGuid); var newOrder = OrderHelper.CreateNewOrderFromExisting(order); IO.Container.Resolve<IOrderNumberService>().GenerateAndPersistOrderNumber(order); order.OrderNodeId = e.NewDocument.Id; order.Save(); e.NewDocument.Text = order.OrderNumber; e.NewDocument.SetProperty("orderGuid", newOrder.UniqueOrderId.ToString()); e.NewDocument.SetProperty("orderStatusPicker", newOrder.Status.ToString()); e.NewDocument.Save(); BasePage.Current.ClientTools.SyncTree(e.NewDocument.Parent.Path, false); BasePage.Current.ClientTools.ChangeContentFrameUrl(string.Concat("editContent.aspx?id=", e.NewDocument.Id)); } }
/// <summary>On event, after copy.</summary> protected void Document_AfterCopy(Document sender, CopyEventArgs e) { SetRelationStaticId(e.NewDocument); }