예제 #1
0
        public static FeatureRegister CreateDBFiles(string DBorigin, string OutXmlPath, string LogXml2DB)
        {
            Provider.WriteLogFormat(LogXml2DB, "Write DB xml Files");
            var db       = FeaturesContext.Open(DBorigin);
            var AllRules = db.NormalRule.ToList();

            Provider.WriteLogFormat(LogXml2DB, "Create Country Items and Register");
            var register = FeatureRegister.CreateDBFiles(db, OutXmlPath);

            Provider.WriteFile <Dbconfiguration>(db.Dbconfiguration.First(), OutXmlPath + "\\" + FeatureManagerCompatibility.ConfigurationFileName);
            Provider.WriteFile <CountryItems>(register.CountryItems, OutXmlPath + "\\CountryItems.xml");

            // File used in WPF only
            CreatePartNumbersFile(db, OutXmlPath);
            CreateProbePresetFile(db, OutXmlPath);

            Provider.WriteLogFormat(LogXml2DB, "Create Feature Main for all logical models");
            var ModelNames = register.ModelLicenses.Select(m => m.License.Name).ToList();

            foreach (var ModelName in ModelNames)
            {
                WriteMain(register, AllRules, ModelName, OutXmlPath);
            }
            return(register);
        }
예제 #2
0
 private static void InsertLogicalModels(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictPhysMod, Dictionary <string, int> dictLicenses,
                                         Paths Paths, string log)
 {
     db.BulkInsert(LogicalModel.Import(dictPhysMod, dictLicenses, buffer, Paths, log));
     buffer.p_logicalModels = db.LogicalModel.ToList();
     buffer.ModelLicenses   = buffer.p_logicalModels.Join(buffer.p_licenses, m => m.LicenseId, l => l.Id, (m, l) => new ModelLicense(m, l)).ToList();
 }
예제 #3
0
 private static void SetDBConfigurations(FeaturesContext db, int BuildNumber)
 {
     db.BulkInsert(new List <Dbconfiguration>()
     {
         new Dbconfiguration(_Compatibility: FeatureManagerCompatibility.Compatibility, _Version: BuildNumber)
     });
 }
예제 #4
0
        public static void CreateProbePresetFile(FeaturesContext db, String OutXmlPath)
        {
            var ProbePresets = new ProbePresetInfo()
            {
                Items = db.ProbePreset.ToList()
            };

            Provider.WriteFile <ProbePresetInfo>(ProbePresets, OutXmlPath + "\\" + ProbePresetInfo.ProbePresetFileName);
        }
예제 #5
0
        // ANTO DB
        public static void CreatePartNumbersFile(FeaturesContext db, String OutXmlPath)
        {
            var PNInfo = new PartNumberInfo
            {
                Associations = db.PartNumbersAssociations.ToList()
            };

            Provider.WriteFile <PartNumberInfo>(PNInfo, OutXmlPath + "\\" + PartNumberInfo.PartNumberFileName);
        }
예제 #6
0
		// ANTO DB
		public static FeatureRegister CreateDBFiles(FeaturesContext db, string OutXmlPath)
		{
			var FullFileName = BuildXmlFileName(OutXmlPath);
			var FullKeyFileName = BuildXmlKeyFileName(OutXmlPath);

			FeatureRegister register = new FeatureRegister();
			register.FillFromDB(db);
			Provider.WriteFile<FeatureRegister>(register, FullFileName, FullKeyFileName);
			return register;
		}
예제 #7
0
 public Dictionaries(FeaturesContext _db)
 {
     p_buffer                 = new DBBuffer();
     p_buffer.p_probes        = _db.Probe.ToList();
     p_buffer.p_applications  = _db.Application.ToList();
     p_buffer.p_bundles       = _db.Bundle.ToList();
     p_buffer.p_option        = _db.Option.ToList();
     p_buffer.p_logicalModels = _db.LogicalModel.ToList();
     p_buffer.p_biospyKits    = _db.BiopsyKits.ToList();
     p_buffer.p_countries     = _db.Country.ToList();
 }
예제 #8
0
        private static Dictionary <string, int> InsertPhysicalModels(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
        {
            db.BulkInsert(Models.PhysicalModel.Import(Paths, log));
            buffer.p_physicalModels = db.PhysicalModel.ToList();
            var dictPhysMod = buffer.p_physicalModels.Select(pm => new
            {
                pm.Description,
                pm.Id
            }).ToDictionary(m => m.Description, m => m.Id);

            return(dictPhysMod);
        }
예제 #9
0
        private static Dictionary <string, int> InsertFeatures(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictLicenses, Paths Paths, string log)
        {
            db.BulkInsert(Feature.Import(dictLicenses, Paths, log));
            buffer.p_features = db.Feature.ToList();
            var dictFeat = buffer.p_features.Select(pm => new
            {
                pm.Name,
                pm.Id
            }).ToDictionary(m => m.Name, m => m.Id);

            return(dictFeat);
        }
예제 #10
0
        private static Dictionary <string, int> InsertOptions(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictFeat, Paths Paths, string log)
        {
            db.BulkInsert(Option.Import(dictFeat, Paths, log));
            buffer.p_option = db.Option.ToList();
            var dictOptions = buffer.p_option.Select(pm => new
            {
                pm.Name,
                pm.Id
            }).ToDictionary(m => m.Name, m => m.Id);

            return(dictOptions);
        }
예제 #11
0
        private static void ImportRules(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictLicenses, Paths Paths, string LogXml2DB)
        {
            db.readLogModLicRules(buffer, dictLicenses, Paths, LogXml2DB);                     // Rules from license manager
            db.ImportProbesWithRules(buffer, Paths, LogXml2DB);                                // import Probes and probe rules

            db.BulkInsert(Uirule.ImportOptionProbes(buffer, Paths, LogXml2DB));                // probe option associations
            db.BulkInsert(Uirule.ImportVersionRules(buffer, Paths, LogXml2DB));                // versions Rules
            ImportRegulatoryFeatures(db, buffer, Paths, LogXml2DB);

            db.BulkInsert(Uirule.ImportRegulatoryRules(buffer, Paths, LogXml2DB));                // Regulatory blocks for country
            db.BulkInsert(Uirule.ImportRDBlockingRules(buffer, Paths, LogXml2DB));                // R&D blocks for country
        }
예제 #12
0
        public static void CreateDatabase(Paths Paths, string logFileXml2DB, int BuildNumber, DatabaseType databaseType, string connectionString)
        {
            try
            {
                FeaturesContext.Create(Paths.DBfile, databaseType, connectionString);
                var db = FeaturesContext.Open(Paths.DBfile);
                // ANTO DB LOG
                //db.EnableLog();
                var buffer = new DBBuffer();

                /* data insertion in the DB */
                Provider.WriteLogFormat(logFileXml2DB, "Filling up Tables");

                InsertSWPacks(db, buffer, Paths, logFileXml2DB);
                InsertSettingsFamilies(db, buffer, Paths, logFileXml2DB);
                var dictLicenses = InsertLicenses(db, buffer, Paths, logFileXml2DB);
                var dictPhysMod  = InsertPhysicalModels(db, buffer, Paths, logFileXml2DB);
                InsertLogicalModels(db, buffer, dictPhysMod, dictLicenses, Paths, logFileXml2DB);
                InsertTwinLicenses(db, dictLicenses, Paths, logFileXml2DB);
                var dictFeat    = InsertFeatures(db, buffer, dictLicenses, Paths, logFileXml2DB);
                var dictOptions = InsertOptions(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertApplications(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertBundles(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertFeatureRelations(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertLicenseRelations(db, buffer, Paths, logFileXml2DB);
                InsertLicenseRelationsExceptions(db, buffer, Paths, logFileXml2DB);
                InsertDeprecated(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertCertifiers(db, buffer, Paths, logFileXml2DB);
                InsertCountries(db, buffer, Paths, logFileXml2DB);
                InsertDistributors(db, buffer, Paths, logFileXml2DB);
                InsertCountryDistributors(db, buffer, Paths, logFileXml2DB);
                InsertCountryLicenses(db, buffer, Paths, logFileXml2DB);
                InsertMinorVersions(db, buffer, Paths, logFileXml2DB);

                ImportRules(db, buffer, dictLicenses, Paths, logFileXml2DB);

                InsertPartNumbers(db, buffer, Paths, logFileXml2DB);
                ImportVersions(db, buffer, Paths, logFileXml2DB);

                buffer.p_UIRules = db.Uirule.ToList();

                Provider.WriteLogFormat(logFileXml2DB, "Convert UIRules to NormalRules");
                db.BulkInsert(FeaturesContext.createNormalRules(buffer));
                SetDBConfigurations(db, BuildNumber);
                Provider.WriteLogFormat(logFileXml2DB, "Database Created");
            }
            catch (Exception ex)
            {
                var errormessage = Provider.WriteErrorLogFormat("Error while creating the Database: " + ex.Message);
                throw new ApplicationException(errormessage, ex);
            }
        }
예제 #13
0
        // ANTO DB
        public void FillBuffer(FeaturesContext _db)
        {
            p_probes                    = _db.Probe.ToList();
            p_features                  = _db.Feature.ToList();
            p_bundles                   = _db.Bundle.ToList();
            p_LicenseRelation           = _db.LicenseRelation.ToList();
            p_LicenseRelationExceptions = _db.LicenseRelationException.ToList();
            p_Deprecated                = _db.Deprecated.ToList();
            p_applications              = _db.Application.ToList();
            p_option                    = _db.Option.ToList();
            p_settingsFamilies          = _db.SettingFamily.ToList();
            p_licenses                  = _db.License.ToList();
            p_physicalModels            = _db.PhysicalModel.ToList();
            p_certifiers                = _db.Certifier.ToList();
            p_swPacks                   = _db.Swpack.ToList();
            p_logicalModels             = _db.LogicalModel.ToList();
            p_biospyKits                = _db.BiopsyKits.ToList();
            p_countries                 = _db.Country.ToList();
            p_UIRules                   = _db.Uirule.ToList();
            p_NormalRules               = _db.NormalRule.ToList();
            p_ProbeTransducers          = _db.ProbeTransducers.ToList();
            p_probe_SettingsFamily      = _db.ProbeSettingsFamily.ToList();
            p_probe_Presets             = _db.ProbePreset.ToList();
            p_Distributors              = _db.Distributor.ToList();
            p_Country_Distributors      = _db.CountryDistributor.ToList();
            p_CountryLicenses           = _db.CountryLicense.ToList();
            p_RegualtoryFeatures        = _db.RegulatoryFeature.ToList();
            p_MinorVersionAssociation   = _db.MinorVersionAssociation.ToList();
            p_PartNumbersAssociations   = _db.PartNumbersAssociations.ToList();

            AllProbeFamilies        = p_probes.GroupBy(p => p.ProbeFamily);
            AllProbeTypes           = p_ProbeTransducers.GroupBy(t => t.TransducerType);
            p_multiTransducerProbes = p_ProbeTransducers.GroupBy(t => t.ProbeId).Where(g => g.Count() > 1)
                                      .Join(p_probes, g => g.Key, p => p.Id, (t, p) => p).ToList();

            ModelLicenses = p_logicalModels.Join(p_licenses, m => m.LicenseId, l => l.Id, (m, l) => new ModelLicense(m, l)).ToList();
        }
예제 #14
0
 private static void InsertDeprecated(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictFeat, Paths Paths, string log)
 {
     db.BulkInsert(Deprecated.Import(dictFeat, Paths, log));
     buffer.p_Deprecated = db.Deprecated.ToList();
 }
예제 #15
0
 private static void InsertCertifiers(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(Certifier.Import(Paths, log));
     buffer.p_certifiers = db.Certifier.ToList();
 }
예제 #16
0
 private static void InsertFeatureRelations(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictFeat, Paths Paths, string log)
 {
     db.BulkInsert(FeatureRelation.Import(dictFeat, Paths, log, buffer));
 }
예제 #17
0
 private static void InsertLicenseRelationsExceptions(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(LicenseRelationException.Import(buffer, Paths, log));
     buffer.p_LicenseRelationExceptions = db.LicenseRelationException.ToList();
 }
예제 #18
0
 private static void InsertApplications(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictFeat, Paths Paths, string log)
 {
     db.BulkInsert(Application.Import(dictFeat, Paths, log));
     buffer.p_applications = db.Application.ToList();
 }
예제 #19
0
 private static void InsertBundles(FeaturesContext db, DBBuffer buffer, Dictionary <string, int> dictFeat, Paths Paths, string log)
 {
     db.BulkInsert(Bundle.Import(dictFeat, Paths, log));
     buffer.p_bundles = db.Bundle.ToList();
 }
예제 #20
0
 private static void InsertDistributors(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(Distributor.Import(Paths, log));
     buffer.p_Distributors = db.Distributor.ToList();
 }
예제 #21
0
		// ANTO DB
		public void FillFromDB(FeaturesContext _db)
		{
			Licenses = _db.License.ToList();
			Twins = _db.TwinLicenses.ToList();
			PhysicalModels = _db.PhysicalModel.ToList();
			LicenseRelations = _db.LicenseRelation.ToList();
			LicenseRelationExceptions = _db.LicenseRelationException.ToList();
			Applications = _db.Application.ToList();
			Options = _db.Option.ToList();
			FeatureRelations = _db.FeatureRelation.ToList();
			Deprecates = _db.Deprecated.ToList();
			Features = _db.Feature.ToList();
			SettingsFamilies = _db.SettingFamily.ToList();
			SWpacks = _db.Swpack.ToList();
			Probes = _db.Probe.ToList();
			Kits = _db.BiopsyKits.ToList();
			ProbeTransducers = _db.ProbeTransducers.ToList();
			Countries = _db.Country.ToList();
			Certifiers = _db.Certifier.OrderBy(item => item.Id).ToList(); // ANTO DB in SQL Server the Id 2 comes before Id 1
			CertifierVersions = _db.CertifierVersion.ToList();
			CountryVersions = _db.CountryVersion.ToList();
			CountryLicenses = _db.CountryLicense.ToList();
			Distributors = _db.Distributor.ToList();
			MinorVersionAssociations = _db.MinorVersionAssociation.ToList();

			CountryDictionary = new Dictionary<string, int>();
			DistributorDictionary = new Dictionary<string, int>();
			foreach (var countryLicense in CountryLicenses)
			{
				var country = Countries.Single(c => c.Id == countryLicense.CountryId);
				Distributor distributor = null;
				if (countryLicense.DistributorId != null)
				{
					distributor = Distributors.Single(d => d.Id == countryLicense.DistributorId);
				}
				var license = Licenses.Single(l => l.Id == countryLicense.LicenseId);
				CountryItems.CountryItemList.Add(new CountryItem(country, distributor, license));

				var comboValue = GetCountryComboDisplay(country, distributor);
				CountryDictionary.Add(comboValue, country.Id);
				if (distributor != null)
				{
					DistributorDictionary.Add(comboValue, distributor.Id);
				}
			}

			var LModels = _db.LogicalModel.ToList();
			ModelLicenses = LModels.Join(Licenses, m => m.LicenseId, l => l.Id, (m, l) => new ModelLicense(m, l)).ToList();
			FeatureLicenses = Features.Join(Licenses, f => f.LicenseId, l => l.Id, (f, l) => new FeatureLicense(f, l)).ToList();

			OptionDictionary = Options.Join(Features, o => o.FeatureId, f => f.Id, (o, f) => new
			{
				option = o,
				feature = f
			}).ToDictionary(x => x.feature.NameInCode, x => x.option.Id);

			ApplicationDictionary = Applications.ToList().Join(Features, a => a.FeatureId, f => f.Id, (a, f) => new
			{
				application = a,
				feature = f
			}).ToDictionary(x => x.feature.NameInCode, x => x.application.Id);

			ProbeDictionary = Probes.ToDictionary(x => x.SaleName, y => y.Id);
			KitDictionary = Kits.ToDictionary(x => x.Name, y => y.Id);

			LogicalModelDictionary = LModels.Join(Licenses, m => m.LicenseId, l => l.Id, (m, l) => new
			{
				modelId = m.Id,
				licenseName = l.Name
			}).ToDictionary(x => x.licenseName, y => y.modelId);

			// license names: if the feature is not associated to any license, take the name of the licensed parent in the FeatureRelation
			foreach (var feature in Features)
			{
				if (feature.LicenseId != null)
				{
					LicenseNames.Add(new LicenseName(feature.NameInCode, Licenses.Single(l => l.Id == feature.LicenseId)));
				}
				else
				{
					var parentLicenseFeatures = FeatureRelations.Where(b => b.FeatureId == feature.Id)
												.Join(FeatureLicenses, b => b.ParentFeatureId, fl => fl.Feature.Id, (b, fl) => fl.License).ToList();
					foreach (var parent in parentLicenseFeatures)
					{
						LicenseNames.Add(new LicenseName(feature.NameInCode, parent));
					}
				}
			}
		}
예제 #22
0
 private static void InsertMinorVersions(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(MinorVersionAssociation.Import(Paths, log));
     buffer.p_MinorVersionAssociation = db.MinorVersionAssociation.ToList();
 }
예제 #23
0
 private static void InsertTwinLicenses(FeaturesContext db, Dictionary <string, int> dictLicenses, Paths Paths, string log)
 {
     db.BulkInsert(TwinLicenses.Import(dictLicenses, Paths, log));
 }
예제 #24
0
 private static void InsertPartNumbers(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(PartNumbersAssociations.Import(Paths, buffer, log));
     buffer.p_PartNumbersAssociations = db.PartNumbersAssociations.ToList();
 }
예제 #25
0
 private static void InsertSettingsFamilies(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(SettingFamily.Import(buffer.p_swPacks, Paths, log));
     buffer.p_settingsFamilies = db.SettingFamily.ToList();
 }
예제 #26
0
 private static void ImportVersions(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.ReadVersion(buffer, Paths, log);
 }
예제 #27
0
 private static void InsertCountryLicenses(FeaturesContext db, DBBuffer buffer, Paths Paths, string log)
 {
     db.BulkInsert(CountryLicense.Import(buffer, Paths, log));
     buffer.p_CountryLicenses = db.CountryLicense.ToList();
 }
예제 #28
0
 private static void ImportRegulatoryFeatures(FeaturesContext db, DBBuffer buffer, Paths Paths, string LogXml2DB)
 {
     db.BulkInsert(RegulatoryFeature.Import(buffer, Paths, LogXml2DB));
     buffer.p_RegualtoryFeatures = db.RegulatoryFeature.ToList();
 }
예제 #29
0
 public FeaturesController(FeaturesContext context)
 {
     _context = context;
 }
예제 #30
0
 private static void InsertSWPacks(FeaturesContext db, DBBuffer buffer, Paths Paths, string logFileXml2DB)
 {
     db.BulkInsert(Swpack.Import(Paths, logFileXml2DB));
     buffer.p_swPacks = db.Swpack.ToList();
 }