Beispiel #1
0
 public int GetImageFilesCount()
 {
     using (var db = new ResultDBContext())
     {
         return((from imageFile in db.imageFiles select imageFile).Count());
     }
 }
Beispiel #2
0
 public ImageFile InsertImageFile(ImageFile imageFile)
 {
     using (var db = new ResultDBContext())
     {
         db.imageFiles.InsertOnSubmit(imageFile);
         db.SubmitChanges();
     }
     return(imageFile);
 }
Beispiel #3
0
 public ImageInfo InsertImageInfo(ImageInfo imageInfo)
 {
     using (var db = new ResultDBContext())
     {
         db.imageInfos.InsertOnSubmit(imageInfo);
         db.SubmitChanges();
     }
     return(imageInfo);
 }
Beispiel #4
0
 public bool DatabaseExists()
 {
     try
     {
         using (var db = new ResultDBContext())
         {
             return(db.DatabaseExists());
         }
     }
     catch (Exception)
     {
         throw new Exception("No Connection to the Source Database.");
     }
 }
Beispiel #5
0
        public void RunSQLScript(string SQLScriptName)
        {
            string sqlScript = null;

            if (SQLScriptName.ToLower().Equals("reset"))
            {
                //To Do: This scripts need to be relative, but for now its local..
                sqlScript = File.ReadAllText(@"C:\Users\Chris\Source\Repos\UCN-4-Semester-Project---Group-7\TrashDetector\ResultDatabase\Scripts\Reset.sql");
            }

            if (sqlScript != null)
            {
                using (var db = new ResultDBContext())
                {
                    db.ExecuteCommand(sqlScript);
                }
            }
        }