private void ConfigureDlg() { //Настройка элементов откуда переносим RouteListsFilter filterFrom = new RouteListsFilter(UoW); filterFrom.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteListFrom.RepresentationModel = new ViewModel.RouteListsVM(filterFrom); yentryreferenceRouteListFrom.Changed += YentryreferenceRouteListFrom_Changed; yentryreferenceRouteListFrom.CanEditReference = QSMain.User.Permissions["can_delete"]; ylistcomboReceptionTicketFrom.SetRenderTextFunc <CarUnloadDocument>(d => $"Талон разгрузки №{d.Id}. {d.Warehouse.Name}"); ylistcomboReceptionTicketFrom.ItemSelected += YlistcomboReceptionTicketFrom_ItemSelected; ytreeviewFrom.ColumnsConfig = colConfigFrom; //Настройка компонентов куда переносим RouteListsFilter filterTo = new RouteListsFilter(UoW); filterTo.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteListTo.RepresentationModel = new ViewModel.RouteListsVM(filterTo); yentryreferenceRouteListTo.Changed += YentryreferenceRouteListTo_Changed; yentryreferenceRouteListTo.CanEditReference = QSMain.User.Permissions["can_delete"]; ylistcomboReceptionTicketTo.SetRenderTextFunc <CarUnloadDocument>(d => $"Талон разгрузки №{d.Id}. {d.Warehouse.Name}"); ylistcomboReceptionTicketTo.ItemSelected += YlistcomboReceptionTicketTo_ItemSelected; ytreeviewTo.ColumnsConfig = colConfigTo; CheckSensitivities(); }
void ConfigureDlg() { enumFineType.ItemsEnum = typeof(FineTypes); enumFineType.Binding.AddBinding(Entity, s => s.FineType, w => w.SelectedItem).InitializeFromSource(); yspinLiters.Binding.AddBinding(Entity, s => s.LitersOverspending, w => w.ValueAsDecimal); ylabelDate.Binding.AddFuncBinding(Entity, e => e.Date.ToString("D"), w => w.LabelProp).InitializeFromSource(); yspinMoney.Binding.AddBinding(Entity, e => e.TotalMoney, w => w.ValueAsDecimal).InitializeFromSource(); yentryFineReasonString.Binding.AddBinding(Entity, e => e.FineReasonString, w => w.Text).InitializeFromSource(); fineitemsview1.FineUoW = UoWGeneric; var filterRouteList = new RouteListsFilter(UoW); filterRouteList.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRouteList); yentryreferenceRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource(); yentryreferenceRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); Entity.ObservableItems.ListChanged += ObservableItems_ListChanged; yentryAuthor.RepresentationModel = new EmployeesVM(); yentryAuthor.Binding.AddBinding(Entity, e => e.Author, w => w.Subject).InitializeFromSource(); UpdateControlsState(); ShowLiters(); }
private void ConfigureDlg() { var filterFrom = new RouteListsFilter(UoW); filterFrom.SetAndRefilterAtOnce( f => f.OnlyStatuses = new[] { RouteListStatus.EnRoute, RouteListStatus.OnClosing }, f => f.SetFilterDates( DateTime.Today.AddDays(-3), DateTime.Today.AddDays(1) ) ); var vmFrom = new RouteListsVM(filterFrom); GC.KeepAlive(vmFrom); yentryreferenceRLFrom.RepresentationModel = vmFrom; yentryreferenceRLFrom.JournalButtons = QS.Project.Dialogs.GtkUI.Buttons.Add | QS.Project.Dialogs.GtkUI.Buttons.Edit; yentryreferenceRLFrom.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); var filterTo = new RouteListsFilter(UoW); filterTo.SetAndRefilterAtOnce( f => f.OnlyStatuses = new[] { RouteListStatus.New, RouteListStatus.InLoading, RouteListStatus.EnRoute, RouteListStatus.OnClosing }, f => f.SetFilterDates( DateTime.Today.AddDays(-3), DateTime.Today.AddDays(1) ) ); var vmTo = new RouteListsVM(filterTo); yentryreferenceRLTo.RepresentationModel = vmTo; yentryreferenceRLTo.JournalButtons = QS.Project.Dialogs.GtkUI.Buttons.Add | QS.Project.Dialogs.GtkUI.Buttons.Edit; yentryreferenceRLTo.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); yentryreferenceRLFrom.Changed += YentryreferenceRLFrom_Changed; yentryreferenceRLTo.Changed += YentryreferenceRLTo_Changed; //Для каждой TreeView нужен свой экземпляр ColumnsConfig ytreeviewRLFrom.ColumnsConfig = GetColumnsConfig(false); ytreeviewRLTo.ColumnsConfig = GetColumnsConfig(true); ytreeviewRLFrom.Selection.Mode = Gtk.SelectionMode.Multiple; ytreeviewRLTo.Selection.Mode = Gtk.SelectionMode.Multiple; ytreeviewRLFrom.Selection.Changed += YtreeviewRLFrom_OnSelectionChanged; ytreeviewRLTo.Selection.Changed += YtreeviewRLTo_OnSelectionChanged; ConfigureTreeViewsDriverBalance(); ybtnTransferTerminal.Clicked += (sender, e) => TransferTerminal.Execute(); ybtnRevertTerminal.Clicked += (sender, e) => RevertTerminal.Execute(); }
private void ConfigureDlg() { buttonSave.Sensitive = CanEdit; btnCancel.Clicked += (sender, args) => OnCloseTab(AskSaveOnClose, CloseSource.Cancel); buttonDivideAtAll.Sensitive = CanEdit; buttonGetReasonFromTemplate.Sensitive = CanEdit; enumFineType.ItemsEnum = typeof(FineTypes); enumFineType.Sensitive = CanEdit; enumFineType.Binding .AddBinding(Entity, s => s.FineType, w => w.SelectedItem) .InitializeFromSource(); yspinLiters.Sensitive = CanEdit; yspinLiters.Binding .AddBinding(Entity, s => s.LitersOverspending, w => w.ValueAsDecimal); ylabelAuthor.Binding.AddBinding(Entity, e => e.Author, w => w.LabelProp, new EmployeeToLastNameWithInitialsConverter()).InitializeFromSource(); ylabelDate.Binding .AddFuncBinding(Entity, e => e.Date.ToString("D"), w => w.LabelProp) .InitializeFromSource(); ydatepicker.Binding .AddBinding(Entity, e => e.Date, w => w.Date) .InitializeFromSource(); ydatepicker.IsEditable = true; yspinMoney.Binding .AddBinding(Entity, e => e.TotalMoney, w => w.ValueAsDecimal) .InitializeFromSource(); yentryFineReasonString.Sensitive = CanEdit; yentryFineReasonString.Binding .AddBinding(Entity, e => e.FineReasonString, w => w.Text) .InitializeFromSource(); fineitemsview1.FineUoW = UoWGeneric; fineitemsview1.Sensitive = CanEdit; var filterRouteList = new RouteListsFilter(UoW); filterRouteList.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRouteList); yentryreferenceRouteList.Sensitive = CanEdit; yentryreferenceRouteList.Binding .AddBinding(Entity, e => e.RouteList, w => w.Subject) .InitializeFromSource(); yentryreferenceRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); Entity.ObservableItems.ListChanged += ObservableItems_ListChanged; UpdateControlsState(); ShowLiters(); ylabelDate.Visible = !UoW.IsNew; UpdateDateEditable(); }
void ConfigureDlg() { enumcomboOperation.ItemsEnum = typeof(IncomeType); enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource(); var filterCasher = new EmployeeFilter(UoW); filterCasher.ShowFired = false; yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher); yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource(); var filter = new EmployeeFilter(UoW); filter.ShowFired = false; yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filter); yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource(); var filterRL = new RouteListsFilter(UoW); filterRL.OnlyStatuses = new RouteListStatus[] { RouteListStatus.EnRoute, RouteListStatus.OnClosing }; yEntryRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRL); yEntryRouteList.Binding.AddBinding(Entity, s => s.RouteListClosing, w => w.Subject).InitializeFromSource(); yEntryRouteList.CanEditReference = QSMain.User.Permissions["can_delete"]; yEntryRouteList.Hidden += YEntryRouteList_ValueOrVisibilityChanged; yEntryRouteList.Shown += YEntryRouteList_ValueOrVisibilityChanged; yEntryRouteList.ChangedByUser += YEntryRouteList_ValueOrVisibilityChanged; yentryClient.ItemsQuery = Repository.CounterpartyRepository.ActiveClientsQuery(); yentryClient.Binding.AddBinding(Entity, s => s.Customer, w => w.Subject).InitializeFromSource(); ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource(); OrmMain.GetObjectDescription <ExpenseCategory> ().ObjectUpdated += OnExpenseCategoryUpdated; OnExpenseCategoryUpdated(null, null); comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource(); OrmMain.GetObjectDescription <IncomeCategory> ().ObjectUpdated += OnIncomeCategoryUpdated; OnIncomeCategoryUpdated(null, null); comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource(); checkNoClose.Binding.AddBinding(Entity, e => e.NoFullCloseMode, w => w.Active); yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource(); ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource(); ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <Selectable <Expense> > () .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing() .AddColumn("Дата").AddTextRenderer(a => a.Value.Date.ToString()) .AddColumn("Получено").AddTextRenderer(a => a.Value.Money.ToString("C")) .AddColumn("Непогашено").AddTextRenderer(a => a.Value.UnclosedMoney.ToString("C")) .AddColumn("Статья").AddTextRenderer(a => a.Value.ExpenseCategory.Name) .AddColumn("Основание").AddTextRenderer(a => a.Value.Description) .Finish(); }
private void ConfigureDlg() { //Настройка элементов откуда переносим RouteListsFilter filterFrom = new RouteListsFilter(UoW); filterFrom.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteListFrom.RepresentationModel = new ViewModel.RouteListsVM(filterFrom); yentryreferenceRouteListFrom.Changed += YentryreferenceRouteListFrom_Changed; yentryreferenceRouteListFrom.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); ylistcomboReceptionTicketFrom.SetRenderTextFunc <CarUnloadDocument>(d => $"Талон разгрузки №{d.Id}. {d.Warehouse.Name}"); ylistcomboReceptionTicketFrom.ItemSelected += YlistcomboReceptionTicketFrom_ItemSelected; ytreeviewFrom.ColumnsConfig = colConfigFrom; //Настройка компонентов куда переносим RouteListsFilter filterTo = new RouteListsFilter(UoW); filterTo.SetFilterDates(DateTime.Today.AddDays(-7), DateTime.Today.AddDays(1)); yentryreferenceRouteListTo.RepresentationModel = new ViewModel.RouteListsVM(filterTo); yentryreferenceRouteListTo.Changed += YentryreferenceRouteListTo_Changed; yentryreferenceRouteListTo.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); ylistcomboReceptionTicketTo.SetRenderTextFunc <CarUnloadDocument>(d => $"Талон разгрузки №{d.Id}. {d.Warehouse.Name}"); ylistcomboReceptionTicketTo.ItemSelected += YlistcomboReceptionTicketTo_ItemSelected; ytreeviewTo.ColumnsConfig = colConfigTo; CheckSensitivities(); NotifyConfiguration.Instance.BatchSubscribeOnEntity <CarUnloadDocument>( s => { foreach (var doc in s.Select(x => x.GetEntity <CarUnloadDocument>())) { if (yentryreferenceRouteListFrom.Subject is RouteList rlFrom && doc.RouteList.Id == rlFrom.Id) { YentryreferenceRouteListFrom_Changed(this, new EventArgs()); } if (yentryreferenceRouteListTo.Subject is RouteList rlTo && doc.RouteList.Id == rlTo.Id) { YentryreferenceRouteListTo_Changed(this, new EventArgs()); } } } ); }
void ConfigureDlg() { if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.CarUnloadEdit, Entity.Warehouse)) { FailInitialize = true; return; } var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.CarUnloadEdit, Entity.Warehouse); yentryrefRouteList.IsEditable = yentryrefWarehouse.IsEditable = ytextviewCommnet.Editable = editing; returnsreceptionview1.Sensitive = bottlereceptionview1.Sensitive = nonserialequipmentreceptionview1.Sensitive = defectiveitemsreceptionview1.Sensitive = editing; bottlereceptionview1.UoW = defectiveitemsreceptionview1.UoW = returnsreceptionview1.UoW = UoW; ylabelDate.Binding.AddFuncBinding(Entity, e => e.TimeStamp.ToString("g"), w => w.LabelProp).InitializeFromSource(); yentryrefWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery(WarehousePermissions.CarUnloadEdit); yentryrefWarehouse.Binding.AddBinding(Entity, e => e.Warehouse, w => w.Subject).InitializeFromSource(); ytextviewCommnet.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource(); var filter = new RouteListsFilter(UoW); filter.SetAndRefilterAtOnce(x => x.RestrictStatus = RouteListStatus.EnRoute); yentryrefRouteList.RepresentationModel = new ViewModel.RouteListsVM(filter); yentryrefRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource(); yentryrefRouteList.CanEditReference = QSMain.User.Permissions["can_delete"]; defectiveitemsreceptionview1.Warehouse = returnsreceptionview1.Warehouse = Entity.Warehouse; UpdateWidgetsVisible(); if (!UoW.IsNew) { LoadReception(); } }
void ConfigureDlg() { if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.CarLoadEdit, Entity.Warehouse)) { FailInitialize = true; return; } editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.CarLoadEdit, Entity.Warehouse); yentryrefRouteList.IsEditable = yentryrefWarehouse.IsEditable = ytextviewCommnet.Editable = editing; carloaddocumentview1.Sensitive = editing; ylabelDate.Binding.AddFuncBinding(Entity, e => e.TimeStamp.ToString("g"), w => w.LabelProp).InitializeFromSource(); yentryrefWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery(WarehousePermissions.CarLoadEdit); yentryrefWarehouse.Binding.AddBinding(Entity, e => e.Warehouse, w => w.Subject).InitializeFromSource(); ytextviewCommnet.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource(); var filter = new RouteListsFilter(UoW); filter.SetAndRefilterAtOnce(x => x.RestrictStatus = RouteListStatus.InLoading); yentryrefRouteList.RepresentationModel = new ViewModel.RouteListsVM(filter); yentryrefRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource(); yentryrefRouteList.CanEditReference = QSMain.User.Permissions["can_delete"]; enumPrint.ItemsEnum = typeof(CarLoadPrintableDocuments); UpdateRouteListInfo(); Entity.UpdateStockAmount(UoW); Entity.UpdateAlreadyLoaded(UoW); Entity.UpdateInRouteListAmount(UoW); carloaddocumentview1.DocumentUoW = UoWGeneric; carloaddocumentview1.SetButtonEditing(editing); if (UoW.IsNew && Entity.Warehouse != null) { carloaddocumentview1.FillItemsByWarehouse(); } }
void ConfigureDlg() { if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.CarLoadEdit, Entity.Warehouse)) { FailInitialize = true; return; } var currentUserId = ServicesConfig.CommonServices.UserService.CurrentUserId; var hasPermitionToEditDocWithClosedRL = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission( "can_change_car_load_and_unload_docs", currentUserId); var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.CarLoadEdit, Entity.Warehouse); editing &= Entity.RouteList?.Status != RouteListStatus.Closed || hasPermitionToEditDocWithClosedRL; yentryrefRouteList.IsEditable = ySpecCmbWarehouses.Sensitive = ytextviewCommnet.Editable = editing; carloaddocumentview1.Sensitive = editing; ylabelDate.Binding.AddFuncBinding(Entity, e => e.TimeStamp.ToString("g"), w => w.LabelProp).InitializeFromSource(); ySpecCmbWarehouses.ItemsList = StoreDocumentHelper.GetRestrictedWarehousesList(UoW, WarehousePermissions.CarLoadEdit); ySpecCmbWarehouses.Binding.AddBinding(Entity, e => e.Warehouse, w => w.SelectedItem).InitializeFromSource(); ytextviewCommnet.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource(); var filter = new RouteListsFilter(UoW); filter.SetAndRefilterAtOnce(x => x.RestrictedStatuses = new[] { RouteListStatus.InLoading }); yentryrefRouteList.RepresentationModel = new ViewModel.RouteListsVM(filter); yentryrefRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); yentryrefRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource(); enumPrint.ItemsEnum = typeof(CarLoadPrintableDocuments); UpdateRouteListInfo(); Entity.UpdateStockAmount(UoW, _stockRepository); Entity.UpdateAlreadyLoaded(UoW, _routeListRepository); Entity.UpdateInRouteListAmount(UoW, _routeListRepository); carloaddocumentview1.DocumentUoW = UoWGeneric; carloaddocumentview1.SetButtonEditing(editing); buttonSave.Sensitive = editing; if (!editing) { HasChanges = false; } if (UoW.IsNew && Entity.Warehouse != null) { carloaddocumentview1.FillItemsByWarehouse(); } ySpecCmbWarehouses.ItemSelected += OnYSpecCmbWarehousesItemSelected; var permmissionValidator = new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), _employeeRepository); Entity.CanEdit = permmissionValidator.Validate(typeof(CarLoadDocument), currentUserId, nameof(RetroactivelyClosePermission)); if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date) { ytextviewCommnet.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); yentryrefRouteList.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); ySpecCmbWarehouses.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); ytextviewRouteListInfo.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); carloaddocumentview1.Sensitive = false; buttonSave.Sensitive = false; } else { Entity.CanEdit = true; } }
void ConfigureDlg() { callTaskWorker = new CallTaskWorker( CallTaskSingletonFactory.GetInstance(), new CallTaskRepository(), OrderSingletonRepository.GetInstance(), EmployeeSingletonRepository.GetInstance(), new BaseParametersProvider(), ServicesConfig.CommonServices.UserService, SingletonErrorReporter.Instance); if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.CarUnloadEdit, Entity.Warehouse)) { FailInitialize = true; return; } var currentUserId = QS.Project.Services.ServicesConfig.CommonServices.UserService.CurrentUserId; var hasPermitionToEditDocWithClosedRL = QS.Project.Services.ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_car_load_and_unload_docs", currentUserId); var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.CarUnloadEdit, Entity.Warehouse); editing &= Entity.RouteList?.Status != RouteListStatus.Closed || hasPermitionToEditDocWithClosedRL; Entity.InitializeDefaultValues(UoW, new NomenclatureRepository(new NomenclatureParametersProvider())); yentryrefRouteList.IsEditable = ySpecCmbWarehouses.Sensitive = ytextviewCommnet.Editable = editing; returnsreceptionview.Sensitive = hbxTareToReturn.Sensitive = nonserialequipmentreceptionview1.Sensitive = defectiveitemsreceptionview1.Sensitive = editing; defectiveitemsreceptionview1.UoW = returnsreceptionview.UoW = UoW; ylabelDate.Binding.AddFuncBinding(Entity, e => e.TimeStamp.ToString("g"), w => w.LabelProp).InitializeFromSource(); ySpecCmbWarehouses.ItemsList = StoreDocumentHelper.GetRestrictedWarehousesList(UoW, WarehousePermissions.CarUnloadEdit); ySpecCmbWarehouses.Binding.AddBinding(Entity, e => e.Warehouse, w => w.SelectedItem).InitializeFromSource(); ytextviewCommnet.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource(); var filter = new RouteListsFilter(UoW); filter.SetAndRefilterAtOnce(x => x.RestrictedStatuses = new[] { RouteListStatus.EnRoute }); yentryrefRouteList.RepresentationModel = new ViewModel.RouteListsVM(filter); yentryrefRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource(); yentryrefRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); Entity.PropertyChanged += (sender, e) => { if (e.PropertyName == nameof(Entity.Warehouse)) { OnWarehouseChanged(); } if (e.PropertyName == nameof(Entity.RouteList)) { UpdateWidgetsVisible(); } }; lblTareReturnedBefore.Binding.AddFuncBinding(Entity, e => e.ReturnedTareBeforeText, w => w.Text).InitializeFromSource(); spnTareToReturn.Binding.AddBinding(Entity, e => e.TareToReturn, w => w.ValueAsInt).InitializeFromSource(); defectiveitemsreceptionview1.Warehouse = returnsreceptionview.Warehouse = Entity.Warehouse; UpdateWidgetsVisible(); buttonSave.Sensitive = editing; if (!editing) { HasChanges = false; } if (!UoW.IsNew) { LoadReception(); } var permmissionValidator = new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), EmployeeRepository); Entity.CanEdit = permmissionValidator.Validate(typeof(CarUnloadDocument), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission)); if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date) { ytextviewCommnet.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); yentryrefRouteList.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); ySpecCmbWarehouses.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); ytextviewRouteListInfo.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); spnTareToReturn.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource(); defectiveitemsreceptionview1.Sensitive = false; nonserialequipmentreceptionview1.Sensitive = false; returnsreceptionview.Sensitive = false; buttonSave.Sensitive = false; } else { Entity.CanEdit = true; } }
void ConfigureDlg() { if (!UoW.IsNew) { enumcomboOperation.Sensitive = false; specialListCmbOrganisation.Sensitive = false; } accessfilteredsubdivisionselectorwidget.OnSelected += Accessfilteredsubdivisionselectorwidget_OnSelected; if (Entity.RelatedToSubdivision != null) { accessfilteredsubdivisionselectorwidget.SelectIfPossible(Entity.RelatedToSubdivision); } enumcomboOperation.ItemsEnum = typeof(IncomeType); enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource(); var filterCasher = new EmployeeFilterViewModel { Status = Domain.Employees.EmployeeStatus.IsWorking }; yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher); yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource(); var filter = new EmployeeFilterViewModel { Status = Domain.Employees.EmployeeStatus.IsWorking }; yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filter); yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource(); var filterRL = new RouteListsFilter(UoW) { OnlyStatuses = new[] { RouteListStatus.EnRoute, RouteListStatus.OnClosing } }; yEntryRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRL); yEntryRouteList.Binding.AddBinding(Entity, s => s.RouteListClosing, w => w.Subject).InitializeFromSource(); yEntryRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete"); yEntryRouteList.Hidden += YEntryRouteList_ValueOrVisibilityChanged; yEntryRouteList.Shown += YEntryRouteList_ValueOrVisibilityChanged; yEntryRouteList.ChangedByUser += YEntryRouteList_ValueOrVisibilityChanged; yentryClient.ItemsQuery = Repositories.CounterpartyRepository.ActiveClientsQuery(); yentryClient.Binding.AddBinding(Entity, s => s.Customer, w => w.Subject).InitializeFromSource(); ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource(); ydateDocument.Sensitive = canEditDate; NotifyConfiguration.Instance.BatchSubscribeOnEntity <ExpenseCategory>( s => comboExpense.ItemsList = CategoryRepository.ExpenseCategories(UoW).Where(x => x.ExpenseDocumentType != ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery) ); comboExpense.ItemsList = CategoryRepository.ExpenseCategories(UoW).Where(x => x.ExpenseDocumentType != ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery); comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource(); NotifyConfiguration.Instance.BatchSubscribeOnEntity <IncomeCategory>( s => comboCategory.ItemsList = CategoryRepository.IncomeCategories(UoW).Where(x => x.IncomeDocumentType != IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery && x.Id != excludeIncomeCategoryId) ); comboCategory.ItemsList = CategoryRepository.IncomeCategories(UoW).Where(x => x.IncomeDocumentType != IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery && x.Id != excludeIncomeCategoryId); comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource(); specialListCmbOrganisation.ShowSpecialStateNot = true; specialListCmbOrganisation.ItemsList = UoW.GetAll <Organization>(); specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.Organisation, w => w.SelectedItem).InitializeFromSource(); specialListCmbOrganisation.ItemSelected += SpecialListCmbOrganisationOnItemSelected; checkNoClose.Binding.AddBinding(Entity, e => e.NoFullCloseMode, w => w.Active); yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource(); ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource(); ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <Selectable <Expense> > () .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing() .AddColumn("Дата").AddTextRenderer(a => a.Value.Date.ToString()) .AddColumn("Получено").AddTextRenderer(a => a.Value.Money.ToString("C")) .AddColumn("Непогашено").AddTextRenderer(a => a.Value.UnclosedMoney.ToString("C")) .AddColumn("Статья").AddTextRenderer(a => a.Value.ExpenseCategory.Name) .AddColumn("Основание").AddTextRenderer(a => a.Value.Description) .Finish(); UpdateSubdivision(); if (!CanEdit) { table1.Sensitive = false; ytreeviewDebts.Sensitive = false; ytextviewDescription.Sensitive = false; buttonSave.Sensitive = false; accessfilteredsubdivisionselectorwidget.Sensitive = false; } }