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

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

                                                                               cmd.ExecuteNonQuery();

                                                           }

                                       }

                                       /// <summary>

                                       /// Уволить сотрудника

                                       /// </summary>

                                       /// <param name="id">СОТРУДНИК.ID</param>

                                       public static void FireEmployee(int id)

                                       {

                                                           using (OracleConnection connection = GetConnection())

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

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pID", id);

                                                                               cmd.ExecuteNonQuery();

                                                           }

                                       }

                                       /// <summary>

                                       /// Восстановление уволенного сотрудника

                                       /// </summary>

                                       /// <param name="information"></param>

                                       public static void RestoreEmployee(DbEmployee information)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           {

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

                                                                               {

                                                                                                  cmd.CommandType = CommandType.StoredProcedure;

                                                                                                  cmd.Parameters.AddWithValue("pID", information.ID).Direction = ParameterDirection.InputOutput;

                                                                                                  cmd.ExecuteNonQuery();

                                                                                                  information.ID = (int)cmd.Parameters["pID"].Value;

                                                                               }

                                                           }

                                       }

                                       public static void ClearPools()

                                       {

                                                           try { Oracle.DataAccess.Client.OracleConnection.ClearAllPools(); }

                                                           catch { }

                                                           try { System.Data.OracleClient.OracleConnection.ClearAllPools(); }

                                                           catch { }

                                       }

                                       /// <summary>

                                       /// Чтение информации о должности

                                       /// </summary>

                                       /// <param name="reader">откуда читаем</param>

                                       /// <returns></returns>

                                       public static Dictionary<int, DbPost> AdminGetAllPostsDictionary()

                                       {

                                                           Dictionary<int, DbPost> result = new Dictionary<int, DbPost>();

                                                           foreach (DbPost entry in AdminGetAllPostsList())

                                                                               result.Add(entry.Id, entry);

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Получение списка всех должностей

                                       /// </summary>

                                       public static List<DbPost> AdminGetAllPostsList()

                                       {

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

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("select * from ДОЛЖНОСТЬ WHERE WAS_REMOVED = 0 ORDER BY НАЗВАНИЕ", connection))

                                                           using (OracleDataReader reader = cmd.ExecuteReader())

                                                           {

                                                                               while (reader.Read())

                                                                                                  result.Add(new DbPost(Convert.ToInt32(reader["ID"]), reader["НАЗВАНИЕ"] as string, (decimal)reader["ЗАРПЛАТА"]));