private void ButtonTextLinkEdit_Click(object sender, RoutedEventArgs e) { HyperlinkButton btnEdit = sender as HyperlinkButton; var tempVM = btnEdit.DataContext as FloorSectionLinkVM; UCLinkForSection ucBrand = new UCLinkForSection(tempVM.DeepCopy()); ucBrand.Dialog = CurrentWindow.ShowDialog(ResFloorMaintain.Head_TextLinkSection, ucBrand, (obj, args) => { if (args.DialogResult == DialogResultType.OK) { var result = args.Data as FloorSectionLinkVM; FloorSectionItem sectionItem = result.ConvertVM <FloorSectionLinkVM, FloorSectionItem>((s, t) => { t.ItemTextLink = EntityConverter <FloorSectionLinkVM, FloorItemTextLink> .Convert(result); }); ServiceFacade.UpdateFloorSectionItem(sectionItem, (s, objArgs) => { if (objArgs.FaultsHandle()) { return; } for (int i = 0; i < TextLinkListVM.Count; i++) { if (TextLinkListVM[i].SysNo == tempVM.SysNo) { TextLinkListVM[i] = result.DeepCopy(); TextLinkResult.ItemsSource = TextLinkListVM; break; } } }); } }); }
private void BtnAddTextLink_Click(object sender, RoutedEventArgs e) { if (CurrentVM == null) { CurrentWindow.Alert(ResFloorMaintain.Info_SectionChecked); return; } UCLinkForSection ucTextLink = new UCLinkForSection(); ucTextLink.Dialog = CurrentWindow.ShowDialog(ResFloorMaintain.Head_TextLinkSection, ucTextLink, (obj, args) => { if (args.DialogResult == DialogResultType.OK) { var result = args.Data as FloorSectionLinkVM; FloorSectionItem sectionItem = LoadSectionItem(result, FloorItemType.TextLink); sectionItem.ItemTextLink = result.ConvertVM <FloorSectionLinkVM, FloorItemTextLink>(); ServiceFacade.CreateFloorSectionItem(sectionItem, (s, objArgs) => { if (objArgs.FaultsHandle()) { return; } result.SysNo = objArgs.Result; TextLinkListVM.Add(result); TextLinkResult.ItemsSource = TextLinkListVM; }); } }); }