Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<Dataset> GetDatasetList(string projectileName, string targetMaterialName)
        {
            ParametersForDataset parameters = new ParametersForDataset();

            parameters.ProjectileName = projectileName;
            parameters.TargetMaterialName = targetMaterialName;

            List<Dataset> datasets = _dalRetrieve.GetDatasets(parameters);

            return datasets;
        }
Ejemplo n.º 2
0
        public List<Dataset> GetDatasets(ParametersForDataset parameters)
        {
            using (var db = new TSPDSContext())
            {
                var query = db.Dataset.AsQueryable();
                if (!string.IsNullOrWhiteSpace(parameters.ProjectileName))
                    query = query.Where(x => x.Projectile.Name == parameters.ProjectileName);

                if (parameters.MethodId.HasValue)
                    query = query.Where(x => x.Method_Id == parameters.MethodId);

                if (parameters.ArticleReferencesId.HasValue)
                    query = query.Where(x => x.ArticleReferences_Id == parameters.ArticleReferencesId);

                if (parameters.StateOfAggregationId.HasValue)
                    query = query.Where(x => x.StateOfAggregation_Id == parameters.StateOfAggregationId);

                if (!string.IsNullOrWhiteSpace(parameters.FirstName))
                    query = query.Where(x => x.Revision.Any(s => s.User.FirstName == parameters.FirstName));

                if (!string.IsNullOrWhiteSpace(parameters.LastName))
                    query = query.Where(x => x.Revision.Any(s => s.User.LastName == parameters.LastName));

                if (!string.IsNullOrWhiteSpace(parameters.Institute))
                    query = query.Where(x => x.Revision.Any(s => s.User.Institute == parameters.Institute));

                if (parameters.RevId.HasValue)
                    query = query.Where(x => x.Revision.Any(s => s.Id == parameters.RevId));

                if (parameters.Approved.HasValue)
                    query = query.Where(x => x.Revision.Any(s => s.Approved == parameters.Approved));

                //TargetMaterial search options
                if (!string.IsNullOrWhiteSpace(parameters.TargetMaterialName))
                    query = query.Where(x => x.TargetMaterial.Name == parameters.TargetMaterialName);

                if (!string.IsNullOrWhiteSpace(parameters.TargetMaterialChemicalFormula))
                    query =
                        query.Where(x => x.TargetMaterial.ChemicalFormula == parameters.TargetMaterialChemicalFormula);

                if (!string.IsNullOrWhiteSpace(parameters.TargetMaterialICRUId))
                    query = query.Where(x => x.TargetMaterial.ICRUId == parameters.TargetMaterialICRUId);

                if (!string.IsNullOrWhiteSpace(parameters.TargetMaterialZCharge))
                    query = query.Where(x => x.TargetMaterial.ZCharge == parameters.TargetMaterialZCharge);

                if (parameters.TargetMaterialMass.HasValue)
                    query = query.Where(x => x.TargetMaterial.Mass == parameters.TargetMaterialMass);

                if (parameters.TargetMaterialMolarMass.HasValue)
                    query = query.Where(x => x.TargetMaterial.MolarMass == parameters.TargetMaterialMolarMass);

                if (parameters.ProjectileMass.HasValue)
                    query = query.Where(x => x.Projectile.Mass == parameters.ProjectileMass);

                if (!string.IsNullOrEmpty(parameters.ProjectilePDGNumber))
                    query = query.Where(x => x.Projectile.PDGNumber == parameters.ProjectilePDGNumber);

                if (parameters.ProjectilezCharge.HasValue)
                    query = query.Where(x => x.Projectile.zCharge == parameters.ProjectilezCharge);

                query = query.Include(m => m.Projectile);
                query = query.Include(m => m.Method);
                query = query.Include(m => m.TargetMaterial);
                query = query.Include(m => m.StateOfAggregation);
                query = query.Include(m => m.ArticleReferences);
                query = query.Include(m => m.DataPoint);
                query = query.Include(m => m.Revision);

                return query.ToList();
            }
        }
Ejemplo n.º 3
0
        public void Search(string projectileName, string targetMaterial)
        {
            dal = new MSSQLModelDAL();

            //retrieve datasets with desired targetmaterial
            ParametersForDataset parameters = new ParametersForDataset()
            {
                ProjectileName = projectileName,
                TargetMaterialName = targetMaterial
            };
            var foundData = dal.GetDatasets(parameters);

            if (!foundData.Any())
            {
                new Dataset();
            }

            foreach (var dataSet in foundData)
            {
                if (dataSet.TargetMaterial == null)
                {
                    dataSet.TargetMaterial = new TargetMaterial();
                    dataSet.TargetMaterial.Name = "";
                }

                if (dataSet.StateOfAggregation == null)
                {
                    dataSet.StateOfAggregation = new StateOfAggregation();
                    dataSet.StateOfAggregation.Form = "";
                }

                if (dataSet.Projectile == null)
                {
                    dataSet.Projectile = new Projectile();
                    dataSet.Projectile.Name = "";
                }

                if (dataSet.Method == null)
                {
                    dataSet.Method = new Method();
                    dataSet.Method.Name = "";
                }

                if (dataSet.ArticleReferences == null)
                {
                    dataSet.ArticleReferences = new ArticleReferences();
                    dataSet.ArticleReferences.DOINumber = "";
                    dataSet.ArticleReferences.Firstname = "";
                    dataSet.ArticleReferences.Year = 0;
                }

            }
            _foundDataSets = foundData;
        }