コード例 #1
0
        void ConfigureDlg()
        {
            TabName = "Приходный кассовый ордер самовывоза";

            Entity.TypeDocument = IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery;

            permissioncommentview.UoW             = UoW;
            permissioncommentview.Title           = "Комментарий по проверке закрытия МЛ: ";
            permissioncommentview.Comment         = Entity.CashierReviewComment;
            permissioncommentview.PermissionName  = "can_edit_cashier_review_comment";
            permissioncommentview.Comment         = Entity.CashierReviewComment;
            permissioncommentview.CommentChanged += (comment) => Entity.CashierReviewComment = comment;

            enumcomboOperation.ItemsEnum = typeof(IncomeType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();
            enumcomboOperation.Sensitive = false;
            Entity.TypeOperation         = IncomeType.Payment;

            var filterCasher = new EmployeeRepresentationFilterViewModel();

            filterCasher.Status = Domain.Employees.EmployeeStatus.IsWorking;
            yentryCasher.RepresentationModel = new EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();
            yentryCasher.Sensitive = false;

            var filterOrders = new OrdersFilter(UoW);

            filterOrders.SetAndRefilterAtOnce(
                x => x.RestrictStatus              = OrderStatus.WaitForPayment,
                x => x.AllowPaymentTypes           = new PaymentType[] { PaymentType.cash, PaymentType.BeveragesWorld },
                x => x.RestrictSelfDelivery        = true,
                x => x.RestrictWithoutSelfDelivery = false,
                x => x.RestrictHideService         = true,
                x => x.RestrictOnlyService         = false
                );
            yentryOrder.RepresentationModel = new OrdersVM(filterOrders);
            yentryOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <IncomeCategory>(
                s => comboCategory.ItemsList = _categoryRepository.SelfDeliveryIncomeCategories(UoW)
                );
            comboCategory.ItemsList = incomeCategoryList;
            comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                ytextviewDescription.Editable = false;
                buttonSave.Sensitive          = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
            }

            UpdateSubdivision();
        }
コード例 #2
0
        private void ConfigureBindings()
        {
            ylabelCreationDate.Binding.AddFuncBinding(ViewModel.Entity, e => e.CreationDate.ToString("g"), w => w.LabelProp).InitializeFromSource();
            ylabelAuthor.Binding.AddFuncBinding(ViewModel.Entity, e => e.Author != null ? e.Author.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelStatus.Binding.AddFuncBinding(ViewModel.Entity, e => e.Status.GetEnumTitle(), w => w.LabelProp).InitializeFromSource();
            yspinMoney.Binding.AddBinding(ViewModel.Entity, e => e.TransferedSum, w => w.ValueAsDecimal).InitializeFromSource();
            yspinMoney.Binding.AddBinding(ViewModel, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();

            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.Status = EmployeeStatus.IsWorking
                );
            entryDriver.RepresentationModel = new EmployeesVM(filterDriver);
            entryDriver.Binding.AddBinding(ViewModel.Entity, e => e.Driver, w => w.Subject).InitializeFromSource();
            entryDriver.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(ViewModel.Entity, x => x.Car, x => x.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            comboboxCashSubdivisionFrom.SetRenderTextFunc <Subdivision>(s => s.Name);
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsFrom, w => w.ItemsList).InitializeFromSource();
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxCashSubdivisionFrom.Binding.AddBinding(ViewModel.Entity, e => e.CashSubdivisionFrom, w => w.SelectedItem).InitializeFromSource();

            comboboxCashSubdivisionTo.SetRenderTextFunc <Subdivision>(s => s.Name);
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsTo, w => w.ItemsList).InitializeFromSource();
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxCashSubdivisionTo.Binding.AddBinding(ViewModel.Entity, e => e.CashSubdivisionTo, w => w.SelectedItem).InitializeFromSource();

            comboExpenseCategory.SetRenderTextFunc <ExpenseCategory>(s => s.Name);
            comboExpenseCategory.Binding.AddBinding(ViewModel, vm => vm.ExpenseCategories, w => w.ItemsList).InitializeFromSource();
            comboExpenseCategory.Binding.AddBinding(ViewModel.Entity, e => e.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();
            comboExpenseCategory.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            comboIncomeCategory.SetRenderTextFunc <IncomeCategory>(s => s.Name);
            comboIncomeCategory.Binding.AddBinding(ViewModel, vm => vm.IncomeCategories, w => w.ItemsList).InitializeFromSource();
            comboIncomeCategory.Binding.AddBinding(ViewModel.Entity, e => e.IncomeCategory, w => w.SelectedItem).InitializeFromSource();
            comboIncomeCategory.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ylabelCashierSender.Binding.AddFuncBinding(ViewModel.Entity, e => e.CashierSender != null ? e.CashierSender.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelCashierReceiver.Binding.AddFuncBinding(ViewModel.Entity, e => e.CashierReceiver != null ? e.CashierReceiver.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();
            ylabelSendTime.Binding.AddFuncBinding(ViewModel.Entity, e => e.SendTime.HasValue ? e.SendTime.Value.ToString("g") : "", w => w.LabelProp).InitializeFromSource();
            ylabelReceiveTime.Binding.AddFuncBinding(ViewModel.Entity, e => e.ReceiveTime.HasValue ? e.ReceiveTime.Value.ToString("g") : "", w => w.LabelProp).InitializeFromSource();

            ytextviewComment.Binding.AddBinding(ViewModel.Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();
            ytextviewComment.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ViewModel.SendCommand.CanExecuteChanged += (sender, e) => {
                buttonSend.Sensitive = ViewModel.SendCommand.CanExecute();
            };

            ViewModel.ReceiveCommand.CanExecuteChanged += (sender, e) => {
                buttonReceive.Sensitive = ViewModel.ReceiveCommand.CanExecute();
            };

            buttonPrint.Sensitive = ViewModel.PrintCommand.CanExecute();
        }
コード例 #3
0
        void ConfigureDlg()
        {
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            dateperiodpicker.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            dateperiodpicker.EndDate   = dateperiodpicker.StartDate.AddMonths(1).AddTicks(-1);

            filter = new EmployeeRepresentationFilterViewModel();

            var availablePlansToUse = new[] { WageParameterItemTypes.SalesPlan };

            lstCmbPlanType.SetRenderTextFunc <WageParameterItemTypes>(t => t.GetEnumTitle());
            lstCmbPlanType.ItemsList    = availablePlansToUse;
            lstCmbPlanType.SelectedItem = availablePlansToUse.FirstOrDefault();
            lstCmbPlanType.Changed     += LstCmbPlanType_Changed;
            LstCmbPlanType_Changed(this, new EventArgs());
            yEntRefEmployee.RepresentationModel = new EmployeesVM(filter);
            yEntRefEmployee.ChangedByUser      += (sender, e) => {
                var actualWageParameter = (yEntRefEmployee.Subject as Employee)?.GetActualWageParameter(DateTime.Now);
                if (actualWageParameter == null || actualWageParameter.WageParameterItem.WageParameterItemType != WageParameterItemTypes.SalesPlan)
                {
                    return;
                }

                lblEmployeePlan.Markup = actualWageParameter.Title;
            };
            comboTypeOfDate.ItemsEnum    = typeof(OrderDateType);
            comboTypeOfDate.SelectedItem = OrderDateType.CreationDate;
        }
コード例 #4
0
        public CashExpenseFilterView()
        {
            this.Build();
            UoW    = UnitOfWorkFactory.CreateWithoutRoot();
            Filter = new ExpenseFilter();

            ydateperiodPicker.Binding.AddBinding(Filter, x => x.StartDate, w => w.StartDate).InitializeFromSource();
            ydateperiodPicker.Binding.AddBinding(Filter, x => x.EndDate, w => w.EndDate).InitializeFromSource();
            ydateperiodPicker.PeriodChanged += (sender, e) => Refilter();

            var employeeFilter = new EmployeeRepresentationFilterViewModel
            {
                Status = Domain.Employees.EmployeeStatus.IsWorking
            };

            entryEmployee.RepresentationModel = new EmployeesVM(employeeFilter);
            entryEmployee.Binding.AddBinding(Filter, x => x.Employee, w => w.Subject).InitializeFromSource();
            entryEmployee.ChangedByUser += (sender, e) => Refilter();

            var expenseCategoryVM = new EntityCommonRepresentationModelConstructor <ExpenseCategory>(UoW)
                                    .AddColumn("Имя", x => x.Name).AddSearch(x => x.Name)
                                    .AddColumn("Тип документа", x => x.ExpenseDocumentType.GetEnumTitle())
                                    .OrderBy(x => x.Name)
                                    .Finish();

            entryExpenseCategory.RepresentationModel = expenseCategoryVM;
            entryExpenseCategory.Binding.AddBinding(Filter, x => x.ExpenseCategory, w => w.Subject).InitializeFromSource();
            entryExpenseCategory.ChangedByUser += (sender, e) => Refilter();
        }
コード例 #5
0
        private void Configure()
        {
            ydateperiodpickerCreateEventDate.Binding.AddBinding(ViewModel, vm => vm.CreateEventDateFrom, w => w.StartDateOrNull).InitializeFromSource();
            ydateperiodpickerCreateEventDate.Binding.AddBinding(ViewModel, vm => vm.CreateEventDateTo, w => w.EndDateOrNull).InitializeFromSource();

            ydateperiodpickerStartEventDate.Binding.AddBinding(ViewModel, vm => vm.StartEventDateFrom, w => w.StartDateOrNull).InitializeFromSource();
            ydateperiodpickerStartEventDate.Binding.AddBinding(ViewModel, vm => vm.StartEventDateTo, w => w.EndDateOrNull).InitializeFromSource();

            ydateperiodpickerEndEventDate.Binding.AddBinding(ViewModel, vm => vm.EndEventDateFrom, w => w.StartDateOrNull).InitializeFromSource();
            ydateperiodpickerEndEventDate.Binding.AddBinding(ViewModel, vm => vm.EndEventDateTo, w => w.EndDateOrNull).InitializeFromSource();

            referenceAuthor.RepresentationModel = new EmployeesVM(new EmployeeRepresentationFilterViewModel());
            referenceAuthor.Binding.AddBinding(ViewModel, vm => vm.Author, w => w.Subject).InitializeFromSource();

            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            referenceDriver.Binding.AddBinding(ViewModel, vm => vm.Driver, w => w.Subject).InitializeFromSource();

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(ViewModel.CarSelectorFactory);
            entityviewmodelentryCar.Binding.AddBinding(ViewModel, vm => vm.Car, w => w.Subject).InitializeFromSource();

            entityviewmodelentryCarEventType.SetEntityAutocompleteSelectorFactory(ViewModel.CarEventTypeSelectorFactory);
            entityviewmodelentryCarEventType.Binding.AddBinding(ViewModel, vm => vm.CarEventType, e => e.Subject).InitializeFromSource();
        }
コード例 #6
0
        public DriverWagesReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryreferenceDriver.RepresentationModel = new EmployeesVM(filter);
            yentryreferenceDriver.Changed            += (sender, args) =>
            {
                if (dateperiodpicker.StartDateOrNull.HasValue && yentryreferenceDriver.Subject is Employee)
                {
                    OnUpdate(true);
                }
            };

            dateperiodpicker.PeriodChanged += (sender, args) =>
            {
                if (yentryreferenceDriver.Subject is Employee && dateperiodpicker.StartDateOrNull.HasValue)
                {
                    OnUpdate(true);
                }
            };
        }
コード例 #7
0
        protected override void ConfigureWithUow()
        {
            enumcomboDocumentType.ItemsEnum   = typeof(DocumentType);
            enumcomboDocumentType.HiddenItems = new[] { DocumentType.DeliveryDocument as object };

            yentryrefWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery();

            if (ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !ServicesConfig.CommonServices.UserService.GetCurrentUser(UoW).IsAdmin)
            {
                yentryrefWarehouse.Sensitive = yentryrefWarehouse.CanEditReference = false;
            }

            if (CurrentUserSettings.Settings.DefaultWarehouse != null)
            {
                yentryrefWarehouse.Subject = UoW.GetById <Warehouse>(CurrentUserSettings.Settings.DefaultWarehouse.Id);
            }

            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryrefDriver.RepresentationModel = new EmployeesVM(filter);
            dateperiodDocs.StartDate            = DateTime.Today.AddDays(-7);
            dateperiodDocs.EndDate = DateTime.Today.AddDays(1);

            comboMovementStatus.ItemsEnum = typeof(MovementDocumentStatus);
        }
コード例 #8
0
ファイル: CarEventView.cs プロジェクト: Art8m/Vodovozfork
        private void Configure()
        {
            ylabelCreateDate.Binding.AddFuncBinding(ViewModel.Entity, e => e.CreateDate.ToString("g"), w => w.LabelProp).InitializeFromSource();

            ylabelAuthor.Binding.AddFuncBinding(ViewModel.Entity, e => e.Author != null ? e.Author.GetPersonNameWithInitials() : "", w => w.LabelProp).InitializeFromSource();

            entityviewmodelentryCarEventType.SetEntityAutocompleteSelectorFactory(ViewModel.CarEventTypeSelectorFactory);
            entityviewmodelentryCarEventType.Binding.AddBinding(ViewModel.Entity, e => e.CarEventType, e => e.Subject).InitializeFromSource();

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(ViewModel.CarSelectorFactory);
            entityviewmodelentryCar.Binding.AddBinding(ViewModel.Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.ChangedByUser += (sender, e) => ViewModel.ChangeDriverCommand.Execute();

            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            referenceDriver.Binding.AddBinding(ViewModel.Entity, e => e.Driver, w => w.Subject).InitializeFromSource();

            ydatepickerStartEventDate.Binding.AddBinding(ViewModel.Entity, e => e.StartDate, w => w.Date).InitializeFromSource();

            ydatepickerEndEventDate.Binding.AddBinding(ViewModel.Entity, e => e.EndDate, w => w.Date).InitializeFromSource();

            ytextviewCommnet.Binding.AddBinding(ViewModel.Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();

            buttonSave.Clicked   += (sender, args) => ViewModel.SaveAndClose();
            buttonCancel.Clicked += (sender, args) => ViewModel.Close(true, CloseSource.Cancel);
        }
コード例 #9
0
ファイル: AdvanceReportDlg.cs プロジェクト: Art8m/Vodovozfork
        void ConfigureDlg()
        {
            accessfilteredsubdivisionselectorwidget.OnSelected += Accessfilteredsubdivisionselectorwidget_OnSelected;
            if (Entity.RelatedToSubdivision != null)
            {
                accessfilteredsubdivisionselectorwidget.SelectIfPossible(Entity.RelatedToSubdivision);
            }

            var filterEmployee = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filterEmployee);
            yentryEmployee.Binding.AddBinding(Entity, e => e.Accountable, w => w.Subject).InitializeFromSource();

            var filterCasher = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, e => e.Casher, w => w.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <ExpenseCategory>(HandleBatchEntityChangeHandler);
            UpdateExpenseCategories();

            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            specialListCmbOrganisation.ShowSpecialStateNot = true;
            specialListCmbOrganisation.ItemsList           = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.Organisation, w => w.SelectedItem).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <RecivedAdvance>()
                                           .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing()
                                           .AddColumn("Дата").AddTextRenderer(a => a.Advance.Date.ToString())
                                           .AddColumn("Получено").AddTextRenderer(a => a.Advance.Money.ToString("C"))
                                           .AddColumn("Непогашено").AddTextRenderer(a => a.Advance.UnclosedMoney.ToString("C"))
                                           .AddColumn("Статья").AddTextRenderer(a => a.Advance.ExpenseCategory.Name)
                                           .AddColumn("Основание").AddTextRenderer(a => a.Advance.Description)
                                           .Finish();
            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
                buttonSave.Sensitive          = false;
                ytreeviewDebts.Sensitive      = false;
                ytextviewDescription.Editable = false;
            }
        }
コード例 #10
0
ファイル: CashFlow.cs プロジェクト: Art8m/Vodovozfork
        public CashFlow(
            ISubdivisionRepository subdivisionRepository, ICommonServices commonServices, ICategoryRepository categoryRepository)
        {
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

            if (categoryRepository == null)
            {
                throw new ArgumentNullException(nameof(categoryRepository));
            }

            Build();

            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            comboPart.ItemsEnum            = typeof(ReportParts);
            comboIncomeCategory.ItemsList  = categoryRepository.IncomeCategories(UoW);
            comboExpenseCategory.Sensitive = comboIncomeCategory.Sensitive = false;
            var now = DateTime.Now;

            dateStart.Date = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
            dateEnd.Date   = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);

            var filterCasher = new EmployeeRepresentationFilterViewModel();

            filterCasher.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.office);
            filterCasher.Status = EmployeeStatus.IsWorking;
            yentryrefCasher.RepresentationModel = new EmployeesVM(filterCasher);

            yentryrefEmployee.RepresentationModel = new EmployeesVM();

            var recurciveConfig = OrmMain.GetObjectDescription <ExpenseCategory>().TableView.RecursiveTreeConfig;
            var list            = categoryRepository.ExpenseCategories(UoW);

            list.Insert(0, allItem);
            var model = recurciveConfig.CreateModel((IList)list);

            comboExpenseCategory.Model = model.Adapter;
            comboExpenseCategory.PackStart(new CellRendererText(), true);
            comboExpenseCategory.SetCellDataFunc(comboExpenseCategory.Cells[0], HandleCellLayoutDataFunc);
            comboExpenseCategory.SetActiveIter(model.IterFromNode(allItem));

            UserSubdivisions = GetSubdivisionsForUser();
            specialListCmbCashSubdivisions.SetRenderTextFunc <Subdivision>(s => s.Name);
            specialListCmbCashSubdivisions.ItemsList = UserSubdivisions;

            ylblOrganisations.Visible = specialListCmbOrganisations.Visible = false;
            Organisations             = UoW.GetAll <Organization>();
            specialListCmbOrganisations.SetRenderTextFunc <Organization>(s => s.Name);
            specialListCmbOrganisations.ItemsList = Organisations;

            int  currentUserId = commonServices.UserService.CurrentUserId;
            bool canCreateCashReportsForOrganisations =
                commonServices.PermissionService.ValidateUserPresetPermission("can_create_cash_reports_for_organisations", currentUserId);

            checkOrganisations.Visible  = canCreateCashReportsForOrganisations;
            checkOrganisations.Toggled += CheckOrganisationsToggled;
        }
コード例 #11
0
        protected override void ConfigureWithUow()
        {
            yentryExpense.ItemsQuery = new CategoryRepository(new ParametersProvider()).ExpenseCategoriesQuery();

            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(x => x.Status = EmployeeStatus.IsWorking);
            repEntryAccountable.RepresentationModel   = new EmployeesVM(filter);
        }
コード例 #12
0
        public EmployeesFines()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryDriver.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #13
0
        public OrderCreationDateReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.office,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yEntRefEmployee.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #14
0
        void ConfigureDlg()
        {
            TabName = "Расходный кассовый ордер самовывоза";

            Entity.TypeDocument = ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery;

            enumcomboOperation.ItemsEnum = typeof(ExpenseType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();
            enumcomboOperation.Sensitive = false;
            Entity.TypeOperation         = ExpenseType.ExpenseSelfDelivery;

            var filterOrders = new OrdersFilter(UoW);

            filterOrders.SetAndRefilterAtOnce(
                x => x.RestrictStatus              = OrderStatus.WaitForPayment,
                x => x.AllowPaymentTypes           = new PaymentType[] { PaymentType.cash, PaymentType.BeveragesWorld },
                x => x.RestrictSelfDelivery        = true,
                x => x.RestrictWithoutSelfDelivery = false,
                x => x.RestrictHideService         = true,
                x => x.RestrictOnlyService         = false
                );
            yentryOrder.RepresentationModel = new OrdersVM(filterOrders);
            yentryOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();

            var filterCasher = new EmployeeRepresentationFilterViewModel();

            filterCasher.Status = Domain.Employees.EmployeeStatus.IsWorking;
            yentryCasher.RepresentationModel = new EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();
            yentryCasher.Sensitive = false;

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <ExpenseCategory>(
                s => comboExpense.ItemsList = _categoryRepository.ExpenseSelfDeliveryCategories(UoW)
                );
            comboExpense.ItemsList = expenseCategoryList;
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
                buttonSave.Sensitive          = false;
                ytextviewDescription.Editable = false;
            }
        }
コード例 #15
0
ファイル: MastersReport.cs プロジェクト: Art8m/Vodovozfork
        public MastersReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryreferenceDriver.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #16
0
        private void ConfigureDlg()
        {
            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.Status = EmployeeStatus.IsWorking
                );
            entryDriver.RepresentationModel = new EmployeesVM(filterDriver);
            datePickerFrom.IsEditable       = true;
            datePickerTo.IsEditable         = true;

            buttonRecalculate.Clicked          += ButtonRecalculate_Clicked;
            buttonRecalculateForwarder.Clicked += ButtonRecalculateForwarder_Clicked;;
        }
コード例 #17
0
        public ShortfallBattlesReport()
        {
            this.Build();
            ydatepicker.Date         = DateTime.Now.Date;
            comboboxDriver.ItemsEnum = typeof(Drivers);
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryDriver.RepresentationModel  = new EmployeesVM(filter);
            ySpecCmbNonReturnReason.ItemsList = UoW.Session.QueryOver <NonReturnReason>().List();
        }
コード例 #18
0
        public DefectiveItemsReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            yEnumCmbSource.ItemsEnum = typeof(DefectSource);
            yEnumCmbSource.AddEnumToHideList(new Enum[] { DefectSource.None });

            var driversFilter = new EmployeeRepresentationFilterViewModel
            {
                RestrictCategory = EmployeeCategory.driver, Status = EmployeeStatus.IsWorking
            };

            yEntryRefDriver.RepresentationModel = new EmployeesVM(driversFilter);

            datePeriod.StartDate = datePeriod.EndDate = DateTime.Today;
        }
コード例 #19
0
ファイル: CarProxyDlg.cs プロジェクト: Art8m/Vodovozfork
        void ConfigureDlg()
        {
            if (Entity.EmployeeDocument == null && Entity.Driver != null)
            {
                GetDocument();
            }

            ylabelNumber.Binding.AddBinding(Entity, x => x.Title, x => x.LabelProp).InitializeFromSource();

            yentryOrganization.SubjectType = typeof(Organization);
            yentryOrganization.Binding.AddBinding(Entity, x => x.Organization, x => x.Subject).InitializeFromSource();
            yentryOrganization.Changed += (sender, e) => {
                UpdateStates();
            };

            var filterDefaultForwarder = new EmployeeRepresentationFilterViewModel();

            filterDefaultForwarder.Status = EmployeeStatus.IsWorking;
            filterDefaultForwarder.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.driver);
            yentryDriver.RepresentationModel = new EmployeesVM(filterDefaultForwarder);
            yentryDriver.Binding.AddBinding(Entity, x => x.Driver, x => x.Subject).InitializeFromSource();
            yentryDriver.Changed += (sender, e) => {
                UpdateStates();
            };

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(Entity, x => x.Car, x => x.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Changed += (sender, e) => {
                UpdateStates();
            };

            RefreshParserRootObject();

            templatewidget.CanRevertCommon = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_set_common_additionalagreement");
            templatewidget.Binding.AddBinding(Entity, e => e.DocumentTemplate, w => w.Template).InitializeFromSource();
            templatewidget.Binding.AddBinding(Entity, e => e.ChangedTemplateFile, w => w.ChangedDoc).InitializeFromSource();
            templatewidget.BeforeOpen += Templatewidget_BeforeOpen;

            UpdateStates();
        }
コード例 #20
0
        protected void OnRadioCatAllToggled(object sender, EventArgs e)
        {
            var filter = new EmployeeRepresentationFilterViewModel();

            filter.Status = EmployeeStatus.IsWorking;
            if (radioCatDriver.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.driver);
            }

            if (radioCatForwarder.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.forwarder);
            }

            if (radioCatOffice.Active)
            {
                filter.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.office);
            }
            yentryDriver.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #21
0
        public FirstSecondClientReport(IOrderRepository orderRepository)
        {
            if (orderRepository == null)
            {
                throw new ArgumentNullException(nameof(orderRepository));
            }

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var reasons = orderRepository.GetDiscountReasons(UoW);

            yCpecCmbDiscountReason.ItemsList = reasons;
            daterangepicker.StartDate        = DateTime.Now.AddDays(-7);
            daterangepicker.EndDate          = DateTime.Now.AddDays(1);

            var filter = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking, Category = EmployeeCategory.office
            };

            yentryEmployer.RepresentationModel = new EmployeesVM(filter);
        }
コード例 #22
0
ファイル: FuelReport.cs プロジェクト: Art8m/Vodovozfork
        public FuelReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryreferenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            var filter = new EmployeeRepresentationFilterViewModel();

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.office,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            yentryAuthor.RepresentationModel = new EmployeesVM(filter);
            dateperiodpicker.StartDate       = dateperiodpicker.EndDate = DateTime.Today;
        }
コード例 #23
0
        public void ConfigureDlg()
        {
            Entity.ObservableAddresses.ElementAdded   += ObservableAddresses_ElementAdded;
            Entity.ObservableAddresses.ElementRemoved += ObservableAddresses_ElementRemoved;
            Entity.ObservableAddresses.ElementChanged += ObservableAddresses_ElementChanged;;

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Car, CarJournalViewModel, CarJournalFilterViewModel>(ServicesConfig.CommonServices));
            entityviewmodelentryCar.Binding.AddBinding(Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Sensitive = logisticanEditing;

            var filterDriver = new EmployeeRepresentationFilterViewModel();

            filterDriver.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.driver,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceDriver.RepresentationModel = new EmployeesVM(filterDriver);
            referenceDriver.Binding.AddBinding(Entity, rl => rl.Driver, widget => widget.Subject).InitializeFromSource();
            referenceDriver.Sensitive = logisticanEditing;
            var filterForwarder = new EmployeeRepresentationFilterViewModel();

            filterForwarder.SetAndRefilterAtOnce(
                x => x.RestrictCategory = EmployeeCategory.forwarder,
                x => x.Status           = EmployeeStatus.IsWorking
                );
            referenceForwarder.RepresentationModel = new EmployeesVM(filterForwarder);
            referenceForwarder.Binding.AddBinding(Entity, rl => rl.Forwarder, widget => widget.Subject).InitializeFromSource();
            referenceForwarder.Sensitive = logisticanEditing;
            referenceForwarder.Changed  += ReferenceForwarder_Changed;

            referenceLogistican.RepresentationModel = new EmployeesVM();
            referenceLogistican.Binding.AddBinding(Entity, rl => rl.Logistician, widget => widget.Subject).InitializeFromSource();
            referenceLogistican.Sensitive = logisticanEditing;

            speccomboShift.ItemsList = _deliveryShiftRepository.ActiveShifts(UoW);
            speccomboShift.Binding.AddBinding(Entity, rl => rl.Shift, widget => widget.SelectedItem).InitializeFromSource();
            speccomboShift.Sensitive = logisticanEditing;

            datePickerDate.Binding.AddBinding(Entity, rl => rl.Date, widget => widget.Date).InitializeFromSource();
            datePickerDate.Sensitive = logisticanEditing;

            ylabelLastTimeCall.Binding.AddFuncBinding(Entity, e => GetLastCallTime(e.LastCallTime), w => w.LabelProp).InitializeFromSource();
            yspinActualDistance.Sensitive = allEditing;

            buttonMadeCall.Sensitive = allEditing;

            buttonRetriveEnRoute.Sensitive = Entity.Status == RouteListStatus.OnClosing && isUserLogist &&
                                             ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_retrieve_routelist_en_route");

            buttonNewFine.Sensitive = allEditing;

            buttonRefresh.Sensitive = allEditing;

            //Заполняем иконки
            var ass = Assembly.GetAssembly(typeof(MainClass));

            statusIcons.Add(RouteListItemStatus.EnRoute, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.car.png"));
            statusIcons.Add(RouteListItemStatus.Completed, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-smile-grin.png"));
            statusIcons.Add(RouteListItemStatus.Overdue, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-angry.png"));
            statusIcons.Add(RouteListItemStatus.Canceled, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-crying.png"));
            statusIcons.Add(RouteListItemStatus.Transfered, new Gdk.Pixbuf(ass, "Vodovoz.icons.status.face-uncertain.png"));

            ytreeviewAddresses.ColumnsConfig = ColumnsConfigFactory.Create <RouteListKeepingItemNode>()
                                               .AddColumn("№ п/п").AddNumericRenderer(x => x.RouteListItem.IndexInRoute + 1)
                                               .AddColumn("Заказ")
                                               .AddTextRenderer(node => node.RouteListItem.Order.Id.ToString())
                                               .AddColumn("Адрес")
                                               .AddTextRenderer(node => node.RouteListItem.Order.DeliveryPoint == null ? "Требуется точка доставки" : node.RouteListItem.Order.DeliveryPoint.ShortAddress)
                                               .AddColumn("Время")
                                               .AddTextRenderer(node => node.RouteListItem.Order.DeliverySchedule == null ? "" : node.RouteListItem.Order.DeliverySchedule.Name)
                                               .AddColumn("Статус")
                                               .AddPixbufRenderer(x => statusIcons[x.Status])
                                               .AddEnumRenderer(node => node.Status, excludeItems: new Enum[] { RouteListItemStatus.Transfered })
                                               .AddSetter((c, n) => c.Editable = allEditing && n.Status != RouteListItemStatus.Transfered)
                                               .AddColumn("Отгрузка")
                                               .AddNumericRenderer(node => node.RouteListItem.Order.OrderItems
                                                                   .Where(b => b.Nomenclature.Category == NomenclatureCategory.water && b.Nomenclature.TareVolume == TareVolume.Vol19L)
                                                                   .Sum(b => b.Count))
                                               .AddColumn("Возврат тары")
                                               .AddNumericRenderer(node => node.RouteListItem.Order.BottlesReturn)
                                               .AddColumn("Сдали по факту")
                                               .AddNumericRenderer(node => node.RouteListItem.DriverBottlesReturned)
                                               .AddColumn("Статус изменен")
                                               .AddTextRenderer(node => node.LastUpdate)
                                               .AddColumn("Комментарий")
                                               .AddTextRenderer(node => node.Comment)
                                               .Editable(allEditing)
                                               .AddColumn("Переносы")
                                               .AddTextRenderer(node => node.Transferred)
                                               .RowCells()
                                               .AddSetter <CellRenderer>((cell, node) => cell.CellBackgroundGdk = node.RowColor)
                                               .Finish();
            ytreeviewAddresses.Selection.Mode     = SelectionMode.Multiple;
            ytreeviewAddresses.Selection.Changed += OnSelectionChanged;
            ytreeviewAddresses.Sensitive          = allEditing;
            ytreeviewAddresses.RowActivated      += YtreeviewAddresses_RowActivated;

            //Point!
            //Заполняем телефоны

            if (Entity.Driver != null && Entity.Driver.Phones.Count > 0)
            {
                uint rows = Convert.ToUInt32(Entity.Driver.Phones.Count + 1);
                PhonesTable1.Resize(rows, 2);
                Label label = new Label();
                label.LabelProp = $"{Entity.Driver.FullName}";
                PhonesTable1.Attach(label, 0, 2, 0, 1);

                for (uint i = 1; i < rows; i++)
                {
                    Label l = new Label();
                    l.LabelProp  = "+7 " + Entity.Driver.Phones[Convert.ToInt32(i - 1)].Number;
                    l.Selectable = true;
                    PhonesTable1.Attach(l, 0, 1, i, i + 1);

                    HandsetView h = new HandsetView(Entity.Driver.Phones[Convert.ToInt32(i - 1)].DigitsNumber);
                    PhonesTable1.Attach(h, 1, 2, i, i + 1);
                }
            }
            if (Entity.Forwarder != null && Entity.Forwarder.Phones.Count > 0)
            {
                uint rows = Convert.ToUInt32(Entity.Forwarder.Phones.Count + 1);
                PhonesTable2.Resize(rows, 2);
                Label label = new Label();
                label.LabelProp = $"{Entity.Forwarder.FullName}";
                PhonesTable2.Attach(label, 0, 2, 0, 1);

                for (uint i = 1; i < rows; i++)
                {
                    Label l = new Label();
                    l.LabelProp  = "+7 " + Entity.Forwarder.Phones[Convert.ToInt32(i - 1)].Number;
                    l.Selectable = true;
                    PhonesTable2.Attach(l, 0, 1, i, i + 1);

                    HandsetView h = new HandsetView(Entity.Forwarder.Phones[Convert.ToInt32(i - 1)].DigitsNumber);
                    PhonesTable2.Attach(h, 1, 2, i, i + 1);
                }
            }

            //Телефон
            PhonesTable1.ShowAll();
            PhonesTable2.ShowAll();

            phoneLogistican.MangoManager = phoneDriver.MangoManager = phoneForwarder.MangoManager = MainClass.MainWin.MangoManager;
            phoneLogistican.Binding.AddBinding(Entity, e => e.Logistician, w => w.Employee).InitializeFromSource();
            phoneDriver.Binding.AddBinding(Entity, e => e.Driver, w => w.Employee).InitializeFromSource();
            phoneForwarder.Binding.AddBinding(Entity, e => e.Forwarder, w => w.Employee).InitializeFromSource();

            //Заполняем информацию о бутылях
            UpdateBottlesSummaryInfo();

            UpdateNodes();
        }
コード例 #24
0
        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 EmployeeRepresentationFilterViewModel
            {
                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 EmployeeRepresentationFilterViewModel
            {
                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 = _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;
            }
        }
コード例 #25
0
ファイル: CashExpenseDlg.cs プロジェクト: Art8m/Vodovozfork
        private 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(ExpenseType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();

            var filterCasher = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            var filterEmployee = new EmployeeRepresentationFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filterEmployee);
            yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();
            yentryEmployee.ChangedByUser += (sender, e) => UpdateEmployeeBalaceInfo();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();
            ydateDocument.Sensitive = _canEditDate;

            IFileChooserProvider fileChooserProvider = new FileChooser("Расход " + DateTime.Now + ".csv");
            var filterViewModel = new ExpenseCategoryJournalFilterViewModel {
                ExcludedIds    = _categoryRepository.ExpenseSelfDeliveryCategories(UoW).Select(x => x.Id),
                HidenByDefault = true
            };

            var expenseCategorySelectorFactory = new SimpleEntitySelectorFactory <ExpenseCategory, ExpenseCategoryViewModel>(
                () =>
            {
                var expenseCategoryJournalViewModel = new SimpleEntityJournalViewModel <ExpenseCategory, ExpenseCategoryViewModel>(
                    x => x.Name,
                    () => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForCreate(),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        fileChooserProvider,
                        filterViewModel,
                        _employeeJournalFactory,
                        _subdivisionJournalFactory
                        ),
                    node => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForOpen(node.Id),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        fileChooserProvider,
                        filterViewModel,
                        _employeeJournalFactory,
                        _subdivisionJournalFactory
                        ),
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices
                    )
                {
                    SelectionMode = JournalSelectionMode.Single
                };
                expenseCategoryJournalViewModel.SetFilter(filterViewModel,
                                                          filter => Restrictions.Not(Restrictions.In("Id", filter.ExcludedIds.ToArray())));

                return(expenseCategoryJournalViewModel);
            }
                );

            entityVMEntryExpenseCategory.SetEntityAutocompleteSelectorFactory(expenseCategorySelectorFactory);
            entityVMEntryExpenseCategory.Binding.AddBinding(Entity, e => e.ExpenseCategory, w => w.Subject).InitializeFromSource();

            specialListCmbOrganisation.ShowSpecialStateNot = true;
            specialListCmbOrganisation.ItemsList           = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.Organisation, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            UpdateEmployeeBalanceVisibility();
            UpdateEmployeeBalaceInfo();
            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
                buttonSave.Sensitive          = false;
                ytextviewDescription.Editable = false;
            }
        }