public IEnumerable <Models.SpectrumResult> get_spectrum_results_from_specid(string specid) { // /api/spectrum/get_spectrum_results_from_specid?specid=7D12877D-AD49-4D20-819B-528BED809265 Guid Id = new Guid(specid); List <Models.SpectrumResult> res = new List <Models.SpectrumResult>(); using (SqlConnection conn = new SqlConnection(LorakonConnectionStrings.ConnectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand("select * from SpectrumResult where SpectrumInfoID = @SID", conn); cmd.Parameters.AddWithValue("@SID", Id); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Models.SpectrumResult r = new Models.SpectrumResult(); r.ID = new Guid(reader["ID"].ToString()); r.SpectrumInfoID = Id; r.CreateDate = Convert.ToDateTime(reader["CreateDate"]); r.UpdateDate = Convert.ToDateTime(reader["UpdateDate"]); r.NuclideName = reader["NuclideName"].ToString(); r.Confidence = Convert.ToSingle(reader["Confidence"]); r.Activity = Convert.ToSingle(reader["Activity"]); r.ActivityUncertainty = Convert.ToSingle(reader["ActivityUncertainty"]); r.MDA = Convert.ToSingle(reader["MDA"]); r.Evaluated = Convert.ToBoolean(reader["Evaluated"]); r.Approved = Convert.ToBoolean(reader["Approved"]); r.ApprovedIsMDA = Convert.ToBoolean(reader["ApprovedIsMDA"]); r.ApprovedStatus = reader["ApprovedStatus"].ToString(); r.Rejected = Convert.ToBoolean(reader["Rejected"]); r.Comment = reader["Comment"].ToString(); res.Add(r); } } } return(res); }
public Models.SpectrumResult get_spectrum_result(string id) { // /api/spectrum/get_spectrum_result/18218763-163E-4F46-8564-1BEE4118BECC Guid Id = new Guid(id); Models.SpectrumResult res = new Models.SpectrumResult(); using (SqlConnection conn = new SqlConnection(LorakonConnectionStrings.ConnectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand("select * from SpectrumResult where ID = @ID", conn); cmd.Parameters.AddWithValue("@ID", Id); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { reader.Read(); res.ID = Id; res.SpectrumInfoID = new Guid(reader["SpectrumInfoID"].ToString()); res.CreateDate = Convert.ToDateTime(reader["CreateDate"]); res.UpdateDate = Convert.ToDateTime(reader["UpdateDate"]); res.NuclideName = reader["NuclideName"].ToString(); res.Confidence = Convert.ToSingle(reader["Confidence"]); res.Activity = Convert.ToSingle(reader["Activity"]); res.ActivityUncertainty = Convert.ToSingle(reader["ActivityUncertainty"]); res.MDA = Convert.ToSingle(reader["MDA"]); res.Evaluated = Convert.ToBoolean(reader["Evaluated"]); res.Approved = Convert.ToBoolean(reader["Approved"]); res.ApprovedIsMDA = Convert.ToBoolean(reader["ApprovedIsMDA"]); res.ApprovedStatus = reader["ApprovedStatus"].ToString(); res.Rejected = Convert.ToBoolean(reader["Rejected"]); res.Comment = reader["Comment"].ToString(); } } } return(res); }