private void ConfigureEntries() { entityviewmodelentryEmployee.SetEntityAutocompleteSelectorFactory( _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory()); entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(_carJournalFactory.CreateCarAutocompleteSelectorFactory()); }
private void Configure() { datepicker.Date = DateTime.Today; timeHourEntry.Text = DateTime.Now.Hour.ToString("00.##"); timeMinuteEntry.Text = DateTime.Now.Minute.ToString("00.##"); entryDriver.SetEntityAutocompleteSelectorFactory( _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory()); entryCar.SetEntityAutocompleteSelectorFactory(_carJournalFactory.CreateCarAutocompleteSelectorFactory()); }
private void Configure() { datepicker.Date = DateTime.Today; timeHourEntry.Text = DateTime.Now.Hour.ToString("00.##"); timeMinuteEntry.Text = DateTime.Now.Minute.ToString("00.##"); entryDriver.SetEntityAutocompleteSelectorFactory( _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory()); entryCar.SetEntityAutocompleteSelectorFactory(new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices)); }
public RouteListAnalysisViewModel( IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IOrderSelectorFactory orderSelectorFactory, IEmployeeJournalFactory employeeJournalFactory, ICounterpartyJournalFactory counterpartyJournalFactory, IDeliveryPointJournalFactory deliveryPointJournalFactory, ISubdivisionJournalFactory subdivisionJournalFactory, IGtkTabsOpener gtkDialogsOpener, IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener, IDeliveryShiftRepository deliveryShiftRepository, IEmployeeSettings employeeSettings, IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(uowBuilder, unitOfWorkFactory, commonServices) { _orderSelectorFactory = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory)); _employeeJournalFactory = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)); _counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory)); _deliveryPointJournalFactory = deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory)); _subdivisionJournalFactory = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory)); _gtkDialogsOpener = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener)); _undeliveredOrdersJournalOpener = undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener)); _employeeSettings = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings)); UndeliveredOrdersRepository = undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository)); _commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices)); if (deliveryShiftRepository == null) { throw new ArgumentNullException(nameof(deliveryShiftRepository)); } DeliveryShifts = deliveryShiftRepository.ActiveShifts(UoW); Entity.ObservableAddresses.PropertyOfElementChanged += ObservableAddressesOnPropertyOfElementChanged; undeliveryViewOpener = new UndeliveredOrdersJournalOpener(); employeeService = VodovozGtkServicesConfig.EmployeeService; CurrentEmployee = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id); if (CurrentEmployee == null) { AbortOpening("Ваш пользователь не привязан к действующему сотруднику, вы не можете открыть " + "диалог разбора МЛ, так как некого указывать в качестве логиста.", "Невозможно открыть разбор МЛ"); } LogisticanSelectorFactory = _employeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory(); DriverSelectorFactory = _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory(); ForwarderSelectorFactory = _employeeJournalFactory.CreateWorkingForwarderEmployeeAutocompleteSelectorFactory(); TabName = $"Диалог разбора {Entity.Title}"; }
public CarEventFilterViewModel(ICarJournalFactory carJournalFactory, ICarEventTypeJournalFactory carEventTypeJournalFactory, IEmployeeJournalFactory employeeJournalFactory) { CarSelectorFactory = (carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory))) .CreateCarAutocompleteSelectorFactory(); CarEventTypeSelectorFactory = (carEventTypeJournalFactory ?? throw new ArgumentNullException(nameof(carEventTypeJournalFactory))) .CreateCarEventTypeAutocompleteSelectorFactory(); EmployeeSelectorFactory = (employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory))) .CreateWorkingEmployeeAutocompleteSelectorFactory(); DriverSelectorFactory = employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory(); }
protected override void CreatePopupActions() { PopupActionsList.Add( new JournalAction( "Перейти в недовезённый заказ", selectedItems => true, selectedItems => true, selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); if (selectedNode != null) { _gtkDlgOpener.OpenOrderDlg(this, selectedNode.OldOrderId); } } ) ); PopupActionsList.Add( new JournalAction( "Перейти в новый заказ", selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); return(selectedNode != null && selectedNode.NewOrderId > 0); }, selectedItems => true, selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); if (selectedNode != null) { _gtkDlgOpener.OpenOrderDlg(this, selectedNode.NewOrderId); } } ) ); PopupActionsList.Add( new JournalAction( "Закрыть недовоз", selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); return(selectedNode != null && selectedNode.UndeliveryStatus != UndeliveryStatus.Closed && _canCloseUndeliveries); }, selectedItems => true, selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); if (selectedNode == null) { return; } UndeliveredOrder undeliveredOrder = UoW.GetById <UndeliveredOrder>(selectedNode.Id); undeliveredOrder.Close(CurrentEmployee); UoW.Save(undeliveredOrder); UoW.Commit(); } ) ); PopupActionsList.Add( new JournalAction( "Создать штраф", selectedItems => true, selectedItems => true, selectedItems => { var selectedNodes = selectedItems.OfType <UndeliveredOrderJournalNode>(); var selectedNode = selectedNodes.FirstOrDefault(); if (selectedNode == null) { return; } FineViewModel fineViewModel = new FineViewModel( EntityUoWBuilder.ForCreate(), UnitOfWorkFactory, _undeliveryViewOpener, _employeeService, _driverEmployeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory(), _employeeSettings, _commonServices ); var undeliveredOrder = UoW.GetById <UndeliveredOrder>(selectedNode.Id); fineViewModel.UndeliveredOrder = undeliveredOrder; fineViewModel.RouteList = new RouteListItemRepository().GetRouteListItemForOrder(UoW, undeliveredOrder.OldOrder)?.RouteList; TabParent.AddSlaveTab(this, fineViewModel); } ) ); }
private void ConfigureDlg() { notebook1.Page = 0; notebook1.ShowTabs = false; dataentryModel.Binding.AddBinding(Entity, e => e.Model, w => w.Text).InitializeFromSource(); dataentryRegNumber.Binding.AddBinding(Entity, e => e.RegistrationNumber, w => w.Text).InitializeFromSource(); comboTypeOfUse.ItemsEnum = typeof(CarTypeOfUse); comboTypeOfUse.Binding.AddBinding(Entity, e => e.TypeOfUse, w => w.SelectedItemOrNull).InitializeFromSource(); comboDriverCarKind.ItemsList = UoW.GetAll <DriverCarKind>(); comboDriverCarKind.Binding.AddBinding(Entity, e => e.DriverCarKind, w => w.SelectedItem).InitializeFromSource(); orderNumberSpin.Binding.AddBinding(Entity, e => e.OrderNumber, w => w.ValueAsInt).InitializeFromSource(); yentryVIN.Binding.AddBinding(Entity, e => e.VIN, w => w.Text).InitializeFromSource(); yentryManufactureYear.Binding.AddBinding(Entity, e => e.ManufactureYear, w => w.Text).InitializeFromSource(); yentryMotorNumber.Binding.AddBinding(Entity, e => e.MotorNumber, w => w.Text).InitializeFromSource(); yentryChassisNumber.Binding.AddBinding(Entity, e => e.ChassisNumber, w => w.Text).InitializeFromSource(); yentryCarcaseNumber.Binding.AddBinding(Entity, e => e.Carcase, w => w.Text).InitializeFromSource(); yentryColor.Binding.AddBinding(Entity, e => e.Color, w => w.Text).InitializeFromSource(); yentryDocSeries.Binding.AddBinding(Entity, e => e.DocSeries, w => w.Text).InitializeFromSource(); yentryDocNumber.Binding.AddBinding(Entity, e => e.DocNumber, w => w.Text).InitializeFromSource(); yentryDocIssuedOrg.Binding.AddBinding(Entity, e => e.DocIssuedOrg, w => w.Text).InitializeFromSource(); ydatepickerDocIssuedDate.Binding.AddBinding(Entity, e => e.DocIssuedDate, w => w.DateOrNull).InitializeFromSource(); yentryFuelCardNumber.Binding.AddBinding(Entity, e => e.FuelCardNumber, w => w.Text).InitializeFromSource(); yentryFuelCardNumber.Binding.AddFuncBinding(Entity, e => e.CanEditFuelCardNumber, w => w.Sensitive).InitializeFromSource(); yentryPTSNum.Binding.AddBinding(Entity, e => e.DocPTSNumber, w => w.Text).InitializeFromSource(); yentryPTSSeries.Binding.AddBinding(Entity, e => e.DocPTSSeries, w => w.Text).InitializeFromSource(); entryDriver.SetEntityAutocompleteSelectorFactory( _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory()); entryDriver.Changed += OnEntryDriverChanged; entryDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Subject).InitializeFromSource(); dataentryFuelType.SubjectType = typeof(FuelType); dataentryFuelType.Binding.AddBinding(Entity, e => e.FuelType, w => w.Subject).InitializeFromSource(); radiobuttonMain.Active = true; dataspinbutton1.Binding.AddBinding(Entity, e => e.FuelConsumption, w => w.Value).InitializeFromSource(); maxWeightSpin.Binding.AddBinding(Entity, e => e.MaxWeight, w => w.ValueAsInt).InitializeFromSource(); maxVolumeSpin.Binding.AddBinding(Entity, e => e.MaxVolume, w => w.Value).InitializeFromSource(); minBottlesSpin.Binding.AddBinding(Entity, e => e.MinBottles, w => w.ValueAsInt).InitializeFromSource(); maxBottlesSpin.Binding.AddBinding(Entity, e => e.MaxBottles, w => w.ValueAsInt).InitializeFromSource(); minBottlesFromAddressSpin.Binding.AddBinding(Entity, e => e.MinBottlesFromAddress, w => w.ValueAsInt).InitializeFromSource(); maxBottlesFromAddressSpin.Binding.AddBinding(Entity, e => e.MaxBottlesFromAddress, w => w.ValueAsInt).InitializeFromSource(); photoviewCar.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource(); photoviewCar.GetSaveFileName = () => String.Format("{0}({1})", Entity.Model, Entity.RegistrationNumber); carRepository = new CarRepository(); checkIsRaskat.Active = Entity.IsRaskat; Entity.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(Entity.IsRaskat) && checkIsRaskat.Active != Entity.IsRaskat) { checkIsRaskat.Active = Entity.IsRaskat; } }; checkIsRaskat.Toggled += (s, e) => { if (Entity.Id == 0 || !carRepository.IsInAnyRouteList(UoW, Entity)) { Entity.IsRaskat = checkIsRaskat.Active; } else if (checkIsRaskat.Active != Entity.IsRaskat) { checkIsRaskat.Active = Entity.IsRaskat; MessageDialogHelper.RunWarningDialog("На данном автомобиле есть МЛ, смена типа невозможна"); } }; labelRaskatType.Binding.AddBinding(Entity, e => e.IsRaskat, w => w.Visible).InitializeFromSource(); enumRaskatType.ItemsEnum = typeof(RaskatType); enumRaskatType.ShowSpecialStateNot = true; enumRaskatType.Binding.AddBinding(Entity, e => e.IsRaskat, w => w.Visible).InitializeFromSource(); enumRaskatType.Binding.AddBinding(Entity, e => e.RaskatType, w => w.SelectedItemOrNull).InitializeFromSource(); enumRaskatType.Binding.AddFuncBinding(Entity, e => e.Id == 0, w => w.Sensitive).InitializeFromSource(); checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource(); attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Car)); if (!UoWGeneric.IsNew) { attachmentFiles.ItemId = UoWGeneric.Root.Id; attachmentFiles.UpdateFileList(); } OnEntryDriverChanged(null, null); textDriverInfo.Selectable = true; int currentUserId = ServicesConfig.CommonServices.UserService.CurrentUserId; bool canChangeVolumeWeightConsumption = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_cars_volume_weight_consumption", currentUserId) || Entity.Id == 0 || !(Entity.IsCompanyCar || Entity.IsRaskat); bool canChangeBottlesFromAddress = ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_cars_bottles_from_address", currentUserId); dataspinbutton1.Sensitive = canChangeVolumeWeightConsumption; maxVolumeSpin.Sensitive = canChangeVolumeWeightConsumption; maxWeightSpin.Sensitive = canChangeVolumeWeightConsumption; checkIsRaskat.Sensitive = CarTypeIsEditable() || ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_change_car_is_raskat"); comboTypeOfUse.Sensitive = CarTypeIsEditable(); minBottlesFromAddressSpin.Sensitive = canChangeBottlesFromAddress; maxBottlesFromAddressSpin.Sensitive = canChangeBottlesFromAddress; yTreeGeographicGroups.Selection.Mode = Gtk.SelectionMode.Single; yTreeGeographicGroups.ColumnsConfig = FluentColumnsConfig <GeographicGroup> .Create() .AddColumn("Название").AddTextRenderer(x => x.Name) .Finish(); yTreeGeographicGroups.ItemsDataSource = Entity.ObservableGeographicGroups; UpdateSensitivity(); }