protected void OnButtonAddClicked(object sender, EventArgs e) { ormtableview.Selection.UnselectAll(); var classDiscript = OrmMain.GetObjectDescription(objectType); if (classDiscript.SimpleDialog) { EntityEditSimpleDialog.RunSimpleDialog(this.Toplevel as Window, objectType, null); } else if (RepresentationModel is IRepresentationModelWithParent) { var dlg = OrmMain.CreateObjectDialog(objectType, (RepresentationModel as IRepresentationModelWithParent).GetParent); TabParent.OpenTab(OrmMain.GenerateDialogHashName(objectType, 0), () => dlg, this ); dlg.EntitySaved += dlg_EntitySaved; } else { var dlg = OrmMain.CreateObjectDialog(objectType); dlg.EntitySaved += dlg_EntitySaved; TabParent.AddTab(dlg, this, true); if (TabParent is TdiSliderTab) { ((TdiSliderTab)TabParent).IsHideJournal = true; } } }
protected void OnEnumPrintEnumItemClicked(object sender, QS.Widgets.EnumItemClickedEventArgs e) { if (UoWGeneric.HasChanges) { if (CommonDialogs.SaveBeforePrint(typeof(CarLoadDocument), "талона")) { if (!Save()) { return; } } else { return; } } var reportInfo = new QS.Report.ReportInfo { Title = Entity.Title, Identifier = "Store.CarLoadDocument", Parameters = new System.Collections.Generic.Dictionary <string, object> { { "id", Entity.Id } }, PrintType = ReportInfo.PrintingType.MultiplePrinters }; TabParent.OpenTab( QSReport.ReportViewDlg.GenerateHashName(reportInfo), () => new QSReport.ReportViewDlg(reportInfo), this); }
void PrintSelectedDocument(RouteListPrintableDocuments choise) { TabParent.OpenTab( QS.Dialog.Gtk.TdiTabBase.GenerateHashName <DocumentsPrinterDlg>(), () => CreateDocumentsPrinterDlg(choise) ); }
private IJournalAction CreateGiveFuelAction() { return(new JournalAction( "Выдать топливо", selectedItems => selectedItems.FirstOrDefault() is RouteListJournalNode node && _fuelIssuingStatuses.Contains(node.StatusEnum), selectedItems => true, selectedItems => { if (!(selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode)) { return; } var routeList = UoW.GetById <RouteList>(selectedNode.Id); TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new FuelDocumentViewModel( routeList, commonServices, _subdivisionRepository, _employeeRepository, _fuelRepository, NavigationManagerProvider.NavigationManager, _trackRepository, _categoryRepository, _employeeJournalFactory, _carJournalFactory ) ); } )); }
private void OpenDocument() { TabParent.OpenTab(DialogHelper.GenerateDialogHashName(RepresentationModel.GetEntityType(tableview.GetSelectedObject()), 0), () => RepresentationModel.GetOpenEntityDlg(tableview.GetSelectedObject()), this ); }
protected void InitPopupActions() { var callTaskWorker = new CallTaskWorker( CallTaskSingletonFactory.GetInstance(), _callTaskRepository, new OrderRepository(), new EmployeeRepository(), _baseParametersProvider, commonServices.UserService, ErrorReporter.Instance); PopupActionsList.Add(new JournalAction( "Закрытие МЛ", (selectedItems) => selectedItems.Any(x => _closingDlgStatuses.Contains((x as RouteListJournalNode).StatusEnum)), (selectedItems) => selectedItems.Any(x => _closingDlgStatuses.Contains((x as RouteListJournalNode).StatusEnum)), (selectedItems) => { if (selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode && _closingDlgStatuses.Contains(selectedNode.StatusEnum)) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new RouteListClosingDlg(selectedNode.Id, true) ); } }
void OpenCounterparty(object sender, EventArgs e) { TabParent.OpenTab( OrmMain.GenerateDialogHashName <Counterparty>(Entity.Counterparty.Id), () => new CounterpartyDlg(Entity.Counterparty.Id) ); }
protected void OnBtnAddClicked(object sender, EventArgs e) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <Warehouse>(0), () => new WarehouseDlg(), this ); }
protected void OnButtonOpenCarClicked(object sender, EventArgs e) { var selected = ytreeviewAtWorkDrivers.GetSelectedObjects <AtWorkDriver>(); TabParent.OpenTab(OrmMain.GenerateDialogHashName <Car>(selected[0].Car.Id), () => new CarsDlg(selected[0].Car) ); }
protected void OnButtonChangeToEmployeeClicked(object sender, EventArgs e) { if (UoW.HasChanges || Entity.Id == 0) { if (!MessageDialogHelper.RunQuestionDialog("Для продолжения необходимо сохранить изменения, сохранить и продолжить?")) { return; } if (Save()) { OnEntitySaved(true); } else { return; } } var employeeUow = UnitOfWorkFactory.CreateWithNewRoot <Employee>(); Personnel.ChangeTraineeToEmployee(employeeUow, Entity); var cs = new ConfigurationSection(new ConfigurationRoot(new List <IConfigurationProvider> { new MemoryConfigurationProvider(new MemoryConfigurationSource()) }), ""); cs["BaseUri"] = "https://driverapi.vod.qsolution.ru:7090/api/"; var apiHelper = new ApiClientProvider.ApiClientProvider(cs); var driverApiRegisterEndpoint = new DriverApiUserRegisterEndpoint(apiHelper); var employeeViewModel = new EmployeeViewModel( _authorizationService, _employeeWageParametersFactory, _employeeJournalFactory, _subdivisionJournalFactory, _employeePostsJournalFactory, _cashDistributionCommonOrganisationProvider, _subdivisionService, _emailServiceSettingAdapter, _wageCalculationRepository, _employeeRepository, employeeUow, ServicesConfig.CommonServices, _validationContextFactory, _phonesViewModelFactory, _warehouseRepository, _routeListRepository, driverApiRegisterEndpoint, CurrentUserSettings.Settings, _userRepository, _baseParametersProvider, true); TabParent.OpenTab(DialogHelper.GenerateDialogHashName <Employee>(Entity.Id), () => employeeViewModel); OnCloseTab(false); }
private void CreateCustomEditAction() { var editAction = new JournalAction("Изменить", (selected) => { var selectedNodes = selected.OfType <EmployeeJournalNode>(); if (selectedNodes == null || selectedNodes.Count() != 1) { return(false); } EmployeeJournalNode selectedNode = selectedNodes.First(); if (!EntityConfigs.ContainsKey(selectedNode.EntityType)) { return(false); } var config = EntityConfigs[selectedNode.EntityType]; return(config.PermissionResult.CanRead); }, (selected) => true, (selected) => { var selectedNodes = selected.OfType <EmployeeJournalNode>(); if (selectedNodes == null || selectedNodes.Count() != 1) { return; } EmployeeJournalNode selectedNode = selectedNodes.First(); if (!EntityConfigs.ContainsKey(selectedNode.EntityType)) { return; } var config = EntityConfigs[selectedNode.EntityType]; var foundDocumentConfig = config.EntityDocumentConfigurations.FirstOrDefault(x => x.IsIdentified(selectedNode)); TabParent.OpenTab(() => foundDocumentConfig.GetOpenEntityDlgFunction().Invoke(selectedNode), this); if (foundDocumentConfig.JournalParameters.HideJournalForOpenDialog) { HideJournal(TabParent); } } ); if (SelectionMode == JournalSelectionMode.None) { RowActivatedAction = editAction; } NodeActionsList.Add(editAction); }
private void ConfigureActions() { MenuButton addDocumentButton = new MenuButton(); addDocumentButton.Label = "Добавить"; Menu addDocumentActions = new Menu(); foreach (var item in RepresentationModel.NewEntityActionsConfigs) { var menuItem = new MenuItem(item.Title); menuItem.Activated += (sender, e) => { TabParent.OpenTab(DialogHelper.GenerateDialogHashName(item.EntityType, 0), item.GetNewEntityDlg, this ); }; SetCreateActionsSensitiveFunc(menuItem, item.EntityType); addDocumentActions.Add(menuItem); } addDocumentButton.Menu = addDocumentActions; addDocumentActions.ShowAll(); hboxButtonActions.Add(addDocumentButton); Box.BoxChild addDocumentButtonBox = (Box.BoxChild)hboxButtonActions[addDocumentButton]; addDocumentButtonBox.Expand = false; addDocumentButtonBox.Fill = false; Button editDocumentbutton = new Button(); editDocumentbutton.Label = "Редактировать"; editDocumentbutton.Clicked += (sender, e) => { OpenDocument(); }; SetOpenActionSensitiveFunc(editDocumentbutton); hboxButtonActions.Add(editDocumentbutton); Box.BoxChild editDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[editDocumentbutton]; editDocumentbuttonBox.Expand = false; editDocumentbuttonBox.Fill = false; Button deleteDocumentbutton = new Button(); deleteDocumentbutton.Label = "Удалить"; deleteDocumentbutton.Clicked += (sender, e) => { var selectedObject = tableview.GetSelectedObject(); if (OrmMain.DeleteObject(RepresentationModel.GetEntityType(selectedObject), RepresentationModel.GetDocumentId(selectedObject))) { RepresentationModel.UpdateNodes(); } }; SetDeleteActionSensitiveFunc(deleteDocumentbutton); hboxButtonActions.Add(deleteDocumentbutton); Box.BoxChild deleteDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[deleteDocumentbutton]; deleteDocumentbuttonBox.Expand = false; deleteDocumentbuttonBox.Fill = false; hboxButtonActions.ShowAll(); }
protected void OnButtonOpenDriverClicked(object sender, EventArgs e) { var selected = ytreeviewAtWorkDrivers.GetSelectedObjects <AtWorkDriver>(); foreach (var one in selected) { TabParent.OpenTab(OrmMain.GenerateDialogHashName <Employee>(one.Employee.Id), () => new EmployeeDlg(one.Employee.Id) ); } }
protected void OnBtnEditDistrictClicked(object sender, EventArgs e) { if (currentDistrict.Id == 0 && MessageDialogWorks.RunQuestionDialog("Для продолжения необходимо сохранить район, сохранить и продолжить?")) { uow.Save(currentDistrict); uow.Commit(); } TabParent.OpenTab( DialogHelper.GenerateDialogHashName <ScheduleRestrictedDistrict>(currentDistrict.Id), () => new ScheduleRestrictedDistrictDlg(currentDistrict) ); }
protected void OnButtonEditClicked(object sender, EventArgs e) { if (OrmMain.GetObjectDescription(objectType).SimpleDialog) { EntityEditSimpleDialog.RunSimpleDialog(this.Toplevel as Window, objectType, ytreeviewRef.GetSelectedObject()); } else { var selected = ytreeviewRef.GetSelectedObject(); TabParent.OpenTab(OrmMain.GenerateDialogHashName(objectType, DomainHelper.GetId(selected)), () => OrmMain.CreateObjectDialog(objectType, selected), this ); } }
protected void OnButtonEditClicked(object sender, EventArgs e) { if (tableWarehouses.GetSelectedObjects().GetLength(0) > 0) { int?id = (tableWarehouses.GetSelectedObjects()[0] as SubdivisionWithWarehousesVMNode).WarehouseId; if (id.HasValue) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <Warehouse>(id.Value), () => CreateWarehouseDlg(id.Value), this ); } } }
private void OnButtonAddClicked(object sender, EventArgs e) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <ProductGroup>(0), () => { var productGroupDlg = new ProductGroupDlg(); productGroupDlg.EntitySaved += (o, args) => { vm.UpdateNodes(); tableProductGroup.YTreeModel = vm.YTreeModel; }; return(productGroupDlg); }, this ); }
private IJournalAction CreateOpenCreateDialogAction() { return(new JournalAction( "Открыть диалог создания", selectedItems => true, selectedItems => true, selectedItems => { if (selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new RouteListCreateDlg(selectedNode.Id) ); } } )); }
protected void OnButtonAddClicked(object sender, EventArgs e) { ytreeviewRef.Selection.UnselectAll(); if (OrmMain.GetObjectDescription(objectType).SimpleDialog) { SelectObject(EntityEditSimpleDialog.RunSimpleDialog(this.Toplevel as Window, objectType, null)); } else { var tab = TabParent.OpenTab(OrmMain.GenerateDialogHashName(objectType, 0), () => OrmMain.CreateObjectDialog(objectType), this ); if (tab != null) { (tab as ITdiDialog).EntitySaved += NewItemDlg_EntitySaved; } } }
private IJournalAction CreateOpenRouteListControlDlg() { return(new JournalAction( "Отгрузка со склада", selectedItems => selectedItems.FirstOrDefault() is RouteListJournalNode node && _controlDlgStatuses.Contains(node.StatusEnum), selectedItems => true, selectedItems => { if (selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new RouteListControlDlg(selectedNode.Id) ); } } )); }
private IJournalAction CreateOpenClosingDialogAction() { return(new JournalAction( "Открыть диалог закрытия", selectedItems => selectedItems.FirstOrDefault() is RouteListJournalNode node && _closingDlgStatuses.Contains(node.StatusEnum), selectedItems => true, selectedItems => { if (selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new RouteListClosingDlg(selectedNode.Id) ); } } )); }
protected void OnButtonEditClicked(object sender, EventArgs e) { if (tableWarehouses.GetSelectedObjects().GetLength(0) > 0) { int?id = (tableWarehouses.GetSelectedObjects()[0] as SubdivisionWithWarehousesVMNode).WarehouseId; if (id.HasValue) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <Warehouse>(id.Value), () => { var dlg = new WarehouseDlg(id.Value); dlg.EntitySaved += (s, ea) => ConfigureWidget(); return(dlg); }, this ); } } }
protected void OnButtonPrintClicked(object sender, EventArgs e) { if (UoWGeneric.HasChanges && CommonDialogs.SaveBeforePrint(typeof(InventoryDocument), "акта инвентаризации")) { Save(); } var reportInfo = new QS.Report.ReportInfo { Title = String.Format("Акт инвентаризации №{0} от {1:d}", Entity.Id, Entity.TimeStamp), Identifier = "Store.InventoryDoc", Parameters = new Dictionary <string, object> { { "inventory_id", Entity.Id } } }; TabParent.OpenTab( QSReport.ReportViewDlg.GenerateHashName(reportInfo), () => new QSReport.ReportViewDlg(reportInfo) ); }
private void OnButtonEditClicked(object sender, EventArgs e) { var selectedNode = tableProductGroup.GetSelectedObjects().OfType <ProductGroupVMNode>().FirstOrDefault(); if (selectedNode != null) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <ProductGroup>(selectedNode.Id), () => { var dlg = new ProductGroupDlg(selectedNode.Id); dlg.EntitySaved += (s, ea) => { vm.UpdateNodes(); tableProductGroup.YTreeModel = vm.YTreeModel; }; return(dlg); }, this ); } }
protected void OnButtonPrintClicked(object sender, EventArgs e) { if (UoWGeneric.HasChanges && CommonDialogs.SaveBeforePrint(typeof(ShiftChangeWarehouseDocument), "акта передачи склада")) { Save(); } var reportInfo = new QS.Report.ReportInfo { Title = String.Format("Акт передачи склада №{0} от {1:d}", Entity.Id, Entity.TimeStamp), Identifier = "Store.ShiftChangeWarehouse", Parameters = new Dictionary <string, object> { { "document_id", Entity.Id } } }; TabParent.OpenTab( QSReport.ReportViewDlg.GenerateHashName(reportInfo), () => new QSReport.ReportViewDlg(reportInfo) ); }
protected void OnButtonChatClicked(object sender, EventArgs e) { var drivers = uow.GetById <Employee>(yTreeViewDrivers.GetSelectedIds()); foreach (var driver in drivers) { var chat = ChatRepository.GetChatForDriver(uow, driver); if (chat == null) { var chatUoW = UnitOfWorkFactory.CreateWithNewRoot <Chat> (); chatUoW.Root.ChatType = ChatType.DriverAndLogists; chatUoW.Root.Driver = driver; chatUoW.Save(); chat = chatUoW.Root; } TabParent.OpenTab(ChatWidget.GenerateHashName(chat.Id), () => new ChatWidget(chat.Id) ); } }
protected void OnButtonPrintClicked(object sender, EventArgs e) { if (UoWGeneric.HasChanges && CommonDialogs.SaveBeforePrint(typeof(CarUnloadDocument), "талона")) { Save(); } var reportInfo = new QS.Report.ReportInfo { Title = Entity.Title, Identifier = "Store.CarUnloadDoc", Parameters = new Dictionary <string, object> { { "id", Entity.Id } } }; TabParent.OpenTab( QSReport.ReportViewDlg.GenerateHashName(reportInfo), () => new QSReport.ReportViewDlg(reportInfo), this); }
protected void OnEnumPrintEnumItemClicked(object sender, EnumItemClickedEventArgs e) { if (UoWGeneric.HasChanges && CommonDialogs.SaveBeforePrint(typeof(CarLoadDocument), "талона")) { Save(); } var reportInfo = new QS.Report.ReportInfo { Title = Entity.Title, Identifier = CarLoadPrintableDocuments.Common.Equals(e.ItemEnum) ? "Store.CarLoadDoc" : "Store.CarLoadDocPallets", Parameters = new System.Collections.Generic.Dictionary <string, object> { { "id", Entity.Id } } }; TabParent.OpenTab( QSReport.ReportViewDlg.GenerateHashName(reportInfo), () => new QSReport.ReportViewDlg(reportInfo), this); }
private IJournalAction CreateOpenMileageCheckDialogAction() { return(new JournalAction( "Открыть диалог проверки километража", selectedItems => selectedItems.FirstOrDefault() is RouteListJournalNode node && _mileageCheckDlgStatuses.Contains(node.StatusEnum) && node.CarOwnType == CarOwnType.Company && node.CarTypeOfUse != CarTypeOfUse.Truck, selectedItems => true, selectedItems => { if (selectedItems.FirstOrDefault() is RouteListJournalNode selectedNode) { TabParent.OpenTab( DialogHelper.GenerateDialogHashName <RouteList>(selectedNode.Id), () => new RouteListMileageCheckDlg(selectedNode.Id) ); } } )); }
private void CreateDefaultAddAction() { var entityConfig = EntityConfigs.First().Value; var addAction = new JournalAction("Добавить", selected => entityConfig.PermissionResult.CanCreate, selected => entityConfig.PermissionResult.CanCreate, selected => { var docConfig = entityConfig.EntityDocumentConfigurations.First(); ITdiTab tab = docConfig.GetCreateEntityDlgConfigs().First().OpenEntityDialogFunction(); TabParent.OpenTab(() => tab, this); if (docConfig.JournalParameters.HideJournalForCreateDialog) { if (TabParent is ITdiSliderTab slider) { slider.IsHideJournal = true; } } }); NodeActionsList.Add(addAction); }