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

                                                                                                  entry.DiseaseId = Convert.ToInt32(reader["ДИАГНОЗ_ID"]);

                                                                                                  result.Add(entry);

                                                                               }

                                                           }

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Добавление нового лекарства

                                       /// </summary>

                                       public static int AddNewDrug(string name, string description)

                                       {

                                                           using (OracleConnection connection = GetConnection())

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

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pНАЗВАНИЕ", name);

                                                                               cmd.Parameters.AddWithValue("pОПИСАНИЕ", description);

                                                                               cmd.Parameters.Add("pID", OracleType.Int32).Direction = ParameterDirection.Output;

                                                                               cmd.ExecuteNonQuery();

                                                                               return (int)cmd.Parameters["pID"].Value;

                                                           }

                                       }

                                       /// <summary>

                                       /// Добавление нового заболевания

                                       /// </summary>

                                       public static int AddNewDisease(string name, string description)

                                       {

                                                           using (OracleConnection connection = GetConnection())

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

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pНАЗВАНИЕ", name);

                                                                               cmd.Parameters.AddWithValue("pОПИСАНИЕ", description);

                                                                               cmd.Parameters.Add("pID", OracleType.Int32).Direction = ParameterDirection.Output;

                                                                               cmd.ExecuteNonQuery();

                                                                               return (int)cmd.Parameters["pID"].Value;

                                                           }

                                       }

                                       /// <summary>

                                       /// Добавление нового наказания

                                       /// </summary>

                                       public static int AddNewPunishment(string name)

                                       {

                                                           using (OracleConnection connection = GetConnection())

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

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pНАЗВАНИЕ", name);

                                                                               cmd.Parameters.Add("pID", OracleType.Int32).Direction = ParameterDirection.Output;

                                                                               cmd.ExecuteNonQuery();

                                                                               return (int)cmd.Parameters["pID"].Value;

                                                           }

                                       }

                                       /// <summary>

                                       /// Добавление соответствия между лекарством и болезнью

                                       /// </summary>

                                       public static void AddProperDrugDisease(int drugId, int diseaseId)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("INSERT INTO ЛЕКАРСТВА_ДИАГНОЗЫ (ЛЕКАРСТВО_ID, ДИАГНОЗ_ID) VALUES (:ЛЕКАРСТВО_ID, :ДИАГНОЗ_ID)", connection))

                                                           {

                                                                               cmd.Parameters.AddWithValue(":ЛЕКАРСТВО_ID", drugId);