예제 #1
0
 /// <summary>
 /// Inserts a new pathology case into the database.
 /// Case number must be unique. If not unique, insertion will be ignored by sqlite database.
 /// </summary>
 /// <param name="caselyUserData"></param>
 public static void InsertNewCaselyUserData(CaselyUserData caselyUserData)
 {
     using (var cn = new SQLiteConnection(DbConnectionString)) {
         var sql = @"INSERT INTO casely_user_data (case_number, service) VALUES (@CaseNumber, @Service);";
         DynamicParameters dp = new DynamicParameters();
         dp.Add("@CaseNumber", caselyUserData.CaseNumber, System.Data.DbType.String);
         dp.Add("@Service", caselyUserData.Service, System.Data.DbType.String);
         var result = cn.Execute(sql, dp);
     }
 }
예제 #2
0
 public static void InsertNewParts(List <PartEntry> parts, CaselyUserData caselyUserData)
 {
     using (var cn = new SQLiteConnection(DbConnectionString)) {
         var sql = @"INSERT INTO casely_user_data (case_number, service)
                      VALUES (@CaseNumber, @Service);";
         cn.Execute(sql, caselyUserData);
         sql = @"INSERT INTO part_entry (part, procedure,
                     specimen, date_modified, time_modified, case_number, author_id)
                     VALUES (@Part, @Procedure, @Specimen, @DateModifiedString,@TimeModifiedString, @CaseNumber, @AuthorID);";
         cn.Execute(sql, parts);
     }
 }
예제 #3
0
 public static void UpdateCompletedCase(CaselyUserData caselyUserData)
 {
     using (var cn = new SQLiteConnection(DbConnectionString)) {
         var sql = @"UPDATE casely_user_data 
                         SET case_number = @CaseNumber, service = @Service, evaluation = @Evaluation, evaluation_comment = @EvaluationComment
                         WHERE case_number = @CaseNumber;";
         cn.Open();
         cn.EnableExtensions(true);
         cn.LoadExtension("SQLite.Interop.dll", "sqlite3_fts5_init"); // needed in order to modify the full text table
         cn.Execute(sql, caselyUserData);
         cn.Close();
     }
 }
예제 #4
0
 public static void InsertNewPartDiagnosisEntry(List <PartDiagnosis> ce, CaselyUserData caselyUserData)
 {
     using (var cn = new SQLiteConnection(DbConnectionString)) {
         var sql = @"INSERT INTO casely_user_data (case_number, service)
                      VALUES (@CaseNumber, @Service);";
         cn.Execute(sql, caselyUserData);
         sql = @"INSERT INTO part_diagnosis ( case_number, part, date_modified, time_modified,
                                         organ_system, organ, category, diagnosis, diagnosis_detailed)
                     VALUES (@CaseNumber, @Part, @DateModifiedString, @TimeModifiedString,@OrganSystem, @Organ, 
                             @Category, @Diagnosis, @DiagnosisDetailed);";
         cn.Execute(sql, ce);
     }
 }
예제 #5
0
        public static void InsertNewCaseEntry(CaseEntry ce, CaselyUserData caselyUserData)
        {
            using (var cn = new SQLiteConnection(DbConnectionString)) {
                cn.Open();
                cn.EnableExtensions(true);
                cn.LoadExtension("SQLite.Interop.dll", "sqlite3_fts5_init"); // this line is required to enable full text search support

                var sql = @"INSERT INTO casely_user_data (case_number, service)
                             VALUES (@CaseNumber, @Service);";
                cn.Execute(sql, caselyUserData);
                sql = @"INSERT INTO case_entry (author_id, case_number, date_modified,
                                                time_modified, tumor_synoptic, comment, result, material, history, interpretation, gross, microscopic)
                            VALUES (@AuthorID, @CaseNumber,@DateModifiedString,@TimeModifiedString,@TumorSynoptic, @Comment, @Result, @Material, @History, 
                                    @Interpretation, @Gross, @Microscopic);";
                cn.Execute(sql, ce);
            }
        }