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

                                                                                                  loginParam.Direction = passParam.Direction = ParameterDirection.InputOutput;

                                                                                                  loginParam.Size = passParam.Size = 120;

                                                                                                  cmd.ExecuteNonQuery();

                                                                                                  DBLogin = cmd.Parameters["pLOGIN"].Value as string;

                                                                                                  DBPassword = ServerInfo.decryptPassword(cmd.Parameters["pPASSWORD"].Value as string);

                                                                                                  try

                                                                                                  {

                                                                                                                      CurrentUser = GetPersonalInfo(username, password);

                                                                                                  }

                                                                                                  catch

                                                                                                  {

                                                                                                                      CurrentUser = null;

                                                                                                                      return false;

                                                                                                  }

                                                                                                  return true;

                                                                               }

                                                           }

                                                           catch (Exception)

                                                           {

                                                                               return false;

                                                           }

                                       }

                                       private static DateTime? readNullableDate(object obj)

                                       {

                                                           if (Convert.IsDBNull(obj)) return null;

                                                           return (DateTime?)obj;

                                       }

                                       /// <summary>

                                       /// Удаление временной составляющей из даты

                                       /// </summary>

                                       public static DateTime ToDate(DateTime date)

                                       {

                                                           return DateTime.Parse(date.ToShortDateString());

                                       }

                                       /// <summary>

                                       /// Удаление временной составляющей из nullable-даты

                                       /// </summary>

                                       public static DateTime? ToDate(DateTime? date)

                                       {

                                                           if (!date.HasValue) return date;

                                                           date = ToDate(date.Value);

                                                           return date;

                                       }

                                       /// <summary>

                                       /// В БД храним картинки 160х210, если разрешение не такое - то растягиваем\сжимаем

                                       /// </summary>

                                       /// <param name="bitmap"></param>

                                       /// <returns></returns>

                                       public static Bitmap StretchBitmap(Bitmap bitmap)

                                       {

                                                           if (bitmap.Width == 160 && bitmap.Height == 210) return bitmap;

                                                           return new Bitmap(bitmap, 160, 210);

                                       }

                                       private static DbPerson ReadPersonInfo(DbPerson person, DbDataReader reader)

                                       {

                                                           person.ID = Convert.ToInt32(reader["ID"]);

                                                           person.Name = reader["Имя"] as string;

                                                           person.Surname = reader["Фамилия"] as string;

                                                           person.Patronymic = reader["Отчество"] as string;

                                                           person.Passport = (reader["ПАСПОРТ"] as string) ?? "";

                                                           return person;

                                       }

                                       private static DbEmployee UserReadEmployeeInfo(DbDataReader reader)

                                       {

                                                           DbEmployee result = new DbEmployee();

                                                           ReadPersonInfo(result, reader);

                                                           result.PlacementDate = (DateTime)reader["КОГДА_УСТРОИЛСЯ"];