Beispiel #1
0
        public ActionResult BackupDatabase()
        {
            var SqlServer = new TM.Connection.SQLServer();

            try
            {
                var path = TM.Common.Directories.DBBak;
                TM.IO.FileDirectory.CreateDirectory(path, false);
                //TM.IO.FileDirectory.SetAccessRule(path, false);
                var backup = new TM.SQLServer.Backup(path);
                backup.BackingAll(SqlServer.Connection);
                //InsertDirectory(TM.Common.Directories.DBBak + "test\\abc");
                var a = InsertDirectoriesFiles(path);
                this.success("thành công");
            }
            catch (Exception ex)
            {
                this.danger(ex.Message);
            }
            finally
            {
                SqlServer.Close();
            }
            return(RedirectToAction("Index"));
        }
        public JsonResult BackupDatabase()
        {
            var SqlServer = new TM.Connection.SQLServer();

            try
            {
                var path = TM.Common.Directories.DBBak;
                TM.IO.FileDirectory.CreateDirectory(path, false);
                //TM.IO.FileDirectory.SetAccessRule(path, false);
                var backup = new TM.SQLServer.Backup(path);
                backup.BackingAll(SqlServer.Connection);
                //InsertDirectory(TM.Common.Directories.DBBak + "test\\abc");
                var a = InsertDirectoriesFiles(path);
                return(Json(new { success = "Backup Database thành công!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex) { return(Json(new { danger = ex.Message }, JsonRequestBehavior.AllowGet)); }
            finally { SqlServer.Close(); }
        }