Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }