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

                                                           if (test.Replace(test[0].ToString(), "") == "") return "Плохо с воображением?";

                                                           return "";

                                       }

                                       public static bool CheckForSimplePassword(IWin32Window parent, string password)

                                       {

                                                           string result = CheckForSimplePassword(password);

                                                           if (result != "") { Program.ShowError(parent, result); return false; }

                                                           return true;

                                       }

                                       public static Dictionary<int, DbEmployee> AdminGetEmploys() { return AdminGetEmploys(true); }

                                       public static Dictionary<int, DbEmployee> AdminGetEmploys(bool active)

                                       {

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

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("select * from AdminGetAllEmploys" + (active ? " WHERE КОГДА_УВОЛИЛСЯ IS NULL" : ""), connection))

                                                           using (OracleDataReader reader = cmd.ExecuteReader())

                                                           {

                                                                               while (reader.Read())

                                                                                                  result.Add(Convert.ToInt32(reader["ID"]), AdminReadEmployeeInfo(reader));

                                                           }

                                                           return result;

                                       }

                                       public static Dictionary<int, DbEmployee> UserGetEmploys() { return UserGetEmploys(true); }

                                       public static Dictionary<int, DbEmployee> UserGetEmploys(bool active)

                                       {

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

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("select * from UserGetAllEmploys" + (active ? " WHERE КОГДА_УВОЛИЛСЯ IS NULL" : ""), connection))

                                                           using (OracleDataReader reader = cmd.ExecuteReader())

                                                           {

                                                                               while (reader.Read())

                                                                                                  result.Add(Convert.ToInt32(reader["ID"]), UserReadEmployeeInfo(reader));

                                                           }

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Обновление инфы о лекарстве

                                       /// </summary>

                                       public static void UpdateDrug(int id, string name, string description)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("UPDATE ЛЕКАРСТВА SET НАЗВАНИЕ = :НАЗВАНИЕ, ОПИСАНИЕ = :ОПИСАНИЕ WHERE ID = :ID", connection))

                                                           {

                                                                               cmd.Parameters.AddWithValue(":ID", id);

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

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

                                                                               cmd.ExecuteNonQuery();

                                                           }

                                       }

                                       /// <summary>

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

                                       /// </summary>

                                       public static void UpdateDisease(int id, string name, string description)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("UPDATE ДИАГНОЗЫ SET НАЗВАНИЕ=:НАЗВАНИЕ,ОПИСАНИЕ=:ОПИСАНИЕ WHERE ID=:ID", connection))

                                                           {

                                                                               cmd.Parameters.AddWithValue(":ID", id);

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