示例#1
0
 private void updateStatuses()
 {
     // check for features that have become usable
     for (int i = 0; i < this.lockedFeatures.Count;)
     {
         AppFeature feature = this.lockedFeatures[i];
         if (feature.GetIsUsable())
         {
             this.newUsableFeatures.Add(feature);
             this.lockedFeatures.RemoveAt(i);
         }
         else
         {
             i++;
         }
     }
     // check for features that have become used
     for (int i = 0; i < this.newUsableFeatures.Count;)
     {
         AppFeature feature = this.newUsableFeatures[i];
         if (feature.GetHasBeenUsed())
         {
             this.numUsedFeatures++;
             this.newUsableFeatures.RemoveAt(i);
         }
         else
         {
             i++;
         }
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            AppFeature appFeature = db.AppFeatures.Find(id);

            db.AppFeatures.Remove(appFeature);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public AppFeatureView(AppFeature data, bool Load)
 {
     this.AppId          = data.AppId;
     this.AppName        = data.App.Name;
     this.FeatureAppId   = data.FeatureAppId;
     this.FeatureAppName = data.FeatureApp.Name;
     this.Content        = data.FeatureApp.Name + data.Content;
     this.Order          = data.Order;
 }
 public ActionResult Edit([Bind(Include = "AppFeatureId,Category,Name,Description,Status,VoteCount")] AppFeature appFeature)
 {
     if (ModelState.IsValid)
     {
         db.Entry(appFeature).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Admin"));
     }
     return(View(appFeature));
 }
        public ActionResult Create([Bind(Include = "AppFeatureId,Category,Name,Description,State,VoteCount")] AppFeature appFeature)
        {
            if (ModelState.IsValid)
            {
                db.AppFeatures.Add(appFeature);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(appFeature));
        }
        private async void menu_list_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e)
        {
            AppFeature tappedItem = e.ItemData as AppFeature;

            switch (tappedItem.Title)
            {
            case "Users not following you back":
                var not_followin_back_page_instance = new NotFollowingMePage();
                not_followin_back_page_instance.InstaApi          = InstaApi;
                not_followin_back_page_instance.CurrentUserObject = CurrentUserObject;

                ObservableCollection <InstagramUser> usernames = new ObservableCollection <InstagramUser>();

                foreach (var u in not_following_back)
                {
                    var added_user = new InstagramUser
                    {
                        FullName = u.FullName,
                        Username = u.UserName,
                        ImageUrl = u.ProfilePicUrl,
                        UserId   = u.Pk
                    };
                    usernames.Add(added_user);
                }

                not_followin_back_page_instance.not_following_back = usernames;
                await Navigation.PushAsync(not_followin_back_page_instance);

                break;

            case "Users you don't follow back":
                var you_dont_follow_page_instance = new YouDontFollowPage();
                you_dont_follow_page_instance.InstaApi = InstaApi;

                var usernames1 = new List <InstagramUser>();

                foreach (var u in i_dont_follow_back)
                {
                    var added_user = new InstagramUser
                    {
                        FullName = u.FullName,
                        Username = u.UserName,
                        ImageUrl = u.ProfilePicUrl
                    };
                    usernames1.Add(added_user);
                }

                you_dont_follow_page_instance.i_dont_follow_back = usernames1;
                await Navigation.PushAsync(you_dont_follow_page_instance);

                break;
            }
        }
示例#7
0
        public async Task <ActionResult> AppFeaturesAdd(AppFeatureView model)
        {
            using (var db = new TDContext())
            {
                if (!ModelState.IsValid)
                {
                    return(Json(Js.Error(this.GetModelStateError())));
                }
                var FeatureAppId = model.Selected;

                var find = db.FeatureApps.Find(FeatureAppId);
                if (find == null)
                {
                    find = db.FeatureApps.FirstOrDefault(x => x.Name == model.Selected);
                    if (find == null)
                    {
                        find = new FeatureApp
                        {
                            Name = model.Selected
                        };
                        db.FeatureApps.Add(find);
                        var str = await db.SaveDatabase();

                        if (str != null)
                        {
                            return(Json(str.GetError()));
                        }
                    }
                    FeatureAppId = find.Id;
                }


                var data = await db.AppFeatures.FindAsync(model.AppId, FeatureAppId);

                if (data != null)
                {
                    return(Json(Global.FeatureAppAppExist.GetError()));
                }

                data         = new AppFeature(model.AppId, FeatureAppId);
                data.Content = model.Content;
                data.Order   = model.Order;
                db.AppFeatures.Add(data);
                var str2 = await db.SaveDatabase();

                if (str2.NotNull())
                {
                    return(Json(str2.GetError()));
                }
                return(Json(Js.SuccessRedirect(Global.FeatureAppAppAdded, "AppFeaturesAdd/" + model.AppId)));
            }
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AppFeature appFeature = db.AppFeatures.Find(id);

            if (appFeature == null)
            {
                return(HttpNotFound());
            }
            return(View(appFeature));
        }
        public async Task <ActionResult> UpVote(int id, bool up)
        {
            AppFeature appFeature = db.AppFeatures.Find(id);

            if (appFeature == null)
            {
                return(Json(new { status = "Error" }));
            }

            if (up)
            {
                ++appFeature.VoteCount;
            }
            else
            {
                --appFeature.VoteCount;
            }


            db.Entry(appFeature).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(Json(new { status = "Success" }));
        }
示例#10
0
        public void ConfigureServices(IServiceCollection services)
        {
            var             assemblyNames = Assembly.GetEntryAssembly().GetReferencedAssemblies();
            List <Assembly> assemblies    = new List <Assembly>();

            foreach (var assemblyName in assemblyNames)
            {
                assemblies.Add(Assembly.Load(assemblyName));
            }

            services.AddMediatR(assemblies);

            services.AddResponseCompression(options =>
            {
                options.Providers.Add <GzipCompressionProvider>();
                options.EnableForHttps = true;
                options.MimeTypes      =
                    ResponseCompressionDefaults.MimeTypes.Concat(
                        new[]
                {
                    "application/xhtml+xml",
                    "application/atom+xml",
                    "image/svg+xml",
                });
            });

            services.Configure <GzipCompressionProviderOptions>(options =>
                                                                options.Level = CompressionLevel.Fastest);

            services.AddResponseCompression(options =>
            {
                options.Providers.Add <GzipCompressionProvider>();
                options.EnableForHttps = true;
            });

            services.Configure <GzipCompressionProviderOptions>(options =>
            {
                options.Level = CompressionLevel.Fastest;
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info
                {
                    Title       = "Dwapi API Test",
                    Version     = "v1",
                    Description = "Dwapi API. Exposes endpoints used in datawarehouse operations"
                });
            });

            services.AddSignalR();

            services.AddHangfire(_ => _.UseMemoryStorage());
            JobStorage.Current = new MemoryStorage();
            services.AddMvc()
            .AddMvcOptions(o => o.OutputFormatters.Add(new XmlDataContractSerializerOutputFormatter()))
            .AddJsonOptions(o =>
                            o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

            services.ConfigureWritable <ConnectionStrings>(Configuration.GetSection("ConnectionStrings"));
            var connectionString      = Startup.Configuration["ConnectionStrings:DwapiConnection"];
            DatabaseProvider provider = (DatabaseProvider)Convert.ToInt32(Configuration["ConnectionStrings:Provider"]);

            try
            {
                if (provider == DatabaseProvider.MySql)
                {
                    services.AddDbContext <SettingsContext>(o =>
                    {
                        o.UseMySql(connectionString,
                                   x => x.MigrationsAssembly(typeof(SettingsContext).GetTypeInfo().Assembly.GetName()
                                                             .Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    }
                                                            );
                    services.AddDbContext <ExtractsContext>(o =>
                    {
                        o.UseMySql(connectionString,
                                   x => x.MigrationsAssembly(typeof(ExtractsContext).GetTypeInfo().Assembly.GetName().Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    });
                    services.AddDbContext <UploadContext>(o =>
                    {
                        o.UseMySql(connectionString,
                                   x => x.MigrationsAssembly(typeof(UploadContext).GetTypeInfo().Assembly.GetName().Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    });
                }

                if (provider == DatabaseProvider.MsSql)
                {
                    services.AddDbContext <SettingsContext>(
                        o =>
                    {
                        o.UseSqlServer(connectionString,
                                       x => x.MigrationsAssembly(typeof(SettingsContext).GetTypeInfo().Assembly.GetName()
                                                                 .Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    }
                        );
                    services.AddDbContext <ExtractsContext>(o =>
                    {
                        o.UseSqlServer(connectionString,
                                       x => x.MigrationsAssembly(typeof(ExtractsContext).GetTypeInfo().Assembly.GetName().Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    });
                    services.AddDbContext <UploadContext>(o =>
                    {
                        o.UseSqlServer(connectionString,
                                       x => x.MigrationsAssembly(typeof(UploadContext).GetTypeInfo().Assembly.GetName().Name));
                        o.EnableSensitiveDataLogging(CurrrentEnv.IsDevelopment());
                    });
                }
            }
            catch (Exception e)
            {
                var error = "Connections not Initialized";
                Log.Error(e, error);
                StartupErrors.Add(error);
            }

            try
            {
                var name        = Configuration["Features:PKV:Name"];
                var description = Configuration["Features:PKV:Description"];
                var key         = Configuration["Features:PKV:Key"];
                AppFeature = AppFeature.Load(name, description, key, CurrrentEnv.IsDevelopment());
            }
            catch (Exception e)
            {
                string error = "Features not Initialized";
                Log.Error(e, error);
                StartupErrors.Add(error);
            }

            services.AddTransient <ExtractsContext>();
            services.AddScoped <ICentralRegistryRepository, CentralRegistryRepository>();
            services.AddScoped <IEmrSystemRepository, EmrSystemRepository>();
            services.AddScoped <IDocketRepository, DocketRepository>();
            services.AddScoped <IDatabaseProtocolRepository, DatabaseProtocolRepository>();
            services.AddScoped <IRestProtocolRepository, RestProtocolRepository>();
            services.AddScoped <IExtractRepository, ExtractRepository>();
            services.AddScoped <IPsmartStageRepository, PsmartStageRepository>();
            services.AddTransient <IExtractHistoryRepository, ExtractHistoryRepository>();
            services.AddScoped <ITempPatientExtractRepository, TempPatientExtractRepository>();
            services.AddScoped <ITempPatientArtExtractRepository, TempPatientArtExtractRepository>();
            services.AddScoped <ITempPatientBaselinesExtractRepository, TempPatientBaselinesExtractRepository>();
            services.AddScoped <ITempPatientLaboratoryExtractRepository, TempPatientLaboratoryExtractRepository>();
            services.AddScoped <ITempPatientPharmacyExtractRepository, TempPatientPharmacyExtractRepository>();
            services.AddScoped <ITempPatientStatusExtractRepository, TempPatientStatusExtractRepository>();
            services.AddScoped <ITempPatientVisitExtractRepository, TempPatientVisitExtractRepository>();
            services.AddScoped <ITempPatientAdverseEventExtractRepository, TempPatientAdverseEventExtractRepository>();
            services.AddScoped <IValidatorRepository, ValidatorRepository>();
            services.AddScoped <IPatientExtractRepository, PatientExtractRepository>();
            services.AddScoped <IPatientArtExtractRepository, PatientArtExtractRepository>();
            services.AddScoped <IPatientBaselinesExtractRepository, PatientBaselinesExtractRepository>();
            services.AddScoped <IPatientLaboratoryExtractRepository, PatientLaboratoryExtractRepository>();
            services.AddScoped <IPatientPharmacyExtractRepository, PatientPharmacyExtractRepository>();
            services.AddScoped <IPatientStatusExtractRepository, PatientStatusExtractRepository>();
            services.AddScoped <IPatientVisitExtractRepository, PatientVisitExtractRepository>();
            services.AddScoped <IPatientAdverseEventExtractRepository, PatientAdverseEventExtractRepository>();
            services.AddScoped <ITempPatientExtractErrorSummaryRepository, TempPatientExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientArtExtractErrorSummaryRepository, TempPatientArtExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientBaselinesExtractErrorSummaryRepository,
                        TempPatientBaselinesExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientLaboratoryExtractErrorSummaryRepository,
                        TempPatientLaboratoryExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientPharmacyExtractErrorSummaryRepository,
                        TempPatientPharmacyExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientStatusExtractErrorSummaryRepository,
                        TempPatientStatusExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempPatientVisitExtractErrorSummaryRepository, TempPatientVisitExtractErrorSummaryRepository
                        >();
            services
            .AddScoped <ITempPatientAdverseEventExtractErrorSummaryRepository,
                        TempPatientAdverseEventExtractErrorSummaryRepository>();

            services.AddScoped <IMasterPatientIndexRepository, MasterPatientIndexRepository>();
            services.AddScoped <ITempMasterPatientIndexRepository, TempMasterPatientIndexRepository>();

            services.AddScoped <IDatabaseManager, DatabaseManager>();
            services.AddScoped <IRegistryManagerService, RegistryManagerService>();
            services.AddScoped <IEmrManagerService, EmrManagerService>();
            services.AddScoped <IExtractManagerService, ExtractManagerService>();

            services.AddScoped <IPsmartExtractService, PsmartExtractService>();
            services.AddScoped <IExtractStatusService, ExtractStatusService>();
            services.AddScoped <IPsmartSourceReader, PsmartSourceReader>();
            services.AddScoped <IPsmartSendService, PsmartSendService>();

            services.AddScoped <IDwhExtractSourceReader, DwhExtractSourceReader>();
            services.AddScoped <IPatientSourceExtractor, PatientSourceExtractor>();
            services.AddScoped <IPatientArtSourceExtractor, PatientArtSourceExtractor>();
            services.AddScoped <IPatientBaselinesSourceExtractor, PatientBaselinesSourceExtractor>();
            services.AddScoped <IPatientLaboratorySourceExtractor, PatientLaboratorySourceExtractor>();
            services.AddScoped <IPatientPharmacySourceExtractor, PatientPharmacySourceExtractor>();
            services.AddScoped <IPatientStatusSourceExtractor, PatientStatusSourceExtractor>();
            services.AddScoped <IPatientVisitSourceExtractor, PatientVisitSourceExtractor>();
            services.AddScoped <IPatientAdverseEventSourceExtractor, PatientAdverseEventSourceExtractor>();
            services.AddScoped <IExtractValidator, ExtractValidator>();
            services.AddScoped <IPatientLoader, PatientLoader>();
            services.AddScoped <IPatientArtLoader, PatientArtLoader>();
            services.AddScoped <IPatientBaselinesLoader, PatientBaselinesLoader>();
            services.AddScoped <IPatientLaboratoryLoader, PatientLaboratoryLoader>();
            services.AddScoped <IPatientPharmacyLoader, PatientPharmacyLoader>();
            services.AddScoped <IPatientStatusLoader, PatientStatusLoader>();
            services.AddScoped <IPatientVisitLoader, PatientVisitLoader>();
            services.AddScoped <IPatientAdverseEventLoader, PatientAdverseEventLoader>();
            services.AddScoped <IClearDwhExtracts, ClearDwhExtracts>();

            services.AddScoped <IMasterPatientIndexReader, MasterPatientIndexReader>();
            services.AddScoped <IMasterPatientIndexSourceExtractor, MasterPatientIndexSourceExtractor>();
            services.AddScoped <IMasterPatientIndexValidator, MasterPatientIndexValidator>();
            services.AddScoped <IMasterPatientIndexLoader, MasterPatientIndexLoader>();
            services.AddScoped <IClearCbsExtracts, ClearCbsExtracts>();
            services.AddScoped <ICbsExtractReader, CbsExtractReader>();
            services.AddScoped <ICbsSendService, CbsSendService>();
            services.AddScoped <ICbsPackager, CbsPackager>();
            services.AddScoped <IMpiSearchService, MpiSearchService>();

            services.AddScoped <IDwhExtractReader, DwhExtractReader>();
            services.AddScoped <IDwhPackager, DwhPackager>();
            services.AddScoped <IDwhSendService, DwhSendService>();
            services.AddScoped <ICTSendService, CTSendService>();
            services.AddScoped <IDwhExtractSentServcie, DwhExtractSentServcie>();

            services.AddScoped <ITempHTSClientExtractRepository, TempHTSClientExtractRepository>();
            services.AddScoped <ITempHTSClientLinkageExtractRepository, TempHTSClientLinkageExtractRepository>();
            services.AddScoped <ITempHTSClientPartnerExtractRepository, TempHTSClientPartnerExtractRepository>();

            services.AddScoped <IHTSClientExtractRepository, HTSClientExtractRepository>();
            services.AddScoped <IHTSClientLinkageExtractRepository, HTSClientLinkageExtractRepository>();
            services.AddScoped <IHTSClientPartnerExtractRepository, HTSClientPartnerExtractRepository>();

            services.AddScoped <ITempHtsClientsExtractRepository, TempHtsClientsExtractRepository>();
            services.AddScoped <ITempHtsClientsLinkageExtractRepository, TempHtsClientsLinkageExtractRepository>();
            services.AddScoped <ITempHtsClientTestsExtractRepository, TempHtsClientTestsExtractRepository>();
            services.AddScoped <ITempHtsTestKitsExtractRepository, TempHtsTestKitsExtractRepository>();
            services.AddScoped <ITempHtsClientTracingExtractRepository, TempHtsClientTracingExtractRepository>();
            services.AddScoped <ITempHtsPartnerTracingExtractRepository, TempHtsPartnerTracingExtractRepository>();
            services
            .AddScoped <ITempHtsPartnerNotificationServicesExtractRepository,
                        TempHtsPartnerNotificationServicesExtractRepository>();

            services.AddScoped <IHtsClientsExtractRepository, HtsClientsExtractRepository>();
            services.AddScoped <IHtsClientsLinkageExtractRepository, HtsClientsLinkageExtractRepository>();
            services.AddScoped <IHtsClientTestsExtractRepository, HtsClientTestsExtractRepository>();
            services.AddScoped <IHtsTestKitsExtractRepository, HtsTestKitsExtractRepository>();
            services.AddScoped <IHtsClientTracingExtractRepository, HtsClientTracingExtractRepository>();
            services.AddScoped <IHtsPartnerTracingExtractRepository, HtsPartnerTracingExtractRepository>();
            services
            .AddScoped <IHtsPartnerNotificationServicesExtractRepository,
                        HtsPartnerNotificationServicesExtractRepository>();

            services
            .AddScoped <ITempHTSClientExtractErrorSummaryRepository, TempHTSClientExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHTSClientLinkageExtractErrorSummaryRepository,
                        TempHTSClientLinkageExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHTSClientPartnerExtractErrorSummaryRepository,
                        TempHTSClientPartnerExtractErrorSummaryRepository>();

            services
            .AddScoped <ITempHtsClientsExtractErrorSummaryRepository, TempHtsClientsExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHtsClientLinkageErrorSummaryRepository,
                        TempHtsClientsLinkageExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHtsClientTestsErrorSummaryRepository, TempHtsClientTestsExtractErrorSummaryRepository
                        >();
            services.AddScoped <ITempHtsTestKitsErrorSummaryRepository, TempHtsTestKitsExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHtsClientTracingErrorSummaryRepository,
                        TempHtsClientTracingExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHtsPartnerTracingErrorSummaryRepository,
                        TempHtsPartnerTracingExtractErrorSummaryRepository>();
            services
            .AddScoped <ITempHtsPartnerNotificationServicesErrorSummaryRepository,
                        TempHtsPartnerNotificationServicesExtractErrorSummaryRepository>();

            //services.AddScoped<ICleanHtsExtracts, CleanHtsExtracts>();
            services.AddScoped <IClearHtsExtracts, ClearHtsExtracts>();

            services.AddScoped <IHTSExtractSourceReader, HTSExtractSourceReader>();

            /*services.AddScoped<IHTSClientSourceExtractor, HTSClientSourceExtractor>();
             * services.AddScoped<IHTSClientLinkageSourceExtractor, HTSClientLinkageSourceExtractor>();
             * services.AddScoped<IHTSClientPartnerSourceExtractor, HTSClientPartnerSourceExtractor>();*/

            services.AddScoped <IHtsClientsSourceExtractor, HtsClientsSourceExtractor>();
            services.AddScoped <IHtsClientTestsSourceExtractor, HtsClientTestsSourceExtractor>();
            services.AddScoped <IHtsClientsLinkageSourceExtractor, HtsClientsLinkageSourceExtractor>();
            services.AddScoped <IHtsTestKitsSourceExtractor, HtsTestKitsSourceExtractor>();
            services.AddScoped <IHtsClientTracingSourceExtractor, HtsClientTracingSourceExtractor>();
            services.AddScoped <IHtsPartnerTracingSourceExtractor, HtsPartnerTracingSourceExtractor>();
            services
            .AddScoped <IHtsPartnerNotificationServicesSourceExtractor, HtsPartnerNotificationServicesSourceExtractor
                        >();

            /*services.AddScoped<IHTSClientLoader, HTSClientLoader>();
             * services.AddScoped<IHTSClientLinkageLoader, HTSClientLinkageLoader>();
             * services.AddScoped<IHTSClientPartnerLoader, HTSClientPartnerLoader>();*/

            services.AddScoped <IHtsClientsLoader, HtsClientsLoader>();
            services.AddScoped <IHtsClientTestsLoader, HtsClientTestsLoader>();
            services.AddScoped <IHtsClientsLinkageLoader, HtsClientsLinkageLoader>();
            services.AddScoped <IHtsTestKitsLoader, HtsTestKitsLoader>();
            services.AddScoped <IHtsClientTracingLoader, HtsClientTracingLoader>();
            services.AddScoped <IHtsPartnerTracingLoader, HtsPartnerTracingLoader>();
            services.AddScoped <IHtsPartnerNotificationServicesLoader, HtsPartnerNotificationServicesLoader>();

            services.AddScoped <IHtsPackager, HtsPackager>();
            services.AddScoped <IHtsSendService, HtsSendService>();
            services.AddScoped <IHtsExtractValidator, HtsExtractValidator>();
            services.AddScoped <IHtsSendService, HtsSendService>();
            services.AddScoped <IHtsExtractReader, HtsExtractReader>();


            services.AddScoped <ITempMetricMigrationExtractRepository, TempMetricMigrationExtractRepository>();
            services.AddScoped <IMetricMigrationExtractRepository, MetricMigrationExtractRepository>();
            services
            .AddScoped <ITempMetricMigrationExtractErrorSummaryRepository,
                        TempMetricMigrationExtractErrorSummaryRepository>();
            services.AddScoped <IClearMgsExtracts, ClearMgsExtracts>();


            services.AddScoped <IMgsExtractSourceReader, MgsExtractSourceReader>();
            services.AddScoped <IMetricMigrationSourceExtractor, MetricMigrationSourceExtractor>();
            services.AddScoped <IMgsExtractReader, MgsExtractReader>();
            services.AddScoped <IMetricMigrationLoader, MetricMigrationLoader>();
            services.AddScoped <IMgsPackager, MgsPackager>();
            services.AddScoped <IMgsSendService, MgsSendService>();
            services.AddScoped <IMetricExtractValidator, MetricExtractValidator>();


            services.AddScoped <IHtsSendService, HtsSendService>();

            services.AddScoped <IAppDatabaseManager, AppDatabaseManager>();

            services.AddScoped <IEmrMetricRepository, EmrMetricRepository>();
            services.AddScoped <IEmrMetricsService, EmrMetricsService>();
            services.AddScoped <IEmrMetricReader, EmrMetricReader>();

            services.AddScoped <IAppMetricRepository, AppMetricRepository>();
            var container = new Container();

            container.Populate(services);
            ServiceProvider = container.GetInstance <IServiceProvider>();
        }
示例#11
0
        public async Task <ActionResult> AppFeaturesEdit(AppFeatureView model)
        {
            using (var db = new TDContext())
            {
                if (!ModelState.IsValid)
                {
                    return(Json(Js.Error(this.GetModelStateError())));
                }
                var FeatureAppId = model.Selected;

                var find = db.FeatureApps.Find(FeatureAppId);
                if (find == null)
                {
                    find = db.FeatureApps.FirstOrDefault(x => x.Name == model.Selected);
                    if (find == null)
                    {
                        find = new FeatureApp
                        {
                            Name = model.Selected
                        };
                        db.FeatureApps.Add(find);
                        var str = await db.SaveDatabase();

                        if (str != null)
                        {
                            return(Json(str.GetError()));
                        }
                    }
                    FeatureAppId = find.Id;
                }


                var data = await db.AppFeatures.FindAsync(model.AppId, FeatureAppId);

                if (data == null)
                {
                    model.FeatureAppId = FeatureAppId;
                    data = new AppFeature(model.AppId, FeatureAppId)
                    {
                        Content = model.Content,
                        Order   = model.Order
                    };
                    db.AppFeatures.Add(data);
                    var str = await db.SaveDatabase();

                    if (str != null)
                    {
                        return(Json(str.GetError()));
                    }
                }
                data.Content         = model.Content;
                data.Order           = model.Order;
                db.Entry(data).State = EntityState.Modified;
                var result = await db.SaveDatabase();

                if (result.NotNull())
                {
                    result.GetError();
                }
                return(Json(Js.SuccessRedirect(Global.FeatureAppAppChanged, Resources.AdminAppEditLink + model.AppId)));
            }
        }