Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public List <string> GetAllImagesGUID()
        {
            string        sql          = "Select LockedFileName From tblFiles";
            dbController  db           = new dbController();
            DataTable     FileNamesTbl = db.getQueryList(sql);
            List <string> files        = new List <string>();

            foreach (DataRow row in FileNamesTbl.Rows)
            {
                files.Add(row["LockedFileName"].ToString());
            }

            return(files);
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
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);
        }