示例#1
0
        public HelperRun <TInterfaceModel> GetExecutor <TInterfaceModel, TViewModel>(EType type, string stextJson, Operation op)
        {
            IStep <IManagementModelRequest <TInterfaceModel> > _businessLogic = null;

            lock (lockReesource)
            {
                _businessLogic = HI.GetInst().Get <IStep <IManagementModelRequest <TInterfaceModel> > >();
            }

            IMapper _mapper = HI.GetInst().Get <IMapper>();

            TViewModel itemViewModel = JsonConvert.DeserializeObject <TViewModel>(stextJson);
            var        itemModel     = _mapper.Map <TInterfaceModel>(itemViewModel);

            var request = new ManagementModelRequest <TInterfaceModel>
            {
                Item = itemModel,
                Type = op
            };


            HelperRun <TInterfaceModel> pExecutor = new HelperRun <TInterfaceModel>
            {
                BusinessLogic = _businessLogic,
                Request       = request
            };


            return(pExecutor);
        }
示例#2
0
        private bool GenerateAux <TIModel, TViewModel>(string jsonInTextbox)
        {
            FactoryHelperRun factory = new FactoryHelperRun();
            var pExecutor            = factory.GetExecutor <TIModel, TViewModel>(EType.ConfigSupplyViewModel, jsonInTextbox, Operation.NEW);

            if (pExecutor == null)
            {
                return(false);
            }
            StepObserver.RegisterSteps(pExecutor.BusinessLogic, pExecutor.Request);
            Executor = pExecutor;
            return(true);
        }