internal void DeleteInterfaceICAByStatus(ICAInterfaceStatus iCAInterfaceStatus)
        {
            IRepository<InterfaceICA> interfaceICARepository = new RepositoryImpl<InterfaceICA>(applicationSession);

            DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(InterfaceICA))
                                                                .Add(Expression.Eq("Status", iCAInterfaceStatus.ToString()));
            DeleteAll(detachedCriteria);
        }
        public override void Process(
            EventBean lookupEvent,
            EventBean[] prefillPath,
            ICollection<EventBean[]> resultFinalRows,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            var repository = new RepositoryImpl(_rootStream, lookupEvent, _numStreams);
            var processOptional = true;

            for (var i = 0; i < _requireResultsInstruction; i++) {
                var currentInstruction = _lookupInstructions[i];
                var hasResults = currentInstruction.Process(repository, exprEvaluatorContext);

                // no results, check what to do
                if (!hasResults) {
                    // If there was a required stream, we are done.
                    if (currentInstruction.HasRequiredStream) {
                        return;
                    }

                    // If this is the first stream and there are no results, we are done with lookups
                    if (i == 0) {
                        processOptional = false; // go to result processing
                    }
                }
            }

            if (processOptional) {
                for (var i = _requireResultsInstruction; i < _lookupInstructions.Length; i++) {
                    var currentInstruction = _lookupInstructions[i];
                    currentInstruction.Process(repository, exprEvaluatorContext);
                }
            }

            // go over the assembly instruction set
            var results = repository.NodesPerStream;

            // no results - need to execute the very last instruction/top node
            if (results == null) {
                var lastAssemblyNode = _assemblyInstructions[_assemblyInstructions.Length - 1];
                lastAssemblyNode.Init(null);
                lastAssemblyNode.Process(null, resultFinalRows, lookupEvent);
                return;
            }

            // we have results - execute all instructions
            BaseAssemblyNode assemblyNode;
            for (var i = 0; i < _assemblyInstructions.Length; i++) {
                assemblyNode = _assemblyInstructions[i];
                assemblyNode.Init(results);
            }

            for (var i = 0; i < _assemblyInstructions.Length; i++) {
                assemblyNode = _assemblyInstructions[i];
                assemblyNode.Process(results, resultFinalRows, lookupEvent);
            }
        }
        // 如果封装的类型和数据库里的其他类型没有继承关系,则使用这个函数执行映射
        private IRepository <T> RegisterTable <T>(string tableName)
            where T : class, ITableItem
        {
            var result = new RepositoryImpl <T, T>(this, null, tableName);

            _tableMap.Add(typeof(T), result);

            return(result);
        }
Exemple #4
0
 private void MyInitializeComponent()
 {
     foreach (MyItem item in RepositoryImpl.GetInstance().GetItems())
     {
         var cbi = new ComboBoxItem();
         cbi.Content = item;
         cbItems.Items.Add(cbi);
     }
     cbItems.SelectedIndex = 0;
 }
Exemple #5
0
 private void EditItem()
 {
     if (!RepositoryImpl.GetInstance().UpdateItem(Item, Pos))
     {
         MessageBox.Show("El material ya existe", "Error");
     }
     else
     {
         this.Close();
     }
 }
        // 如果封装的类型和数据库里的其他类型有继承关系,则使用这个函数执行映射,
        // 需要指定类型和类型的基类
        private IRepository <T> RegisterDeriveredTable <T, U>(Func <T, U> persistRouting, string tableName)
            where T : class, ITableItem
            where U : class, T
        {
            var result = new RepositoryImpl <T, U>(this, persistRouting, tableName);

            _tableMap.Add(typeof(T), result.IfImplementation);
            _tableMap.Add(typeof(U), result);

            return(result.IfImplementation);
        }
        private void MyInitializeComponent()
        {
            foreach (Race race in RepositoryImpl.GetInstance().GetRaces())
            {
                var cbi = new ComboBoxItem();
                cbi.Content = race;
                cbRace.Items.Add(race);
            }

            lvItems.ItemsSource = Supply.Items;
        }
 private void EditSupply()
 {
     if (!RepositoryImpl.GetInstance().UpdateSupply(Supply, Pos))
     {
         MessageBox.Show("El avituallamiento ya existe", "Error");
     }
     else
     {
         this.Close();
     }
 }
 private void EditRace()
 {
     if (!RepositoryImpl.GetInstance().UpdateRace(Race, Pos))
     {
         MessageBox.Show("La carrera ya existe", "Error");
     }
     else
     {
         this.Close();
     }
 }
        /// <summary>
        /// Generates the code for a transformation element of a given EnAr instance.
        /// This method can be called from EnAr UI directly.
        /// </summary>
        /// <param name="eaRepository">The EnAr instance.</param>
        /// <param name="transformationGuid">The identifier of the transformation for code generation.</param>
        /// <param name="absoluteOutputFolder">The output folder to put the code into.</param>
        /// <param name="useMetamodelInterface">If true, the generated code will rely on an IMetamodelInterface object. Otherwise, it will rely on standard C# getters/setters.</param>
        public static void GenerateTransformationCode(Repository eaRepository, string transformationGuid, string absoluteOutputFolder, bool useMetamodelInterface = true)
        {
            // Create hybrid repository of an EA instance
            RepositoryImpl hybridrepo = new RepositoryImpl(eaRepository);

            // Import the transformation as real qvt model
            EnArExplorer              explorer = new EnArExplorer(hybridrepo, eaRepository);
            EnArImporterQVT           importer = new EnArImporterQVT(explorer);
            IRelationalTransformation relationalTransformation = importer.ConstructRelationalTransformationFromGuid(transformationGuid);

            // Generate code from qvt model
            QVTCodeGeneratorHelper.GenerateAllCode(relationalTransformation, absoluteOutputFolder, useMetamodelInterface);
        }
        /// <summary>
        /// To initialize EA with a given project file.
        /// The "Close" method should be called when it is over.
        /// </summary>
        /// <param name="fileName"></param>
        public EnArLoader(string fileName, bool isAbsolute = false, bool makeCopy = true)
        {
            if (AbsolutePathToOutput == null)
            {
                // Find the model test file in the VS project
                projectFolder = VariousUtil.GetProjectFolder();
                // Create output folder
                AbsolutePathToOutput = Path.Combine(projectFolder, GeneratorOutputPath);
            }
            if (currentLlRepository == null)
            {
                // Creates EA instance
                Repository currentEaRepository = new Repository();

                // Opens the model file in the EA instance
                string absolutePathToModel = isAbsolute ? fileName : Path.Combine(projectFolder, fileName); // and from there we can find the "models" folder

                if (makeCopy)
                {
                    string absolutePathToModelCopy = absolutePathToModel;
                    absolutePathToModelCopy = Path.ChangeExtension(absolutePathToModelCopy, ".tmp.eap");
                    if (File.Exists(absolutePathToModelCopy))
                    {
                        File.Delete(absolutePathToModelCopy);
                    }
                    File.Copy(absolutePathToModel, absolutePathToModelCopy);
                    absolutePathToModel = absolutePathToModelCopy;
                }

                bool openResult = currentEaRepository.OpenFile(absolutePathToModel);
                Assert.True(openResult, "The file " + absolutePathToModel + "could not be opened");

                // Opens the model
                currentLlRepository = new RepositoryImpl(currentEaRepository);
                currentLlRepository.ChachingFinished += HybridRepositoryCachingFinished;
                for (int i = 0; i < 50; i++)
                {
                    if (dataModelReadyToUse == false)
                    {
                        Thread.Sleep(500);
                    }
                }

                if (dataModelReadyToUse == false)
                {
                    throw new Exception("Timeout when trying to open EnAr file " + fileName);
                }

                Explorer = new EnArExplorer(currentLlRepository, currentEaRepository);
            }
        }
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (DataGrid.SelectedCells.Count == 0)
            {
                MessageBox.Show("Seleccione una carrera", "Error");
                return;
            }

            Race race;

            try{
                race = (Race)DataGrid.SelectedCells[0].Item;
            }
            catch (InvalidCastException)
            {
                return;
            }
            RepositoryImpl.GetInstance().RemoveRace(race);
        }
        internal List<RefCaveatCaseEntity> GetListRefCaveatCaseEntityBySGID(string SGID)
        {
            List<RefCaveatCaseEntity> listRefCaveatCaseEntity = new List<RefCaveatCaseEntity>();
            RefCaveatCaseEntity refCaveatCaseEntity = new RefCaveatCaseEntity();
            DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(RefCaveatCase))
                                                                .Add(Expression.Eq("SubmissionGroupId", SGID));
            IRepository<RefCaveatCase> refCaveatCaseRepository = new RepositoryImpl<RefCaveatCase>(applicationSession);

            List<RefCaveatCase> listRefCaveatCase = refCaveatCaseRepository.GetAll(detachedCriteria) as List<RefCaveatCase>;
            if (listRefCaveatCase != null && listRefCaveatCase.Count > 0)
            {
                foreach (RefCaveatCase refCaveatCase in listRefCaveatCase)
                {
                    refCaveatCaseEntity = AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.CommonMapper.GetRefCaveatCaseEntity(refCaveatCase);
                    listRefCaveatCaseEntity.Add(refCaveatCaseEntity);
                }
            }
            return listRefCaveatCaseEntity;
        }
        internal ADMInfoEntity GetADMInfoEntityBySGID(string SGID)
        {
            ADMInfoEntity aDMInfoEntity = new ADMInfoEntity();

            IRepository<ADMInfo> aDMInfoRepository = new RepositoryImpl<ADMInfo>(applicationSession);

            DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(ADMInfo))
                                                               .Add(Expression.Eq("SubmissionGroupId", SGID));
            List<ADMInfo> listADMInfo = aDMInfoRepository.GetAll(detachedCriteria) as List<ADMInfo>;
            if (listADMInfo != null && listADMInfo.Count > 0)
            {
                foreach (ADMInfo adMInfo in listADMInfo)
                {
                    aDMInfoEntity = AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.CaseSpecificMapper.GetADMInfoEntity(adMInfo);
                }
            }
            else
                aDMInfoEntity = null;
            return aDMInfoEntity;
        }
        internal List<InterfaceICAEntity> GetAllInterfaceICAEntity()
        {
            List<InterfaceICA> listInterfaceICA;
            List<InterfaceICAEntity> listInterfaceICAEntity = new List<InterfaceICAEntity>();
            InterfaceICAEntity interfaceICAEntity = new InterfaceICAEntity();
            IRepository<InterfaceICA> interfaceICARepository = new RepositoryImpl<InterfaceICA>(applicationSession);
            listInterfaceICA = interfaceICARepository.GetAll() as List<InterfaceICA>;

            if (listInterfaceICA != null && listInterfaceICA.Count > 0)
            {
                foreach (InterfaceICA interfaceICA in listInterfaceICA)
                {
                    interfaceICAEntity = AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.BackEndSpecificMapper.GetInterfaceICAEntity(interfaceICA);
                    listInterfaceICAEntity.Add(interfaceICAEntity);
                }
            }
            else
                listInterfaceICAEntity = null;
            return listInterfaceICAEntity;
        }
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (DataGrid.SelectedCells.Count == 0)
            {
                MessageBox.Show("Seleccione un avituallamiento", "Error");
                return;
            }

            Supply supply;

            try
            {
                supply = (Supply)DataGrid.SelectedCells[0].Item;
            }
            catch (InvalidCastException)
            {
                return;
            }
            RepositoryImpl.GetInstance().RemoveSupply(supply);
        }
        internal BankruptcyInfoEntity GetBankruptcyInfoBySGID(string submissionGroupId)
        {
            BankruptcyInfoEntity bankruptcyInfoEntity = new BankruptcyInfoEntity();
            IRepository<BankruptcyInfo> bankruptcyInfoRepository = new RepositoryImpl<BankruptcyInfo>(applicationSession);
            List<BankruptcyInfo> listBankruptcyInfo = new List<BankruptcyInfo>();
            DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(BankruptcyInfo))
                                                                .Add(Expression.Eq("SubmissionGroupId", submissionGroupId));
            listBankruptcyInfo = bankruptcyInfoRepository.GetAll(detachedCriteria) as List<BankruptcyInfo>;

            if (listBankruptcyInfo != null && listBankruptcyInfo.Count > 0)
            {
                foreach (BankruptcyInfo bankruptcyInfo in listBankruptcyInfo)
                {
                    bankruptcyInfoEntity = AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.CaseSpecificMapper.GetBankruptcyInfoEntity(bankruptcyInfo);
                }

            }
            else
                bankruptcyInfoEntity = null;
            return bankruptcyInfoEntity;
        }
        internal List<InterfaceICAEntity> GetAllInterfaceICAEntityByStatus()
        {
            DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(InterfaceICA))
                .Add(Expression.Not(NHibernate.Criterion.Restrictions.Eq("Status", "C")));

            List<InterfaceICA> listInterfaceICA;
            List<InterfaceICAEntity> listInterfaceICAEntity = new List<InterfaceICAEntity>();
            InterfaceICAEntity interfaceICAEntity = new InterfaceICAEntity();
            IRepository<InterfaceICA> interfaceICARepository = new RepositoryImpl<InterfaceICA>(applicationSession);
            listInterfaceICA = interfaceICARepository.GetAll(detachedCriteria) as List<InterfaceICA>;
            if (listInterfaceICA != null && listInterfaceICA.Count > 0)
            {
                foreach (InterfaceICA interfaceICA in listInterfaceICA)
                {
                    interfaceICAEntity = AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.BackEndSpecificMapper.GetInterfaceICAEntity(interfaceICA);
                    listInterfaceICAEntity.Add(interfaceICAEntity);
                }
            }
            else
                listInterfaceICAEntity = null;
            return listInterfaceICAEntity;
        }
        /// <summary>
        /// Gets the CaseInfoDetails
        /// </summary>
        /// <param name="criteria">Criteria contains CaseInfoId</param>
        /// <returns></returns>
        public CaseInfoEntity GetCaseInfoDetails(Criteria criteria)
        {
            Check.RequireWithNullException(criteria != null, "criteria was null or empty; it has to have value within it.");

            var caseInfoEntity = new CaseInfoEntity();

            using (var unitOfWork = new UnitOfWorkImpl(DataBaseConnectivity.Application))
            {
                try
                {
                    var icaseinfoRepository = new RepositoryImpl<CaseInfo>(unitOfWork.Session);
                    caseInfoEntity = CaseMapper.GetCaseInfoEntity(icaseinfoRepository.Get(Convert.ToInt64(criteria.Value)));
                }
                catch (Exception ex)
                {
                    unitOfWork.Rollback();
                    Logger.Error("Error encountered at GetCaseInfoDetails", ex);
                    throw;
                }
            }

            return caseInfoEntity;
        }
Exemple #20
0
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (DataGrid.SelectedCells.Count == 0)
            {
                MessageBox.Show("Seleccione un material", "Error");
                return;
            }

            MyItem item;

            try
            {
                item = (MyItem)DataGrid.SelectedCells[0].Item;
            }
            catch (InvalidCastException)
            {
                return;
            }
            if (!RepositoryImpl.GetInstance().RemoveItem(item))
            {
                MessageBox.Show("El material está asociado a un avituallamiento", "Error");
            }
        }
 private RefCaveatCase GetRefCaveatCaseEntity(Criteria criteria)
 {
     IRepository<RefCaveatCase> refCaveatCaseRepository = new RepositoryImpl<RefCaveatCase>(applicationSession);
     return refCaveatCaseRepository.Get(criteria.Value);
 }
 public SupplyManager()
 {
     InitializeComponent();
     _supplies            = RepositoryImpl.GetInstance().GetSupplies();
     DataGrid.ItemsSource = Supplies;
 }
 public RepositoryIfImpl(RepositoryImpl <T, U> outer, string tableName)
 {
     _outer     = outer;
     _tableName = tableName;
 }
 internal void SaveOrUpdateRefCaveatCaseEntity(RefCaveatCaseEntity refCaveatCaseEntity)
 {
     IRepository<RefCaveatCase> refCaveatCaseRepository = new RepositoryImpl<RefCaveatCase>(applicationSession);
     refCaveatCaseRepository.SaveOrUpdate(AllInOne.Legal.DataMapper.BackEnd.DomainToNHibernate.ObjectMapper.CommonMapper.GetRefCaveatCase(refCaveatCaseEntity));
 }
 private List<BankruptcyOtherDefDetail> GetAllBankruptcyOtherDefDetail(DetachedCriteria detachedCriteria)
 {
     IRepository<BankruptcyOtherDefDetail> bankruptcyOtherDefDetailRepository = new RepositoryImpl<BankruptcyOtherDefDetail>(applicationSession);
     return bankruptcyOtherDefDetailRepository.GetAll(detachedCriteria) as List<BankruptcyOtherDefDetail>;
 }
 internal void SaveOrUpdateBankruptcyOtherDefDetailEntity(BankruptcyOtherDefDetailEntity bankruptcyOtherDefDetailEntity)
 {
     IRepository<BankruptcyOtherDefDetail> bankruptcyOtherDefDetailRepository = new RepositoryImpl<BankruptcyOtherDefDetail>(applicationSession);
     bankruptcyOtherDefDetailRepository.SaveOrUpdate(AllInOne.Legal.DataMapper.BackEnd.DomainToNHibernate.ObjectMapper.BankruptcyMapper.GetBankruptcyOtherDefDetail(bankruptcyOtherDefDetailEntity));
 }
 public RaceManager()
 {
     InitializeComponent();
     _races = RepositoryImpl.GetInstance().GetRaces();
     DataGrid.ItemsSource = Races;
 }
Exemple #28
0
 public void TestInitialize()
 {
     _factory    = new DbFactory <Foo>(DbFactory <Foo> .Configuration.Test);
     _repository = new RepositoryImpl(_factory);
 }
        internal InterfaceICAEntity GetInterfaceICAByPK(string iCAInterfaceId)
        {
            IRepository<InterfaceICA> interfaceICARepository = new RepositoryImpl<InterfaceICA>(applicationSession);
            InterfaceICA interfaceICA = interfaceICARepository.Get(iCAInterfaceId);

            return AllInOne.Legal.DataMapper.BackEnd.NHibernateToDomain.ObjectMapper.BackEndSpecificMapper.GetInterfaceICAEntity(interfaceICA);
        }
        private ADMInfo GetADMInfo(Criteria criteria)
        {
            try
            {
                ADMInfo aDMInfo = new ADMInfo();

                IRepository<ADMInfo> iADMInfoRepository = new RepositoryImpl<ADMInfo>(applicationSession);
                aDMInfo = iADMInfoRepository.Get(criteria.Value);
                return aDMInfo;
            }
            catch (Exception ex)
            {
                Logger.Error("Error encountered at GetADMInfo", ex);
                throw;
            }
        }
Exemple #31
0
 public ItemManager()
 {
     InitializeComponent();
     _items = RepositoryImpl.GetInstance().GetItems();
     DataGrid.ItemsSource = _items;
 }
 internal void SaveOrUpdateADMInfoEntity(ADMInfoEntity aDMInfoEntity)
 {
     IRepository<ADMInfo> iADMInfoRepository = new RepositoryImpl<ADMInfo>(applicationSession);
     iADMInfoRepository.SaveOrUpdate(AllInOne.Legal.DataMapper.BackEnd.DomainToNHibernate.ObjectMapper.CaseSpecificMapper.GetAdmInfo(aDMInfoEntity));
 }
 internal void SaveOrUpdateInterfaceICAEntity(InterfaceICAEntity interfaceICAEntity)
 {
     IRepository<InterfaceICA> interfaceICARepository = new RepositoryImpl<InterfaceICA>(applicationSession);
     interfaceICARepository.SaveOrUpdate(AllInOne.Legal.DataMapper.BackEnd.DomainToNHibernate.ObjectMapper.ExternalMapper.GetInterfaceICA(interfaceICAEntity));
 }