Exemplo n.º 1
0
        void OnRouteListItemActivated(object sender, RowActivatedArgs args)
        {
            var node = routeListAddressesView.GetSelectedRouteListItem();
            var dlg  = new OrderReturnsView(node, UoW);

            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 2
0
        protected void OnBtnAddNomenclatureClicked(object sender, System.EventArgs e)
        {
            var nomenclatureFilter = new NomenclatureRepFilter(UoWGeneric);

            nomenclatureFilter.SetAndRefilterAtOnce(
                x => x.AvailableCategories         = Nomenclature.GetCategoriesForSaleToOrder(),
                x => x.DefaultSelectedCategory     = NomenclatureCategory.water,
                x => x.DefaultSelectedSaleCategory = SaleCategory.forSale
                );
            PermissionControlledRepresentationJournal SelectDialog = new PermissionControlledRepresentationJournal(new NomenclatureForSaleVM(nomenclatureFilter))
            {
                Mode       = JournalSelectMode.Multiple,
                ShowFilter = true
            };

            SelectDialog.CustomTabName("Номенклатура на продажу");
            SelectDialog.ObjectSelected += (s, ea) => {
                var selectedNodes = ea.GetNodes <NomenclatureForSaleVMNode>();
                if (!selectedNodes.Any())
                {
                    return;
                }
                foreach (var node in selectedNodes)
                {
                    Nomenclature n = UoWGeneric.GetById <Nomenclature>(node.Id);
                    if (n != null && !Entity.ObservableNomenclatures.Any(x => x == n))
                    {
                        Entity.ObservableNomenclatures.Add(n);
                    }
                }
            };
            TabParent.AddSlaveTab(this, SelectDialog);
        }
Exemplo n.º 3
0
        protected void OnButtonBottleAddEditFineClicked(object sender, EventArgs e)
        {
            string fineReason       = "Недосдача";
            var    bottleDifference = bottlesReturnedTotal - bottlesReturnedToWarehouse;
            var    summ             = DefaultBottle.SumOfDamage * (bottleDifference > 0 ? bottleDifference : (decimal)0);

            summ += routelistdiscrepancyview.Items.Where(x => x.UseFine).Sum(x => x.SumOfDamage);
            var nomenclatures = routelistdiscrepancyview.Items.Where(x => x.UseFine)
                                .ToDictionary(x => x.Nomenclature, x => - x.Remainder);

            if (checkUseBottleFine.Active)
            {
                nomenclatures.Add(DefaultBottle, bottleDifference);
            }

            FineDlg fineDlg;

            if (Entity.BottleFine != null)
            {
                fineDlg = new FineDlg(Entity.BottleFine);

                Entity.BottleFine.UpdateNomenclature(nomenclatures);
                fineDlg.Entity.TotalMoney = summ;
                fineDlg.EntitySaved      += FineDlgExist_EntitySaved;
            }
            else
            {
                fineDlg = new FineDlg(summ, Entity, fineReason, Entity.Date, Entity.Driver);
                fineDlg.Entity.AddNomenclature(nomenclatures);
                fineDlg.EntitySaved += FineDlgNew_EntitySaved;
            }
            TabParent.AddSlaveTab(this, fineDlg);
        }
Exemplo n.º 4
0
 private void CreateActivateNodeAction()
 {
     PopupActionsList.Add(
         new JournalAction(
             "Активировать",
             selectedItems => canActivateDistrictsSet && canUpdate &&
             selectedItems.OfType <DistrictsSetJournalNode>().FirstOrDefault()?.Status == DistrictsSetStatus.Draft,
             selectedItems => true,
             selectedItems => {
         var selectedNodes = selectedItems.OfType <DistrictsSetJournalNode>();
         var selectedNode  = selectedNodes.FirstOrDefault();
         if (selectedNode == null)
         {
             return;
         }
         var activeDistrictsSet = UoW.Session.QueryOver <DistrictsSet>().Where(x => x.Status == DistrictsSetStatus.Active).Take(1).SingleOrDefault();
         if (activeDistrictsSet?.DateCreated > selectedNode.DateCreated)
         {
             commonServices.InteractiveService.ShowMessage(ImportanceLevel.Warning, "Нельзя активировать, так как дата создания выбранной версии меньше чем дата создания активной версии");
             return;
         }
         var selectedDistrictsSet = UoW.GetById <DistrictsSet>(selectedNode.Id);
         if (selectedDistrictsSet.Districts.All(x => x.CopyOf == null) &&
             !commonServices.InteractiveService.Question("Для выбранной версии невозможно перенести все приоритеты работы водителей\nПродолжить?"))
         {
             return;
         }
         TabParent.AddSlaveTab(this,
                               new DistrictsSetActivationViewModel(EntityUoWBuilder.ForOpen(selectedNode.Id), QS.DomainModel.UoW.UnitOfWorkFactory.GetDefaultFactory, commonServices)
                               );
     }
             )
         );
 }
 private void CreateAddWriteoffItemCommand()
 {
     AddWriteoffItemCommand = new DelegateCommand(
         () => {
         var fuelTypeJournalViewModel = new SimpleEntityJournalViewModel <FuelType, FuelTypeViewModel>(x => x.Name,
                                                                                                       () => new FuelTypeViewModel(EntityUoWBuilder.ForCreate(), unitOfWorkFactory, commonServices),
                                                                                                       (node) => new FuelTypeViewModel(EntityUoWBuilder.ForOpen(node.Id), unitOfWorkFactory, commonServices),
                                                                                                       QS.DomainModel.UoW.UnitOfWorkFactory.GetDefaultFactory,
                                                                                                       commonServices
                                                                                                       );
         fuelTypeJournalViewModel.SetRestriction(() => {
             return(Restrictions.Not(Restrictions.In(Projections.Id(), Entity.ObservableFuelWriteoffDocumentItems.Select(x => x.FuelType.Id).ToArray())));
         });
         fuelTypeJournalViewModel.SelectionMode           = JournalSelectionMode.Single;
         fuelTypeJournalViewModel.OnEntitySelectedResult += (sender, e) => {
             var node = e.SelectedNodes.FirstOrDefault();
             if (node == null)
             {
                 return;
             }
             Entity.AddNewWriteoffItem(UoW.GetById <FuelType>(node.Id));
         };
         TabParent.AddSlaveTab(this, fuelTypeJournalViewModel);
     },
         () => CanEdit
         );
     AddWriteoffItemCommand.CanExecuteChangedWith(this, x => CanEdit);
 }
Exemplo n.º 6
0
        protected void OnButtonChangeDeliveryTimeClicked(object sender, EventArgs e)
        {
            if (ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("logistic_changedeliverytime"))
            {
                var selectedObjects = ytreeviewAddresses.GetSelectedObjects();
                if (selectedObjects.Count() != 1)
                {
                    return;
                }
                var selectedAddress = selectedObjects
                                      .Cast <RouteListKeepingItemNode>()
                                      .FirstOrDefault();

                OrmReference SelectDialog;

                ICriteria ItemsCriteria = UoWGeneric.Session.CreateCriteria(typeof(DeliverySchedule));
                SelectDialog = new OrmReference(typeof(DeliverySchedule), UoWGeneric, ItemsCriteria)
                {
                    Mode = OrmReferenceMode.Select
                };
                SelectDialog.ObjectSelected += (selectSender, selectE) => {
                    if (selectedAddress.RouteListItem.Order.DeliverySchedule != (DeliverySchedule)selectE.Subject)
                    {
                        selectedAddress.RouteListItem.Order.DeliverySchedule = (DeliverySchedule)selectE.Subject;
                        selectedAddress.ChangedDeliverySchedule = true;
                    }
                };
                TabParent.AddSlaveTab(this, SelectDialog);
            }
        }
Exemplo n.º 7
0
        protected void OnButtonAddDocumentClicked(object sender, EventArgs e)
        {
            EmployeeDocDlg dlg = new EmployeeDocDlg(UoW, null);

            dlg.Save += (object sender1, EventArgs e1) => Entity.ObservableDocuments.Add(dlg.Entity);
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 8
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var nomenclatureSelector = _nomenclatureSelectorFactory.CreateNomenclatureSelector();

            nomenclatureSelector.OnEntitySelectedResult += NomenclatureSelectorOnEntitySelectedResult;
            TabParent.AddSlaveTab(this, nomenclatureSelector);
        }
Exemplo n.º 9
0
        void RunAgreementCreateDialog(CounterpartyContract contract)
        {
            ITdiTab dlg;
            string  paymentTypeString = "";

            switch (UoWGeneric.Root.Payment)
            {
            case PaymentType.cash:
                paymentTypeString = "наличной";
                break;

            case PaymentType.cashless:
                paymentTypeString = "безналичной";
                break;

            case PaymentType.barter:
                paymentTypeString = "бартерной";
                break;
            }
            string question = "Отсутствует доп. соглашение сервиса с клиентом в договоре для " +
                              paymentTypeString +
                              " формы оплаты. Создать?";

            if (MessageDialogWorks.RunQuestionDialog(question))
            {
                dlg = new RepairAgreementDlg(contract);
                (dlg as IAgreementSaved).AgreementSaved += (sender, e) => {
                    UoWGeneric.Root.InitialOrder?.CreateOrderAgreementDocument(e.Agreement);
                };
                TabParent.AddSlaveTab(this, dlg);
            }
        }
Exemplo n.º 10
0
 protected void OnButtonOpenExpenseClicked(object sender, EventArgs e)
 {
     if (FuelDocument.FuelCashExpense?.Id > 0)
     {
         TabParent.AddSlaveTab(this, new CashExpenseDlg(FuelDocument.FuelCashExpense.Id));
     }
 }
Exemplo n.º 11
0
        protected void OnYtreeviewAddressesRowActivated(object o, Gtk.RowActivatedArgs args)
        {
            var        node = ytreeviewAddresses.GetSelectedObject() as AddressNode;
            ITdiDialog dlg  = new DeliveryPointDlg(node.Address);

            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 12
0
        protected void OnBtnShowUndeliveryClicked(object sender, EventArgs e)
        {
            var undeliveredOrdersFilter = new UndeliveredOrdersFilterViewModel(
                ServicesConfig.CommonServices,
                new OrderSelectorFactory(),
                new EmployeeJournalFactory(),
                new CounterpartyJournalFactory(),
                new DeliveryPointJournalFactory(),
                new SubdivisionJournalFactory())
            {
                HidenByDefault            = true,
                RestrictOldOrder          = Entity.UndeliveredOrder.OldOrder,
                RestrictOldOrderStartDate = Entity.UndeliveredOrder.OldOrder.DeliveryDate,
                RestrictOldOrderEndDate   = Entity.UndeliveredOrder.OldOrder.DeliveryDate,
                RestrictUndeliveryStatus  = Entity.UndeliveredOrder.UndeliveryStatus
            };

            var dlg = new UndeliveredOrdersJournalViewModel(
                undeliveredOrdersFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new GtkTabsOpener(),
                new EmployeeJournalFactory(),
                VodovozGtkServicesConfig.EmployeeService,
                new UndeliveredOrdersJournalOpener(),
                new OrderSelectorFactory(),
                new UndeliveredOrdersRepository()
                );

            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 13
0
        protected void OnYtreeviewAddressesRowActivated(object o, Gtk.RowActivatedArgs args)
        {
            var id          = ytreeviewAddresses.GetSelectedObject <AddressNode>().Address.Id;
            var dpViewModel = _deliveryPointViewModelFactory.GetForOpenDeliveryPointViewModel(id);

            TabParent.AddSlaveTab(this, dpViewModel);
        }
Exemplo n.º 14
0
 protected void OnButtonEditDocumentClicked(object sender, EventArgs e)
 {
     if (ytreeviewEmployeeDocument.GetSelectedObject <EmployeeDocument>() != null)
     {
         EmployeeDocDlg dlg = new EmployeeDocDlg(((EmployeeDocument)ytreeviewEmployeeDocument.GetSelectedObjects()[0]).Id, UoW);
         TabParent.AddSlaveTab(this, dlg);
     }
 }
Exemplo n.º 15
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var nomenclatureSelectDlg = new OrmReference(nomenclatureRepository.NomenclatureOfGoodsOnlyQuery());

            nomenclatureSelectDlg.Mode            = OrmReferenceMode.Select;
            nomenclatureSelectDlg.ObjectSelected += NomenclatureSelectDlg_ObjectSelected;
            TabParent.AddSlaveTab(this, nomenclatureSelectDlg);
        }
Exemplo n.º 16
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var addEmployeeDlg = new ReferenceRepresentation(new EmployeesVM());

            addEmployeeDlg.Mode            = OrmReferenceMode.Select;
            addEmployeeDlg.ObjectSelected += AddEmployeeDlg_ObjectSelected;
            TabParent.AddSlaveTab(this, addEmployeeDlg);
        }
Exemplo n.º 17
0
        protected void OnBtnAddGeographicGroupClicked(object sender, EventArgs e)
        {
            var selectGeographicGroups = new OrmReference(typeof(GeographicGroup), UoW);

            selectGeographicGroups.Mode            = OrmReferenceMode.MultiSelect;
            selectGeographicGroups.ObjectSelected += SelectGeographicGroups_ObjectSelected;
            TabParent.AddSlaveTab(this, selectGeographicGroups);
        }
        protected void OnButtonAddScheduleClicked(object sender, EventArgs e)
        {
            var SelectSchedules = new OrmReference(typeof(DeliverySchedule), uow);

            SelectSchedules.Mode            = OrmReferenceMode.MultiSelect;
            SelectSchedules.ObjectSelected += SelectSchedules_ObjectSelected;
            TabParent.AddSlaveTab(this, SelectSchedules);
        }
Exemplo n.º 19
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var addEmployeeDlg = new PermissionControlledRepresentationJournal(new EmployeesVM());

            addEmployeeDlg.Mode            = JournalSelectMode.Single;
            addEmployeeDlg.ObjectSelected += AddEmployeeDlg_ObjectSelected;
            TabParent.AddSlaveTab(this, addEmployeeDlg);
        }
Exemplo n.º 20
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var dlg = new ReferenceRepresentation(new FittingsVM());

            dlg.Mode            = OrmReferenceMode.MultiSelect;
            dlg.ObjectSelected += Dlg_ObjectSelected1;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 21
0
        protected void OnButtonAddEnumItemClicked(object sender, QS.Widgets.EnumItemClickedEventArgs e)
        {
            ProxyDocumentType type = (ProxyDocumentType)e.ItemEnum;
            var dlg = OrmMain.CreateObjectDialog(ProxyDocument.GetProxyDocumentClass(type));

            dlg.EntitySaved += Dlg_EntitySaved;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 22
0
		protected void OnButtonFillClicked (object sender, EventArgs e)
		{
			OrmReference SelectDialog = new OrmReference (typeof(ProductSpecification), UoWGeneric);
			SelectDialog.Mode = OrmReferenceMode.Select;
			SelectDialog.ObjectSelected += SelectDialog_ObjectSelected;

			TabParent.AddSlaveTab (this, SelectDialog);
		}
Exemplo n.º 23
0
        protected void OnButtonAddDeliveryPointsClicked(object sender, EventArgs e)
        {
            var dlg = new PermissionControlledRepresentationJournal(new ViewModel.ClientDeliveryPointsVM(UoW, Entity.Counterparty));

            dlg.Mode            = JournalSelectMode.Multiple;
            dlg.ObjectSelected += Dlg_ObjectSelected;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 24
0
        protected void OnButtonAddDeliveryPointsClicked(object sender, EventArgs e)
        {
            var dlg = new ReferenceRepresentation(new ViewModel.ClientDeliveryPointsVM(UoW, Entity.Counterparty));

            dlg.Mode            = OrmReferenceMode.MultiSelect;
            dlg.ObjectSelected += Dlg_ObjectSelected;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 25
0
        protected void OnButtonEdit1Clicked(object sender, EventArgs e)
        {
            editingItem = projectTreeView.GetSelectedObject <ProjectItem> ();
            var dlg = new ReferenceRepresentation(new FittingsVM());

            dlg.Mode            = OrmReferenceMode.Select;
            dlg.ObjectSelected += Dlg_EditObjectSelected;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 26
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            var addNewNomenclature = new OrmReference(Repository.NomenclatureRepository.NomenclatureWaterOnlyQuery());

            addNewNomenclature.Mode            = OrmReferenceMode.Select;
            addNewNomenclature.TabName         = "Выберите номенклатуру";
            addNewNomenclature.ObjectSelected += AddNewNomenclature_ObjectSelected;;
            TabParent.AddSlaveTab(this, addNewNomenclature);
        }
Exemplo n.º 27
0
        protected void OnButtonAddDocumentClicked(object sender, System.EventArgs e)
        {
            var docTypesJournal = new OrmReference(typeof(TypeOfEntity), UoW)
            {
                Mode = OrmReferenceMode.Select
            };

            docTypesJournal.ObjectSelected += DocTypesJournal_ObjectSelected;
            TabParent.AddSlaveTab(this, docTypesJournal);
        }
Exemplo n.º 28
0
        protected void OnButtonSelectPriceClicked(object sender, EventArgs e)
        {
            var priceEditingItem = projectTreeView.GetSelectedObject <ProjectItem> ();
            var dlg = new ReferenceRepresentation(new FittingPricesVM(priceEditingItem.Fitting));

            dlg.Tag             = priceEditingItem;
            dlg.Mode            = OrmReferenceMode.Select;
            dlg.ObjectSelected += Dlg_ItemPriceSelected;;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 29
0
        protected void OnButtonManualSetClicked(object sender, EventArgs e)
        {
            var editingRow = ytreeviewParsing.GetSelectedObjects <ReadingXLSRow> ().First();
            var dlg        = new ReferenceRepresentation(new Fittings.ViewModel.FittingsVM());

            dlg.Tag             = editingRow;
            dlg.Mode            = OrmReferenceMode.Select;
            dlg.ObjectSelected += DlgManualSet_ObjectSelected;
            TabParent.AddSlaveTab(this, dlg);
        }
Exemplo n.º 30
0
        void OpenDialog(NHibernate.Criterion.QueryOver <Nomenclature> nomenclatureType)
        {
            OrmReference SelectDialog = new OrmReference(typeof(Nomenclature), UoWGeneric,
                                                         nomenclatureType.GetExecutableQueryOver(UoWGeneric.Session).RootCriteria);

            SelectDialog.Mode            = OrmReferenceMode.Select;
            SelectDialog.ButtonMode      = ReferenceButtonMode.CanAdd;
            SelectDialog.ObjectSelected += NomenclatureSelected;
            TabParent.AddSlaveTab(this, SelectDialog);
        }