public async Task<string> HandleResult(IDictionary<string, object> payload) { var connectionString = "Data Source=TestSQL;Initial Catalog=YPIData;Integrated Security=True"; string testName = (string)payload["testName"]; string aliquotOrderId = (string)payload["aliquotOrderId"]; string result = (string)payload["result"]; string sql = null; if (testName == "TRICH") { HPVResult hpvResult = null; if (result == "TRICH neg") { hpvResult = new HPVNegativeResult(); sql = @"Update tblTrichomonasTestOrder set Result = '" + hpvResult.Result + "' " + "from tblTrichomonasTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1, " + "[Accepted] = 1, " + "[AcceptedBy] = 'Optimus Prime', " + "[AcceptedById] = 5134, " + "[AcceptedDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[AcceptedTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "', " + "[Final] = 1, " + "[Signature] = 'Optimus Prime', " + "[FinaledById] = 5134, " + "[FinalDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[FinalTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "' " + "where PanelSetId = 61 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (result == "TRICH POS") { hpvResult = new HPVPositiveResult(); sql = @"Update tblTrichomonasTestOrder set Result = '" + hpvResult.Result + "' " + "from tblTrichomonasTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1, " + "[Accepted] = 1, " + "[AcceptedBy] = 'Optimus Prime', " + "[AcceptedById] = 5134, " + "[AcceptedDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[AcceptedTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "' " + "where PanelSetId = 61 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (result == "Invalid") { hpvResult = new HPVInvalidResult(); sql = @"Update tblHPVTestOrder set Result = '" + hpvResult.Result + "' " + "from tblHPVTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1 " + "where PanelSetId = 61 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } } using (var cnx = new SqlConnection(connectionString)) { using (var cmd = new SqlCommand(sql, cnx)) { await cnx.OpenAsync(); await cmd.ExecuteNonQueryAsync(); } } return "Optimus Prime updated result: " + aliquotOrderId + " - " + testName + " on: " + DateTime.Now.ToString(); }
public async Task <string> HandleResult(IDictionary <string, object> payload) { var connectionString = "Server = 10.1.2.26; Uid = sqldude; Pwd = 123Whatsup; Database = lis;"; string testName = (string)payload["testName"]; string aliquotOrderId = (string)payload["aliquotOrderId"]; string overallInterpretation = (string)payload["overallInterpretation"]; string sql = null; if (testName == "HPV") { HPVResult hpvResult = null; if (overallInterpretation == "Negative") { hpvResult = new HPVNegativeResult(); sql = @"Update tblHPVTestOrder psoh " + "Inner join tblPanelSetOrder pso on psoh.ReportNo = pso.ReportNo " + "Set Result = '" + hpvResult.Result + "' " + "Where pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "Accepted = 1, " + "AcceptedBy = 'AUTOVER TESTING', " + "AcceptedById = 5134, " + "AcceptedDate = '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "AcceptedTime = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "', " + "Final = 1, " + "Signature = 'AUTOVER TESTING', " + "FinaledById = 5134, " + "FinalDate = '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "FinalTime = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (overallInterpretation == "POSITIVE") { hpvResult = new HPVPositiveResult(); sql = @"Update tblHPVTestOrder psoh " + "Inner join tblPanelSetOrder pso on psoh.ReportNo = pso.ReportNo " + "Set Result = '" + hpvResult.Result + "' " + "Where pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "Accepted = 1, " + "AcceptedBy = 'AUTOVER TESTING', " + "AcceptedById = 5134, " + "AcceptedDate = '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "AcceptedTime = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (overallInterpretation == "Invalid") { hpvResult = new HPVInvalidResult(); sql = @"Update tblHPVTestOrder psoh " + "Inner Join tblPanelSetOrder pso on psoh.ReportNo = pso.ReportNo " + "set Result = '" + hpvResult.Result + "' " + "Where pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "' " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } } using (var cnx = new MySqlConnection(connectionString)) { using (var cmd = new MySqlCommand(sql, cnx)) { await cnx.OpenAsync(); await cmd.ExecuteNonQueryAsync(); } } return("Optimus Prime updated result: " + aliquotOrderId + " - " + testName + " on: " + DateTime.Now.ToString()); }
public async Task <string> HandleResult(IDictionary <string, object> payload) { var connectionString = "Data Source=TestSQL;Initial Catalog=YPIData;Integrated Security=True"; string testName = (string)payload["testName"]; string aliquotOrderId = (string)payload["aliquotOrderId"]; string overallInterpretation = (string)payload["overallInterpretation"]; string sql = null; if (testName == "HPV") { HPVResult hpvResult = null; if (overallInterpretation == "Negative") { hpvResult = new HPVNegativeResult(); sql = @"Update tblHPVTestOrder set Result = '" + hpvResult.Result + "' " + "from tblHPVTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1, " + "[Accepted] = 1, " + "[AcceptedBy] = 'Optimus Prime', " + "[AcceptedById] = 5134, " + "[AcceptedDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[AcceptedTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "', " + "[Final] = 1, " + "[Signature] = 'Optimus Prime', " + "[FinaledById] = 5134, " + "[FinalDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[FinalTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "' " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (overallInterpretation == "POSITIVE") { hpvResult = new HPVPositiveResult(); sql = @"Update tblHPVTestOrder set Result = '" + hpvResult.Result + "' " + "from tblHPVTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1, " + "[Accepted] = 1, " + "[AcceptedBy] = 'Optimus Prime', " + "[AcceptedById] = 5134, " + "[AcceptedDate] = '" + DateTime.Today.ToString("MM/dd/yyyy") + "', " + "[AcceptedTime] = '" + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + "' " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } else if (overallInterpretation == "Invalid") { hpvResult = new HPVInvalidResult(); sql = @"Update tblHPVTestOrder set Result = '" + hpvResult.Result + "' " + "from tblHPVTestOrder psoh, tblPanelSetOrder pso " + "where psoh.ReportNo = pso.ReportNo " + "and pso.OrderedOnId = '" + aliquotOrderId + "' and pso.Accepted = 0; "; sql += @"Update tblPanelSetOrder set ResultCode = '" + hpvResult.ResultCode + "', " + "[HoldDistribution] = 1 " + "where PanelSetId = 14 and Accepted = 0 and OrderedOnId = '" + aliquotOrderId + "';"; } } using (var cnx = new SqlConnection(connectionString)) { using (var cmd = new SqlCommand(sql, cnx)) { await cnx.OpenAsync(); await cmd.ExecuteNonQueryAsync(); } } return("Optimus Prime updated result: " + aliquotOrderId + " - " + testName + " on: " + DateTime.Now.ToString()); }