protected void OnBtnAddNomenclatureClicked(object sender, System.EventArgs e) { var nomenclatureFilter = new NomenclatureRepFilter(UoWGeneric); nomenclatureFilter.SetAndRefilterAtOnce( x => x.AvailableCategories = Nomenclature.GetCategoriesForSaleToOrder(), x => x.DefaultSelectedCategory = NomenclatureCategory.water, x => x.DefaultSelectedSaleCategory = SaleCategory.forSale ); PermissionControlledRepresentationJournal SelectDialog = new PermissionControlledRepresentationJournal(new NomenclatureForSaleVM(nomenclatureFilter)) { Mode = JournalSelectMode.Multiple, ShowFilter = true }; SelectDialog.CustomTabName("Номенклатура на продажу"); SelectDialog.ObjectSelected += (s, ea) => { var selectedNodes = ea.GetNodes <NomenclatureForSaleVMNode>(); if (!selectedNodes.Any()) { return; } foreach (var node in selectedNodes) { Nomenclature n = UoWGeneric.GetById <Nomenclature>(node.Id); if (n != null && !Entity.ObservableNomenclatures.Any(x => x == n)) { Entity.ObservableNomenclatures.Add(n); } } }; TabParent.AddSlaveTab(this, SelectDialog); }
/// <summary> /// Открывает диалог выбора объекта /// </summary> public void OpenSelectDialog(string newTabTitle = null) { var modelWithParent = RepresentationModel as IRepresentationModelWithParent; if (modelWithParent != null && MyEntityDialogExist) { if (MyEntityDialog.UoW.IsNew && MyEntityDialog.EntityObject == modelWithParent.GetParent) { if (DialogHelper.SaveBeforeSelectFromChildReference(modelWithParent.GetParent.GetType(), SubjectType)) { if (!MyTdiDialog.Save()) { return; } } else { return; } } } var selectDialog = new PermissionControlledRepresentationJournal(RepresentationModel, JournalButtons); if (newTabTitle != null) { selectDialog.CustomTabName(newTabTitle); } selectDialog.Mode = JournalSelectMode.Single; selectDialog.ObjectSelected += SelectDialog_ObjectSelected; MyTab.TabParent.AddSlaveTab(MyTab, selectDialog); }
void ActionClientBalance_Activated(object sender, System.EventArgs e) { tdiMain.OpenTab( PermissionControlledRepresentationJournal.GenerateHashName <ClientEquipmentBalanceVM>(), () => { var journal = new PermissionControlledRepresentationJournal(new ClientEquipmentBalanceVM()); journal.CustomTabName("Оборудование у клиентов"); return(journal); } ); }
void MenuitemSelectFromClient_Activated(object sender, EventArgs e) { equipmentToSetSerial = ytreeEquipment.GetSelectedObject <ReceptionEquipmentItemNode>(); var filter = new ClientBalanceFilter(UoW); filter.SetAndRefilterAtOnce( x => x.RestrictCounterparty = equipmentToSetSerial.ServiceClaim.Counterparty, x => x.RestrictNomenclature = x.UoW.GetById <Nomenclature>(equipmentToSetSerial.NomenclatureId) ); var selectFromClientDlg = new PermissionControlledRepresentationJournal(new Vodovoz.ViewModel.ClientEquipmentBalanceVM(filter)); selectFromClientDlg.CustomTabName( string.Format( "Оборудование у {0}", StringWorks.EllipsizeEnd(equipmentToSetSerial.ServiceClaim.Counterparty.Name, 50) ) ); selectFromClientDlg.ObjectSelected += SelectFromClientDlg_ObjectSelected; MyTab.TabParent.AddSlaveTab(MyTab, selectFromClientDlg); }