public static async void Log(string description) { if (Database == null || !Database.ToString().ToLower().Contains("sql")) { return; } Query insertQuery = Database.CreateQuery("INSERT INTO [UpdateLog] (UDate, VhfVer, UserName, MACADDR, Description) VALUES (CURRENT_TIMESTAMP, @VhfVer, @User, @MACADDR, @Description)"); //insertQuery.Parameters.Add(new QueryParameter("@UDate", System.Data.DbType.DateTime2, DateTime.Now)); insertQuery.Parameters.Add(new QueryParameter("@VhfVer", System.Data.DbType.String, _vhfVersion)); insertQuery.Parameters.Add(new QueryParameter("@User", System.Data.DbType.String, _user)); insertQuery.Parameters.Add(new QueryParameter("@MACADDR", System.Data.DbType.String, _macAddress)); insertQuery.Parameters.Add(new QueryParameter("@Description", System.Data.DbType.String, description)); await Task.Factory.StartNew(() => { try { int rows = Database.ExecuteNonQuery(insertQuery); } catch (Exception) { // do nothing, don't let this crash the app } }); }
public static bool DoesDataSourceExistForProject(Project project) { IDbDriver db = project.CollectedData.GetDatabase(); if (db.FullName.Trim().StartsWith("[MS Access]", StringComparison.OrdinalIgnoreCase)) { string databasePath = db.DataSource.StartsWith("data source=") ? db.DataSource.Substring(12) : db.DataSource; if (!System.IO.File.Exists(databasePath)) { return(false); } } else if (db.ToString().Contains("Sql")) { try { foreach (View view in project.Views) { } } catch (Exception) { return(false); } } return(true); }
public Query GenerateDeleteQuery(IDbDriver database, int toViewId, int fromViewId) { string queryString = "DELETE * FROM [metaLinks] WHERE " + "[FromRecordGuid] = @FromRecordGuid AND [ToRecordGuid] = @ToRecordGuid AND [FromViewId] = @FromViewId AND [ToViewId] = @ToViewId"; if (database.ToString().ToLower().Contains("sql")) { queryString = "DELETE FROM [metaLinks] WHERE " + "[FromRecordGuid] = @FromRecordGuid AND [ToRecordGuid] = @ToRecordGuid AND [FromViewId] = @FromViewId AND [ToViewId] = @ToViewId"; } Query deleteQuery = database.CreateQuery(queryString); deleteQuery.Parameters.Add(new QueryParameter("@FromRecordGuid", DbType.String, SourceCaseVM.RecordId)); deleteQuery.Parameters.Add(new QueryParameter("@ToRecordGuid", DbType.String, ExposedCaseVM.RecordId)); deleteQuery.Parameters.Add(new QueryParameter("@FromViewId", DbType.Int32, fromViewId)); deleteQuery.Parameters.Add(new QueryParameter("@ToViewId", DbType.Int32, toViewId)); return(deleteQuery); }
private static void UpdateMetaFields(Project project, string countryName = "") { IDbDriver db = project.CollectedData.GetDatabase(); // 1 = text // 17, 18, 19 = ddl's Query updateQuery = db.CreateQuery("UPDATE [metaFields] SET FieldTypeId = 1 " + "WHERE (FieldTypeId = 17 OR FieldTypeId = 18 OR FieldTypeId = 19) " + "AND (PromptText = @PromptTextDistrict OR PromptText = @PromptTextSC)"); updateQuery.Parameters.Add(new QueryParameter("@PromptTextDistrict", DbType.String, "District:")); updateQuery.Parameters.Add(new QueryParameter("@PromptTextSC", DbType.String, "Sub-County:")); int rows = db.ExecuteNonQuery(updateQuery); if (rows == 0) { // shouldn't get here } #region Wipe out districts string querySyntax = "DELETE * FROM [codeDistrictSubCountyList]"; if (db.ToString().ToLower().Contains("sql")) { querySyntax = "DELETE FROM [codeDistrictSubCountyList]"; } Query deleteQuery = db.CreateQuery(querySyntax); db.ExecuteNonQuery(deleteQuery); #endregion // Wipe out districts updateQuery = db.CreateQuery("UPDATE [metaFields] " + "SET PromptText = 'Viral Hemorrhagic Fever Outbreak Laboratory Diagnostic Specimens and Results Form' " + "WHERE FieldId = 230 OR FieldId = 590"); rows = db.ExecuteNonQuery(updateQuery); updateQuery = db.CreateQuery("UPDATE [metaFields] SET [ControlLeftPositionPercentage] = @CLPP WHERE [Name] = @Name"); updateQuery.Parameters.Add(new QueryParameter("@CLPP", DbType.Double, 0.01)); updateQuery.Parameters.Add(new QueryParameter("@Name", DbType.String, "CRFTitle")); rows = db.ExecuteNonQuery(updateQuery); updateQuery = db.CreateQuery("UPDATE [metaFields] " + "SET PromptText = 'Viral Hemorrhagic Fever Contact Information Entry Form' " + "WHERE FieldId = 345"); rows = db.ExecuteNonQuery(updateQuery); updateQuery = db.CreateQuery("UPDATE [metaFields] " + "SET PromptText = @CountryName " + "WHERE FieldId = 4"); updateQuery.Parameters.Add(new QueryParameter("@CountryName", DbType.String, countryName + " Viral Hemorrhagic Fever Case Investigation Form")); rows = db.ExecuteNonQuery(updateQuery); if (rows == 0) { // shouldn't get here } updateQuery = db.CreateQuery("UPDATE metaPages " + "SET BackgroundId = 0"); rows = db.ExecuteNonQuery(updateQuery); if (rows == 0) { // shouldn't get here } }
void computeWorker_DoWork(object sender, DoWorkEventArgs e) { Result result = new Result(); EpiDataHelper DataHelper = e.Argument as EpiDataHelper; if (DataHelper != null && DataHelper.Project != null && DataHelper.Project.CollectedData != null) { IDbDriver db = DataHelper.Project.CollectedData.GetDatabase(); int total = (from caseVM in DataHelper.CaseCollection where caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); string format = "P1"; int count = (from caseVM in DataHelper.CaseCollection where caseVM.FinalLabClass == Core.Enums.FinalLabClassification.ConfirmedAcute && caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); result.ConfirmedAcuteCount = count.ToString(); result.ConfirmedAcutePercent = ((double)count / (double)total).ToString(format); count = (from caseVM in DataHelper.CaseCollection where caseVM.FinalLabClass == Core.Enums.FinalLabClassification.ConfirmedConvalescent && caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); result.ConfirmedConvalescentCount = count.ToString(); result.ConfirmedConvalescentPercent = ((double)count / (double)total).ToString(format); count = (from caseVM in DataHelper.CaseCollection where caseVM.FinalLabClass == Core.Enums.FinalLabClassification.NotCase && caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); result.NegativeCount = count.ToString(); result.NegativePercent = ((double)count / (double)total).ToString(format); count = (from caseVM in DataHelper.CaseCollection where caseVM.FinalLabClass == Core.Enums.FinalLabClassification.Indeterminate && caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); result.IndeterminateCount = count.ToString(); result.IndeterminatePercent = ((double)count / (double)total).ToString(format); count = (from caseVM in DataHelper.CaseCollection where caseVM.FinalLabClass == Core.Enums.FinalLabClassification.NeedsFollowUpSample && caseVM.EpiCaseDef != Core.Enums.EpiCaseClassification.Excluded select caseVM).Count(); result.NeedsFollowUpCount = count.ToString(); result.NeedsFollowUpPercent = ((double)count / (double)total).ToString(format); Epi.Fields.RenderableField finalLabClassField = DataHelper.CaseForm.Fields["FinalLabClass"] as Epi.Fields.RenderableField; Epi.Fields.RenderableField epiCaseDefField = DataHelper.CaseForm.Fields["EpiCaseDef"] as Epi.Fields.RenderableField; if (finalLabClassField != null && epiCaseDefField != null && finalLabClassField.Page != null && epiCaseDefField.Page != null) { string finalLabClassTableName = finalLabClassField.Page.TableName; string epiCaseClassTableName = epiCaseDefField.Page.TableName; string queryText = ""; if (db.ToString().ToLower().Contains("sql")) { queryText = "select count(*) from " + finalLabClassTableName + " AS crf INNER JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId INNER JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((crf.FinalLabClass = '' OR crf.FinalLabClass is null) AND (crfEpiCaseClass.EpiCaseDef <> '4'))"; } else { queryText = "select count(*) from ((" + finalLabClassTableName + " AS crf) INNER JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId) INNER JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((crf.FinalLabClass = '' OR crf.FinalLabClass is null) AND (crfEpiCaseClass.EpiCaseDef <> '4'))"; } Query selectQuery = db.CreateQuery(queryText); count = (int)db.ExecuteScalar(selectQuery); if (db.ToString().ToLower().Contains("sql")) { queryText = "select crfEpiCaseClass.ID from " + finalLabClassTableName + " AS crf INNER JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId INNER JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((crf.FinalLabClass = '' OR crf.FinalLabClass is null) AND (crfEpiCaseClass.EpiCaseDef <> '4'))"; } else { queryText = "select crfEpiCaseClass.ID from ((" + finalLabClassTableName + " AS crf) INNER JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId) INNER JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((crf.FinalLabClass = '' OR crf.FinalLabClass is null) AND (crfEpiCaseClass.EpiCaseDef <> '4'))"; } selectQuery = db.CreateQuery(queryText); DataTable dt = db.Select(selectQuery); WordBuilder wb = new WordBuilder(","); foreach (DataRow row in dt.Rows) { wb.Add(row["ID"].ToString()); } result.PendingIDs = wb.ToString(); result.PendingCount = count.ToString(); result.PendingPercent = ((double)count / (double)total).ToString(format); if (db.ToString().ToLower().Contains("sql")) { queryText = "select count(*) from CaseInformationForm AS crf LEFT JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId LEFT JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((lrf.GlobalRecordId = '' OR lrf.GlobalRecordId is null) AND (crfEpiCaseClass.EpiCaseDef <> '4') AND crf.RecStatus = 1)"; } else { queryText = "select count(*) from ((CaseInformationForm AS crf) LEFT JOIN " + epiCaseClassTableName + " AS crfEpiCaseClass on crf.GlobalRecordId = crfEpiCaseClass.GlobalRecordId) LEFT JOIN LaboratoryResultsForm lrf on crf.GlobalRecordId = lrf.FKEY where ((lrf.GlobalRecordId = '' OR lrf.GlobalRecordId is null) AND (crfEpiCaseClass.EpiCaseDef <> '4') AND crf.RecStatus = 1)"; } selectQuery = db.CreateQuery(queryText); count = (int)db.ExecuteScalar(selectQuery); result.NotSampledCount = count.ToString(); result.NotSampledPercent = ((double)count / (double)total).ToString(format); e.Result = result; } else { throw new InvalidOperationException("FinalLabClass and EpiCaseDef must both be non-null fields in computeWorker_doWork in LabClassAllPatients.xaml.cs"); } } }
private void RefreshForm() { lvDataSourceObjects.Groups.Clear(); lvDataSourceObjects.Items.Clear(); if (selectedDataSource is IDbDriver) { IDbDriver db = selectedDataSource as IDbDriver; switch (db.ToString()) { case "Epi.Data.Office.AccessDatabase": case "Epi.Data.Office.Access2007Database": case "Epi.Data.Office.ExcelWorkbook": case "Epi.Data.Office.Excel2007Workbook": this.txtDataSource.Text = db.DataSource; break; default: this.txtDataSource.Text = db.ConnectionString; break; } List <string> tableNames = db.GetTableNames(); foreach (string tableName in tableNames) { ListViewItem newItem = new ListViewItem(new string[] { tableName, tableName }); this.lvDataSourceObjects.Items.Add(newItem); } gbxExplorer.Enabled = true; } else if (selectedDataSource is Project) { Project project = selectedDataSource as Project; txtDataSource.Text = (selectedDataSource == selectedProject) ? SharedStrings.CURRENT_PROJECT : project.FullName; if (chkViews.Checked) { ListViewGroup viewGroup = new ListViewGroup("Epi Info Views"); this.lvDataSourceObjects.Groups.Add(viewGroup); foreach (string s in project.GetViewNames()) { ListViewItem newItem = new ListViewItem(new string[] { s, "View" }, viewGroup); this.lvDataSourceObjects.Items.Add(newItem); } } if (chkTables.Checked) { ListViewGroup tablesGroup = new ListViewGroup("Tables"); this.lvDataSourceObjects.Groups.Add(tablesGroup); foreach (string s in project.GetNonViewTableNames()) { ListViewItem newItem = new ListViewItem(new string[] { s, "Table" }, tablesGroup); this.lvDataSourceObjects.Items.Add(newItem); } } gbxExplorer.Enabled = true; } else { // Clear ... this.txtDataSource.Text = "(none)"; this.lvDataSourceObjects.Items.Clear();// DataSource = null; gbxExplorer.Enabled = false; } this.CheckForInputSufficiency(); }
public void CreateCaseSyncFileStart(ContactTracing.ImportExport.SyncFileFilters filters /*string fileName, bool includeCases, bool includeCaseExposures, bool includeContacts, Epi.ImportExport.Filters.RowFilters filters, bool deIdentifyData, Epi.RecordProcessingScope recordProcessingScope*/) { if (IsWaitingOnOtherClients) { return; } if (String.IsNullOrEmpty(SyncFilePath.Trim())) { throw new ArgumentNullException("fileName"); } bool success = true; IsDataSyncing = true; RecordsExported = String.Empty; var stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); #region Remove extraneous data //int rows = 0; MinorSyncStatus = "Deleting extraneous page table rows..."; IDbDriver db = _project.CollectedData.GetDatabase(); if (db.ToString().ToLower().Contains("sql")) { using (IDbTransaction transaction = db.OpenTransaction()) { foreach (View form in _project.Views) { Query formDeleteDuplicateQuery = Database.CreateQuery("WITH cte AS (SELECT *, ROW_NUMBER() OVER(PARTITION BY GlobalRecordId ORDER BY GlobalRecordId) 'RowRank' FROM " + form.TableName + ") " + "DELETE FROM cte " + "WHERE RowRank > 1"); Database.ExecuteNonQuery(formDeleteDuplicateQuery, transaction); foreach (Page page in form.Pages) { Query deleteQuery = db.CreateQuery("DELETE FROM " + form.Name + " WHERE GlobalRecordId NOT IN (SELECT GlobalRecordId FROM " + page.TableName + ")"); db.ExecuteNonQuery(deleteQuery, transaction); //if (rows > 0) //{ // // report ?? //} Query pageDeleteQuery = db.CreateQuery("DELETE FROM " + page.TableName + " WHERE GlobalRecordId NOT IN (SELECT GlobalRecordId FROM " + form.Name + ")"); db.ExecuteNonQuery(deleteQuery, transaction); //if (rows > 0) //{ // // report ?? //} Query pageDeleteDuplicateQuery = Database.CreateQuery("WITH cte AS (SELECT *, ROW_NUMBER() OVER(PARTITION BY GlobalRecordId ORDER BY GlobalRecordId) 'RowRank' FROM " + page.TableName + ") " + "DELETE FROM cte " + "WHERE RowRank > 1"); Database.ExecuteNonQuery(pageDeleteDuplicateQuery, transaction); } } Query linksDeleteQuery = db.CreateQuery("DELETE FROM metaLinks WHERE ToViewId = @ToViewId AND ToRecordGuid NOT IN (SELECT GlobalRecordId FROM " + ContactForm.TableName + ")"); linksDeleteQuery.Parameters.Add(new QueryParameter("@ToViewId", DbType.Int32, ContactFormId)); db.ExecuteNonQuery(linksDeleteQuery, transaction); if (db.TableExists("metaHistory")) { Query historyDeleteQuery = db.CreateQuery("DELETE FROM metaHistory WHERE ContactGUID NOT IN (SELECT GlobalRecordId FROM " + ContactForm.TableName + ")"); db.ExecuteNonQuery(historyDeleteQuery, transaction); } try { transaction.Commit(); } catch (Exception ex0) { Epi.Logger.Log(String.Format(DateTime.Now + ": " + "DB cleanup exception Type: {0}", ex0.GetType())); Epi.Logger.Log(String.Format(DateTime.Now + ": " + "DB cleanup exception Message: {0}", ex0.Message)); Epi.Logger.Log(String.Format(DateTime.Now + ": " + "DB cleanup rollback started...")); DbLogger.Log("Database cleanup failed on commit. Exception: " + ex0.Message); try { transaction.Rollback(); Epi.Logger.Log(String.Format(DateTime.Now + ": " + "DB cleanup rollback was successful.")); } catch (Exception ex1) { DbLogger.Log("Database cleanup rollback failed. Exception: " + ex1.Message); } } db.CloseTransaction(transaction); } } #endregion // Remove extraneous data RecordsExported = String.Empty; IsDataSyncing = true; IsShowingExportProgress = true; SendMessageForAwaitAll(); DbLogger.Log(String.Format("Initiated process 'export sync file' - IncludeCasesAndContacts = {0}", IncludeCasesAndContacts)); Task.Factory.StartNew( () => { success = CreateCaseSyncFile(filters /*fileName, includeCases, includeCaseExposures, includeContacts, filters, deIdentifyData, recordProcessingScope*/); }, System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default).ContinueWith( delegate { SendMessageForUnAwaitAll(); TaskbarProgressState = System.Windows.Shell.TaskbarItemProgressState.None; MajorProgressValue = 0; IsDataSyncing = false; MinorProgressValue = 0; stopwatch.Stop(); MinorSyncStatus = String.Empty; if (success) { HasExportErrors = false; MajorSyncStatus = "Finished exporting data to sync file."; TimeElapsed = "Elapsed time: " + stopwatch.Elapsed.TotalMinutes.ToString("F1") + " minutes."; DbLogger.Log(String.Format("Completed process 'export sync file' successfully - elapsed time = {0} ms", stopwatch.Elapsed.TotalMilliseconds.ToString())); } else { HasExportErrors = true; MajorSyncStatus = "There was a problem exporting the data."; DbLogger.Log(String.Format("Completed process 'export sync file' with errors")); } CommandManager.InvalidateRequerySuggested(); }, TaskScheduler.FromCurrentSynchronizationContext()); }
/// <summary> /// Executes a SQL query based on a valid SMS message /// </summary> /// <param name="updateType">The type of update</param> /// <param name="message">The SMS message</param> /// <returns>bool; whether the execution was successful</returns> public bool ExecuteSmsUpdate(ShortMessage message) { #region Input Validation if (message == null) { throw new ArgumentNullException("Message object cannot be null"); } if (String.IsNullOrEmpty(message.Message)) { throw new InvalidOperationException("SMS message cannot be empty"); } string[] parts = message.Message.Split(' '); if (parts.Length != 3) { throw new InvalidOperationException("SMS message must contain three parts."); } int updateType; bool success = int.TryParse(parts[0], out updateType); if (updateType < 1 || updateType > 3) { throw new InvalidOperationException("SMS message update type is invalid. Valid values are 1, 2, and 3"); } #endregion // Input Validation bool operationWasSuccessful = true; int id; success = int.TryParse(parts[1], out id); if (success) { if (updateType == 1) { #region Case Data Update // do nothing right now operationWasSuccessful = false; #endregion Case Data Update } else if (updateType == 2) { #region Daily Follow-up Update int status; success = int.TryParse(parts[2], out status); if (status >= 0 && status <= 7) { // get the database IDbDriver db = this.CollectedData.GetDatabase(); // get the global record ID for this contact Query selectQuery = db.CreateQuery("SELECT GlobalRecordId FROM ContactEntryForm WHERE UniqueKey = @Id"); selectQuery.Parameters.Add(new QueryParameter("@Id", System.Data.DbType.Int32, id)); DataTable dt = db.Select(selectQuery); string guid = dt.Rows[0][0].ToString(); // calculate the window so we know which day column to update selectQuery = db.CreateQuery("SELECT LastContactDate FROM metaLinks WHERE " + "ToRecordGuid = @ToRecordGuid AND " + "FromViewId = @FromViewId AND " + "ToViewId = @ToViewId"); selectQuery.Parameters.Add(new QueryParameter("@ToRecordGuid", System.Data.DbType.String, guid)); selectQuery.Parameters.Add(new QueryParameter("@FromViewId", System.Data.DbType.Int32, CaseFormId)); selectQuery.Parameters.Add(new QueryParameter("@ToViewId", System.Data.DbType.Int32, ContactFormId)); dt = db.Select(selectQuery); DateTime lastContactDate = (DateTime)(dt.Rows[0][0]); DateTime today = DateTime.Today; TimeSpan ts = today - lastContactDate; int day = (int)ts.TotalDays; // this should never be a decimal since all dates stored should not have time componenets // update the right row in metaLinks Query updateQuery = db.CreateQuery("UPDATE metaLinks SET Day" + day.ToString() + " = @Status WHERE " + "ToRecordGuid = @ToRecordGuid AND " + "FromViewId = @FromViewId AND " + "ToViewId = @ToViewId"); updateQuery.Parameters.Add(new QueryParameter("@Status", DbType.Byte, status)); updateQuery.Parameters.Add(new QueryParameter("@ToRecordGuid", System.Data.DbType.String, guid)); updateQuery.Parameters.Add(new QueryParameter("@FromViewId", System.Data.DbType.Int32, CaseFormId)); updateQuery.Parameters.Add(new QueryParameter("@ToViewId", System.Data.DbType.Int32, ContactFormId)); int records = db.ExecuteNonQuery(updateQuery); if (records == 1) { operationWasSuccessful = true; } else { operationWasSuccessful = false; } // add a changeset message if (db.ToString().ToLower().Contains("sql")) { System.Guid changesetGuid = System.Guid.NewGuid(); string changesetGuidString = changesetGuid.ToString(); DateTime now = DateTime.Now; using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(db.ConnectionString + ";Connection Timeout=10")) { conn.Open(); System.Data.SqlClient.SqlCommand insertCommand = new System.Data.SqlClient.SqlCommand("INSERT INTO Changesets (ChangesetID, UpdateType, UserID, MACADDR, Description, DestinationRecordID, CheckinDate) VALUES (" + "@ChangesetID, @UpdateType, @UserID, @MACADDR, @Description, @DestinationRecordID, @CheckinDate)", conn); insertCommand.Parameters.Add("@ChangesetID", SqlDbType.NVarChar).Value = changesetGuidString; insertCommand.Parameters.Add("@UpdateType", SqlDbType.Int).Value = 15; insertCommand.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = "SMS server"; insertCommand.Parameters.Add("@MACADDR", SqlDbType.NVarChar).Value = "SMS"; insertCommand.Parameters.Add("@Description", SqlDbType.NVarChar).Value = "SMS contact status update"; insertCommand.Parameters.Add("@DestinationRecordID", SqlDbType.NVarChar).Value = guid; insertCommand.Parameters.Add("@CheckinDate", SqlDbType.DateTime2).Value = now; records = insertCommand.ExecuteNonQuery(); if (records == 1) { success = true; } } } } #endregion // Daily Follow-up Update } else if (updateType == 3) { #region Lab Data Update // do nothing right now operationWasSuccessful = false; #endregion Lab Data Update } } return(operationWasSuccessful); }