public void DeleteFile(string fileGUID) { dbController db = new dbController(); string sql = "Select OriginalFilePath from tblFiles Where LockedFileName ='" + fileGUID + "'"; string originalPath = db.getQueryScaller(sql).ToString(); sql = "Update tblFiles Set Status = 0 Where LockedFileName ='" + fileGUID + "'"; db.getQueryScaller(sql); }
public void RestoreFile(string fileGUID) { dbController db = new dbController(); string sql = "Select OriginalFilePath from tblFiles Where LockedFileName ='" + fileGUID + "'"; string originalPath = db.getQueryScaller(sql).ToString(); sql = "Update tblFiles Set Status = 0 Where LockedFileName ='" + fileGUID + "'"; db.getQueryScaller(sql); string LockedFilePath = VaultFolderPath() + fileGUID; if (File.Exists(LockedFilePath)) { File.Copy(LockedFilePath, originalPath); } }
public static void AddRecord(string OrignalFileName, string LockedFile) { string sql = "Insert into tblFiles (OriginalFilePath,LockedFileName,Status) Values ('" + OrignalFileName + "','" + LockedFile + "',1)"; dbController db = new dbController(); db.getQueryScaller(sql); }
public static void DeleteOldFiles() { dbController db = new dbController(); string sql = "Select LockedFileName From tblFiles Where Status = 0"; DataTable tbl = db.getQueryList(sql); FileController fileC = new FileController(); foreach (DataRow row in tbl.Rows) { string FilePathToDelete = fileC.VaultFolderPath() + row["LockedFileName"].ToString(); File.Delete(FilePathToDelete); } sql = "Delete From tblFiles Where Status = 0"; db.getQueryScaller(sql); }