コード例 #1
0
 protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
         {
         case InstanceTypes.OrderItem:
             OrderFacade  facade       = new OrderFacade(uow);
             OrderItemDto orderItemDto = e.Instance as OrderItemDto;
             // Save data
             IFacadeUpdateResult <OrderData> result = facade.SaveOrderItem(CurrentInstance.Id, orderItemDto);
             e.IsSuccessful = result.IsSuccessful;
             if (result.IsSuccessful)
             {
                 // Refresh
                 OrderDto savedParentInstance = result.ToDto(new OrderConverter());
                 CurrentInstance.OrderItems = savedParentInstance.OrderItems;
             }
             else
             {
                 // Deal with Update result
                 ProcUpdateResult(result.ValidationResult, result.Exception);
             }
             break;
         }
     }
 }