//Bead Stability Helper Method private DE_BeadStability CreateBeadRow(SqlDataReader results) { DE_BeadStability row = new DE_BeadStability(); row.Id = Convert.ToInt32(results["id"]); row.CreatedDate = Convert.ToDateTime(results["created_date"]); row.DatadsetId = Convert.ToInt32(results["dataset_id"]); row.Strain = Convert.ToString(results["strain"]); row.FormTreatment = Convert.ToString(results["form_trt"]); row.Rep = Convert.ToInt32(results["rep"]); row.BeadAge = Convert.ToString(results["bead_age"]); row.Notes = Convert.ToString(results["notes"]); row.DilutionResults = new List <string>(); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_zero"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg1"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg2"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg3"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg4"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg5"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg6"])); row.DilutionResults.Add(Convert.ToString(results["dil_1HR_neg7"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_zero"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg1"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg2"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg3"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg4"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg5"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg6"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg7"])); row.DilutionResults.Add(Convert.ToString(results["dil_6HR_neg8"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_zero"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg1"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg2"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg3"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg4"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg5"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg6"])); row.DilutionResults.Add(Convert.ToString(results["dil_24HR_neg7"])); return(row); }
//Bead Stability public bool Update1Row(DE_BeadStability row) { int rowsUpdated = 0; if (row.Notes == null) { row.Notes = ""; } for (int i = 0; i < row.DilutionResults.Count; i++) { if (row.DilutionResults[i] == null) { row.DilutionResults[i] = ""; } } try { using (SqlConnection conn = new SqlConnection(connectionString)) { SqlCommand cmd; conn.Open(); cmd = new SqlCommand("update beads_stability set notes = @notes, dil_1HR_zero = @dil_1HR_zero, dil_1HR_neg1 = @dil_1HR_neg1, dil_1HR_neg2 = @dil_1HR_neg2, dil_1HR_neg3 = @dil_1HR_neg3, dil_1HR_neg4 = @dil_1HR_neg4, dil_1HR_neg5 = @dil_1HR_neg5, dil_1HR_neg6 = @dil_1HR_neg6, dil_1HR_neg7 = @dil_1HR_neg7, dil_6HR_zero = @dil_6HR_zero, dil_6HR_neg1 = @dil_6HR_neg1, dil_6HR_neg2 = @dil_6HR_neg2, dil_6HR_neg3 = @dil_6HR_neg3, dil_6HR_neg4 = @dil_6HR_neg4, dil_6HR_neg5 = @dil_6HR_neg5, dil_6HR_neg6 = @dil_6HR_neg6, dil_6HR_neg7 = @dil_6HR_neg7, dil_6HR_neg8 = @dil_6HR_neg8, dil_24HR_zero = @dil_24HR_zero, dil_24HR_neg1 = @dil_24HR_neg1, dil_24HR_neg2 = @dil_24HR_neg2, dil_24HR_neg3 = @dil_24HR_neg3, dil_24HR_neg4 = @dil_24HR_neg4, dil_24HR_neg5 = @dil_24HR_neg5, dil_24HR_neg6 = @dil_24HR_neg6, dil_24HR_neg7 = @dil_24HR_neg7 where id = @rowId;", conn); cmd.Parameters.AddWithValue("@rowId", row.Id); cmd.Parameters.AddWithValue("@notes", row.Notes); cmd.Parameters.AddWithValue("@dil_1HR_zero", row.DilutionResults[0]); cmd.Parameters.AddWithValue("@dil_1HR_neg1", row.DilutionResults[1]); cmd.Parameters.AddWithValue("@dil_1HR_neg2", row.DilutionResults[2]); cmd.Parameters.AddWithValue("@dil_1HR_neg3", row.DilutionResults[3]); cmd.Parameters.AddWithValue("@dil_1HR_neg4", row.DilutionResults[4]); cmd.Parameters.AddWithValue("@dil_1HR_neg5", row.DilutionResults[5]); cmd.Parameters.AddWithValue("@dil_1HR_neg6", row.DilutionResults[6]); cmd.Parameters.AddWithValue("@dil_1HR_neg7", row.DilutionResults[7]); cmd.Parameters.AddWithValue("@dil_6HR_zero", row.DilutionResults[8]); cmd.Parameters.AddWithValue("@dil_6HR_neg1", row.DilutionResults[9]); cmd.Parameters.AddWithValue("@dil_6HR_neg2", row.DilutionResults[10]); cmd.Parameters.AddWithValue("@dil_6HR_neg3", row.DilutionResults[11]); cmd.Parameters.AddWithValue("@dil_6HR_neg4", row.DilutionResults[12]); cmd.Parameters.AddWithValue("@dil_6HR_neg5", row.DilutionResults[13]); cmd.Parameters.AddWithValue("@dil_6HR_neg6", row.DilutionResults[14]); cmd.Parameters.AddWithValue("@dil_6HR_neg7", row.DilutionResults[15]); cmd.Parameters.AddWithValue("@dil_6HR_neg8", row.DilutionResults[16]); cmd.Parameters.AddWithValue("@dil_24HR_zero", row.DilutionResults[17]); cmd.Parameters.AddWithValue("@dil_24HR_neg1", row.DilutionResults[18]); cmd.Parameters.AddWithValue("@dil_24HR_neg2", row.DilutionResults[19]); cmd.Parameters.AddWithValue("@dil_24HR_neg3", row.DilutionResults[20]); cmd.Parameters.AddWithValue("@dil_24HR_neg4", row.DilutionResults[21]); cmd.Parameters.AddWithValue("@dil_24HR_neg5", row.DilutionResults[22]); cmd.Parameters.AddWithValue("@dil_24HR_neg6", row.DilutionResults[23]); cmd.Parameters.AddWithValue("@dil_24HR_neg7", row.DilutionResults[24]); rowsUpdated = cmd.ExecuteNonQuery(); } } catch (SqlException ex) { throw; } return(rowsUpdated == 1); }