예제 #1
0
 public int GetImageFilesCount()
 {
     using (var db = new ResultDBContext())
     {
         return((from imageFile in db.imageFiles select imageFile).Count());
     }
 }
예제 #2
0
 public ImageFile InsertImageFile(ImageFile imageFile)
 {
     using (var db = new ResultDBContext())
     {
         db.imageFiles.InsertOnSubmit(imageFile);
         db.SubmitChanges();
     }
     return(imageFile);
 }
예제 #3
0
 public ImageInfo InsertImageInfo(ImageInfo imageInfo)
 {
     using (var db = new ResultDBContext())
     {
         db.imageInfos.InsertOnSubmit(imageInfo);
         db.SubmitChanges();
     }
     return(imageInfo);
 }
예제 #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.");
     }
 }
예제 #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);
                }
            }
        }