protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SupplierDto project = e.Instance as SupplierDto; SupplierFacade facade = new SupplierFacade(uow); IFacadeUpdateResult <SupplierData> result = facade.SaveSupplier(project); e.IsSuccessful = result.IsSuccessful; if (result.IsSuccessful) { // Refresh whole list RetrieveInstances(facade); } else { // Deal with Update result ProcUpdateResult(result.ValidationResult, result.Exception); } } }
protected void ucIEdit_InstanceSaving(object sender, InstanceSavingEventArgs e) { SupplierDto instance = e.Instance as SupplierDto; if (instance != null) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { SupplierFacade facade = new SupplierFacade(uow); IFacadeUpdateResult <SupplierData> result = facade.SaveSupplier(instance); e.IsSuccessful = result.IsSuccessful; if (result.IsSuccessful) { // Refresh Instance CurrentInstance = result.ToDto <SupplierDto>(new SupplierConverter()); } else { // Deal with Update result ProcUpdateResult(result.ValidationResult, result.Exception); } } } }