예제 #1
0
 public FileStreamResult Download()
 {
     return(new FileStreamResult(LocalDbHelper.Download(), "application/x-sql")
     {
         FileDownloadName = "localdb.sql"
     });
 }
예제 #2
0
        public IActionResult Restore([Bind("Path")] string path)
        {
            var success = LocalDbHelper.Restore(path);

            if (success)
            {
                return(RedirectToAction("Index", new { table = "T1" }));
            }

            return(RedirectToAction("Error"));
        }
예제 #3
0
        public IActionResult Delete([Bind("ID")] T1 data)
        {
            var success = LocalDbHelper.Delete(data);

            if (success)
            {
                return(RedirectToAction("Index", new { table = "T1" }));
            }

            return(RedirectToAction("Error"));
        }
예제 #4
0
        public ContentResult Backup()
        {
            var success = LocalDbHelper.Backup();

            if (success)
            {
                return(Content("{\"success\":true}", "application/json"));
            }

            return(Content("{\"success\":false}", "application/json"));
        }
예제 #5
0
        public IActionResult Index(string table = null)
        {
            var data = new List <T1>();

            if (table == "T1")
            {
                ViewData["Table"] = table;
                data = LocalDbHelper.ReadT1();
            }

            return(View(data));
        }
예제 #6
0
        public IActionResult Index([Bind("ID,Name")] FilterModel filterModel, string table = null)
        {
            var data = new List <T1>();

            if (table == "T1")
            {
                ViewData["Table"] = table;
                data = LocalDbHelper.ReadT1(filterModel);
            }

            ViewData["Filter"] = filterModel;

            return(View(data));
        }
예제 #7
0
        public void TestCreateConnectCloseDeleteDatabase()
        {
            var connStr = LocalDbHelper.CreateDatabase("Database1", InstanceName);

            Assert.IsTrue(File.Exists(Environment.ExpandEnvironmentVariables(Path.Combine(LocalDbHelper.DataPath, InstanceName, "Database1_data.mdf"))));

            var conn = new System.Data.SqlClient.SqlConnection(connStr);

            conn.Open();
            Assert.AreEqual(System.Data.ConnectionState.Open, conn.State);
            // intentionally leaving database connection open above

            LocalDbHelper.DeleteDatabase("Database1", InstanceName);
            Assert.IsFalse(File.Exists(Environment.ExpandEnvironmentVariables(Path.Combine(LocalDbHelper.DataPath, InstanceName, "Database1_data.mdf"))));
        }
예제 #8
0
        private static bool Bootstrap()
        {
            container = new Container();
            var connectionstring = LocalDbHelper.GetConnectionString();

            if (string.IsNullOrEmpty(connectionstring))
            {
                MessageBox.Show("De database kon niet worden aangemaakt of gevonden. Mogelijk is deze niet geïnstalleerd. Installeer SqlLocalDB.MSI", "Database niet gevonden", MessageBoxButtons.OK);
                return(false);
            }


            container.Register <IDataService>(() => new DataService(connectionstring), Lifestyle.Singleton);
            container.Register <TopXConverter>();
            return(true);
        }
 public PlatformBllBase()
 {
     m_dbHelper = LocalDbHelper <Platform> .Instance;
 }
예제 #10
0
 public InstanceStatusKeeper(ISLogger logger)
 {
     this.logger        = logger;
     instanceInfoHelper = new InstanceInfoHelper();
     localDbHelper      = new LocalDbHelper();
 }
예제 #11
0
 public static void Cleanup()
 {
     LocalDbHelper.DeleteInstance(InstanceName);
 }
예제 #12
0
 static LocalDbHelperTests()
 {
     LocalDbHelper.TryDeleteInstance(InstanceName);
     LocalDbHelper.CreateInstance(InstanceName);
 }
예제 #13
0
 public CommonRepository()
 {
     DbHelper = new LocalDbHelper();
 }
 public UserBllBase()
 {
     m_dbHelper = LocalDbHelper <User> .Instance;
 }