saving
This commit is contained in:
@@ -364,6 +364,25 @@ namespace BeWo.View.Detail
|
||||
return ViewModel.IsNew ? new[] { UserRightType.CreateAll, UserRightType.CustomerView_Create } : new[] { UserRightType.EditAll, UserRightType.CustomerView_Edit };
|
||||
}
|
||||
|
||||
internal override bool DoSaveCheck()
|
||||
{
|
||||
if (this.IsDirty)
|
||||
{
|
||||
|
||||
}
|
||||
var valid = base.DoSaveCheck();
|
||||
|
||||
if (valid)
|
||||
{
|
||||
MessageBox.Show("Nix da", "Änderungen speichern", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
return false;
|
||||
//ServiceFacade.DoCustomerServiceAsync(s => s.AllowSavingCustomer(cdc), AfterSave);
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
protected override void Save()
|
||||
{
|
||||
if (!_saveInProgress)
|
||||
@@ -374,27 +393,19 @@ namespace BeWo.View.Detail
|
||||
//var lDataContract = ViewModel.CommitToDataContract();
|
||||
try
|
||||
{
|
||||
|
||||
long oid = 0;
|
||||
IsDoneWithInsertOrUpdate = false;
|
||||
|
||||
if (ViewModel.IsNew)
|
||||
{
|
||||
oid = ServiceFacade.DoCustomerServiceSync(s => s.InsertNewCustomer(cdc));
|
||||
ServiceFacade.DoCustomerServiceAsync(s => s.InsertNewCustomer(cdc), AfterSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
IsDoneWithInsertOrUpdate = false;
|
||||
oid = ServiceFacade.DoCustomerServiceSync(s => s.UpdateCustomer(cdc));
|
||||
}
|
||||
|
||||
if (oid > 0)
|
||||
{
|
||||
Cache.GetInstance().ClearSupportConceptTree();
|
||||
Cache.GetInstance().ClearCustomers();
|
||||
BeWoApp.MainControl.ResetView(UIContext.Customer);
|
||||
|
||||
ReloadViewModel(oid);
|
||||
ServiceFacade.DoCustomerServiceAsync(s => s.UpdateCustomer(cdc), AfterSave);
|
||||
}
|
||||
|
||||
}
|
||||
catch (FaultException<BeWoFault>)
|
||||
{
|
||||
@@ -473,6 +484,18 @@ namespace BeWo.View.Detail
|
||||
c.ItemsSource = _PossibleDiagnosis;
|
||||
}
|
||||
|
||||
private void AfterSave(long oid)
|
||||
{
|
||||
if (oid > 0)
|
||||
{
|
||||
Cache.GetInstance().ClearSupportConceptTree();
|
||||
Cache.GetInstance().ClearCustomers();
|
||||
BeWoApp.MainControl.ResetView(UIContext.Customer);
|
||||
|
||||
ReloadViewModel(oid);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReloadViewModel(long pCustomerOID)
|
||||
{
|
||||
// reload to update version information and oid
|
||||
|
||||
Reference in New Issue
Block a user