public void FillMandantAndFactory(WMSBusinessObject entity) { var obj = entity as IWBPos; if (obj == null) { return; } if (obj.IWBID_R == null) { obj.MandantID = null; obj.FactoryID_R = null; return; } IWB iwb = null; using (var mgr = GetManager <IWB>()) iwb = mgr.Get(obj.IWBID_R); obj.MandantID = iwb == null ? null : iwb.MandantID; obj.FactoryID_R = iwb == null ? null : iwb.FactoryID_R; }
protected override void Execute(NativeActivityContext context) { var width = DialogWidth.Get(context); var height = DialogHeight.Get(context); var placeFilter = PlaceFilter.Get(context); var operationCode = OperationCode.Get(context); var place = InvoicePlace.Get(context); var iwb = IWB.Get(context); var mandantId = MandantID.Get(context); using (var viewModel = (AcceptanceViewModel)IoC.Instance.Resolve(typeof(AcceptanceViewModel))) { viewModel.PrintTE = CheckPrintTE(mandantId); viewModel.PlaceFilter = placeFilter; viewModel.OperationCode = operationCode; viewModel.MandantId = mandantId; viewModel.CurrentIWB = iwb; viewModel.IsMigration = IsMigration.Get(context); viewModel.BatchcodeWorkflowCode = BatchcodeWorkflowCode.Get(context); viewModel.SkuChangeMpWorkflowCode = SkuChangeMpWorkflowCode.Get(context); viewModel.PanelCaption = Title; viewModel.IsProductsShown = IsNeedShowProducts.Get(context); viewModel.DisplayFieldsFormat = DisplayFieldsFormat.Get(context); if (place != null) { viewModel.AcceptancePlace = new EntityReference(place.PlaceCode, Place.EntityType, new[] { new EntityReferenceFieldValue("PlaceCode", place.PlaceCode), new EntityReferenceFieldValue("PlaceName", place.PlaceName) }); } ((IModelHandler)viewModel).SetSource(Source.Get(context)); var viewService = IoC.Instance.Resolve <IViewService>(); if (viewService.ShowDialogWindow(viewModel, true, false, width, height, noButtons: true) == true && viewModel.IsAllowAccept == true) { if (viewModel.SelectedItems != null && viewModel.SelectedItems.Any()) { // пометим выбранные записи foreach (var r in viewModel.Source) { r.IsSelected = viewModel.SelectedItems.Contains(r); } } Result.Set(context, viewModel.Source.Cast <IWBPosInput>().ToArray()); var acceptancePlace = GetAcceptancePlace(viewModel); InvoicePlace.Set(context, acceptancePlace); IsNeedShowProducts.Set(context, viewModel.IsProductsShown); DialogResult.Set(context, true); } else { DialogResult.Set(context, false); } PrintTE.Set(context, viewModel.PrintTE); } }