Example #1
0
        public void Get_Details_Test()
        {
            DatabaseLogic datbaseLogic = new DatabaseLogic(new DatabaseConnection());
            int?          i            = datbaseLogic.GetDetails(23).Count;

            Assert.AreNotEqual(null, i);
        }
Example #2
0
        public ActionResult DbJson(string serverName)
        {
            var list = new List <IdNameModel>();

            if (serverName != "")
            {
                var databaseLogic     = new DatabaseLogic();
                var listDatabaseModel = new List <DatabaseModel>();
                var databaseModels    = databaseLogic.GetAllDatabase(serverName).ToDatabaseModels();
                if (databaseModels != null)
                {
                    listDatabaseModel = databaseModels.ToList();
                }
                list.AddRange(listDatabaseModel.Select(i => new IdNameModel()
                {
                    Text  = i.DatabaseName,
                    Value = i.DatabaseName
                }));
            }
            list.Add(new IdNameModel()
            {
                Text  = "全部",
                Value = ""
            });
            return(Content(JsonConvert.SerializeObject(list)));
        }
Example #3
0
        public void Get_Count_Test()
        {
            DatabaseLogic datbaseLogic = new DatabaseLogic(new DatabaseConnection());
            int?          i            = datbaseLogic.GetFundCount("Gym");

            Assert.AreNotEqual(null, i);
        }
        public static int Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Information()
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
                         .Enrich.FromLogContext()
                         .Filter.ByExcluding((logEvent) => logEvent.MessageTemplate.Text.Contains("Source:"))
                         .WriteTo.File(
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs", $"log_{DateTime.UtcNow.ToString("yyyy _ MM _ dd _ HH _ mm _ ss _ fffffff").Replace(" ", string.Empty)}_UTC.txt"),
                restrictedToMinimumLevel: LogEventLevel.Information,
                fileSizeLimitBytes: 5_000_000,
                rollOnFileSizeLimit: true
                )
                         .CreateLogger();

            try
            {
                Log.Information("Starting web host...");
                var host = CreateHostBuilder(args).Build();

                DatabaseLogic.Initialize <PromoCodesAspNetCoreWebApiDbContext>(host.Services);

                host.Run();
                return(0);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Example #5
0
        public void Get_Ten_Items_Test()
        {
            DatabaseLogic datbaseLogic = new DatabaseLogic(new DatabaseConnection());
            int?          i            = datbaseLogic.GetDataWithName("School", 0).Count;

            Assert.AreEqual(10, i);
        }
Example #6
0
        public void Insert_Fund_Test()
        {
            DatabaseLogic datbaseLogic = new DatabaseLogic(new DatabaseConnection());
            Random        rand         = new Random();
            string        status       = datbaseLogic.InsertRandomFund(rand);

            Assert.AreEqual("Complete", status);
        }
Example #7
0
        public ActionResult _PatientOverview()
        {
            int id       = Convert.ToInt32(Session["patientId"].ToString());
            var db_logic = new DatabaseLogic(connection, id);
            var model    = db_logic.GetSummaryData();

            return(PartialView(model));
        }
Example #8
0
        public ActionResult CreatePatient(CreatePatientModel model)
        {
            var db_logic = new DatabaseLogic(connection);

            db_logic.PostCreatePatientData(model);

            return(RedirectToAction("AssignPatient"));
        }
Example #9
0
        public ActionResult AssignPatient()
        {
            var model    = new AssignPatientModel();
            var db_logic = new DatabaseLogic(connection);

            model = db_logic.GetAssignPatientData();

            return(View(model));
        }
Example #10
0
        public void Insert_Value_Test()
        {
            DatabaseLogic datbaseLogic = new DatabaseLogic(new DatabaseConnection());
            Random        rand         = new Random();
            int           testFundId   = 23;
            string        status       = datbaseLogic.InsertRandomValue(testFundId, rand);

            Assert.AreEqual("Complete", status);
        }
Example #11
0
        public ItemEntityController()
        {
            var             db      = new DBContext.VareDataModelContext();
            IItemRepository repo    = new ItemRepository(db);
            var             unit    = new AuctionUnitOfWork(db);
            var             dbLogic = new DatabaseLogic(unit, repo);

            _dbLogic = dbLogic;
        }
        public void DatabaseLogic_CreateDatabase()
        {
            DatabaseLogic.CreateDatabase();

            using (SQLiteConnection dbConn = SqlConnectionFactory.GetSqlConnection()) {
                List <Account> temp1 = dbConn.Table <Account>().ToList();
                List <FinancialTransaction> temp2 = dbConn.Table <FinancialTransaction>().ToList();
                List <RecurringTransaction> temp3 = dbConn.Table <RecurringTransaction>().ToList();
                List <Category>             temp4 = dbConn.Table <Category>().ToList();
            }
        }
Example #13
0
        public ActionResult SaveFlowsheets(FlowSheetsModel model)
        {
            model = verifyModel(model);

            int    id       = Convert.ToInt32(Session["patientId"].ToString());
            var    db_logic = new DatabaseLogic(connection, id);
            string mrn      = Session["mrn"].ToString();

            db_logic.PostFlowSheetsData(model, mrn);


            return(RedirectToAction("FlowSheets", model));
        }
Example #14
0
        public ActionResult Summary(SummaryViewModel model)
        {
            var dbid     = Session["patientId"].ToString();
            int db_id    = Convert.ToInt32(dbid);
            var db_logic = new DatabaseLogic(connection, db_id);

            db_logic.PostSummaryInputData(model);

            String s = "https://s3-us-west-2.amazonaws.com/ehr-prod/Patient" + Session["mrn"].ToString() + ".png";

            model.imagePath = s;

            return(RedirectToAction("Summary", new { databaseId = db_id }));
        }
Example #15
0
        static Program()
        {
            var streams = new List <StreamReader>();

            logger            = new Logger();
            presentationLogic = new PresentationLogic();
            var encryptionProcessor          = new Processor();
            IScriptProcessor scriptProcessor = new ScriptProcessor(encryptionProcessor);
            IFileProcessor   fileProcessor   = new FileProcessor(streams);
            IEmailProcessor  emailProcessor  = new EmailProcessor();
            IDatabaseLogic   databaseLogic   = new DatabaseLogic();

            businessLogic = new BusinessLogic(logger, scriptProcessor, fileProcessor, emailProcessor, databaseLogic);
        }
Example #16
0
        public ActionResult Summary(int databaseId)
        {
            var model    = new SummaryViewModel();
            var db_logic = new DatabaseLogic(connection, databaseId);

            model = db_logic.GetSummaryData();

            Session["patientId"] = databaseId;
            Session["mrn"]       = model.mrn;

            String s = "https://s3-us-west-2.amazonaws.com/ehr-prod/Patient" + Session["mrn"].ToString() + ".png";

            model.imagePath = s;

            return(View(model));
        }
        static ViewModelLocator()
        {
            DatabaseLogic.CreateDatabase();

            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            //DataAccess
            SimpleIoc.Default.Register <IDataAccess <Account>, AccountDataAccess>();
            SimpleIoc.Default.Register <IDataAccess <Category>, CategoryDataAccess>();
            SimpleIoc.Default.Register <IDataAccess <FinancialTransaction>, TransactionDataAccess>();
            SimpleIoc.Default.Register <IDataAccess <RecurringTransaction>, RecurringTransactionDataAccess>();
            SimpleIoc.Default.Register <SettingDataAccess>();

            //Logic
            SimpleIoc.Default.Register <IUserNotification, UserNotification>();
            SimpleIoc.Default.Register <IJsonService, JsonService>();
            SimpleIoc.Default.Register <IBackupService, OneDriveBackupService>();
            SimpleIoc.Default.Register(CreateNavigationService);
            SimpleIoc.Default.Register <Utilities>();
            SimpleIoc.Default.Register <Backup>();

            //Manager
            SimpleIoc.Default.Register <LicenseManager>();
            SimpleIoc.Default.Register <CurrencyManager>();

            //Repositories
            SimpleIoc.Default.Register <ITransactionRepository, TransactionRepository>();
            SimpleIoc.Default.Register <IRecurringTransactionRepository, RecurringTransactionRepository>();
            SimpleIoc.Default.Register <IAccountRepository, AccountRepository>();
            SimpleIoc.Default.Register <IRepository <Category>, CategoryRepository>();

            //ViewModels
            SimpleIoc.Default.Register <AddAccountViewModel>();
            SimpleIoc.Default.Register <AccountListUserControlViewModel>();
            SimpleIoc.Default.Register <AddTransactionViewModel>();
            SimpleIoc.Default.Register <BalanceViewModel>();
            SimpleIoc.Default.Register <CategoryListViewModel>();
            SimpleIoc.Default.Register <TransactionListViewModel>();
            SimpleIoc.Default.Register <TileSettingsViewModel>();
            SimpleIoc.Default.Register <GeneralSettingViewModel>();
            SimpleIoc.Default.Register <SettingDefaultsViewModel>();
            SimpleIoc.Default.Register <SelectCurrencyViewModel>();
            SimpleIoc.Default.Register <StatisticViewModel>();
            SimpleIoc.Default.Register <BackupViewModel>();
        }
Example #18
0
        /*
         * _FSBackward
         *
         * When back button is clicked, move the flow sheets
         * table back by 12 hours.
         *
         */
        public ActionResult _FSBackward(FlowSheetsModel model)
        {
            model = verifyModel(model);
            //move all times back by 12 hours, update AM/PM accordingly
            model.backwardTime();
            Session["fs_date"] = model.curDate;
            Session["fs_am"]   = model.am;

            model = verifyModel(model);

            int id       = Convert.ToInt32(Session["patientId"].ToString());
            var db_logic = new DatabaseLogic(connection, id);

            db_logic.DatabaseIntegrityCheck(Session["mrn"].ToString(), model);
            Session["fs_date"] = model.curDate;
            Session["fs_am"]   = model.am;

            //reload the page so that the correct data is filled in for new time
            return(RedirectToAction("FlowSheets", model));
        }
Example #19
0
        /*
         * _FSForward
         *
         * When forward button is clicked, move the flow sheets
         * table forward by 12 hours.
         *
         */
        public ActionResult _FSForward(FlowSheetsModel model)
        {
            model = verifyModel(model);
            //change hours and days to add 12 hours to current time
            model.forwardTime();
            Session["fs_date"] = model.curDate;
            Session["fs_am"]   = model.am;

            model = verifyModel(model);

            int id       = Convert.ToInt32(Session["patientId"].ToString());
            var db_logic = new DatabaseLogic(connection, id);

            db_logic.DatabaseIntegrityCheck(Session["mrn"].ToString(), model);
            Session["fs_date"] = model.curDate;
            Session["fs_am"]   = model.am;

            //reload the page so that the correct data is filled in for new time
            return(RedirectToAction("FlowSheets", model));
        }
Example #20
0
        public ActionResult SummaryImage(HttpPostedFileBase file)
        {
            var dbid     = Session["patientId"].ToString();
            int db_id    = Convert.ToInt32(dbid);
            var db_logic = new DatabaseLogic(connection, db_id);

            if (file.ContentLength > 0)
            {
                //decide where to save the image in the bucket, filename based on patient mrn number
                string savepath   = Path.Combine(Server.MapPath("~/Resources/PatientImages/Patient" + Session["mrn"].ToString() + ".png"));
                string bucketName = "ehr-prod";
                string keyName    = "Patient" + Session["mrn"].ToString() + ".png";

                //path to image uplaoded by user
                var fileName = Path.GetFileName(file.FileName);
                var path     = Path.Combine(Server.MapPath("~/Resources/PatientImages"), fileName);
                //temp save the image locally
                file.SaveAs(savepath);

                IAmazonS3 client;
                client = new AmazonS3Client(awsAccessKey, awsSecretKey, RegionEndpoint.USWest2);
                TransferUtilityConfig config = new TransferUtilityConfig();


                PutObjectRequest request = new PutObjectRequest()
                {
                    BucketName = bucketName,
                    Key        = keyName,
                    FilePath   = savepath,
                    CannedACL  = S3CannedACL.PublicReadWrite
                };
                //save image to S3 bucket
                PutObjectResponse response = client.PutObject(request);
            }

            return(RedirectToAction("Summary", new { databaseId = db_id }));
        }
Example #21
0
 public EditModel(SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }
Example #22
0
 public DeleteModel(SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }
Example #23
0
 public HomeController()
 {
     dblogic = new DatabaseLogic();
 }
 public AddQuestionToSurveyModel(SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }
 public CreateMultipleQuestionsModel(SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }
Example #26
0
 public AccountController()
 {
     _db = new DatabaseLogic();
 }
Example #27
0
 public HomeController()
 {
     _db = new DatabaseLogic();
 }
Example #28
0
 public CreateMultipleAnswersModel(SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }
 public ChangePasswordController()
 {
     db = new DatabaseLogic();
 }
Example #30
0
 public DetailsModel(SurveySite.SurveyDBContext context)
 {
     _databaseLogic = new DatabaseLogic(context);
 }