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

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           {

                                                                               executeEmployeeAddition(information, connection, null, false);

                                                           }

                                       }

                                       /// <summary>

                                       /// Создание параметра с фотографией

                                       /// </summary>

                                       /// <param name="name">имя параметра</param>

                                       /// <param name="bmp">фотография</param>

                                       private static OracleParameter getPhotoParameter(string name, Bitmap bmp)

                                       {

                                                           if (bmp == Properties.Resources.No_Image || bmp == null)

                                                                               return new OracleParameter(name, OracleBinary.Null);

                                                           using (MemoryStream imageStream = new MemoryStream())

                                                           {

                                                                               bmp.Save(imageStream, ImageFormat.Jpeg);

                                                                               return new OracleParameter(name, imageStream.ToArray());

                                                           }

                                       }

                                       /// <summary>

                                       /// Обновление инфы о наказании

                                       /// </summary>

                                       public static void UpdatePunishment(int id, string name)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("UPDATE НАКАЗАНИЯ SET НАЗВАНИЕ=:НАЗВАНИЕ WHERE ID=" + id, connection))

                                                           {

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

                                                                               cmd.ExecuteNonQuery();

                                                           }

                                       }

                                       public static List<DbPatient> GetPatients()

                                       {

                                                           return GetPatients(true);

                                       }

                                       public static List<DbPatient> GetPatients(bool current)

                                       {

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

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("select * from БОЛЬНЫЕ" + (current ? " WHERE ДАТА_ВЫПИСКИ IS NULL" : ""), connection))

                                                           using (OracleDataReader reader = cmd.ExecuteReader())

                                                           {

                                                                               while (reader.Read())

                                                                               {

                                                                                                  DbPatient entry = ReadPersonInfo(new DbPatient(), reader) as DbPatient;

                                                                                                  entry.DiseaseID = Convert.ToInt32(reader["ID_БОЛЕЗНИ"]);

                                                                                                  entry.DiseaseName = reader["НАЗВАНИЕ_БОЛЕЗНИ"] as string;

                                                                                                  entry.HistoryID = Convert.ToInt32(reader["ID_ИСТОРИИ"]);

                                                                                                  entry.PlacementDate = readNullableDate(reader["ДАТА_ПОСТУПЛЕНИЯ"]).Value;

                                                                                                  entry.DischargeDate = readNullableDate(reader["ДАТА_ВЫПИСКИ"]);

                                                                                                  if (entry.DischargeDate.HasValue)

                                                                                                                      entry.InspectedID = Convert.ToInt32(reader["ОСМОТРЕВШИЙ_ID"]);

                                                                                                  result.Add(entry);

                                                                               }

                                                           }

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Получение списка всех назначенных наказаний

                                       /// </summary>