База данных для хранения и обработки информации, которая требуется типичной психиатрической больнице, страница 23

                                                                                                                      entry.Id = Convert.ToInt32(reader["ID"]);

                                                                                                                      entry.Name = reader["НАЗВАНИЕ"] as string;

                                                                                                                      entry.Description = reader["ОПИСАНИЕ"] as string;

                                                                                                                      result.Add(entry);

                                                                                                  }

                                                                               }

                                                           }

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Назначение наказания

                                       /// </summary>

                                       /// <param name="entry"></param>

                                       public static void AssignTreatment(DbTreatmentHistoryEntry entry)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("AssignTreatment", connection))

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pВРАЧ_ID", entry.Assigner);

                                                                               cmd.Parameters.AddWithValue("pЛЕКАРСТВО_ID", entry.DrugId);

                                                                               cmd.Parameters.AddWithValue("pИСТОРИЯ_ID", entry.HistoryId);

                                                                               cmd.Parameters.AddWithValue("pКОЛИЧЕСТВО", entry.Count);

                                                                               cmd.ExecuteNonQuery();

                                                           }

                                       }

                                       /// <summary>

                                       /// Проведенное лечение

                                       /// </summary>

                                       public static List<DbTreatmentHistoryEntry> GetTreatmentHistory(int historyId)

                                       {

                                                           List<DbTreatmentHistoryEntry> result = new List<DbTreatmentHistoryEntry>();

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("select * FROM ЛЕЧЕНИЕ WHERE ИСТОРИЯ_ID = :ИСТОРИЯ_ID", connection))

                                                           {

                                                                               cmd.Parameters.AddWithValue(":ИСТОРИЯ_ID", historyId);

                                                                               using (OracleDataReader reader = cmd.ExecuteReader())

                                                                               {

                                                                                                  while (reader.Read())

                                                                                                  {

                                                                                                                      DbTreatmentHistoryEntry entry = new DbTreatmentHistoryEntry();

                                                                                                                      entry.Assigner = Convert.ToInt32(reader["ВРАЧ_ID"]);

                                                                                                                      entry.DrugId = Convert.ToInt32(reader["ЛЕКАРСТВО_ID"]);

                                                                                                                      entry.HistoryId = historyId;//Convert.ToInt32(reader["ИСТОРИЯ_ID"]);

                                                                                                                      entry.Count = Convert.ToInt32(reader["КОЛИЧЕСТВО"]);

                                                                                                                      entry.Date = readNullableDate(reader["КОГДА"]);

                                                                                                                      result.Add(entry);

                                                                                                  }

                                                                               }

                                                           }

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Добавление нового сотрудника с новой записью в таблицу ЧЕЛОВЕК

                                       /// </summary>

                                       /// <param name="information">инфа о новом пациенте</param>