/// <summary> /// Deprecated Method for adding a new object to the Studies EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToStudies(Study study) { base.AddObject("Studies", study); }
private Study InsertStudy(Study s) { if (s.originalStudyID == null) { s.originalStudyID = -1; } if (s.studyDescription == null) { s.studyDescription = ""; } if (s.studyDate == null || s.studyDate.Year < 1900 || s.studyDate.Year > 9999) { s.studyDate = new DateTime(1900, 1, 1, 0, 0, 0); } string query_string = "INSERT INTO Study(originalStudyID, studyDescription, studyDate, delay, patientID) VALUES (@p1, @p2, @p3, @p4, @p5) SET @ID = SCOPE_IDENTITY();"; SqlConnection db = new SqlConnection(@"Data Source="",1044;Initial Catalog="";User ID="";Password="""); SqlCommand Command = new SqlCommand(query_string, db); Command.Parameters.AddWithValue("@p1", s.originalStudyID); Command.Parameters.AddWithValue("@p2", s.studyDescription); Command.Parameters.AddWithValue("@p3", s.studyDate); Command.Parameters.AddWithValue("@p4", 0); Command.Parameters.AddWithValue("@p5", s.patientID); Command.Parameters.Add("@ID", SqlDbType.Int, 4).Direction = ParameterDirection.Output; db.Open(); Command.ExecuteNonQuery(); AuditController.CreateAuditEntry(Session["userID"].ToString(), Session["username"].ToString(), "Study", null, "Insert"); s.studyID = Convert.ToInt32(Command.Parameters["@ID"].Value.ToString()); db.Close(); return s; }
/// <summary> /// Create a new Study object. /// </summary> /// <param name="studyID">Initial value of the studyID property.</param> public static Study CreateStudy(global::System.Int32 studyID) { Study study = new Study(); study.studyID = studyID; return study; }
private Study GetStudyInfo(List<EvilDICOM.Core.Interfaces.IDICOMElement> elements, int start) { Study new_study = new Study(); new_study.studyDate = new DateTime(1, 1, 1, 0, 0, 0); for (int i = start; i < elements.Count; i++) { var currElement = elements[i]; var currTag = currElement.Tag; if (currTag.Equals(TagHelper.DIRECTORY_RECORD_TYPE)) { break; } else if (currTag.Equals(TagHelper.STUDY_DATE)) { DateTime studydate = DateTime.Parse(currElement.DData.ToString()); new_study.studyDate = new_study.studyDate.AddYears(studydate.Year-1); new_study.studyDate = new_study.studyDate.AddMonths(studydate.Month - 1); new_study.studyDate = new_study.studyDate.AddDays(studydate.Day - 1); } else if (currTag.Equals(TagHelper.STUDY_TIME)) { DateTime studytime = DateTime.Parse(currElement.DData.ToString()); new_study.studyDate = new_study.studyDate.AddHours(studytime.Hour); new_study.studyDate = new_study.studyDate.AddMinutes(studytime.Minute); new_study.studyDate = new_study.studyDate.AddSeconds(studytime.Second); } else if (currTag.Equals(TagHelper.STUDY_DESCRIPTION)) { new_study.studyDescription = currElement.DData.ToString(); } else if (currTag.Equals(TagHelper.STUDY_ID)) { new_study.originalStudyID = Convert.ToInt32(currElement.DData.ToString()); } } return new_study; }