public static SpecificationOverviewItem MapToSpecificationOverviewItem(Specification spec, int langID) { string name = spec.LocalizedSpecifications.SingleOrDefault(x => x.LanguageID == langID).LookupName; SpecificationOverviewItem specOVI = new SpecificationOverviewItem { ID = spec.ID, SpecName = name, IsBool = spec.IsBool, IsEnum = spec.IsEnumeration, IsML = spec.IsMultilingual }; return(specOVI); }
protected override async void Delete(object sender, RoutedEventArgs e) { try { SpecificationOverviewItem ToBeDeleted = ((FrameworkElement)sender).DataContext as SpecificationOverviewItem; string messageboxTitle = String.Format(LangResource.MBTitleDeleteObj, ToBeDeleted.SpecName); string messageboxContent = String.Format(LangResource.MBContentDeleteObj, LangResource.TheSpec.ToLower(), ToBeDeleted.SpecName); MessageBoxManager.Yes = LangResource.Yes; MessageBoxManager.No = LangResource.No; MessageBoxManager.Register(); if (MessageBox.Show(messageboxContent, messageboxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { MessageBoxManager.Unregister(); _specRepo.Delete(ToBeDeleted.ID); SpecList.Remove(ToBeDeleted); await _specRepo.SaveChangesAsync(); BindData(); } else { MessageBoxManager.Unregister(); } } catch (Exception) { MessageBoxManager.Unregister(); MessageBox.Show(LangResource.ErrUpdateOverviewFailed); } }
protected override void Update(object sender, RoutedEventArgs e) { SpecificationOverviewItem spec = ((FrameworkElement)sender).DataContext as SpecificationOverviewItem; ShowUpdateForm <SpecificationForm>(spec.ID); }