protected override XmlDocument GetXmlDocument(WMSBusinessObject item) { var mgr = IoC.Instance.Resolve <IXamlManager <T> >(); var xaml = mgr.GetXaml(item.GetKey()); var xmlDocument = XmlDocumentConverter.ConvertFrom(item); if (string.IsNullOrEmpty(xaml)) { return(xmlDocument); } var el = xmlDocument.CreateElement(TagName); el.InnerText = xaml; if (xmlDocument.DocumentElement != null) { xmlDocument.DocumentElement.AppendChild(el); } return(xmlDocument); }
//private void ShowValidationError(string message) //{ // GetViewService().ShowDialog(StringResources.Error // , string.Format("{0}{1}{2}", typeof(CustomParam).GetDisplayName() + ":", Environment.NewLine, string.Format(DCL.Resources.StringResources.CpCountValidationFormat, message)) // , MessageBoxButton.OK // , MessageBoxImage.Error // , MessageBoxResult.Yes); //} private void OnEdit(EditableBusinessObject selectedItem) { var modelType = typeof(CustomParamValueTreeViewModel <>).MakeGenericType(_itemType); var model = (ICustomParamValueTreeViewModel)IoC.Instance.Resolve(modelType, null); model.Mode = ObjectListMode.LookUpList3Points; model.AutoExpandAllNodes = true; var cpv = (CustomParamValue)Activator.CreateInstance(_itemType); model.KeyPropertyName = cpv.GetPrimaryKeyPropertyName(); model.ParentIdPropertyName = cpv.ChangePropertyName(CustomParamValue.CPVParentPropertyName); model.CpEntity = SourceNameHelper.Instance.GetSourceName(_parentViewModelSource.GetType()).ToUpper(); model.CpKey = _parentViewModelSource.GetKey().To <string>(); model.ShouldUpdateSeparately = ShouldUpdateSeparately; model.SelectedItem = selectedItem; model.MandantCode = (string)(_parentViewModelSource.ContainsProperty("VMANDANTCODE") ? _parentViewModelSource.GetProperty("VMANDANTCODE") : null); if (_parentViewModelSource != null) { model.ParentViewModelSource = _parentViewModelSource; } if (model.CustomFilters != null) { model.ApplyFilter(null); } var issourceupdated = false; EventHandler onSourceUpdatedHandler = (s, e) => { issourceupdated = true; }; try { model.SourceUpdated += onSourceUpdatedHandler; GetViewService() .ShowDialogWindow(viewModel: model, isRestoredLayout: true, isNotNeededClosingOnOkResult: false, noButtons: true, noActionOnCancelKey: false, height: "50%", width: "65%"); if (issourceupdated) { if (ShouldUpdateSeparately) { if (ParentViewModel != null) { ParentViewModel.RefreshData(); } } else { //TODO: Надо доделывать для этого режима Source = (IList)model.GetSource(); } } } finally { model.SourceUpdated -= onSourceUpdatedHandler; } }
public static T GetKey <T>(this WMSBusinessObject wmsBusinessObject) { return(wmsBusinessObject == null ? default(T) : (T)wmsBusinessObject.GetKey()); }
public decimal?GetMandantCode(WMSBusinessObject bo) { return(bo == null ? null : bo.GetKey() as decimal?); }