コード例 #1
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                OrderDto    project = e.Instance as OrderDto;
                OrderFacade facade  = new OrderFacade(uow);
                IFacadeUpdateResult <OrderData> result = facade.SaveOrder(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
コード例 #2
0
        protected void ucIEdit_InstanceSaving(object sender, InstanceSavingEventArgs e)
        {
            OrderDto instance = e.Instance as OrderDto;

            if (instance != null)
            {
                using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
                {
                    OrderFacade facade = new OrderFacade(uow);
                    IFacadeUpdateResult <OrderData> result = facade.SaveOrder(instance);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh Instance
                        CurrentInstance = result.ToDto <OrderDto>(new OrderConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                }
            }
        }