Пример #1
0
 double GetMaxValueForAdjustmentSetting(RegradingOfGoodsDocumentItem item)
 {
     if (item.NomenclatureOld.Category == NomenclatureCategory.bottle &&
         item.NomenclatureNew.Category == NomenclatureCategory.water)
     {
         return(39);
     }
     return((double)item.AmountInStock);
 }
Пример #2
0
        void SelectOldNomenclature_ObjectSelected(object sender, ReferenceRepresentationSelectedEventArgs e)
        {
            var nomenclature = DocumentUoW.GetById <Nomenclature>(e.ObjectId);
            var VMNode       = e.VMNode as ViewModel.StockBalanceVMNode;

            newRow = new RegradingOfGoodsDocumentItem()
            {
                NomenclatureOld = nomenclature,
                AmountInStock   = VMNode.Amount
            };

            var selectNewNomenclature = new OrmReference(QueryOver.Of <Nomenclature>().Where(n => n.Category.IsIn(Nomenclature.GetCategoriesForGoods())));

            selectNewNomenclature.Mode            = OrmReferenceMode.Select;
            selectNewNomenclature.TabName         = "Выберите новую номенклатуру";
            selectNewNomenclature.ObjectSelected += SelectNewNomenclature_ObjectSelected;
            MyTab.TabParent.AddSlaveTab(MyTab, selectNewNomenclature);
        }
Пример #3
0
        protected void OnButtonFineClicked(object sender, EventArgs e)
        {
            var     selected = ytreeviewItems.GetSelectedObject <RegradingOfGoodsDocumentItem>();
            FineDlg fineDlg;

            if (selected.Fine != null)
            {
                fineDlg              = new FineDlg(selected.Fine);
                fineDlg.EntitySaved += FineDlgExist_EntitySaved;
            }
            else
            {
                fineDlg              = new FineDlg("Недостача");
                fineDlg.EntitySaved += FineDlgNew_EntitySaved;
            }
            fineDlg.Entity.TotalMoney = selected.SumOfDamage;
            FineEditItem = selected;
            MyTab.TabParent.AddSlaveTab(MyTab, fineDlg);
        }
Пример #4
0
 void FineDlgNew_EntitySaved(object sender, EntitySavedEventArgs e)
 {
     FineEditItem.Fine = e.Entity as Fine;
     FineEditItem      = null;
 }
Пример #5
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            NomenclatureStockFilterViewModel filter = new NomenclatureStockFilterViewModel(new WarehouseSelectorFactory());

            filter.RestrictWarehouse = DocumentUoW.Root.Warehouse;

            NomenclatureStockBalanceJournalViewModel vm = new NomenclatureStockBalanceJournalViewModel(
                filter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices
                );

            vm.SelectionMode           = JournalSelectionMode.Single;
            vm.TabName                 = "Выберите номенклатуру на замену";
            vm.OnEntitySelectedResult += (s, ea) => {
                var selectedNode = ea.SelectedNodes.Cast <NomenclatureStockJournalNode>().FirstOrDefault();
                if (selectedNode == null)
                {
                    return;
                }
                var nomenclature = DocumentUoW.GetById <Nomenclature>(selectedNode.Id);

                newRow = new RegradingOfGoodsDocumentItem()
                {
                    NomenclatureOld = nomenclature,
                    AmountInStock   = selectedNode.StockAmount
                };

                var nomenclatureFilter = new NomenclatureFilterViewModel();

                var userRepository = new UserRepository();

                var employeeService = VodovozGtkServicesConfig.EmployeeService;

                var counterpartySelectorFactory = new CounterpartyJournalFactory();

                var nomenclatureAutoCompleteSelectorFactory =
                    new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                        ServicesConfig.CommonServices,
                        nomenclatureFilter,
                        counterpartySelectorFactory,
                        _nomenclatureRepository,
                        userRepository
                        );

                var nomenclaturesJournalViewModel =
                    new NomenclaturesJournalViewModel(
                        nomenclatureFilter,
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeService,
                        new NomenclatureJournalFactory(),
                        counterpartySelectorFactory,
                        _nomenclatureRepository,
                        userRepository
                        );

                nomenclaturesJournalViewModel.SelectionMode           = JournalSelectionMode.Single;
                nomenclaturesJournalViewModel.OnEntitySelectedResult += SelectNewNomenclature_ObjectSelected;

                MyTab.TabParent.AddSlaveTab(MyTab, nomenclaturesJournalViewModel);
            };
            MyTab.TabParent.AddSlaveTab(MyTab, vm);
        }