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

                                                           result.FiredDate = readNullableDate(reader["КОГДА_УВОЛИЛСЯ"]);

                                                           result.AdministerOptions = Convert.ToInt32(reader["AdministerOptions"]);

                                                           return result;

                                       }

                                       private static DbEmployee AdminReadEmployeeInfo(DbDataReader reader)

                                       {

                                                           DbEmployee result = UserReadEmployeeInfo(reader);

                                                           result.HumanID = Convert.ToInt32(reader["ЧЕЛОВЕК_ID"]);

                                                           result.Login = reader["LOGIN"] as string;

                                                           result.Phone = (reader["КОНТАКТНЫЙ_ТЕЛЕФОН"] as string) ?? "";

                                                           {

                                                                               object photography = reader["ФОТОГРАФИЯ"];

                                                                               if (!Convert.IsDBNull(photography) && ((byte[])photography).Length != 0)

                                                                               {

                                                                                                  try { result.Photography = new Bitmap(new MemoryStream((byte[])reader["ФОТОГРАФИЯ"])); }

                                                                                                  catch { result.Photography = Properties.Resources.No_Image; }

                                                                               }

                                                                               else

                                                                                                  result.Photography = Properties.Resources.No_Image;

                                                           }

                                                           result.BirthDate = ToDate((DateTime)reader["ДАТА_РОЖДЕНИЯ"]);

                                                           //result.Password = reader["PASSWORD"] as string;

                                                           result.PostID = Convert.ToInt32(reader["ДОЛЖНОСТЬ_ID"]);

                                                           result.Post = reader["ДОЛЖНОСТЬ"] as string;

                                                           return result;

                                       }

                                       /// <summary>

                                       /// Ланные сотрудника по ID

                                       /// </summary>

                                       public static DbEmployee GetEmployeeInfo(int id)

                                       {

                                                           using (OracleConnection connection = GetConnection())

                                                           using (OracleCommand cmd = new OracleCommand("SELECT * FROM AdminGetAllEmploys WHERE ID = :ID", connection))

                                                           {

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

                                                                               using (OracleDataReader reader = cmd.ExecuteReader())

                                                                               {

                                                                                                  reader.Read();

                                                                                                  return AdminReadEmployeeInfo(reader);

                                                                               }

                                                           }

                                       }

                                       /// <summary>

                                       /// Данные сотрудника по логину

                                       /// </summary>

                                       public static DbEmployee GetPersonalInfo(string login, string password)

                                       {

                                                           using (OracleConnection connection = GetConnection())

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

                                                           {

                                                                               cmd.CommandType = CommandType.StoredProcedure;

                                                                               cmd.Parameters.AddWithValue("pLOGIN", login);

                                                                               cmd.Parameters.AddWithValue("pPASSWORD", getHashString(password));

                                                                               cmd.Parameters.Add("pИМЯ", OracleType.VarChar, 30).Direction = ParameterDirection.Output;

                                                                               cmd.Parameters.Add("pФАМИЛИЯ", OracleType.VarChar, 30).Direction = ParameterDirection.Output;

                                                                               cmd.Parameters.Add("pОТЧЕСТВО", OracleType.VarChar, 30).Direction = ParameterDirection.Output;

                                                                               cmd.Parameters.Add("pПАСПОРТ", OracleType.VarChar, 30).Direction = ParameterDirection.Output;