예제 #1
0
        public IActionResult DB_Backup()
        {
            //string dbPath = !this.chBackup.Checked ? backPath : AppDomain.CurrentDomain.BaseDirectory;
            string dbname       = DBHelper.GetAttrByStr(DBCenter.DB.ConnectionString, "Initial Catalog");
            string DatabasePath = GetParam("DatabasePath").Split('.')[0];

            if (SafeC.FileNameCheck(DatabasePath))
            {
                return(WriteErr("文件名不规范"));
            }
            string savePath = "";

            if (DBHelper.IsLocalDB(HttpContext.Connection.LocalIpAddress.ToString(), System.Environment.MachineName))
            {
                savePath = function.VToP(dbPath + GetParam("DatabasePath") + ".bak");
            }
            else
            {
                savePath = "D:\\backup\\" + DatabasePath + ".bak";
            }
            string sql = "backup database [" + dbname + "] to  disk='" + savePath + "'  with  init ";

            if (!Directory.Exists(function.VToP(dbPath)))
            {
                SafeSC.CreateDir(dbPath);
            }
            SqlHelper.ExecuteSql(sql);
            return(WriteOK("数据库备份成功", "DBBackUP"));
        }
예제 #2
0
        public IActionResult CSSEdit_Submit()
        {
            string CSSPath = "";

            if (!string.IsNullOrEmpty(FilePath))
            {
                CSSPath = CSSBaseDir + FilePath.Split('.')[0] + ".css";
            }
            else
            {
                string fname = GetParam("TxtFilename").Replace(" ", "").Split('.')[0];
                if (SafeC.FileNameCheck(fname))
                {
                    return(WriteErr("文件名不符合规则"));
                }
                CSSPath = CSSBaseDir + fname + ".css";
            }
            SafeSC.WriteFile(CSSPath, GetParam("textContent"));
            return(WriteOK("操作成功", "CSSManage"));
        }
예제 #3
0
 public static bool FileNameCheck(params string[] fnames)
 {
     return(SafeC.FileNameCheck(fnames));
 }