Esempio n. 1
0
        public SelfDeliveryDocumentDlg()
        {
            this.Build();

            UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <SelfDeliveryDocument>();
            Entity.Author = EmployeeSingletonRepository.GetInstance().GetEmployeeForCurrentUser(UoW);
            if (Entity.Author == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, так как некого указывать в качестве кладовщика.");
                FailInitialize = true;
                return;
            }

            Entity.Warehouse = StoreDocumentHelper.GetDefaultWarehouse(UoW, WarehousePermissions.SelfDeliveryEdit);
            var validationResult = CheckPermission(EmployeeSingletonRepository.GetInstance().GetEmployeeForCurrentUser(UoW));

            if (!validationResult.CanRead)
            {
                MessageDialogHelper.RunErrorDialog("Нет прав для доступа к документу отпуска самовывоза");
                FailInitialize = true;
                return;
            }

            if (!validationResult.CanCreate)
            {
                MessageDialogHelper.RunErrorDialog("Нет прав для создания документа отпуска самовывоза");
                FailInitialize = true;
                return;
            }

            canEditDocument = true;
            ConfigureDlg();
        }
Esempio n. 2
0
 void ConfigureNewDoc()
 {
     UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <CarUnloadDocument>();
     Entity.Author = Repository.EmployeeRepository.GetEmployeeForCurrentUser(UoW);
     if (Entity.Author == null)
     {
         MessageDialogWorks.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, так как некого указывать в качестве кладовщика.");
         FailInitialize = true;
         return;
     }
     Entity.Warehouse = StoreDocumentHelper.GetDefaultWarehouse(UoW, WarehousePermissions.CarUnloadEdit);
 }
        public RegradingOfGoodsDocumentDlg()
        {
            this.Build();
            UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <RegradingOfGoodsDocument> ();
            Entity.Author = _employeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.Author == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, так как некого указывать в качестве кладовщика.");
                FailInitialize = true;
                return;
            }
            Entity.Warehouse = StoreDocumentHelper.GetDefaultWarehouse(UoW, WarehousePermissions.RegradingOfGoodsEdit);

            ConfigureDlg();
        }