private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     ValidationManager.Validate(this);
     if (WarehouseVM.HasValidationErrors)
     {
         return;
     }
     WarehouseVM.CompanyCode = CPApplication.Current.CompanyCode;
     if (WarehouseSysNo.HasValue)
     {
         WarehouseFacade.UpdateWarehouseInfo(WarehouseVM, () =>
         {
             if (Saved != null)
             {
                 Saved(sender, e);
                 CloseDialog(new ResultEventArgs
                 {
                     DialogResult = DialogResultType.OK
                 });
             }
         });
     }
     else
     {
         WarehouseFacade.CreateWarehouseInfo(WarehouseVM, () =>
         {
             WarehouseSysNo = WarehouseVM.SysNo;
             if (Saved != null)
             {
                 Saved(sender, e);
                 CloseDialog(new ResultEventArgs
                 {
                     DialogResult = DialogResultType.OK
                 });
             }
         });
     }
 }