示例#1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            var isSelected = IsILtemSelected("Standort", () =>
            {
                return(LocationDetailVM.LocationSelected == null || LocationDetailVM.LocationSelected.Id < 0);
            });

            if (!isSelected)
            {
                return;
            }

            var result = LocationDetailVM.EditLocation();

            if (result.IsReadOnly)
            {
                AskForceToEdit(result.CurrentlyUsedBy, () =>
                {
                    LocationDetailVM.ForceEditing();
                    EnableContoles(true);
                });
            }
            else
            {
                EnableContoles(true);
            }
        }
示例#2
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     MarkForDelete("Standort", LocationDetailVM.LocationSelected,
                   () => LocationDetailVM.MarkForDeleteLocation(),
                   () => {
         LocationsVM.LocationsByCustomer(_customer);
         dgLocations.SelectedIndex = 0;
     });
 }
示例#3
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            if (LocationDetailVM.LocationSelected.ReadOnly)
            {
                LocationDetailVM.ReleaseEditing();
            }

            LocationDetailVM.LocationSelected = (Location)dgLocations.SelectedItem;
            EnableContoles(false);
        }
示例#4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var result = LocationDetailVM.Add(_customer);

            if (result.Records > 0)
            {
                LocationsVM.LocationsByCustomer(_customer);
                var location = dgLocations.Items.Cast <Location>().Single(c => c.Id == result.Id);
                dgLocations.SelectedItem = location;

                var titel = string.Format("Standort : {0}", location.GetFullName());
                var msg   = "Standortdaten wurden gespeichert.";
                new NotificationWindow(titel, msg).Show();
            }
            else
            {
                var msg = "Standortdaten konnten nicht gespeichert werden.";
                new NotificationWindow("Fehler!", msg).Show();
            }
        }