コード例 #1
0
        public SalaryRatesReport(IUnitOfWorkFactory unitOfWorkFactory, IWageParametersProvider wageParametersProvider,
                                 ICommonServices commonServices)
        {
            _wageParametersProvider = wageParametersProvider ?? throw new ArgumentNullException(nameof(wageParametersProvider));
            _commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

            Build();
            UoW = unitOfWorkFactory.CreateWithoutRoot();
            SalaryRateFilterNode   salaryRateFilterNodeAlias   = null;
            WageDistrictLevelRates wageDistrictLevelRatesAlias = null;

            _salaryRateFilterNodes = new GenericObservableList <SalaryRateFilterNode>(UoW.Session
                                                                                      .QueryOver(() => wageDistrictLevelRatesAlias).Where(x => !x.IsArchive)
                                                                                      .SelectList(list => list
                                                                                                  .Select(() => wageDistrictLevelRatesAlias.Name).WithAlias(() => salaryRateFilterNodeAlias.Name)
                                                                                                  .Select(() => wageDistrictLevelRatesAlias.Id).WithAlias(() => salaryRateFilterNodeAlias.WageId))
                                                                                      .TransformUsing(Transformers.AliasToBean <SalaryRateFilterNode>()).List <SalaryRateFilterNode>());

            treeViewSalaryProperties.ColumnsConfig = FluentColumnsConfig <SalaryRateFilterNode> .Create()
                                                     .AddColumn("Название").AddTextRenderer(x => x.Name)
                                                     .AddColumn("").AddToggleRenderer(x => x.Selected)
                                                     .Finish();

            treeViewSalaryProperties.ItemsDataSource = _salaryRateFilterNodes;
        }
コード例 #2
0
        public OrderStatisticByWeekReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            dateperiodpicker.StartDate = new DateTime(DateTime.Today.Year, 1, 1);
            dateperiodpicker.EndDate   = DateTime.Today;

            new List <string>()
            {
                "План",
                "Факт"
            }.ForEach(comboboxReportMode.AppendText);

            comboboxReportMode.Active = 0;

            _geographicGroupNodes = new GenericObservableList <GeographicGroupNode>(
                UoW.GetAll <GeographicGroup>().Select(gg => new GeographicGroupNode(gg)
            {
                Selected = true
            }).ToList());
            ytreeviewGeographicGroup.ColumnsConfig = FluentColumnsConfig <GeographicGroupNode>
                                                     .Create()
                                                     .AddColumn("Выбрать").AddToggleRenderer(ggn => ggn.Selected).Editing()
                                                     .AddColumn("Район города").AddTextRenderer(ggn => ggn.ToString())
                                                     .Finish();

            ytreeviewGeographicGroup.ItemsDataSource = _geographicGroupNodes;
            ytreeviewGeographicGroup.HeadersVisible  = false;
        }
コード例 #3
0
        public EntitySubdivisionPermissionModel(IUnitOfWork uow, Subdivision subdivision, PermissionListViewModel permissionListViewModel, IPermissionRepository permissionRepository)
        {
            PermissionListViewModel = permissionListViewModel ?? throw new NullReferenceException(nameof(permissionListViewModel));

            this.subdivision = subdivision;
            this.uow         = uow;
            ExtensionStore   = PermissionListViewModel.PermissionExtensionStore;
            var permissionList = permissionRepository.GetAllSubdivisionEntityPermissions(uow, subdivision.Id, ExtensionStore);

            originalPermissionList = permissionList.ToList();

            PermissionListViewModel.PermissionsList = new GenericObservableList <IPermissionNode>(permissionList.OfType <IPermissionNode>().ToList());
            PermissionListViewModel.PermissionsList.ElementRemoved += (aList, aIdx, aObject) => DeletePermission(aObject as SubdivisionPermissionNode);

            originalTypeOfEntityList = TypeOfEntityRepository.GetAllSavedTypeOfEntity(uow).ToList();
            //убираем типы уже загруженные в права
            foreach (var item in originalPermissionList)
            {
                if (originalTypeOfEntityList.Contains(item.TypeOfEntity))
                {
                    originalTypeOfEntityList.Remove(item.TypeOfEntity);
                }
            }
            SortTypeOfEntityList();
            ObservableTypeOfEntitiesList = new GenericObservableList <TypeOfEntity>(originalTypeOfEntityList);
        }
コード例 #4
0
        public PresetSubdivisionPermissionsViewModel
        (
            IUnitOfWork unitOfWork,
            IPermissionRepository permissionRepository,
            Subdivision subdivision
        ) : base(unitOfWork, permissionRepository)
        {
            this.subdivision = subdivision ?? throw new ArgumentNullException(nameof(subdivision));

            permissionList = permissionRepository.GetAllPresetSubdivisionPermission(UoW, subdivision)
                             .OfType <HierarchicalPresetPermissionBase>().ToList();
            ObservablePermissionsList = new GenericObservableList <HierarchicalPresetPermissionBase>(permissionList.ToList());

            originalPermissionsSourceList = PermissionsSettings.PresetPermissions.Values.ToList();
            foreach (var item in permissionList)
            {
                var sourceItem = originalPermissionsSourceList.SingleOrDefault(x => x.Name == item.PermissionName);
                if (sourceItem != null)
                {
                    originalPermissionsSourceList.Remove(sourceItem);
                }
            }
            ObservablePermissionsSourceList = new GenericObservableList <PresetUserPermissionSource>(originalPermissionsSourceList);

            OrderPermission();
        }
コード例 #5
0
 void ConfigureDlg()
 {
     yEntryName.Binding.AddBinding(Entity, s => s.Name, w => w.Text).InitializeFromSource();
     yEnumCmbType.ItemsEnum = typeof(CertificateType);
     yEnumCmbType.Binding.AddBinding(Entity, s => s.TypeOfCertificate, w => w.SelectedItemOrNull).InitializeFromSource();
     yEnumCmbType.EnumItemSelected += YEnumCmbType_EnumItemSelected;
     photoViewCertificate.Binding.AddBinding(Entity, e => e.ImageFile, w => w.ImageFile).InitializeFromSource();
     photoViewCertificate.GetSaveFileName = () => Entity.Name;
     photoViewCertificate.CanPrint        = true;
     yStartDate.Binding.AddBinding(Entity, s => s.StartDate, w => w.DateOrNull).InitializeFromSource();
     yDateOfExpiration.Binding.AddBinding(Entity, s => s.ExpirationDate, w => w.DateOrNull).InitializeFromSource();
     yChkIsArchive.Binding.AddBinding(Entity, s => s.IsArchive, w => w.Active).InitializeFromSource();
     YEnumCmbType_EnumItemSelected(this, new Gamma.Widgets.ItemSelectedEventArgs(yEnumCmbType.SelectedItem));
     ObservableList = Entity.ObservableNomenclatures;
     yTreeNomenclatures.Selection.Changed += (sender, e) => {
         selectedNomenclature = yTreeNomenclatures.GetSelectedObject <Nomenclature>();
         SetControlsAcessibility();
     };
     yTreeNomenclatures.ColumnsConfig = new FluentColumnsConfig <Nomenclature>()
                                        .AddColumn("Имя")
                                        .AddTextRenderer(n => n.Name)
                                        .AddColumn("Код")
                                        .AddTextRenderer(n => n.Id.ToString())
                                        .Finish();
     yTreeNomenclatures.ItemsDataSource = ObservableList;
 }
コード例 #6
0
 public SizeTypeViewModel(
     IEntityUoWBuilder uowBuilder,
     IUnitOfWorkFactory unitOfWorkFactory,
     INavigationManager navigation,
     SizeService sizeService,
     IValidator validator = null) : base(uowBuilder, unitOfWorkFactory, navigation, validator)
 {
     this.sizeService = sizeService;
     Validations.Clear();
     Validations.Add(new ValidationRequest(Entity,
                                           new ValidationContext(Entity, new Dictionary <object, object> {
         { nameof(IUnitOfWork), UoW }
     })));
     if (UoW.IsNew)
     {
         IsNew = true;
         Sizes = new GenericObservableList <Size>();
     }
     else
     {
         Sizes = new GenericObservableList <Size>(sizeService.GetSize(UoW, Entity).ToList());
         if (Entity.Id <= SizeService.MaxStandartSizeTypeId)
         {
             IsStandartType = true;
         }
     }
 }
コード例 #7
0
        public void SearchTypes(string searchString)
        {
            originalTypeOfEntityList = TypeOfEntityRepository.GetAllSavedTypeOfEntity(uow).ToList();
            //убираем типы уже загруженные в права
            foreach (var item in permissionList)
            {
                if (originalTypeOfEntityList.Contains(item.TypeOfEntity))
                {
                    originalTypeOfEntityList.Remove(item.TypeOfEntity);
                }
            }
            SortTypeOfEntityList();

            ObservableTypeOfEntitiesList = null;
            ObservableTypeOfEntitiesList = new GenericObservableList <TypeOfEntity>(originalTypeOfEntityList);

            if (searchString != "")
            {
                for (int i = 0; i < ObservableTypeOfEntitiesList.Count; i++)
                {
                    if (ObservableTypeOfEntitiesList[i].Name.IndexOf(searchString, StringComparison.OrdinalIgnoreCase) == -1)
                    {
                        ObservableTypeOfEntitiesList.Remove(ObservableTypeOfEntitiesList[i]);
                        i -= 1;
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Adds assembly into list
        /// </summary>
        /// <param name="aAssembly">
        /// Assembly <see cref="Assembly"/>
        /// </param>
        public void Add(Assembly aAssembly)
        {
            if (aAssembly == null)
            {
                return;
            }
            if (assemblies == null)
            {
                assemblies = new GenericObservableList <AssemblyDescription>();
                if (adaptor != null)
                {
                    adaptor.Target = assemblies;
                }
            }
            foreach (AssemblyDescription ad in assemblies)
            {
                if (ad.Assembly == aAssembly)
                {
                    return;
                }
            }

            assemblies.Add(new AssemblyDescription(aAssembly));
            // Go trough assembly referenced assemblies
            foreach (AssemblyName mod in aAssembly.GetReferencedAssemblies())
            {
                if (mod != null)
                {
                    Add(Assembly.Load(mod));
                }
            }
            OnPropertyChanged("Count");
        }
コード例 #9
0
        private void UpdateLists()
        {
            var notLoadedNomenclatures = Entity.NotLoadedNomenclatures(true, _baseParametersProvider.GetNomenclatureIdForTerminal);

            ObservableNotLoadedList = new GenericObservableList <RouteListControlNotLoadedNode>(notLoadedNomenclatures);

            ytreeviewNotLoaded.ItemsDataSource = ObservableNotLoadedList;
        }
コード例 #10
0
        protected void OnButtonFineDuplicatesClicked(object sender, EventArgs e)
        {
            progressOp.Visible          = true;
            progressOp.Adjustment.Value = 0;
            progressOp.Text             = "Получаем дубликаты адресов из базы...";
            QSMain.WaitRedraw();

            DeliveryPoint mainPointAlias = null;

            var dublicateSubquery = QueryOver.Of <DeliveryPoint>()
                                    .Where(x => x.Counterparty.Id == mainPointAlias.Counterparty.Id &&
                                           x.Latitude == mainPointAlias.Latitude &&
                                           x.Longitude == mainPointAlias.Longitude &&
                                           x.Id != mainPointAlias.Id &&
                                           (x.Code1c == null || mainPointAlias.Code1c == null || x.Code1c == mainPointAlias.Code1c))
                                    .Select(x => x.Id);

            var list = uow.Session.QueryOver <DeliveryPoint>(() => mainPointAlias)
                       .WithSubquery.WhereExists(dublicateSubquery)
                       .Fetch(x => x.Counterparty).Eager
                       .OrderBy(x => x.Counterparty).Asc
                       .ThenBy(x => x.Latitude).Asc
                       .ThenBy(x => x.Longitude).Asc
                       .List();

            progressOp.Adjustment.Upper = list.Count + 3;
            progressOp.Text             = "Обрабатываем адреса...";
            progressOp.Adjustment.Value++;
            QSMain.WaitRedraw();

            Duplicates = new List <DublicateNode>();
            DublicateNode lastDuplicate = null;

            foreach (var dp in list)
            {
                if (lastDuplicate == null || !lastDuplicate.Compare(dp))
                {
                    lastDuplicate = new DublicateNode();
                    Duplicates.Add(lastDuplicate);
                }
                lastDuplicate.Addresses.Add(new AddressNode(lastDuplicate, dp));
                progressOp.Adjustment.Value++;
                QSMain.WaitRedraw();
            }

            Duplicates.ForEach(x => x.FineMain());
            progressOp.Adjustment.Value++;
            QSMain.WaitRedraw();

            Duplicates = Duplicates.OrderBy(x => x.CounterParty).ThenBy(x => x.FirstAddress1c).ToList();
            progressOp.Adjustment.Value++;
            QSMain.WaitRedraw();

            ObservableDuplicates = new GenericObservableList <DublicateNode>(Duplicates);

            ytreeviewDuplicates.SetItemsSource(ObservableDuplicates);
            progressOp.Visible = false;
        }
コード例 #11
0
        private void UpdateLists()
        {
            var goods = _routeListRepository.GetGoodsAndEquipsInRL(UoW, Entity);
            var notLoadedNomenclatures = Entity.NotLoadedNomenclatures(true);

            ObservableNotLoadedList = new GenericObservableList <RouteListControlNotLoadedNode>(notLoadedNomenclatures);

            ytreeviewNotLoaded.ItemsDataSource = ObservableNotLoadedList;
        }
コード例 #12
0
        public DeliveryAnalyticsViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            IInteractiveService interactiveService,
            INavigationManager navigation,
            IEntityAutocompleteSelectorFactory districtSelectorFactory)
            : base(interactiveService, navigation)
        {
            _interactiveService     = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
            DistrictSelectorFactory = districtSelectorFactory ?? throw new ArgumentNullException(nameof(districtSelectorFactory));
            if (unitOfWorkFactory is null)
            {
                throw new ArgumentNullException(nameof(unitOfWorkFactory));
            }

            Uow   = unitOfWorkFactory.CreateWithoutRoot();
            Title = "Аналитика объёмов доставки";

            WaveList             = new GenericObservableList <WaveNode>();
            WeekDayName          = new GenericObservableList <WeekDayNodes>();
            GeographicGroupNodes = new GenericObservableList <GeographicGroupNode>();

            WageDistrictNodes = new GenericObservableList <WageDistrictNode>();

            foreach (var wage in Uow.GetAll <WageDistrict>().Select(x => x).ToList())
            {
                var wageNode = new WageDistrictNode(wage);
                wageNode.Selected = true;
                WageDistrictNodes.Add(wageNode);
            }

            foreach (var geographic in Uow.GetAll <GeographicGroup>().Select(x => x).ToList())
            {
                var geographicNode = new GeographicGroupNode(geographic);
                geographicNode.Selected = true;
                GeographicGroupNodes.Add(geographicNode);
            }

            foreach (var wave in Enum.GetValues(typeof(WaveNodes)))
            {
                var waveNode = new WaveNode {
                    WaveNodes = (WaveNodes)wave, Selected = true
                };
                WaveList.Add(waveNode);
            }

            foreach (var week in Enum.GetValues(typeof(WeekDayName)))
            {
                if ((WeekDayName)week == Domain.Sale.WeekDayName.Today)
                {
                    continue;
                }
                var weekNode = new WeekDayNodes {
                    WeekNameNode = (WeekDayName)week, Selected = true
                };
                WeekDayName.Add(weekNode);
            }
        }
コード例 #13
0
            public void RefreshItems()
            {
                list           = sourceFunction.Invoke(FilteredId);
                ObservableList = new GenericObservableList <StockMovementsAdvancedReportNode>(list);

                ObservableList.ElementChanged -= ObservableList_ElementChanged_Unselect;
                ObservableList.ElementChanged += ObservableList_ElementChanged_Unselect;

                ObservableList.ElementChanged -= ObservableList_ElementChanged_Filtering;
                ObservableList.ElementChanged += ObservableList_ElementChanged_Filtering;
            }
コード例 #14
0
        private void FillObservableDriverBalance(GenericObservableList <EmployeeBalanceNode> observableDriverBalance, RouteList routeList)
        {
            observableDriverBalance.Clear();

            var driverTerminalBalance = employeeNomenclatureMovementRepository.GetTerminalFromDriverBalance(UoW,
                                                                                                            routeList.Driver.Id, terminalNomenclatureProvider.GetNomenclatureIdForTerminal);

            if (driverTerminalBalance != null)
            {
                observableDriverBalance.Add(driverTerminalBalance);
            }
        }
        public EntitySubdivisionForUserPermissionModel(IUnitOfWork uow, Subdivision subdivision, UserBase user)
        {
            this.subdivision = subdivision;
            this.uow         = uow;
            this.user        = user;

            originalPermissionList    = _permissionRepository.GetAllSubdivisionForUserEntityPermissions(uow, user.Id);
            ObservablePermissionsList = new GenericObservableList <EntitySubdivisionForUserPermission>(originalPermissionList.ToList());

            originalTypeOfEntityList     = TypeOfEntityRepository.GetAllSavedTypeOfEntity(uow);
            ObservableTypeOfEntitiesList = new GenericObservableList <TypeOfEntity>(originalTypeOfEntityList);
        }
コード例 #16
0
 void ConfigureDlg()
 {
     UoW = UnitOfWorkFactory.CreateWithoutRoot();
     geograficGroup.UoW   = UoW;
     geograficGroup.Label = "Часть города:";
     geographicGroups     = new GenericObservableList <GeographicGroup>();
     geograficGroup.Items = geographicGroups;
     foreach (var gg in UoW.Session.QueryOver <GeographicGroup>().List())
     {
         geographicGroups.Add(gg);
     }
 }
コード例 #17
0
 public DriversInfoExportViewModel(
     WageParameterService wageParameterService,
     IUnitOfWorkFactory unitOfWorkFactory,
     IInteractiveService interactiveService,
     INavigationManager navigation)
     : base(unitOfWorkFactory, interactiveService, navigation)
 {
     this.wageParameterService = wageParameterService ?? throw new ArgumentNullException(nameof(wageParameterService));
     this.interactiveService   = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
     TabName       = "Выгрузка по водителям";
     Items         = new GenericObservableList <DriverInfoNode>();
     DataIsLoading = false;
 }
 void LstCmbSubstring_ItemSelected(object sender, ItemSelectedEventArgs e)
 {
     activityKind = specCmbSubstring.SelectedItem as CounterpartyActivityKind;
     if (activityKind != null)
     {
         substringsToSearch = new GenericObservableList <SubstringToSearch>(activityKind.GetListOfSubstrings());
         yTreeSubstrings.ItemsDataSource = substringsToSearch;
     }
     else
     {
         yTreeSubstrings.ItemsDataSource = substringsToSearch = null;
     }
     SetAccessibility();
 }
コード例 #19
0
 public static void FillListWithEvenBuyAndOddSale(this GenericObservableList <Trade> tradeList, int count)
 {
     for (int i = 0; i < count; i++)
     {
         if (i % 2 == 0)
         {
             tradeList.Add(new Trade(DateTime.Now, 1, 1));
         }
         else
         {
             tradeList.Add(new Trade(DateTime.Now, 2, -1));
         }
     }
 }
コード例 #20
0
        void ReadYookassaPayments()
        {
            var fileNameExtension = fChooser.Filename.Split(new[] { '.' }).Last();

            if (fileNameExtension != "txt" && fileNameExtension != "csv")
            {
                MessageDialogHelper.RunErrorDialog($"Неверное расширение файла! Для выгрузки с Юкассы нужен {fChooser.Filters[1].Name} или {fChooser.Filters[0].Name}.");
                return;
            }

            _yookassaParser = new PaymentsFromYookassaParser(fChooser.Filename);
            _yookassaParser.Parse();
            paymentsByCard = new GenericObservableList <PaymentByCardOnline>(_yookassaParser.PaymentsFromYookassa);
            ShowParsedPayments();
        }
コード例 #21
0
        void ReadTinkoffPayments()
        {
            var fileNameExtension = fChooser.Filename.Split(new[] { '.' }).Last();

            if (fileNameExtension == "txt")
            {
                MessageDialogHelper.RunErrorDialog($"Неверное расширение файла! Для выгрузки с Тинькова нужен {fChooser.Filters[0].Name}.");
                return;
            }

            _tinkoffParser = new PaymentsFromTinkoffParser(fChooser.Filename);
            _tinkoffParser.Parse();
            paymentsByCard = new GenericObservableList <PaymentByCardOnline>(_tinkoffParser.PaymentsFromTinkoff);
            ShowParsedPayments();
        }
コード例 #22
0
        public DistrictsSetViewModel(IEntityUoWBuilder uowBuilder,
                                     IUnitOfWorkFactory unitOfWorkFactory,
                                     ICommonServices commonServices,
                                     IEntityDeleteWorker entityDeleteWorker,
                                     IEmployeeRepository employeeRepository,
                                     IDistrictRuleRepository districtRuleRepository,
                                     INavigationManager navigation = null)
            : base(uowBuilder, unitOfWorkFactory, commonServices, navigation)
        {
            _entityDeleteWorker    = entityDeleteWorker ?? throw new ArgumentNullException(nameof(entityDeleteWorker));
            DistrictRuleRepository = districtRuleRepository ?? throw new ArgumentNullException(nameof(districtRuleRepository));

            TabName = "Районы с графиками доставки";

            CanChangeDistrictWageTypePermissionResult = commonServices.CurrentPermissionService.ValidatePresetPermission("can_change_district_wage_type");

            if (Entity.Id == 0)
            {
                Entity.Author = employeeRepository.GetEmployeeForCurrentUser(UoW);
                Entity.Status = DistrictsSetStatus.Draft;
            }

            var districtPermissionResult = commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(District));

            CanEditDistrict      = districtPermissionResult.CanUpdate && Entity.Status != DistrictsSetStatus.Active;
            CanEditDeliveryRules = CanEditDistrict || commonServices.CurrentPermissionService.ValidatePresetPermission("can_edit_delivery_rules");
            CanDeleteDistrict    = (districtPermissionResult.CanDelete || districtPermissionResult.CanCreate && Entity.Id == 0) && Entity.Status != DistrictsSetStatus.Active;
            CanCreateDistrict    = districtPermissionResult.CanCreate && Entity.Status != DistrictsSetStatus.Active;

            var deliveryScheduleRestrictionPermissionResult =
                commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(DeliveryScheduleRestriction));

            CanEditDeliveryScheduleRestriction =
                (deliveryScheduleRestrictionPermissionResult.CanUpdate ||
                 deliveryScheduleRestrictionPermissionResult.CanCreate && Entity.Id == 0) ||
                CanEditDistrict;

            var districtSetPermissionResult = commonServices.CurrentPermissionService.ValidateEntityPermission(typeof(DistrictsSet));

            CanSave = districtSetPermissionResult.CanUpdate || districtSetPermissionResult.CanCreate && Entity.Id == 0;
            CanEdit = CanSave && Entity.Status != DistrictsSetStatus.Active;

            SortDistricts();

            _geometryFactory = new GeometryFactory(new PrecisionModel(), 3857);
            SelectedDistrictBorderVertices = new GenericObservableList <PointLatLng>();
            NewBorderVertices = new GenericObservableList <PointLatLng>();
        }
コード例 #23
0
 public ComplaintDiscussionViewModel(
     ComplaintDiscussion complaintDiscussion,
     IFilePickerService filePickerService,
     IEmployeeService employeeService,
     ICommonServices commonServices,
     IUnitOfWork uow
     ) : base(complaintDiscussion, commonServices)
 {
     this.filePickerService = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
     this.employeeService   = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
     this.commonServices    = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
     newCommentFiles        = new GenericObservableList <ComplaintFile>();
     UoW = uow;
     CreateCommands();
     ConfigureEntityPropertyChanges();
 }
コード例 #24
0
ファイル: EquipmentBalance.cs プロジェクト: Art8m/Vodovozfork
        public EquipmentBalance()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            var categoryList = Enum.GetValues(typeof(NomenclatureCategory)).Cast <NomenclatureCategory>().ToList();

            List <SelectableNomenclatureTypeNode> items = new List <SelectableNomenclatureTypeNode>();

            foreach (var cat in categoryList)
            {
                var node = new SelectableNomenclatureTypeNode();
                node.Category = cat;
                var attr = cat.GetAttribute <DisplayAttribute>();
                if (attr == null)
                {
                    node.Title = cat.ToString();
                }
                else
                {
                    node.Title = attr.Name;
                }
                if (cat == NomenclatureCategory.equipment)
                {
                    node.Children = GenerateEnumCategoryNodes();
                }
                //РАСКОМЕНТИРОВАТЬ ПРИ ПЕРЕХОДЕ НА ОБЯЗАТЕЛЬНОЕ УКАЗАНИЕ ГРУППЫ У ТОВАРОВ

                /*if(cat == NomenclatureCategory.additional) {
                 *      var groups = uow.Session.QueryOver<ProductGroup>().List().ToList();
                 *      node.Children = GenerateGoodsGroupNodes(groups, null);
                 * }*/
                node.Children.ForEach(x => x.Parent = node);
                items.Add(node);
            }

            observableItems = new GenericObservableList <SelectableNomenclatureTypeNode>(items);
            observableItems.ListContentChanged += ObservableItemsField_ListContentChanged;

            ytreeviewCategories.ColumnsConfig = FluentColumnsConfig <SelectableNomenclatureTypeNode>
                                                .Create()
                                                .AddColumn("Выбрать").AddToggleRenderer(node => node.Selected).Editing()
                                                .AddColumn("Название").AddTextRenderer(node => node.Title)
                                                .Finish();

            ytreeviewCategories.YTreeModel = new RecursiveTreeModel <SelectableNomenclatureTypeNode>(observableItems, x => x.Parent, x => x.Children);
        }
コード例 #25
0
 public ComplaintDiscussionViewModel(
     ComplaintDiscussion complaintDiscussion,
     IFilePickerService filePickerService,
     IEmployeeService employeeService,
     ICommonServices commonServices,
     IUnitOfWork uow,
     IUserRepository userRepository
     ) : base(complaintDiscussion, commonServices)
 {
     _filePickerService = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
     _employeeService   = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
     _userRepository    = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     newCommentFiles    = new GenericObservableList <ComplaintFile>();
     _canCompleteComplaintDiscussionPermission = CommonServices.CurrentPermissionService.ValidatePresetPermission("can_complete_complaint_discussion");
     UoW = uow;
     CreateCommands();
     ConfigureEntityPropertyChanges();
 }
コード例 #26
0
        private void ConfigureDlg()
        {
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            geographicGroup.UoW   = UoW;
            geographicGroup.Label = "Часть города:";
            geographicGroups      = new GenericObservableList <GeographicGroup>();
            geographicGroup.Items = geographicGroups;
            foreach (var gg in UoW.Session.QueryOver <GeographicGroup>().List())
            {
                geographicGroups.Add(gg);
            }

            yEnumCmbTransport.ItemsEnum = typeof(CarTypeOfUse);

            buttonCreateReport.Clicked += OnButtonCreateReportClicked;
            // ycheckAllTS.Activated += OnCheckBtnAllTSClicked;
            ycheckAllTS.Toggled += OnCheckBtnAllTSClicked;
        }
コード例 #27
0
        public CounterpartyJournalFilterViewModel()
        {
            UpdateWith(
                x => x.CounterpartyType,
                x => x.RestrictIncludeArchive,
                x => x.Tag
                );

            SalesChannel salesChannelAlias = null;
            SalesChannelSelectableNode salesChannelSelectableNodeAlias = null;

            var list = UoW.Session.QueryOver(() => salesChannelAlias)
                       .SelectList(scList => scList
                                   .SelectGroup(() => salesChannelAlias.Id).WithAlias(() => salesChannelSelectableNodeAlias.Id)
                                   .Select(() => salesChannelAlias.Name).WithAlias(() => salesChannelSelectableNodeAlias.Name)
                                   ).TransformUsing(Transformers.AliasToBean <SalesChannelSelectableNode>()).List <SalesChannelSelectableNode>();

            SalesChannels = new GenericObservableList <SalesChannelSelectableNode>(list);
        }
        public void SearchPermissions(string searchString)
        {
            //Каждый раз перезаписываем список
            originalTypeOfEntityList     = TypeOfEntityRepository.GetAllSavedTypeOfEntity(uow);
            ObservableTypeOfEntitiesList = new GenericObservableList <TypeOfEntity>(originalTypeOfEntityList);

            if (searchString != "")
            {
                for (int i = 0; i < ObservableTypeOfEntitiesList.Count; i++)
                {
                    //Поиск и удаление не подходящих элементов списка (без учета регистра)
                    if (ObservableTypeOfEntitiesList[i].CustomName.IndexOf(searchString, StringComparison.OrdinalIgnoreCase) == -1)
                    {
                        ObservableTypeOfEntitiesList.Remove(ObservableTypeOfEntitiesList[i]);
                        i--;
                    }
                }
            }
        }
コード例 #29
0
        void PrepareData()
        {
            progressParsing.Text             = "Подготовка таблицы";
            progressParsing.Adjustment.Value = 0;
            logger.Info("Подготовка таблицы");
            //Устанавливаем раскладку по колонкам
            xlsRows.ForEach(x => x.ColumnsMap = dataColumnsMap);
            RefreshParsingColumns();

            var currency = (PriceСurrency)comboCurrency.SelectedItem;

            progressParsing.Text = "Формирование справочных данных";
            logger.Info("Формирование справочных данных");
            progressParsing.Adjustment.Value++;
            var wc = new UpdatingXLSWorkClass();

            wc.UoW       = uow;
            wc.Diameters = uow.GetAll <Diameter>().ToList();
            wc.Currency  = currency;

            xlsRows.ForEach(x => x.WC = wc);

            ObservablexlsRows = new GenericObservableList <UpdatingXLSRow>(xlsRows);
            ObservablexlsRows.ListContentChanged += ObservablexlsRows_ListContentChanged;
            ytreeviewParsing.ItemsDataSource      = ObservablexlsRows;

            progressParsing.Text = "Разбор данных";
            progressParsing.Adjustment.Value++;
            progressParsing.Adjustment.Upper = xlsRows.Count + 2;
            logger.Info("Разбор данных");

            foreach (var row in xlsRows)
            {
                row.TryParse();
                progressParsing.Adjustment.Value++;
                QSMain.WaitRedraw();
            }

            logger.Info("Ок");
            progressParsing.Text             = String.Empty;
            progressParsing.Adjustment.Value = 0;
        }
コード例 #30
0
        public PresetUserPermissionModel(IUnitOfWork uow, UserBase user)
        {
            this.user = user;
            this.uow  = uow;

            originalPermissionList    = UserPermissionRepository.GetUserAllPresetPermissions(uow, user.Id);
            ObservablePermissionsList = new GenericObservableList <PresetUserPermission>(originalPermissionList.ToList());

            originalPermissionsSourceList = PermissionsSettings.PresetPermissions.Values.ToList();

            //убираем типы уже загруженные в права
            foreach (var item in originalPermissionList.Where(x => !x.IsLostPermission))
            {
                if (originalPermissionsSourceList.Contains(item.PermissionSource))
                {
                    originalPermissionsSourceList.Remove(item.PermissionSource);
                }
            }
            ObservablePermissionsSourceList = new GenericObservableList <PresetUserPermissionSource>(originalPermissionsSourceList);
        }