예제 #1
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 employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Filter, x => x.Employee, w => w.Subject).InitializeFromSource();
            evmeEmployee.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();
        }
        void ConfigureDlg()
        {
            ySpecCmbDeliveryPointFrom.SetSizeRequest(250, 30);
            ySpecCmbDeliveryPointTo.SetSizeRequest(250, 30);

            textComment.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();
            datepickerDate.Binding.AddBinding(Entity, e => e.TimeStamp, w => w.Date).InitializeFromSource();

            var clientFactory = new CounterpartyJournalFactory();

            referenceCounterpartyFrom.SetEntitySelectorFactory(clientFactory.CreateCounterpartyAutocompleteSelectorFactory());
            referenceCounterpartyFrom.Binding.AddBinding(Entity, e => e.FromClient, w => w.Subject).InitializeFromSource();

            referenceCounterpartyTo.SetEntitySelectorFactory(clientFactory.CreateCounterpartyAutocompleteSelectorFactory());
            referenceCounterpartyTo.Binding.AddBinding(Entity, e => e.ToClient, w => w.Subject).InitializeFromSource();

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, e => e.ResponsiblePerson, w => w.Subject).InitializeFromSource();

            transferoperationdocumentitemview1.DocumentUoW = UoWGeneric;

            if (Entity.FromClient != null)
            {
                RefreshSpinButtons(new BottlesRepository(), new DepositRepository());
            }
        }
예제 #3
0
        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 officeFilter = new EmployeeFilterViewModel();

            officeFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.office);
            var employeeFactory = new EmployeeJournalFactory(officeFilter);

            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory());

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());

            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;
        }
예제 #4
0
        void ConfigureDlg()
        {
            if (Entity.EmployeeDocument == null && Entity.Employee != null)
            {
                GetDocument();
            }

            ylabelNumber.Binding.AddBinding(Entity, x => x.Title, x => x.LabelProp).InitializeFromSource();
            var orderFactory = new OrderSelectorFactory();

            evmeOrder.SetEntityAutocompleteSelectorFactory(orderFactory.CreateOrderAutocompleteSelectorFactory());
            evmeOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();
            evmeOrder.Changed += (sender, e) => {
                FillForOrder();
            };
            evmeOrder.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            var orgFactory = new OrganizationJournalFactory();

            evmeOrganization.SetEntityAutocompleteSelectorFactory(orgFactory.CreateOrganizationAutocompleteSelectorFactory());
            evmeOrganization.Binding.AddBinding(Entity, x => x.Organization, x => x.Subject).InitializeFromSource();
            evmeOrganization.Changed += (sender, e) => UpdateStates();

            FillForOrder();

            yDPDatesRange.Binding.AddBinding(Entity, x => x.Date, x => x.StartDate).InitializeFromSource();
            yDPDatesRange.Binding.AddBinding(Entity, x => x.ExpirationDate, x => x.EndDate).InitializeFromSource();

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, x => x.Employee, x => x.Subject).InitializeFromSource();

            var supplierFactory = new CounterpartyJournalFactory();

            evmeSupplier.SetEntityAutocompleteSelectorFactory(supplierFactory.CreateCounterpartyAutocompleteSelectorFactory());
            evmeSupplier.Binding.AddBinding(Entity, x => x.Supplier, x => x.Subject).InitializeFromSource();

            yETicketNr.Binding.AddBinding(Entity, x => x.TicketNumber, w => w.Text).InitializeFromSource();

            yDTicketDate.Binding.AddBinding(Entity, x => x.TicketDate, x => x.DateOrNull).InitializeFromSource();

            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;

            yTWEquipment.ColumnsConfig = ColumnsConfigFactory.Create <OrderEquipment>()
                                         .AddColumn("Наименование").SetDataProperty(node => node.FullNameString)
                                         .AddColumn("Направление").SetDataProperty(node => node.DirectionString)
                                         .AddColumn("Кол-во").AddNumericRenderer(node => node.Count).WidthChars(10)
                                         .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                         .AddColumn("")
                                         .Finish();

            UpdateStates();
        }
        public EmployeesPremiums()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var employeeFactory = new EmployeeJournalFactory();

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeDriver.Changed += (sender, args) => ValidateParameters();
        }
예제 #6
0
        public WagesOperationsReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
        }
예제 #7
0
        protected override void ConfigureWithUow()
        {
            var employeeFactory = new EmployeeJournalFactory();

            evmeAccountable.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeAccountable.Changed      += (sender, e) => OnRefiltered();
            yAdvancePeriod.PeriodChanged += (sender, e) => OnRefiltered();
            yentryExpense.Changed        += (sender, e) => OnRefiltered();
            yentryExpense.ItemsQuery      = new CategoryRepository(new ParametersProvider()).ExpenseCategoriesQuery();
        }
예제 #8
0
        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 employeeFactory = new EmployeeJournalFactory();

            evmeCashier.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();
            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();
            evmeEmployee.ChangedByUser += (sender, e) => UpdateEmployeeBalaceInfo();

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

            var expenseFactory = new ExpenseCategorySelectorFactory();

            entityVMEntryExpenseCategory
            .SetEntityAutocompleteSelectorFactory(expenseFactory.CreateSimpleExpenseCategoryAutocompleteSelectorFactory());
            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;
            }
        }
예제 #9
0
        private void ConfigureDlg()
        {
            var employeeFactory = new EmployeeJournalFactory();

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            datePickerFrom.IsEditable = true;
            datePickerTo.IsEditable   = true;

            buttonRecalculate.Clicked          += ButtonRecalculate_Clicked;
            buttonRecalculateForwarder.Clicked += ButtonRecalculateForwarder_Clicked;;
        }
예제 #10
0
        void ConfigureDlg()
        {
            accessfilteredsubdivisionselectorwidget.OnSelected += Accessfilteredsubdivisionselectorwidget_OnSelected;
            if (Entity.RelatedToSubdivision != null)
            {
                accessfilteredsubdivisionselectorwidget.SelectIfPossible(Entity.RelatedToSubdivision);
            }

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, e => e.Accountable, w => w.Subject).InitializeFromSource();
            evmeEmployee.Changed += (sender, e) => FillDebt();

            evmeCashier.Binding.AddBinding(Entity, e => e.Casher, w => w.Subject).InitializeFromSource();
            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());

            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;
            }
        }
        protected override void ConfigureWithUow()
        {
            enumcomboDocumentType.ItemsEnum = typeof(CashDocumentType);
            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Changed += (sender, args) => OnRefiltered();

            ConfigureEntityViewModelEntry();

            //Последние 30 дней.
            dateperiodDocs.StartDateOrNull = DateTime.Today.AddDays(-30);
            dateperiodDocs.EndDateOrNull   = DateTime.Today.AddDays(1);
        }
예제 #12
0
        private void ConfigureDlg()
        {
            DateTime now = DateTime.Now;

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Changed += YentryEmployee_Changed;

            yenumcomboMonth.ItemsEnum         = typeof(Month);
            yenumcomboMonth.SelectedItem      = (Month)now.Month;
            yenumcomboMonth.EnumItemSelected += YenumcomboMonth_EnumItemSelected;

            yspinYear.Value         = (double)now.Year;
            yspinYear.ValueChanged += YspinYear_ValueChanged;

            workcharttable.Date = now;
        }
예제 #13
0
        public void ConfigureDlg(IUnitOfWork uow, UndeliveredOrder undelivery)
        {
            Sensitive = false;
            evmeOldUndeliveredOrder.Changed += OnUndeliveredOrderChanged;

            _canChangeProblemSource = _commonServices.PermissionService.ValidateUserPresetPermission("can_change_undelivery_problem_source", _commonServices.UserService.CurrentUserId);
            _undelivery             = undelivery;
            UoW       = uow;
            _oldOrder = undelivery.OldOrder;
            _newOrder = undelivery.NewOrder;
            if (undelivery.Id > 0 && undelivery.InProcessAtDepartment != null)
            {
                _initialProcDepartmentName = undelivery.InProcessAtDepartment.Name;
            }
            if (undelivery.Id > 0)
            {
                foreach (GuiltyInUndelivery g in undelivery.ObservableGuilty)
                {
                    _initialGuiltyList.Add(
                        new GuiltyInUndelivery {
                        Id = g.Id,
                        UndeliveredOrder = g.UndeliveredOrder,
                        GuiltySide       = g.GuiltySide,
                        GuiltyDepartment = g.GuiltyDepartment
                    }
                        );
                }
            }
            List <OrderStatus> hiddenStatusesList = new List <OrderStatus>();
            var grantedStatusesArray = _orderRepository.GetStatusesForOrderCancelation();

            foreach (OrderStatus status in Enum.GetValues(typeof(OrderStatus)))
            {
                if (!grantedStatusesArray.Contains(status))
                {
                    hiddenStatusesList.Add(status);
                }
            }
            var filterOrders = new OrderJournalFilterViewModel(new CounterpartyJournalFactory(), new DeliveryPointJournalFactory());

            filterOrders.SetAndRefilterAtOnce(x => x.HideStatuses = hiddenStatusesList.Cast <Enum>().ToArray());
            evmeOldUndeliveredOrder.Changed += (sender, e) => {
                _oldOrder      = undelivery.OldOrder;
                lblInfo.Markup = undelivery.GetOldOrderInfo(_orderRepository);
                if (undelivery.Id <= 0)
                {
                    undelivery.OldOrderStatus = _oldOrder.OrderStatus;
                }
                _routeListDoesNotExist = _oldOrder != null && (undelivery.OldOrderStatus == OrderStatus.NewOrder ||
                                                               undelivery.OldOrderStatus == OrderStatus.Accepted ||
                                                               undelivery.OldOrderStatus == OrderStatus.WaitForPayment);

                guiltyInUndeliveryView.ConfigureWidget(UoW, undelivery, !_routeListDoesNotExist);
                SetSensitivities();
                SetVisibilities();
                GetFines();
                RemoveItemsFromEnums();
            };
            var orderFactory = new OrderSelectorFactory(filterOrders);

            evmeOldUndeliveredOrder.SetEntityAutocompleteSelectorFactory(orderFactory.CreateOrderAutocompleteSelectorFactory());
            evmeOldUndeliveredOrder.Binding.AddBinding(undelivery, x => x.OldOrder, x => x.Subject).InitializeFromSource();
            evmeOldUndeliveredOrder.CanEditReference =
                ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            yDateDriverCallTime.Binding.AddBinding(undelivery, t => t.DriverCallTime, w => w.DateOrNull).InitializeFromSource();
            if (undelivery.Id <= 0)
            {
                yDateDriverCallTime.DateOrNull = DateTime.Now;
            }

            yEnumCMBDriverCallPlace.ItemsEnum = typeof(DriverCallType);
            yEnumCMBDriverCallPlace.Binding.AddBinding(undelivery, p => p.DriverCallType, w => w.SelectedItem).InitializeFromSource();

            yDateDispatcherCallTime.Binding.AddBinding(undelivery, t => t.DispatcherCallTime, w => w.DateOrNull).InitializeFromSource();
            if (undelivery.Id <= 0)
            {
                yDateDispatcherCallTime.DateOrNull = DateTime.Now;
            }

            referenceNewDeliverySchedule.ItemsQuery = _deliveryScheduleRepository.AllQuery();
            referenceNewDeliverySchedule.SetObjectDisplayFunc <DeliverySchedule>(e => e.Name);
            referenceNewDeliverySchedule.Binding.AddBinding(undelivery, s => s.NewDeliverySchedule, w => w.Subject).InitializeFromSource();
            referenceNewDeliverySchedule.Sensitive = false;

            SetLabelsAcordingToNewOrder();

            yEnumCMBStatus.ItemsEnum         = typeof(UndeliveryStatus);
            yEnumCMBStatus.SelectedItem      = undelivery.UndeliveryStatus;
            yEnumCMBStatus.EnumItemSelected += (s, e) => {
                SetSensitivities();
                undelivery.SetUndeliveryStatus((UndeliveryStatus)e.SelectedItem);
            };

            yentInProcessAtDepartment.SubjectType = typeof(Subdivision);
            yentInProcessAtDepartment.Binding.AddBinding(undelivery, d => d.InProcessAtDepartment, w => w.Subject).InitializeFromSource();
            yentInProcessAtDepartment.ChangedByUser += (s, e) => {
                undelivery.AddCommentToTheField(
                    UoW,
                    CommentedFields.Reason,
                    String.Format(
                        "сменил(а) \"в работе у отдела\" \nс \"{0}\" на \"{1}\"",
                        _initialProcDepartmentName,
                        undelivery.InProcessAtDepartment.Name
                        )
                    );
            };

            if (undelivery.Id <= 0)
            {
                yentInProcessAtDepartment.Subject = _subdivisionRepository.GetQCDepartment(UoW);
            }

            var employeeFactory = new EmployeeJournalFactory();

            evmeRegisteredBy.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeRegisteredBy.Binding.AddBinding(undelivery, s => s.EmployeeRegistrator, w => w.Subject).InitializeFromSource();

            yEnumCMBDriverCallPlace.EnumItemSelected += CMBSelectedItemChanged;

            txtReason.Binding.AddBinding(undelivery, u => u.Reason, w => w.Buffer.Text).InitializeFromSource();

            lblInfo.Markup = undelivery.GetOldOrderInfo(_orderRepository);

            yenumcomboboxTransferType.ItemsEnum = typeof(TransferType);
            yenumcomboboxTransferType.Binding.AddBinding(undelivery, u => u.OrderTransferType, w => w.SelectedItemOrNull).InitializeFromSource();

            comboProblemSource.SetRenderTextFunc <UndeliveryProblemSource>(k => k.GetFullName);
            comboProblemSource.Binding.AddBinding(undelivery, u => u.ProblemSourceItems, w => w.ItemsList).InitializeFromSource();
            comboProblemSource.Binding.AddBinding(undelivery, u => u.ProblemSource, w => w.SelectedItem).InitializeFromSource();
            comboProblemSource.Sensitive = _canChangeProblemSource;

            comboTransferAbsenceReason.SetRenderTextFunc <UndeliveryTransferAbsenceReason>(u => u.Name);
            comboTransferAbsenceReason.Binding.AddBinding(undelivery, u => u.UndeliveryTransferAbsenceReasonItems, w => w.ItemsList).InitializeFromSource();
            comboTransferAbsenceReason.Binding.AddBinding(undelivery, u => u.UndeliveryTransferAbsenceReason, w => w.SelectedItem).InitializeFromSource();
            comboTransferAbsenceReason.Sensitive = _canChangeProblemSource;

            yTreeFines.ColumnsConfig = ColumnsConfigFactory.Create <FineItem>()
                                       .AddColumn("Номер").AddTextRenderer(node => node.Fine.Id.ToString())
                                       .AddColumn("Сотудники").AddTextRenderer(node => node.Employee.ShortName)
                                       .AddColumn("Сумма штрафа").AddTextRenderer(node => CurrencyWorks.GetShortCurrencyString(node.Money))
                                       .Finish();

            yenumcomboboxTransferType.Visible = undelivery?.NewOrder != null;

            undelivery.PropertyChanged += (sender, e) => {
                if (e.PropertyName != "NewOrder")
                {
                    return;
                }

                if (undelivery.NewOrder == null)
                {
                    yenumcomboboxTransferType.Visible = false;
                    undelivery.OrderTransferType      = null;
                    return;
                }

                yenumcomboboxTransferType.Visible = true;
            };

            GetFines();
            SetVisibilities();
            SetSensitivities();
        }
        private void ConfigureDlg()
        {
            if (!_canEdit)
            {
                MessageDialogHelper.RunWarningDialog("Не достаточно прав. Обратитесь к руководителю.");
                UpdateSensitivity();
            }

            if (_canEdit && Entity.Status != RouteListStatus.Closed)
            {
                if (!Entity.RecountMileage())
                {
                    FailInitialize = true;
                    return;
                }
            }

            buttonAcceptFine.Clicked += ButtonAcceptFineOnClicked;

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(new CarJournalFactory(MainClass.MainWin.NavigationManager).CreateCarAutocompleteSelectorFactory());
            entityviewmodelentryCar.Binding.AddBinding(Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);

            var employeeFactory = new EmployeeJournalFactory();

            evmeDriver.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeDriver.Binding.AddBinding(Entity, rl => rl.Driver, widget => widget.Subject).InitializeFromSource();

            evmeForwarder.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeForwarder.Binding
            .AddBinding(Entity, rl => rl.Forwarder, widget => widget.Subject)
            .AddBinding(Entity, rl => rl.CanAddForwarder, widget => widget.Sensitive)
            .InitializeFromSource();

            evmeLogistician.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeLogistician.Binding.AddBinding(Entity, rl => rl.Logistician, widget => widget.Subject).InitializeFromSource();

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

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

            yspinConfirmedDistance.Binding.AddBinding(Entity, rl => rl.ConfirmedDistance, widget => widget.ValueAsDecimal).InitializeFromSource();

            yentryRecalculatedDistance.Binding.AddBinding(Entity, rl => rl.RecalculatedDistance, widget => widget.Text, new DecimalToStringConverter()).InitializeFromSource();

            ytreeviewAddresses.ColumnsConfig = ColumnsConfigFactory.Create <RouteListKeepingItemNode>()
                                               .AddColumn("Заказ")
                                               .AddTextRenderer(node => node.RouteListItem.Order.Id.ToString())
                                               .AddColumn("Адрес")
                                               .AddTextRenderer(node => String.Format("{0} д.{1}", node.RouteListItem.Order.DeliveryPoint.Street, node.RouteListItem.Order.DeliveryPoint.Building))
                                               .AddColumn("Время")
                                               .AddTextRenderer(node => node.RouteListItem.Order.DeliverySchedule == null ? "" : node.RouteListItem.Order.DeliverySchedule.Name)
                                               .AddColumn("Статус")
                                               .AddEnumRenderer(node => node.Status).Editing(false)
                                               .AddColumn("Доставка за час")
                                               .AddToggleRenderer(x => x.RouteListItem.Order.IsFastDelivery).Editing(false)
                                               .AddColumn("Последнее редактирование")
                                               .AddTextRenderer(node => node.LastUpdate)
                                               .RowCells()
                                               .AddSetter <CellRenderer>((cell, node) => cell.CellBackgroundGdk = node.RowColor)
                                               .Finish();

            items = new List <RouteListKeepingItemNode>();
            foreach (var item in Entity.Addresses)
            {
                items.Add(new RouteListKeepingItemNode {
                    RouteListItem = item
                });
            }

            items.Sort((x, y) => {
                if (x.RouteListItem.StatusLastUpdate.HasValue && y.RouteListItem.StatusLastUpdate.HasValue)
                {
                    if (x.RouteListItem.StatusLastUpdate > y.RouteListItem.StatusLastUpdate)
                    {
                        return(1);
                    }
                    if (x.RouteListItem.StatusLastUpdate < y.RouteListItem.StatusLastUpdate)
                    {
                        return(-1);
                    }
                }
                return(0);
            });

            ytreeviewAddresses.ItemsDataSource = items;
            ytextviewMileageComment.Binding.AddBinding(Entity, x => x.MileageComment, w => w.Buffer.Text).InitializeFromSource();

            //Телефон
            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();
        }
예제 #15
0
        void ConfigureDlg()
        {
            if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.WriteoffEdit, Entity.WriteoffWarehouse))
            {
                FailInitialize = true;
                return;
            }

            var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.WriteoffEdit, Entity.WriteoffWarehouse);

            evmeEmployee.IsEditable = textComment.Editable = editing;
            writeoffdocumentitemsview1.Sensitive = editing && (Entity.WriteoffWarehouse != null || Entity.Client != null);

            textComment.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();
            labelTimeStamp.Binding.AddBinding(Entity, e => e.DateString, w => w.LabelProp).InitializeFromSource();

            var clientFactory = new CounterpartyJournalFactory();

            evmeCounterparty.SetEntityAutocompleteSelectorFactory(clientFactory.CreateCounterpartyAutocompleteSelectorFactory());
            evmeCounterparty.Binding.AddBinding(Entity, e => e.Client, w => w.Subject).InitializeFromSource();
            evmeCounterparty.Changed += OnReferenceCounterpartyChanged;

            ySpecCmbWarehouses.ItemsList = StoreDocumentHelper.GetRestrictedWarehousesList(UoW, WarehousePermissions.WriteoffEdit);
            ySpecCmbWarehouses.Binding.AddBinding(Entity, e => e.WriteoffWarehouse, w => w.SelectedItem).InitializeFromSource();
            ySpecCmbWarehouses.ItemSelected += (sender, e) => {
                writeoffdocumentitemsview1.Sensitive = editing && (Entity.WriteoffWarehouse != null || Entity.Client != null);
            };

            var dpFactory = new DeliveryPointJournalFactory(_deliveryPointJournalFilterViewModel);

            evmeDeliveryPoint.SetEntityAutocompleteSelectorFactory(dpFactory.CreateDeliveryPointByClientAutocompleteSelectorFactory());
            evmeDeliveryPoint.CanEditReference = false;
            evmeDeliveryPoint.Binding.AddBinding(Entity, e => e.DeliveryPoint, w => w.Subject).InitializeFromSource();

            var userHasOnlyAccessToWarehouseAndComplaints =
                ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !ServicesConfig.CommonServices.UserService.GetCurrentUser(UoW).IsAdmin;

            if (userHasOnlyAccessToWarehouseAndComplaints)
            {
                evmeEmployee.CanEditReference = false;
            }

            var employeeFactory = new EmployeeJournalFactory();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, e => e.ResponsibleEmployee, w => w.Subject).InitializeFromSource();
            comboType.ItemsEnum         = typeof(WriteoffType);
            evmeDeliveryPoint.Sensitive = evmeCounterparty.Sensitive = (UoWGeneric.Root.Client != null);
            comboType.EnumItemSelected += (object sender, Gamma.Widgets.ItemSelectedEventArgs e) => {
                ySpecCmbWarehouses.Sensitive = WriteoffType.warehouse.Equals(comboType.SelectedItem);
                evmeDeliveryPoint.Sensitive  = WriteoffType.counterparty.Equals(comboType.SelectedItem) && UoWGeneric.Root.Client != null;
                evmeCounterparty.Sensitive   = WriteoffType.counterparty.Equals(comboType.SelectedItem);
            };
            //FIXME Списание с контрагента не реализовано. Поэтому блокирует выбор типа списания.
            comboType.Sensitive    = false;
            comboType.SelectedItem = UoWGeneric.Root.Client != null ?
                                     WriteoffType.counterparty :
                                     WriteoffType.warehouse;

            writeoffdocumentitemsview1.DocumentUoW = UoWGeneric;

            Entity.ObservableItems.ElementAdded   += (aList, aIdx) => ySpecCmbWarehouses.Sensitive = !Entity.ObservableItems.Any();
            Entity.ObservableItems.ElementRemoved += (aList, aIdx, aObject) => ySpecCmbWarehouses.Sensitive = !Entity.ObservableItems.Any();
            ySpecCmbWarehouses.Sensitive           = editing && !Entity.Items.Any();

            var permmissionValidator =
                new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), _employeeRepository);

            Entity.CanEdit =
                permmissionValidator.Validate(
                    typeof(WriteoffDocument), ServicesConfig.UserService.CurrentUserId, nameof(RetroactivelyClosePermission));

            if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date)
            {
                ySpecCmbWarehouses.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                evmeCounterparty.Sensitive           = false;
                evmeDeliveryPoint.Sensitive          = false;
                comboType.Sensitive                  = false;
                evmeEmployee.Sensitive               = false;
                textComment.Sensitive                = false;
                writeoffdocumentitemsview1.Sensitive = false;

                buttonSave.Sensitive = false;
            }
            else
            {
                Entity.CanEdit = true;
            }
        }
예제 #16
0
        void ConfigureDlg()
        {
            enumStatus.Sensitive         = enumType.Sensitive = false;
            enumStatusEditable.Sensitive = true;
            notebook1.ShowTabs           = false;
            notebook1.CurrentPage        = 0;

            enumcomboWithSerial.ItemsEnum = typeof(ServiceClaimEquipmentSerialType);
            enumcomboWithSerial.Binding.AddBinding(Entity, e => e.WithSerial, w => w.SelectedItem).InitializeFromSource();
            enumStatus.ItemsEnum = typeof(ServiceClaimStatus);
            enumStatus.Binding.AddBinding(Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();
            enumType.ItemsEnum = typeof(ServiceClaimType);
            enumType.Binding.AddBinding(Entity, e => e.ServiceClaimType, w => w.SelectedItem).InitializeFromSource();
            enumPaymentType.ItemsEnum = typeof(PaymentType);
            enumPaymentType.Binding.AddBinding(Entity, e => e.Payment, w => w.SelectedItem).InitializeFromSource();

            checkRepeated.Binding.AddBinding(Entity, e => e.RepeatedService, w => w.Active).InitializeFromSource();
            dataNumber.Binding.AddBinding(Entity, e => e.Id, w => w.LabelProp, new IdToStringConverter()).InitializeFromSource();
            labelTotalPrice.Binding.AddFuncBinding(Entity, e => e.TotalPrice.ToString("C"), w => w.LabelProp).InitializeFromSource();
            datePickUpDate.Binding.AddBinding(Entity, e => e.ServiceStartDate, w => w.Date).InitializeFromSource();
            textReason.Binding.AddBinding(Entity, e => e.Reason, w => w.Buffer.Text).InitializeFromSource();
            textKit.Binding.AddBinding(Entity, e => e.Kit, w => w.Buffer.Text).InitializeFromSource();
            textDiagnosticsResult.Binding.AddBinding(Entity, e => e.DiagnosticsResult, w => w.Buffer.Text).InitializeFromSource();

            var clientFactory = new CounterpartyJournalFactory();

            evmeClient.SetEntityAutocompleteSelectorFactory(clientFactory.CreateCounterpartyAutocompleteSelectorFactory());
            evmeClient.Binding.AddBinding(Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();
            evmeClient.Changed += OnReferenceCounterpartyChanged;

            var employeeFactory = new EmployeeJournalFactory();

            evmeEngineer.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEngineer.Binding.AddBinding(Entity, e => e.Engineer, w => w.Subject).InitializeFromSource();

            yentryEquipmentReplacement.ItemsQuery = _equipmentRepository.AvailableOnDutyEquipmentQuery();
            yentryEquipmentReplacement.SetObjectDisplayFunc <Equipment> (e => e.Title);
            yentryEquipmentReplacement.Binding
            .AddBinding(UoWGeneric.Root, serviceClaim => serviceClaim.ReplacementEquipment, widget => widget.Subject)
            .InitializeFromSource();

            evmeDeliveryPoint.Sensitive = (UoWGeneric.Root.Counterparty != null);
            evmeDeliveryPoint.Binding.AddBinding(Entity, e => e.DeliveryPoint, w => w.Subject).InitializeFromSource();
            evmeDeliveryPoint.Changed += OnReferenceDeliveryPointChanged;
            var dpFactory = new DeliveryPointJournalFactory();

            dpFactory.SetDeliveryPointJournalFilterViewModel(_deliveryPointJournalFilterViewModel);
            evmeDeliveryPoint.SetEntityAutocompleteSelectorFactory(dpFactory.CreateDeliveryPointByClientAutocompleteSelectorFactory());

            referenceNomenclature.ItemsQuery = _nomenclatureRepository.NomenclatureOfItemsForService();
            referenceNomenclature.Binding.AddBinding(Entity, e => e.Nomenclature, w => w.Subject).InitializeFromSource();

            referenceEquipment.SubjectType = typeof(Equipment);
            referenceEquipment.Sensitive   = (UoWGeneric.Root.Nomenclature != null);
            referenceEquipment.Binding.AddBinding(Entity, e => e.Equipment, w => w.Subject).InitializeFromSource();

            treePartsAndServices.ItemsDataSource = UoWGeneric.Root.ObservableServiceClaimItems;
            treeHistory.ItemsDataSource          = UoWGeneric.Root.ObservableServiceClaimHistory;

            treePartsAndServices.ColumnsConfig = FluentColumnsConfig <ServiceClaimItem> .Create()
                                                 .AddColumn("Номенклатура").SetDataProperty(node => node.Nomenclature != null ? node.Nomenclature.Name : "-")
                                                 .AddColumn("Кол-во").AddNumericRenderer(node => node.Count)
                                                 .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                                 .AddSetter((c, node) => c.Digits = node.Nomenclature.Unit == null ? 0 : (uint)node.Nomenclature.Unit.Digits)
                                                 .AddSetter((c, i) => c.Editable  = isEditable)
                                                 .WidthChars(10)
                                                 .AddColumn("Цена").AddNumericRenderer(node => node.Price).Digits(2)
                                                 .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                                 .AddColumn("Сумма").AddNumericRenderer(node => node.Total).Digits(2)
                                                 .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                                 .Finish();

            treeHistory.ColumnsConfig = FluentColumnsConfig <ServiceClaimHistory> .Create()
                                        .AddColumn("Дата").SetDataProperty(node => node.Date.ToShortDateString())
                                        .AddColumn("Время").SetDataProperty(node => node.Date.ToString("HH:mm"))
                                        .AddColumn("Статус").SetDataProperty(node => node.Status.GetEnumTitle())
                                        .AddColumn("Сотрудник").SetDataProperty(node => node.Employee == null ? " - " : node.Employee.FullName)
                                        .AddColumn("Комментарий").SetDataProperty(node => node.Comment)
                                        .Finish();

            UoWGeneric.Root.ObservableServiceClaimItems.ElementChanged += (aList, aIdx) => FixPrice(aIdx [0]);
            configureAvailableNextStatus();
            Entity.PropertyChanged += Entity_PropertyChanged;

            if (UoWGeneric.Root.ServiceClaimType == ServiceClaimType.JustService)
            {
                evmeDeliveryPoint.Visible          = false;
                labelDeliveryPoint.Visible         = false;
                yentryEquipmentReplacement.Visible = false;
                labelReplacement.Visible           = false;
            }
            datePickUpDate.IsEditable = Entity.InitialOrder == null;
            Menu menu            = new Menu();
            var  menuItemInitial = new MenuItem("Перейти к начальному заказу");

            menuItemInitial.Sensitive  = Entity.InitialOrder != null;
            menuItemInitial.Activated += MenuInitialOrderActivated;
            menu.Add(menuItemInitial);
            var menuItemFinal = new MenuItem("Перейти к финальному заказу");

            menuItemFinal.Sensitive  = Entity.FinalOrder != null;
            menuItemFinal.Activated += MenuFinalOrderActivated;
            menu.Add(menuItemFinal);
            menuActions.Menu = menu;
            menu.ShowAll();
        }
        private void ConfigureDlg()
        {
            buttonSave.Sensitive = _allEditing;

            Entity.ObservableAddresses.ElementAdded   += ObservableAddresses_ElementAdded;
            Entity.ObservableAddresses.ElementRemoved += ObservableAddresses_ElementRemoved;
            Entity.ObservableAddresses.ElementChanged += ObservableAddresses_ElementChanged;

            entityviewmodelentryCar.SetEntityAutocompleteSelectorFactory(new CarJournalFactory(MainClass.MainWin.NavigationManager).CreateCarAutocompleteSelectorFactory());
            entityviewmodelentryCar.Binding.AddBinding(Entity, e => e.Car, w => w.Subject).InitializeFromSource();
            entityviewmodelentryCar.CompletionPopupSetWidth(false);
            entityviewmodelentryCar.Sensitive = _logisticanEditing;

            additionalloadingtextview.Binding
            .AddBinding(Entity, e => e.AdditionalLoadingDocument, w => w.AdditionalLoadingDocument)
            .InitializeFromSource();
            additionalloadingtextview.Visible = Entity.AdditionalLoadingDocument != null;

            var driverFilter = new EmployeeFilterViewModel();

            driverFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.driver);
            var driverFactory = new EmployeeJournalFactory(driverFilter);

            evmeDriver.SetEntityAutocompleteSelectorFactory(driverFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeDriver.Binding.AddBinding(Entity, rl => rl.Driver, widget => widget.Subject).InitializeFromSource();
            evmeDriver.Sensitive = _logisticanEditing;

            var forwarderFilter = new EmployeeFilterViewModel();

            forwarderFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.forwarder);
            var forwarderFactory = new EmployeeJournalFactory(forwarderFilter);

            evmeForwarder.SetEntityAutocompleteSelectorFactory(forwarderFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeForwarder.Binding.AddSource(Entity)
            .AddBinding(rl => rl.Forwarder, widget => widget.Subject)
            .AddFuncBinding(rl => _logisticanEditing && rl.CanAddForwarder, widget => widget.Sensitive)
            .InitializeFromSource();

            evmeForwarder.Changed += ReferenceForwarder_Changed;

            var employeeFactory = new EmployeeJournalFactory();

            evmeLogistician.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeLogistician.Binding.AddBinding(Entity, rl => rl.Logistician, widget => widget.Subject).InitializeFromSource();
            evmeLogistician.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");

            btnReDeliver.Binding.AddBinding(Entity, e => e.CanChangeStatusToDeliveredWithIgnoringAdditionalLoadingDocument, w => w.Sensitive).InitializeFromSource();

            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("Доставка за час")
                                               .AddToggleRenderer(x => x.RouteListItem.Order.IsFastDelivery).Editing(false)
                                               .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();
        }
예제 #18
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 employeeFactory = new EmployeeJournalFactory();

            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateEmployeeAutocompleteSelectorFactory());
            evmeCashier.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();
            evmeEmployee.Changed += (sender, e) => FillDebts();

            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;
            }
        }
예제 #19
0
        private void ConfigureDlg()
        {
            subdivisionentitypermissionwidget.ConfigureDlg(UoW, Entity);
            yentryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            yentryShortName.Binding.AddBinding(Entity, e => e.ShortName, w => w.Text).InitializeFromSource();
            yentryrefParentSubdivision.SubjectType = typeof(Subdivision);
            yentryrefParentSubdivision.Binding.AddBinding(Entity, e => e.ParentSubdivision, w => w.Subject).InitializeFromSource();

            var employeeFactory = new EmployeeJournalFactory();

            evmeChief.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
            evmeChief.Binding.AddBinding(Entity, e => e.Chief, w => w.Subject).InitializeFromSource();

            yenumcomboType.ItemsEnum = typeof(SubdivisionType);
            yenumcomboType.Binding.AddBinding(Entity, e => e.SubdivisionType, w => w.SelectedItem).InitializeFromSource();
            yenumcomboType.Sensitive = false;

            subdivisionsVM = new SubdivisionsVM(UoW, Entity);
            repTreeChildSubdivisions.RepresentationModel = subdivisionsVM;
            repTreeChildSubdivisions.YTreeModel          = new RecursiveTreeModel <SubdivisionVMNode>(subdivisionsVM.Result, x => x.Parent, x => x.Children);

            ySpecCmbGeographicGroup.ItemsList = UoW.Session.QueryOver <GeographicGroup>().List();
            ySpecCmbGeographicGroup.Binding.AddBinding(Entity, e => e.GeographicGroup, w => w.SelectedItem).InitializeFromSource();
            ySpecCmbGeographicGroup.ItemSelected += YSpecCmbGeographicGroup_ItemSelected;
            SetControlsAccessibility();

            ytreeviewDocuments.ColumnsConfig = ColumnsConfigFactory.Create <TypeOfEntity>()
                                               .AddColumn("Документ").AddTextRenderer(x => x.CustomName)
                                               .Finish();
            ytreeviewDocuments.ItemsDataSource = Entity.ObservableDocumentTypes;

            lblWarehouses.LineWrapMode = Pango.WrapMode.Word;
            if (Entity.Id > 0)
            {
                lblWarehouses.Text = Entity.GetWarehousesNames(UoW, _subdivisionRepository);
            }
            else
            {
                frmWarehoses.Visible = false;
            }
            vboxDocuments.Visible = QSMain.User.Admin;

            presetPermissionVM = new PresetSubdivisionPermissionsViewModel(UoW, new PermissionRepository(), Entity);
            vboxPresetPermissions.Add(new PresetPermissionsView(presetPermissionVM));
            vboxPresetPermissions.ShowAll();
            vboxPresetPermissions.Visible = QSMain.User.Admin;

            presetPermissionVM.ObservablePermissionsList.ListContentChanged += (sender, e) => HasChanges = true;
            Entity.ObservableDocumentTypes.ListContentChanged += (sender, e) => HasChanges = true;
            subdivisionentitypermissionwidget.ViewModel.ObservableTypeOfEntitiesList.ListContentChanged += (sender, e) => HasChanges = true;

            entryDefaultSalesPlan.SetEntityAutocompleteSelectorFactory(
                new EntityAutocompleteSelectorFactory <SalesPlanJournalViewModel>(typeof(SalesPlan),
                                                                                  () => new SalesPlanJournalViewModel(
                                                                                      UnitOfWorkFactory.GetDefaultFactory,
                                                                                      ServicesConfig.CommonServices,
                                                                                      new NomenclatureJournalFactory())
            {
                SelectionMode = JournalSelectionMode.Single
            }
                                                                                  ));
            entryDefaultSalesPlan.Binding.AddBinding(Entity, s => s.DefaultSalesPlan, w => w.Subject).InitializeFromSource();
            entryDefaultSalesPlan.CanEditReference = false;
        }